On Wed, 2016-08-03 at 10:44 +0200, Marc Haber wrote: > On Wed, Aug 03, 2016 at 10:26:57AM +0200, Mauro Salvini wrote: > > > > > If uname() returns a single-component name, Exim calls gethostbyname() > > > > > (or getipnodebyname() where available) in an attempt to acquire a > > > > > fully qualified host name. > > > > > > > > > > Can you check what your gethostbyname/getipnodebyname returns? > > > > > > > hostname by uname(): myhostname > > > > hostname by gethostbyname(): myhostname.mydomain.local > > > > > > Hm. > > > > > > What does hostname --fqdn say? > > > > It says myhostname.mydomain.local > > Good. > > > > What does exim -bP | grep ^primary_hostname say? > > > > It says myhostname > > not good. > > > Checked /var/lib/exim4/config.autogenerated for primary_hostname: > > > > .ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME > > primary_hostname = MAIN_HARDCODE_PRIMARY_HOSTNAME > > .endif > > > > MAIN_HARDCODE_PRIMARY_HOSTNAME never defined > > So primary_hostname is set according to the docs > (/usr/share/doc/exim4-base/spec.txt.gz): > > $primary_hostname > > This variable contains the value set by primary_hostname in the > configuration file, or read by the uname() function. If uname() returns a > single-component name, Exim calls gethostbyname() (or getipnodebyname() > where available) in an attempt to acquire a fully qualified host name. See > also $smtp_active_hostname. > > The last sentence doesn't apply here. And we see that your > gethostbyname returns the host name just fine. > > What does getent hosts $IP for all your IP addresses say?
getent hosts 127.0.0.1 127.0.0.1 localhost getent hosts 127.0.1.1 127.0.1.1 myhostname.mydomain.local myhostname getent hosts 10.0.xx.xx # LAN address 10.0.xx.xx myhostname getent hosts 10.0.yy.yy # WIFI address, now off 10.0.yy.yy myhostname.mydomain.local Strange difference between last two IPs. If I enable WIFI and disconnect LAN, result is: getent hosts 10.0.xx.xx # LAN address, now off 10.0.xx.xx myhostname.mydomain.local getent hosts 10.0.yy.yy # WIFI address 10.0.yy.yy myhostname Seems to depend of /etc/nsswitch.conf hosts row items order, that is the default one: hosts: files myhostname mdns4_minimal [NOTFOUND=return] dns Moving dns in second position before myhostname, both addresses resolve to myhostname.mydomain.local, but exim -bP | grep ^primary_hostname stills report myhostname. > > > and 192.168.0.10 is your local IP address on the network? > > > > No , I obfuscate it, sorry. It actually is 10.0.xx.xx > > Same thing, a RFC 1918 address that is unlikely to have correct > reverse DNS. > > > > Is your "myhostname.mydomain.local" the literal host name? If so, are > > > you actually using the .local TLD or is that just obfuscated? Please > > > consider using a different TLD as .local may cause interference with > > > avahi (the .local TLD is reserved for use with mDNS). > > > > Yes, domain ends with .local (this name comes from IT&C office > > configuration). > > > > Just for a try, I changed /etc/hosts and /etc/mailname to have a .net > > TLD: > > - exim -bP | grep ^primary_hostname says > > myhostname > > Bad. > > > - exim -bt -d+all username says > > 10:13:17 5455 local_part=username domain=myhostname.mydomain.net > > 10:13:17 5455 checking domains > > 10:13:17 5455 myhostname.mydomain.net in "@:localhost"? no (end of > > list) > > Looks better, but why? Strangely, the process of qualifying the > address is not in the debug output, first thing I see of the username > is its already qualified form. Sorry, I didn't paste all the log but only the part regarding domains. Full log below. Thanks again to spend your time with me :-) Greetings Mauro 11:30:16 6760 Exim version 4.87 uid=0 gid=0 pid=6760 D=fffdffff Berkeley DB: Berkeley DB 5.3.28: (September 9, 2013) Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd Authenticators: cram_md5 plaintext Routers: accept dnslookup ipliteral manualroute queryprogram redirect Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp Fixed never_users: 0 Size of off_t: 8 Compiler: GCC [4.9.2] Library version: GnuTLS: Compile: 3.3.8 Runtime: 3.3.8 Library version: PCRE: Compile: 8.35 Runtime: 8.35 2014-04-04 11:30:16 6760 Total 13 lookups WHITELIST_D_MACROS: "OUTGOING" TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs" 11:30:16 6760 changed uid/gid: forcing real = effective 11:30:16 6760 uid=0 gid=0 pid=6760 11:30:16 6760 auxiliary group list: <none> 11:30:16 6760 seeking password data for user "uucp": cache not available 11:30:16 6760 getpwnam() succeeded uid=10 gid=10 11:30:16 6760 configuration file is /var/lib/exim4/config.autogenerated 11:30:16 6760 log selectors = 0000cffc 10732001 11:30:16 6760 trusted user 11:30:16 6760 admin user 11:30:16 6760 seeking password data for user "mail": cache not available 11:30:16 6760 getpwnam() succeeded uid=8 gid=8 11:30:16 6760 DSN: hubbed_hosts propagating DSN 11:30:16 6760 DSN: smarthost propagating DSN 11:30:16 6760 DSN: real_local propagating DSN 11:30:16 6760 DSN: system_aliases propagating DSN 11:30:16 6760 DSN: userforward propagating DSN 11:30:16 6760 DSN: procmail propagating DSN 11:30:16 6760 DSN: maildrop propagating DSN 11:30:16 6760 DSN: lowuid_aliases propagating DSN 11:30:16 6760 DSN: local_user propagating DSN 11:30:16 6760 DSN: mail4root propagating DSN 11:30:16 6760 expanding: $1 11:30:16 6760 result: root 11:30:16 6760 user name "root" extracted from gecos field "root" 11:30:16 6760 originator: uid=0 gid=0 login=root name=root 11:30:16 6760 sender address = r...@myhostname.mydomain.net 11:30:16 6760 Address testing: uid=0 gid=114 euid=0 egid=114 11:30:16 6760 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 11:30:16 6760 Testing usern...@myhostname.mydomain.net 11:30:16 6760 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 11:30:16 6760 Considering usern...@myhostname.mydomain.net 11:30:16 6760 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 11:30:16 6760 routing usern...@myhostname.mydomain.net 11:30:16 6760 --------> hubbed_hosts router <-------- 11:30:16 6760 local_part=username domain=myhostname.mydomain.net 11:30:16 6760 checking domains 11:30:16 6760 expanding: /etc/exim4/hubbed_hosts 11:30:16 6760 result: /etc/exim4/hubbed_hosts 11:30:16 6760 condition: exists{/etc/exim4/hubbed_hosts} 11:30:16 6760 result: false 11:30:16 6760 expanding: partial-lsearch;/etc/exim4/hubbed_hosts 11:30:16 6760 result: partial-lsearch;/etc/exim4/hubbed_hosts 11:30:16 6760 skipping: result is not used 11:30:16 6760 failed to expand: ${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail} 11:30:16 6760 error message: "if" failed and "fail" requested 11:30:16 6760 failure was forced 11:30:16 6760 expansion of "${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail}" forced failure: assume not in this list 11:30:16 6760 hubbed_hosts router skipped: domains mismatch 11:30:16 6760 --------> smarthost router <-------- 11:30:16 6760 local_part=username domain=myhostname.mydomain.net 11:30:16 6760 checking domains 11:30:16 6760 myhostname.mydomain.net in "@:localhost"? no (end of list) 11:30:16 6760 myhostname.mydomain.net in "! +local_domains"? yes (end of list) 11:30:16 6760 expanding: R: smarthost for $local_part@$domain 11:30:16 6760 result: R: smarthost for usern...@myhostname.mydomain.net 11:30:16 6760 R: smarthost for usern...@myhostname.mydomain.net 11:30:16 6760 calling smarthost router 11:30:16 6760 smarthost router called for usern...@myhostname.mydomain.net 11:30:16 6760 domain = myhostname.mydomain.net 11:30:16 6760 route_item = * mail.mydomain.it byname 11:30:16 6760 myhostname.mydomain.net in "*"? yes (matched "*") 11:30:16 6760 original list of hosts = "mail.mydomain.it" options = byname 11:30:16 6760 expanded list of hosts = "mail.mydomain.it" options = byname 11:30:16 6760 set transport remote_smtp_smarthost 11:30:16 6760 finding IP address for mail.mydomain.it 11:30:16 6760 calling host_find_byname 11:30:16 6760 gethostbyname2(af=inet6) returned 4 (NO_DATA) 11:30:16 6760 Configured local interface: address=127.0.0.1 11:30:16 6760 Configured local interface: address=::1 11:30:16 6760 fully qualified name = mail.mydomain.it 11:30:16 6760 gethostbyname2 looked up these IP addresses: 11:30:16 6760 name=mail.mydomain.it address=192.168.50.4 11:30:16 6760 queued for remote_smtp_smarthost transport: local_part = username 11:30:16 6760 domain = myhostname.mydomain.net 11:30:16 6760 errors_to=NULL 11:30:16 6760 domain_data=NULL localpart_data=NULL 11:30:16 6760 routed by smarthost router 11:30:16 6760 envelope to: usern...@myhostname.mydomain.net 11:30:16 6760 transport: remote_smtp_smarthost 11:30:16 6760 host mail.mydomain.it [192.168.50.4] usern...@myhostname.mydomain.net router = smarthost, transport = remote_smtp_smarthost host mail.mydomain.it [192.168.50.4] 11:30:16 6760 search_tidyup called 11:30:16 6760 >>>>>>>>>>>>>>>> Exim pid=6760 terminating with rc=0 >>>>>>>>>>>>>>>>