postfix-users October 2010 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: com.com weirdness and relay_domains warning

Re: com.com weirdness and relay_domains warning

From: mouss <mouss_at_nospam>
Date: Sat Oct 23 2010 - 09:02:03 GMT
To: Steve Jenkins <steve@stevejenkins.com>

Le 22/10/2010 18:37, Steve Jenkins a écrit :
> My personal server is happily managing virtual mail domains without any
> trouble, but I'm now trying to troubleshoot a work server that is being a
> little more stubborn. It has one primary domain (booyahmedia) and two
> virtual domains (teamsites.com and virtualvow.com).
>
> [snip]
>
> Next, I set up a test virtual alias on each of the virtual domains. The
> /etc/postfix/virtual file is:
>
> teamsites.com #Team Sites
> testing123@teamsites.com testaccount
>
> virtualvow.com #Virtual Vow
> testing123@virtualvow.com testaccount
>
> If I send a test email from Gmail to an address on either of the virtual
> domains, I get some strange entries in the log:
>
> Oct 22 10:04:32 booyahmedia postfix/smtpd[10507]: connect from
> mail-yw0-f43.google.com[209.85.213.43]
> Oct 22 10:04:32 booyahmedia postfix/trivial-rewrite[10510]: warning: do not
> list domain teamsites.com in BOTH virtual_alias_domains and relay_domains
> Oct 22 10:04:38 booyahmedia postfix/smtpd[10507]: C320B3041C:
> client=mail-yw0-f43.google.com[209.85.213.43]
> Oct 22 10:04:38 booyahmedia postfix/cleanup[10524]: C320B3041C:
> message-id=<AANLkTikKL_UZQ-R0t5gQjC32M_YxbAZY+39_nuQ1ryao@mail.gmail.com>
> Oct 22 10:04:38 booyahmedia postfix/qmgr[10468]: C320B3041C:
> from=<testsender@gmail.com>, size=1631, nrcpt=1 (queue active)
> Oct 22 10:05:08 booyahmedia postfix/smtp[10525]: connect to
> com.com[216.239.113.101]: Connection timed out (port 25)
> Oct 22 10:05:09 booyahmedia postfix/smtpd[10507]: disconnect from
> mail-yw0-f43.google.com[209.85.213.43]
> Oct 22 10:05:38 booyahmedia postfix/smtp[10525]: connect to
> com.com[216.239.122.102]: Connection timed out (port 25)
> Oct 22 10:05:38 booyahmedia postfix/smtp[10525]: C320B3041C:
> to=<testaccount@com.com>, orig_to=<testing123@teamsites.com>, relay=none,
> delay=66, delays=6.1/0.02/60/0, dsn=4.4.1, status=deferred (connect to
> com.com[216.239.122.102]: Connection timed out)
>
> First, I'm trying to figure out why it's giving me that trivial-rewrite
> warning because teamsites.com appears only in virtual_alias_domains in
> main.cf. The only references I can find with Google seem to address
> subdomains of the primary domain, but that's not the case here.
>
> Second, it seems that Postfix thinks that the local hostname or domain is
> "com.com" instead of "booyahmedia.com" because it's trying to deliver the
> message to testaccount@com.com instead of testaccount@booyahmedia.com. That
> one's really got me scratching my head.
>
> I can fudge it so that messages will get delivered to the local
> "testaccount" account by editing /etc/postfix/virtual to read:
>
> teamsites.com #Team Sites
> testing123@teamsites.com testaccount@booyahmedia.com
>
> That at least delivers mail sent to the virtual alias to the proper local
> account, but I still get the "do not list teamsites.com in BOTH." warning in
> the log. In any case, I don't want to fudge it anyway - I'd rather it work
> correctly.
>
> I've checked through all the network settings I can think of (/etc/hosts
> /etc/resolv.conf) to see why Postfix might be thinking that com.com is the
> localhost,
>
> Here are some outputs from the shell to help give some context and aid
> troubleshooting:
>
> # postconf -n
> alias_database = hash:/etc/aliases
> alias_maps = hash:/etc/aliases
> command_directory = /usr/sbin
> config_directory = /etc/postfix
> daemon_directory = /usr/libexec/postfix
> debug_peer_level = 2
> disable_vrfy_command = yes
> html_directory = no
> mailq_path = /usr/bin/mailq.postfix
> manpage_directory = /usr/share/man
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
> mynetworks = 127.0.0.0/8
> myorigin = $mydomain
> [snip]
>
> # hostname
> booyahmedia.com

you are a victim of default values, exacerbated by the fact that your
hostname has only one dot.....

the quick fix for you is to explictely specify mydomain:

mydomain = booyahmedia.com

Here is a list of recommendations:
- always set myhostname and mydomain explicitely
- if you don't need relay_domains, then set
relay_domains =
- in your virtual aliases, use fqdn addresses:
testing123@teamsites.com testaccount@booyahmedia.com

now the explanation of what happens:

- your hostname has only one dot, the default for mydomain is "com"
- you have myorigin=mydomain, so myorigin=com
- you used non fqdn addresses in your vitual:

testing123@teamsites.com testaccount

which means the mail is to be passed to testaccount@$myorigin, which is
testaccount@com

- since @com has no dot, postfix will append .$mydomain (because default
is append_dot_mydomain=yes), do the address above becomes
testaccount@com.com

more "fun":
- by default relay_domains=$mydestination, so in your case relay_domains=com
- by default parent_domain_matches_subdomains includes relay_domains, so
(in theory) you accept to relay mail for all *.com domains.

maybe the code to determine mydomain from myhostname should be changed
not to strip the host part if the result is a tld?

> [snip]
>
> Any ideas? How can I test to see what Postfix THINKS the localhost and
> localdomain are? Thanks in advance for any clues.
>
> Steve
>