Re: [exim] Primary_hostname - returns short name

Top Page
Delete this message
Reply to this message
Author: John Horne
Date:  
To: exim-users
Subject: Re: [exim] Primary_hostname - returns short name
On Thu, 2015-01-01 at 23:05 +0000, John Horne wrote:
>
> I have two servers, both are running CentOS 7 and Exim 4.84. However, on
> one server the 'primary_hostname' is being returned as the hosts FQDN
> whereas on the other server it is returning just the short name.
> I have checked on both servers that things such as '/etc/resolv.conf'
> and '/etc/hosts' are correct (and basically the same), and that 'uname
> -n' returns the short name as does 'hostname', and 'hostname -f' returns
> the FQDN (on both servers).
>

Ha! Typical isn't it that having sent this message I have now found the
answer.

It seems that the server returning just the short hostname had the
following entry in the '/etc/nsswitch.conf' file:

hosts: files dns myhostname

If I remove the 'myhostname' entry (which doesn't exist on the working
server), then Exim correctly resolves the servers FQDN.

I have no idea how come one server ended up with this entry and the
other did not. Or whether 'myhostname' is required. According to the man
page ('nss-myhostname') it is recommended that the entry is put last on
the line so that:

    ...any DNS or /etc/hosts based mapping takes precedence.


However, that does not seem to be happening (at least for Exim). Only by
removing the entry do I get the FQDN rather than the '/etc/hosts' or DNS
(FQDN) value being used when the entry is present.




John.

-- 
----------------------------------------------------
John Horne                   Tel: +44 (0)1752 587287
Plymouth University, UK