LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-30-2010, 08:44 PM   #1
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Rep: Reputation: 0
Postfix 2.7.0 ignoring main.cf params?


I've recently upgraded my home server from fc5 to fc13 which means installing the latest version of postfix (identified as 2.7.0 in the maillog). It is used to send mail from cron jobs and logwatch to a local mailbox (aliased) and my googlemail account so I can monitor when away from home.

I finally got it working, but had to pull a trick that I feel bad about--it feels very hacky, and does not survive a reboot.

The problem is no matter what I do, this version of Postfix ignores the settings for "masquerade_domains", "myhostname" and "mydomain" in main.cf, using instead getting the domain name from whatever 127.0.0.1 (or :::1) is set to in /etc/hosts!!

To send mail to Internet locations, the "from" needs to be a valid domain with an MX record. In an earlier version of Postfix (2.6.x) I just fudged this to a domain I own (that is parked) in main.cf using "masquerade_domains". Now I have to insert it in /etc/hosts instead of "localhost", eg:

Code:
127.0.0.1   hostname.real.domain hostname
I can't find anyone on the web who seems to be having this problem. Postfix is definitely reading main.cf as it is obviously picking up other setings such as debug_peer_level and proxy_interfaces.

As I said, it works, but I don't like my solution and /etc/hosts gets rewritten to ":::1 localhost6.localdomain6" when the system is rebooted, meaning I have to edit it to get Postfix working again as sendmail rejects "localhost6.localdomain6" as not found.

Suggestions most welcome.
 
Old 08-30-2010, 09:17 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Could you please provide a 'postconf -n'.. feel free to sanitise

cheers
 
Old 08-31-2010, 12:14 AM   #3
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Could you please provide a 'postconf -n'.. feel free to sanitise

cheers
Sanitized:

Code:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
masquerade_domains = <my real domain>
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mydomain = <my real domain>
myhostname = kali.<my real domain>
mynetworks = 192.168.1.0/28, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
proxy_interfaces = xxx.233.47.38
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.7.0/README_FILES
sample_directory = /usr/share/doc/postfix-2.7.0/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
 
Old 08-31-2010, 12:24 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Can you try making /etc/hosts look like this ?

Code:
127.0.0.1   localhost.localdomain localhost
192.168.1.X   kali.<your real domain> kali
... also, I'm assuming 'inet_interfaces = all' ?

cheers
 
Old 09-01-2010, 01:18 AM   #5
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Can you try making /etc/hosts look like this ?
... also, I'm assuming 'inet_interfaces = all' ?
It's not explicitly set, so should default to 'all' if I read the doco right. I've currently got all hosts ip entries as

Code:
192.168.1.x  name name.<my domain>
Will try reversing and rebooting. The sad part is the hosts file and the main.cf were copied from my old fc5 config which worked fine. Progress...
 
Old 09-01-2010, 01:29 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Another possibility is that something went screwy because you upgraded, remember that upgrading is not recommended. If all else fails it may be worth a fresh build ...
 
