Debian Bug report logs - #450787
postfix: should handle hosts with non-existant FQDN better

version graph

Package: postfix; Maintainer for postfix is Debian Postfix Team <[email protected]>; Source for postfix is src:postfix (PTS, buildd, popcon).

Reported by: Osamu Aoki <[email protected]>

Date: Sat, 10 Nov 2007 16:27:05 UTC

Severity: normal

Found in version postfix/2.4.6-1

Full log


🔗 View this message in rfc822 format

X-Loop: [email protected]
Subject: Bug#450787: postfix: Smarthost set up
Reply-To: Michael Prokop <[email protected]>, [email protected]
Resent-From: Michael Prokop <[email protected]>
Resent-To: [email protected]
Resent-CC: LaMont Jones <[email protected]>
X-Loop: [email protected]
Resent-Date: Mon, 07 Mar 2022 15:12:01 +0000
Resent-Message-ID: <[email protected]>
Resent-Sender: [email protected]
X-Debian-PR-Message: followup 450787
X-Debian-PR-Package: postfix
X-Debian-PR-Keywords: 
References: <20071110162502.GA17024@localhost> <[email protected]> <20071110162502.GA17024@localhost>
X-Debian-PR-Source: postfix
Received: via spool by [email protected] id=B450787.16466657382757
          (code B ref 450787); Mon, 07 Mar 2022 15:12:01 +0000
Received: (at 450787) by bugs.debian.org; 7 Mar 2022 15:08:58 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.2-bugs.debian.org_2005_01_02
	(2018-09-13) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-22.1 required=4.0 tests=BAYES_00,FROMDEVELOPER,
	HAS_BUG_NUMBER,HEADER_FROM_DIFFERENT_DOMAINS,PGPSIGNATURE,
	SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham
	autolearn_force=no version=3.4.2-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 27; hammy, 150; neutral, 110; spammy,
	0. spammytokens: hammytokens:0.000-+--H*ct:pgp-sha256,
	0.000-+--systemctl, 0.000-+--H*ct:application, 0.000-+--H*ct:protocol,
	0.000-+--H*ct:micalg
Received: from odysseus.grml.info ([136.243.234.18]:46626)
	by buxtehude.debian.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <[email protected]>)
	id 1nREyo-0000eb-99
	for [email protected]; Mon, 07 Mar 2022 15:08:58 +0000
Received: by odysseus.grml.info (Postfix, from userid 105)
	id 2043440365; Mon,  7 Mar 2022 16:00:52 +0100 (CET)
Received: from localhost (localhost.localdomain [127.0.0.1])
	by odysseus.grml.info (Postfix) with ESMTP id 4E0334035D;
	Mon,  7 Mar 2022 16:00:51 +0100 (CET)
Date: Mon, 7 Mar 2022 16:00:51 +0100
From: Michael Prokop <[email protected]>
To: LaMont Jones <[email protected]>, [email protected]
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="YcENd0GJHuwfkEWk"
Content-Disposition: inline
In-Reply-To: <[email protected]>
User-Agent: Mutt/2.0.5 (2021-01-21)
X-Greylist: delayed 481 seconds by postgrey-1.36 at buxtehude; Mon, 07 Mar 2022 15:08:57 UTC
[Message part 1 (text/plain, inline)]
Hi,

* LaMont Jones [Fri Jan 04, 2008 at 07:06:49AM -0700]:

> The bug here is quite possibly that postfix's install doesn't make
> dealing with a machine that needs to tweak myorigin (usually because
> it's not in the DNS for the rest of the internet) easier.

I recently stumbled upon a related issue, where a system had a
static IP configuration, but its search path wasn't configured.
systemd-resolved uses "search ." then, and installation of postfix
fails with such a setup.

Steps to reproduce:

| root@grml ~ # hostname
| grml
| root@grml ~ # hostname --fqdn
| grml
| root@grml ~ # grep '^search' /etc/resolv.conf
| search .
| root@grml ~ # apt install postfix
| [...]
| Creating /etc/postfix/dynamicmaps.cf
| Adding group `postdrop' (GID 125) ...
| Done.
| setting myhostname: grml..
| setting alias maps
| setting alias database
| mailname is not a fully qualified ___domain name.  Not changing /etc/mailname.
| setting destinations: $myhostname, grml, localhost.localdomain, , localhost
| setting relayhost: 
| setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
| setting mailbox_size_limit: 0
| setting recipient_delimiter: +
| setting inet_interfaces: all
| setting inet_protocols: all
| /etc/aliases does not exist, creating it.
| WARNING: /etc/aliases exists, but does not have a root alias.
|
| Postfix (main.cf) is now set up with a default configuration.  If you need to 
| make changes, edit /etc/postfix/main.cf (and others) as needed.  To view 
| Postfix configuration values, see postconf(1).
|
| After modifying main.cf, be sure to run 'systemctl reload postfix'.
|
| Running newaliases
| newaliases: warning: valid_hostname: misplaced delimiter: grml..
| newaliases: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: grml..
| dpkg: error processing package postfix (--configure):
|  installed postfix package post-installation script subprocess returned error exit status 75
| [...]

The generated "grml.." setting for postfix's myhostname
configuration is invalid and rejected by e.g. postfix's newaliases.

This is caused by postfix's postinst script, which includes this:

| myfqdn() {
|     myhostname=$(hostname --fqdn 2>/dev/null || echo "")
|     # If we don't have a name with a dot (which includes ""), then we have work.
|     if [ $myhostname = ${myhostname%.*} ]; then
|         # If it's empty, and we have /etc/hostname, try that.
|         if [ -z $myhostname ] && [ -r /etc/hostname ]; then
|             myhostname=$(cat /etc/hostname)
|         fi
|         # If we are still lacking a ___domain component, then try resolv.conf.
|         if [ $myhostname = ${myhostname%.*} ]; then
|             if [ -f /etc/resolv.conf ]; then
|                 # The resolver uses the last one found, and ignores the rest
|                 mydom=$(sed -n 's/^search[[:space:]]*\.*\([^[:space:]]*\).*/\1/p;s/^___domain[[:space:]]*\.*\([^[:space:]]*\).*/\1/p' /etc/resolv.conf | tail -1)
|                 myhostname="$myhostname${mydom:+.${mydom%.}}"
|             else
|                 myhostname="$myhostname.UNKNOWN"
|             fi
|         fi
|     fi
|     echo $myhostname
| }

regards
-mika-
[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 17:47:27 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.