Bug in 2.7.0 pre 14 and hostname

Scott Kitterman amavis at kitterman.com
Mon Mar 28 19:05:28 CEST 2011


On Monday, March 28, 2011 12:45:14 pm Quanah Gibson-Mount wrote:
> --On Monday, March 28, 2011 6:04 PM +0200 Mark Martinec
> 
> <Mark.Martinec+amavis at ijs.si> wrote:
> > Quanah,
> > 
> >> 2.7.0 pre 14 expects "hostname" to return a fully qualified hostname
> >> value,  but that is not correct.  That is what "hostname -f" does.  This
> >> causes  amavis to fail to start on correctly configured systems.
> > 
> > It is no different than 2.6.4 and earlier, no changes in this area.
> > I'm reluctant to change what used to work for most users for so long.
> > 
> > If the default is not appropriate, one should set the $myhostname
> > in a config file. It is probably sensible to do that explicitly even if
> > a default is fine.
> > 
> >> I see specifically it is using POSIX::uname, even though the
> >> documentation says it is very unreliable.  I would advise not using it.
> >> 
> >> uname
> >> 
> >>     Get name of current operating system.
> >>     ($sysname, $nodename, $release, $version, $machine) =
> >>     
> >>       POSIX::uname();
> >> 
> >> Note that the actual meanings of the various fields are not that well
> >> standardized, do not expect any great portability. The $sysname might be
> >> the name of the operating system, the $nodename might be the name of the
> >> host, the $release might be the (major) release number of the operating
> >> system, the $version might be the (minor) release number of the
> >> operating system, and the $machine might be a hardware identifier.
> >> Maybe.
> > 
> > Only the second field ($nodename) is used. It may or may not be a FQDN -
> > if it isn't, a warning with an advice is produced on startup.
> > 
> > If hostname(1) produces a more sensible result, one can place a:
> >   $myhostname=qx(hostname -f); chomp $myhostname;
> > 
> > into amavisd.conf.
> 
> That's what I've ended up doing.  The default behavior will fail on any
> Debian/Ubuntu type of system, since they set it to the shortname.

And amavis provides a nice error message in this case which is patched in 
Debian/Ubuntu to provide the exact config file to modify to resolve this with 
the distro config file arrangement:

diff -urNad pkg-amavisd~/amavisd pkg-amavisd/amavisd
--- pkg-amavisd~/amavisd        2008-06-29 02:37:58.000000000 +0200
+++ pkg-amavisd/amavisd 2008-07-24 20:55:51.000000000 +0200
@@ -12962,7 +12962,8 @@
   The value of variable \$myhostname is \"$myhn\", but should have been
   a fully qualified domain name; perhaps uname(3) did not provide such.
   You must explicitly assign a FQDN of this host to variable \$myhostname
-  in amavisd.conf, or fix what uname(3) provides as a host's network name!
+  in /etc/amavis/conf.d/05-node_id, or fix what uname(3) provides as a host's
+  network name!
 EOD

This should be sufficient I believe.

Scott K


More information about the amavis-users mailing list