Old 09-01-2010, 04:16 AM   #7
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Another possibility is that something went screwy because you upgraded, remember that upgrading is not recommended. If all else fails it may be worth a fresh build ...
Sorry, bad wording. The F13 was a clean install from DVD, followed by painstaking rebuild of stuff like users, perl libraries, yum installs (postfix etc) and diffs of new config files with old versions to modify the new ones (I didn't replace the new with old).

All that said, I've just tried editing the hosts file to "ip fully-qualified alias" format, and rebooted.

Results no different--postfix mail still fails be delivered following boot. The previous 127.0.0.1 entry in /etc/hosts (which used a hostname.domain with a MX record) was replaced with the following 2 lines (effectively 2 aliases):

Code:
127.0.0.1	kali	localhost.localdomain	localhost
::1	kali	localhost6.localdomain6	localhost6
Mail stopped being delivered due to postfix picking localhost.localdomain as the "from" domain (despite the main.cf settings, and why not the "kali" string which was in the canonical position?). The maillog extract (edited to change actual names and domains) shows what happened when mailx was used to send 1 mail to two addresses ("root,ron@valid.org").

After changing the 127.0.0.1 entry to the the valid fully qualified host.domain, the same mailx test succeeded. Didn't even have to restart postfix, so it must reread /etc/hosts every time!

Code:
Sep  1 17:18:14 kali postfix/master[1253]: daemon started -- version 2.7.0, configuration /etc/postfix
Sep  1 17:23:57 kali sendmail[2060]: o817Nkpw002060: from=me, size=238, class=0, nrcpts=2, msgid=<201009010723.o817Nkpw002060@localhost.localdomain>, relay=me@localhost
Sep  1 17:23:58 kali postfix/smtpd[2062]: connect from kali[127.0.0.1]
Sep  1 17:23:58 kali postfix/smtpd[2062]: 1B51280162: client=kali[127.0.0.1]
Sep  1 17:23:58 kali postfix/cleanup[2065]: 1B51280162: message-id=<201009010723.o817Nkpw002060@localhost.localdomain>
Sep  1 17:23:58 kali postfix/qmgr[1262]: 1B51280162: from=<me@localhost.localdomain>, size=689, nrcpt=2 (queue active)
Sep  1 17:23:58 kali sendmail[2060]: o817Nkpw002060: to=root,ron@valid.org, ctladdr=chernich (500/500), delay=00:00:12, xdelay=00:00:01, mailer=relay, pri=60238, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 1B51280162)
Sep  1 17:23:58 kali postfix/smtpd[2062]: disconnect from kali[127.0.0.1]
Sep  1 17:24:07 kali postfix/smtp[2066]: 1B51280162: to=<root@localhost.localdomain>, relay=none, delay=8.9, delays=0.11/0.04/8.8/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=localhost.localdomain type=AAAA: Host not found)
Sep  1 17:24:11 kali postfix/smtp[2067]: 1B51280162: to=<ron@valid.org>, relay=valid.org[75.126.89.28]:25, delay=14, delays=0.11/0.04/13/0.28, dsn=5.0.0, status=bounced (host valid.org[75.126.89.28] said: 550-Verification failed for <me@localhost.localdomain> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))
Sep  1 17:24:12 kali postfix/cleanup[2065]: 228598018A: message-id=<20100901072412.228598018A@kali.valid.com>
Sep  1 17:24:12 kali postfix/qmgr[1262]: 228598018A: from=<>, size=3315, nrcpt=1 (queue active)
Sep  1 17:24:12 kali postfix/bounce[2068]: 1B51280162: sender non-delivery notification: 228598018A
Sep  1 17:24:12 kali postfix/qmgr[1262]: 1B51280162: removed
Sep  1 17:24:20 kali postfix/smtp[2066]: 228598018A: to=<me@localhost.localdomain>, relay=none, delay=8.4, delays=0.04/0/8.4/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=localhost.localdomain type=AAAA: Host not found)
Sep  1 17:24:20 kali postfix/qmgr[1262]: 228598018A: removed

Last edited by Ron7; 09-01-2010 at 05:20 AM.
 
Old 09-01-2010, 09:44 PM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Seems like your system is using dhcp instead of static addressing and something may be modifying /etc/hosts, can you confirm the contents of /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 ?
 
Old 09-01-2010, 09:52 PM   #9
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Some progress, I found that the "kali" which was being inserted as the canonical host name in the localhost address (ipv4 and 6) during boot was being read from the file /etc/sysconfig/network.

The doco says the HOSTNAME value should be canonical, so I changed this and the full host name now gets inserted into the 127.0.0.1 and ::1 lines of the host file during reboot. That sort of fixed my postfix problem of having to make changes after a reboot, though why the main.cf params myhostname, mydomain, and masquerade_domain are all being ignored is still most perplexing. The next point of investigation would be the 2.7.0 source, so I'll probably give up at this point.

The other odd thing is in all Fedora distros I've used since 3, I don't think I've ever seen /etc/hosts unilaterally modified at boot time before F13 (though I skipped 10,11,12 )
 
