Bug 121249 - postfix should retrieve fully qualified domain name by default
postfix should retrieve fully qualified domain name by default
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: postfix (Show other bugs)
1
i386 Linux
medium Severity low
: ---
: ---
Assigned To: John Dennis
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-19 14:33 EDT by Systems Administrator
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-04-21 11:02:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Systems Administrator 2004-04-19 14:33:44 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.7

Description of problem:
By default the call to gethostname will always fail to produce a 'fully qualified name' requiring unnecessary conf file adjustment for certain hosts.

[root@yogi init.d]# mailq
mailq: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf
postqueue: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf

[root@yogi root]# hostname
yogi
[root@yogi root]# hostname --fqdn
yogi.somedomain.com

[root@yogi root]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1                       localhost.localdomain   localhost
# example fake ip and domain name
192.168.1.90           yogi.somedomain.com                  yogi


Version-Release number of selected component (if applicable):
postfix-2.0.16-1

How reproducible:
Always

Steps to Reproduce:
1. start postfix with a default conf file
2. run mailq
3. observe the error message
    

Actual Results:  [root@yogi init.d]# mailq
mailq: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf
postqueue: warning: My hostname yogi is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf


Expected Results:  [root@yogi root]# mailq
Mail queue is empty


Additional info:

Without postfix setup with a fully qualified domain name cron jobs won't function properly.  As a work around I had initially just set the hostname:

[root@yogi root]# hostname yogi.somedomain.com

but that doesn't persist across a reboot after a kernel upgrade :-).  I've now capitulated and updated my /etc/postfix/main.cf config file.
Comment 1 John Dennis 2004-04-19 15:19:10 EDT
Postfix does not require mydomain to be set in main.cf if hostname
returns the domain. When the hostname is not FQDN its impossible for
postfix to guess correctly and it becomes your responsibility to set
it. For example on a multihomed computer which network interface
represents the correct domain to use? Even if there is only one
network interface gethostbyaddr() may not return a FQDN. Or as you
discovered you can reset the hostname at any random point in time to
anything of your chosing that may have zero relationship to DNS. In
cases where the system is ignorant of its domain, you as the system
adminitrator are the only one who knows what domain to use. Thus
postfix's behavior is by design and not a bug. Setting the domain in
such cases in main.cf is the correct answer as you discovered.
Comment 2 John Dennis 2004-04-19 19:00:07 EDT
Some private email went back and forth between Mathew and I on this
issue. I was going to add it here for tracking purposes but I'm
currently suffering with a version of evolution that can't cut and
paste mail messages correctly :-( Bottom line is I will make a patch
that calls gethostbyaddr() which in most cases will return an FQDN
even when gethostname does not.
Comment 3 John Dennis 2004-04-20 16:33:55 EDT
I'm made a new rpm with the patch, it was built for FC1, you can
download it here:

ftp://people.redhat.com/jdennis/postfix-2.0.18-5.i386.rpm

Please test it, but don't forget to comment out or delete your host
name or domain name settings in /etc/postfix/main.cf otherwise we
won't really be exercising the patch.

A quick sanity test that should work is:

% postconf | grep domain
Comment 4 Systems Administrator 2004-04-20 18:50:42 EDT
I've installed and tested the package.

It appears to behave as intended.  

$ postconf | grep mydomain yields the correct domain with a default config file.  
Additionally cron tasks and simple mail commands also go off without a hitch.

Thanks and I hope this makes it into the tree so that other default users may benefit.
Comment 5 John Dennis 2004-04-21 11:02:59 EDT
Thank you for your help in testing.

Note You need to log in before you can comment on or make changes to this bug.