LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Postfix sends mail with wrong origin domain (https://www.linuxquestions.org/questions/linux-software-2/postfix-sends-mail-with-wrong-origin-domain-728227/)

ivanatora 05-24-2009 03:52 PM

Postfix sends mail with wrong origin domain
 
Hello,
The hostname of my PC is dev.ivanatora.info. It has an A record in the DNS zone for ivanatora.info. I have a Postfix installation running here. I'm sending mail to outside, but the From: field is user@ivanatora.info instead of user@dev.ivanatora.info. Here is part of main.cf:
Code:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost

I have not specified myhostname or myorigin, hope the default values are fine, but maybe they are not.
Anyway I set these:
Code:

myhostname = dev.ivanatora.info
mydomain = ivanatora.info

Any ideas what is misconfigured here?

irishbitte 05-24-2009 08:23 PM

change the mydomain entry from this:
Code:

mydomain = ivanatora.info
to this:
Code:

mydomain = dev.ivanatora.info
The reason is most people want their mail to come from the domain rather than the host, and postfix (and you) default to writing in the domain rather than the host.

billymayday 05-24-2009 08:39 PM

You may want to be careful changing mydomain, since it can feed through to other parameters in your postfix config.

The other way to d othis would be to use simple address re-writing. You can use "generic" remapping for this. See http://www.postfix.org/ADDRESS_REWRI...E.html#generic

ivanatora 05-25-2009 03:30 AM

irishbitte, that doesn't seem to work. Mail is still sent with user@ivanatora.info.
Another strange issue is this. I'm trying to send mail to Exim system. The Exim is configured with "verify callout" - it tries to call back the sender to see if local user exist at my side. Using pine and user root I'm able to send mail (there is another mail server at ivanatora.info, so the verification callout passes). But using sendmail from the command line fails. The message is delivered, but the verification callback does not pass. I'm running pine with default settings. Any idea why the sendmail binary won't work? Here is example session from maillog:
Code:

May 25 11:26:44 localhost postfix/pickup[15946]: C89B61C739A: uid=0 from=<root>
May 25 11:26:44 localhost postfix/cleanup[16189]: C89B61C739A: message-id=<20090525082644.C89B61C739A@dev.ivanatora.info>
May 25 11:26:44 localhost postfix/qmgr[15945]: C89B61C739A: from=<root@dev.ivanatora.info>, size=291, nrcpt=1 (queue active)
May 25 11:26:45 localhost postfix/smtpd[16186]: connect from zen.r1servers.com[82.119.92.2]
May 25 11:26:45 localhost postfix/smtpd[16186]: warning: lookup root@dev.ivanatora.info, NIS domain ivanatora.info, map mail.aliases: internal yp server or client error
May 25 11:26:45 localhost postfix/smtpd[16186]: NOQUEUE: reject: RCPT from zen.r1servers.com[82.119.92.2]: 451 4.3.0 <root@dev.ivanatora.info>: Temporary lookup failure; from=<> to=<root@dev.ivanatora.info> proto=SMTP helo=<zen.r1servers.com>
May 25 11:26:45 localhost postfix/cleanup[16189]: 8E2011C7397: message-id=<20090525082645.8E2011C7397@dev.ivanatora.info>
May 25 11:26:45 localhost postfix/smtpd[16186]: disconnect from zen.r1servers.com[82.119.92.2]
May 25 11:26:45 localhost postfix/qmgr[15945]: 8E2011C7397: from=<double-bounce@dev.ivanatora.info>, size=766, nrcpt=1 (queue active)
May 25 11:26:45 localhost postfix/local[16182]: warning: lookup postmaster, NIS domain ivanatora.info, map mail.aliases: internal yp server or client error
May 25 11:26:45 localhost postfix/local[16182]: 8E2011C7397: to=<postmaster@dev.ivanatora.info>, orig_to=<postmaster>, relay=local, delay=0.01, delays=0.01/0/0/0.01, dsn=4.3.0, status=deferred (alias database unavailable)
May 25 11:26:45 localhost postfix/smtp[16183]: C89B61C739A: to=<ivan@aiperfekt.com>, relay=aiperfekt.com[82.119.92.2]:25, delay=2.7, delays=2/0/0.21/0.58, dsn=4.0.0, status=deferred (host aiperfekt.com[82.119.92.2] said: 451 Could not complete sender verify callout (in reply to RCPT TO command))


ivanatora 05-25-2009 03:55 AM

Sorry for double posting.
I've just checked with Wireshark (great debugging tool!) and I see pine sends the followin command:
Code:

MAIL FROM: <root@ivanatora.info>
While sending from commandline:
Code:

# sendmail ivan@test-server.com                                                     
wire
.

Gives the following command:
Code:

MAIL FROM <root@dev.ivanatora.inf>
Ooohh, dumb me. I had user-domain=ivanatora.info in ~/.pinerc
So Postfix does really sends fine from @dev.ivanatora.info but the remote host have problems with "Temporary lookup failure". I will check the state of the MX records, becouse I have played a little with these and maybe I should wait DNS refreshing.




EDIT
Problem solved.
Added these lines to main.cf:
Code:

alias_database = hash:/etc/aliases
alias_maps = $alias_database

No more lookup errors. I think that disabled NIS (which I don't run anyway). No more "alias database unavailable" errors. Mail transmits fine.

irishbitte 05-25-2009 05:12 AM

Yup, these things sometimes are as small as that. Check billymaydays post regarding the MYDOMAIN setting will you?


All times are GMT -5. The time now is 04:34 AM.