Old 09-01-2010, 10:14 PM   #10
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Seems like your system is using dhcp instead of static addressing and something may be modifying /etc/hosts, can you confirm the contents of /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 ?
You are right about using DHCP. For security, my modem is set to provide fixed IP addresses to specific NICs only. It also has the (short form) name for the address, though the linux box in question has a hostname set in /etc/sysconfig/network (see previous post). The eth0 cfg script seems innocuous:

Code:
DEVICE=eth0
HWADDR=00:1C:25:2F:5C:76
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
NM_CONTROLLED=yes
USERCTL=no
IPV6INIT=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
DNS2=xxx.233.0.3
DNS1=xxx.233.0.4
PEERDNS=yes
PEERROUTES=yes
 
Old 09-02-2010, 01:36 AM   #11
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
The 3 directives you're having problems with are all networking related, I think if you switch eth0 to static and fix your /etc/hosts file the problems will go away.. try this:

/etc/sysconfig/network-scripts/ifcfg-eth0
Code:
DEVICE=eth0
HWADDR=00:1C:25:2F:5C:76
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
USERCTL=yes
IPV6INIT=no
IPADDR=192.168.1.X
NETMASK=255.255.255.240
GATEWAY=192.168.1.Y
/etc/hosts
Code:
127.0.0.1   localhost.localdomain localhost
192.168.1.X   kali.<your real domain> kali
/etc/resolv.conf
Code:
domain <your real domain>
nameserver xxx.233.0.4
nameserver xxx.233.0.3
/etc/sysconfig/network
Code:
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=kali.<your real domain>
You can have the GATEWAY configured as above or in /etc/sysconfig/network...

cheers
 
Old 09-02-2010, 02:13 AM   #12
Ron7
LQ Newbie
 
Registered: Mar 2009
Location: University of Queensland, Australia
Distribution: FC9, F13
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
The 3 directives you're having problems with are all networking related, I think if you switch eth0 to static and fix your /etc/hosts file the problems will go away.. try this:
Almost

The 127.0.0.1 and ::1 lines are still being set on boot using the HOSTNAME from /etc/sysconf/network:

Code:
127.0.0.1       kali.xyzzy.com        kali    localhost.localdomain   localhost
::1     kali.xyzzy.com        kali    localhost6.localdomain6 localhost6
And /etc/resolv.conf is still being written at boot. On first try, it was all comments saying I needed to set DNS1 and 2 in the ifcfg script. I did this and now it regenerates the resolv.conf without the 192.168.1.1 nameserver line (good).

So progress, sort of. I agree with the IP statically set, you'd not expect hosts and resolv.conf to get rewritten at boot, but they do! I could chmod +s but that's too tacky for words. However, as is, they are rewritten in a "good" state so postfix works and firefox won't have name RARP delays waiting for the modem DNS to time out.
 
Old 10-13-2010, 01:41 PM   #13
vch
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
To revive an earlier question in this thread, "The problem is no matter what I do, this version of Postfix ignores the settings for "masquerade_domains", "myhostname" and "mydomain" in main.cf, using instead getting the domain name from whatever 127.0.0.1 (or :::1) is set to in /etc/hosts!!"

I'm having this same issue with RHEL 5.5 and Postfix 2.3.3. Is there a way to tell Postfix to ignore the Linux hostname and use what I tell it in the main.cf for the envelope sender (the from address)? I don't want to change the hostname of the server. I just need to email backup summaries using the "mail" command, but they get rejected due to a non-resolvable domain name (i.e. root@domain.local).

Here is the rejection I get:
550 5.1.0 domain.local does not exist (in reply to MAIL FROM command)

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix ignoring mailbox_command..... b0redom Solaris / OpenSolaris 1 08-18-2009 09:16 AM
Help on Postfix 2.1.5 main.cf allancth Linux - Software 2 04-29-2009 08:08 PM
Postfix main.cf halvorls Linux - Server 8 09-25-2008 05:03 PM
postfix main.cf file okidokie Linux - Server 1 02-12-2007 07:04 AM
postfix main.cf illtbagu Linux - Software 8 07-22-2003 12:35 AM


All times are GMT -5. The time now is 04:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration