Debian Bug report logs - #214741
postfix: $myhostname not reading the FQDN correctly

version graph

Package: postfix; Maintainer for postfix is LaMont Jones <lamont@debian.org>; Source for postfix is src:postfix.

Reported by: Joe Nahmias <joe@nahmias.net>

Date: Wed, 8 Oct 2003 13:03:02 UTC

Severity: normal

Tags: patch

Merged with 399802

Found in versions postfix/2.9.6-2, 2.0.16-1, postfix/2.10.2-1, postfix/2.3.4-1, postfix/2.7.1-1+squeeze1

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. Full text and rfc822 format available.

Acknowledgement sent to Joe Nahmias <joe@nahmias.net>:
New Bug report received and forwarded. Copy sent to LaMont Jones <lamont@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Joe Nahmias <joe@nahmias.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: postfix: $myhostname not reading the FQDN correctly
Date: Wed, 08 Oct 2003 02:27:50 -0400
Package: postfix
Version: 2.0.16-1
Severity: normal

Hello,

It seems that there is a problem with how postfix gets the default $myhostname.
I get the following error in /var/log/mail.warn, even though my hostname is
properly configured:

Oct  8 01:05:17 laptop postfix/smtpd[3730]: warning: My hostname laptop is not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf

Unfortunately, this caused all mail to get bounced as postfix thought that mail
for my domain was an attempt to relay...  I got a number of these messages
until I edited /etc/postfix/main.cf and manually set "mydomain = nahmias.net".

For reference, here is the configuration for my hostname:

/etc/hostname:
laptop

/etc/host.conf:
order hosts,bind
multi on

/etc/hosts:
127.0.0.1       laptop.nahmias.net laptop localhost


This seem to result in (an otherwise) correct and functional hostname
configuration:

joe@laptop:~ $ hostname --short
laptop
joe@laptop:~ $ hostname --domain
nahmias.net
joe@laptop:~ $ hostname --fqdn
laptop.nahmias.net

NB: The documentation for both hostname(1) and postfix *claim* to get the FQDN
from gethostname(2).  Something here is just not right.

Let me know if I can provide any further assistance,
Joe Nahmias


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux laptop 2.4.21-4-686 #1 Sat Aug 2 23:27:25 EST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages postfix depends on:
ii  adduser                       3.51       Add and remove users and groups
ii  debconf                       1.3.14     Debian configuration management sy
ii  dpkg                          1.10.15    Package maintenance system for Deb
ii  libc6                         2.3.2-8    GNU C Library: Shared libraries an
ii  libdb4.1                      4.1.25-6   Berkeley v4.1 Database Libraries [
ii  libgdbm3                      1.8.3-2    GNU dbm database routines (runtime
ii  netbase                       4.13       Basic TCP/IP networking system

-- debconf information:
* postfix/main_mailer_type: Internet Site
* postfix/append_dot_mydomain: false
  postfix/bad_recipient_delimiter: 
  postfix/rfc1035_violation: false
* postfix/chattr: true
  postfix/relayhost: 
  postfix/master_upgrade_warning: 
* postfix/mailname: nahmias.net
  postfix/mynetworks: 127.0.0.0/8
  postfix/transport_map_warning: 
* postfix/root_address: NONE
  postfix/recipient_delim: +
  postfix/mailbox_limit: 0
* postfix/destinations: $myhostname, localhost.$mydomain, $mydomain
  postfix/procmail: true
  postfix/dynamicmaps_upgrade_warning: 
  postfix/db_upgrade_warning: true
  postfix/not_configured: 




Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. Full text and rfc822 format available.

Acknowledgement sent to Mike Paul <mike@wyzardry.net>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. Full text and rfc822 format available.

Message #10 received at 214741@bugs.debian.org (full text, mbox):

From: Mike Paul <mike@wyzardry.net>
To: 214741@bugs.debian.org
Subject: More info on this bug
Date: Mon, 08 Oct 2007 23:10:30 -0400
[Message part 1 (text/plain, inline)]
Four years later (to the day, coincidentally), this bug still exists,
though in a slightly different form.  I've done some research and can
provide a bit more information.

If $myhostname isn't defined manually in the config file, Postfix uses
gethostname() to query the system's hostname.  $myhostname needs to be
an FQDN, though, so if the name returned by gethostname() doesn't
contain at least one dot, it appends the value of $mydomain if that's
defined in the config file, or else the static string "localdomain".

Notably, Postfix does *not* call gethostbyname() on the name returned by
gethostname(), the way the "hostname --fqdn" command does.

This'll work as expected if gethostname() returns an FQDN, but on a
typically-configured Debian system, it doesn't.  It returns a "short"
hostname, and this leads to Postfix using e.g. "foo.localdomain" as
$myhostname, even though "hostname --fqdn" returns "foo.bar.com".

Steps to reproduce:
      * Install a fresh copy of Debian (current release is etch).
      * When asked for the machine's hostname during installation, enter
        "foo".
      * When asked for the machine's domain name, enter "bar.com".
      * Install Postfix, and choose the default "Internet Site"
        configuration.  The "mail name" setting doesn't matter.
      * Remove the "myhostname = foo.bar.com" line
        from /etc/postfix/main.cf.  This line is put there by debconf,
        and it works around the problem, but it's redundant and
        shouldn't be necessary.  The machine already knows its FQDN, and
        the sensible default would be to use it.
      * Run "hostname --fqdn" and "hostname --domain".  They will return
        "foo.bar.com" and "bar.com" respectively, as expected.
      * Run "postconf myhostname" and "postconf mydomain".  They will
        return "foo.localdomain" and "localdomain" respectively.  This
        is wrong.

Postfix's behavior here suggests that the machine's hostname, as
returned by gethostname() (i.e. the "hostname" command, without the
"--fqdn" option) is supposed to be an FQDN.  But that isn't the case on
Debian, (nor on other common Linux distros AFAIK), and I don't see why
I'd want my system configured that way anyway.  There don't seem to be
any clear guidelines or best practices on this matter.

Since Postfix wants an FQDN for $myhostname, I think it should get the
default value in the same way the "hostname --fqdn" command does:  get
the (probably short) hostname using gethostname(), and then call
gethostbyname() on it to look up the FQDN.  It's still possible to get
something that isn't an FQDN on a misconfigured system, but at least the
behavior would be consistent with that of the well-known hostname tool,
and would work as expected with Debian's out-of-the-box configuration.

(As an aside, it's possible to get an FQDN hostname in Debian by typing
an FQDN into the hostname box during installation.  It contradicts the
instructions in that box, which say that "the hostname is a single
word", but the installer is smart enough to skip asking for the domain
name when an FQDN is entered as the hostname.  But this causes problems
of its own:  the Postfix Debconf stuff thinks the machine's FQDN is
"foo.bar.com.bar.com".)
-- 
Mike Paul <mike@wyzardry.net>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Fri, 04 Dec 2009 11:39:20 GMT) Full text and rfc822 format available.

Acknowledgement sent to Harald Braumann <harry@unheit.net>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Fri, 04 Dec 2009 11:39:20 GMT) Full text and rfc822 format available.

Message #15 received at 214741@bugs.debian.org (full text, mbox):

From: Harald Braumann <harry@unheit.net>
To: 399802@bugs.debian.org, 214741@bugs.debian.org
Subject: #399802 and #214741 the same?
Date: Fri, 4 Dec 2009 12:24:33 +0100
[Message part 1 (text/plain, inline)]
Hi,

aren't #399802 and #214741 the same? 

Cheers,
harry

PS: I'm not sure if I'm supposed to merge bugs in such a case or if
this is something that only the maintainers do.
[signature.asc (application/pgp-signature, attachment)]

