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-

Attachment: signature.asc
Description: PGP signature

Reply via email to