Forcibly Merged 214741 399802. Request was from LaMont Jones <lamont@debian.org> to control@bugs.debian.org. (Fri, 04 Dec 2009 12:12:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Mon, 05 Apr 2010 15:03:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yann SOUBEYRAND <yann.soubeyrand@gmx.fr>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Mon, 05 Apr 2010 15:03:10 GMT) Full text and rfc822 format available.

Message #22 received at 214741@bugs.debian.org (full text, mbox):

From: Yann SOUBEYRAND <yann.soubeyrand@gmx.fr>
To: 214741@bugs.debian.org
Date: Mon, 05 Apr 2010 17:00:31 +0200
Hi!

This bug is still present in Postfix 2.6.5.





Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Mon, 11 Oct 2010 16:06:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hristo Erinin <hristo.erinin@gmail.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Mon, 11 Oct 2010 16:06:03 GMT) Full text and rfc822 format available.

Message #27 received at 214741@bugs.debian.org (full text, mbox):

From: Hristo Erinin <hristo.erinin@gmail.com>
To: 214741@bugs.debian.org
Subject: postfix: myhostname (if not set explicitly) is assigned the hostname with localdomain by default
Date: Mon, 11 Oct 2010 18:03:16 +0200
Hello,

This bug is still present after 7 years. A confirmation of the bug in 2.5.5-1.1:
Oct  6 12:27:27 fury postfix/postqueue[19564]: dict_eval: expand
$myhostname, localhost.$mydomain, localhost -> fury.localdomain,
localhost.localdomain, localhost
Oct  6 12:27:27 fury postfix/postqueue[19564]: dict_eval: expand
$myhostname -> fury.localdomain

The easiest workaround is setting $mydomain appropriately. This way
the hostname and domain is used by the daemon.

Also please note that the documentation for the package still falsely
claims if unspecified, by default myhostname is set to the FQDN of the
server.


-- 
Best Regards,
Hristo Erinin
System Administrator




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#214741; Package postfix. (Mon, 11 Oct 2010 17:39:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to LaMont Jones <lamont@debian.org>:
Extra info received and forwarded to list. (Mon, 11 Oct 2010 17:39:06 GMT) Full text and rfc822 format available.

Message #32 received at 214741@bugs.debian.org (full text, mbox):

From: LaMont Jones <lamont@debian.org>
To: Hristo Erinin <hristo.erinin@gmail.com>, 214741@bugs.debian.org
Subject: Re: Bug#214741: postfix: myhostname (if not set explicitly) is assigned the hostname with localdomain by default
Date: Mon, 11 Oct 2010 11:36:33 -0600
On Mon, Oct 11, 2010 at 06:03:16PM +0200, Hristo Erinin wrote:
> Oct  6 12:27:27 fury postfix/postqueue[19564]: dict_eval: expand
> $myhostname -> fury.localdomain

What is the output from these commands?
    hostname --fqdn
    grep ^127 /etc/hosts

lamont




Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Mon, 11 Oct 2010 22:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hristo Erinin <hristo.erinin@gmail.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Mon, 11 Oct 2010 22:45:03 GMT) Full text and rfc822 format available.

Message #37 received at 214741@bugs.debian.org (full text, mbox):

From: Hristo Erinin <hristo.erinin@gmail.com>
To: 214741@bugs.debian.org
Subject: Re: Bug#214741: postfix: myhostname (if not set explicitly) is assigned the hostname with localdomain by default
Date: Tue, 12 Oct 2010 00:43:55 +0200
Hello,

On Mon, Oct 11, 2010 at 7:36 PM, LaMont Jones <lamont@debian.org> wrote:
> What is the output from these commands?
>    hostname --fqdn
feer@fury:~$ hostname --fqdn
fury.int.hellvetica.net


>    grep ^127 /etc/hosts
feer@fury:~$ grep ^127 /etc/hosts
127.0.0.1       localhost.localdomain           localhost

I've tried removing the localhost.localdomain from the line above but
it made no difference.

Thanks!

-- 
Best Regards,
Hristo Erinin




Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Wed, 05 Sep 2012 09:45:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Johnathon Tinsley <johnathon@positive-internet.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Wed, 05 Sep 2012 09:45:05 GMT) Full text and rfc822 format available.

Message #42 received at 214741@bugs.debian.org (full text, mbox):

From: Johnathon Tinsley <johnathon@positive-internet.com>
To: 214741@bugs.debian.org
Subject: Bug still a problem
Date: Wed, 05 Sep 2012 10:32:43 +0100
Just confirming, this is still a problem.

-- 
All postal correspondence to:
The Positive Internet Company, 24 Ganton Street, London. W1F 7QY

The Positive Internet Company Limited is registered in England and Wales.
Registered company number: 3673639. VAT no: 726 7072 28.
Registered office: Northside House, Mount Pleasant, Barnet, Herts, EN4 9EE.



Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Tue, 29 Oct 2013 12:51:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Hall <flimzy@flimzy.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Tue, 29 Oct 2013 12:51:04 GMT) Full text and rfc822 format available.

Message #47 received at 214741@bugs.debian.org (full text, mbox):

From: Jonathan Hall <flimzy@flimzy.com>
To: 214741@bugs.debian.org
Subject: Patch for 214741
Date: Tue, 29 Oct 2013 07:42:04 -0500
[Message part 1 (text/plain, inline)]
We are also experiencing this with postfix 2.7.1 and 2.9.6.  The 
included patch solves the problem for 2.7.1, and should be trivial to 
adapt for newer versions.


[214741.patch (text/x-patch, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#214741; Package postfix. (Wed, 30 Oct 2013 15:15:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Hall <flimzy@flimzy.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (Wed, 30 Oct 2013 15:15:09 GMT) Full text and rfc822 format available.

Message #52 received at 214741@bugs.debian.org (full text, mbox):

From: Jonathan Hall <flimzy@flimzy.com>
To: 214741@bugs.debian.org
Subject: Also happens in postfix 2.10.2; patch
Date: Wed, 30 Oct 2013 10:11:31 -0500
[Message part 1 (text/plain, inline)]
Tags: patch

I have also confirmed this bug to exist in postfix 2.10.2, and have 
adapted my previous patch to work with this version.

[2.10.2_214741.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:30:12 GMT) Full text and rfc822 format available.

Added tag(s) squeeze, wheezy, and lenny. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:36:12 GMT) Full text and rfc822 format available.

Removed tag(s) unreproducible and moreinfo. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:36:19 GMT) Full text and rfc822 format available.

Removed tag(s) squeeze, wheezy, and lenny. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:45:04 GMT) Full text and rfc822 format available.

Marked as found in versions 2.7.1. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:51:05 GMT) Full text and rfc822 format available.

Marked as found in versions 2.9.6. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:51:05 GMT) Full text and rfc822 format available.

Marked as found in versions 2.20.2. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:51:06 GMT) Full text and rfc822 format available.

No longer marked as found in versions 2.20.2. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:13 GMT) Full text and rfc822 format available.

Marked as found in versions 2.10.2. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:13 GMT) Full text and rfc822 format available.

Marked as found in versions postfix/2.10.2-1. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:17 GMT) Full text and rfc822 format available.

No longer marked as found in versions 2.10.2. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:18 GMT) Full text and rfc822 format available.

Marked as found in versions postfix/2.9.6-2. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:19 GMT) Full text and rfc822 format available.

No longer marked as found in versions 2.9.6. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:19 GMT) Full text and rfc822 format available.

Marked as found in versions postfix/2.7.1-1+squeeze1. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:20 GMT) Full text and rfc822 format available.

No longer marked as found in versions 2.7.1. Request was from Jonathan Hall <flimzy@flimzy.com> to control@bugs.debian.org. (Wed, 30 Oct 2013 15:57:21 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 16:08:07 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.