Is 1.940 handling hostnames differently?

I’ve been busy for a few months and had gotten behind on updates. Fully updated a couple of my Debian 9 machines’ operating systems and Virtualmin/Webmin GPL files a few days ago.

I notice on the Virtualmin dashboard/system info page that the System hostname now only shows the actual hostname whereas it used to show the fqdn.

This seems to have manifested itself as an issue when sending the completion email following a scheduled backup. The email is now generating a sender as <root@foo.> rather than <root@foo.domain.tld> as before the upgrade to 1.940. Needless to say, the receiving MTA doesn’t like the change much.

At the command line:
# hostname
# hostname -A
# cat /etc/hosts localhost.localdomain localhost foo.domain.tld foo


By default Webmin tries to extract and display FQDN.

What is the hostname set to in Webmin/Networking/Network Configuration/Hostname and DNS Client?

The hostname says ‘foo’ (the hostname). I have a couple of Webmin servers that I have not yet upgraded and do not have this issue. They have the same setting, only showing the hostname.

Sorry, I just realised the From being generated is <webmin@foo>, not root@…

Here are a couple of logs showing before and after the upgrade. And I should note, I was a couple of versions down, so this may have been a problem in a version prior to 1.940.

/var/log/mail.log.1.gz:Jan  9 00:09:55 foo postfix/cleanup[29843]: 28093203B0: warning: header Subject: Completed backup of Virtualmin on foo.domain.tld to /var/backups/remote/vsites/foo/2020-01-09 on SSH server bkp.domain.tld from local; from=<webmin@foo.domain.tld> to=<admin@domain.tld>
/var/log/mail.log.1.gz:Jan 10 00:03:49 foo postfix/cleanup[20471]: 395A2201AD: warning: header Subject: Completed backup of Virtualmin on foo. to /var/backups/remote/vsites/foo/2020-01-10 on SSH server bkp.domain.tld from local; from=<webmin@foo> to=<admin@domain.tld>

Just tried 1.941 on one of my other servers. Same issue.

edit: Tried some downgrades. Looks like the issue was introduced in 1.910.

Did some more poking around. Looks like the following code was introduced to the get_system_hostname() function in in 1.910. If I comment it out, the fqdn and IP address returns to the dashboard. Haven’t tested the backup email as yet. Either way, it looks like I have a workaround for now. Hopefully someone can have a look at why this doesn’t work on Debian.

           # Append domain name from DNS config if needed
           if ($fromfile && $fromfile !~ /\./) {
                   my $lref = &read_file_lines("/etc/resolv.conf", 1);
                   foreach my $l (@$lref) {
                           if ($l =~ /^(search|domain)\s+(\S+)/) {
                                   $dname = $2;
                   $fromfile .= ".".$dname;

Yes me too, just checked user emails for and see that mail started to fail in July 2019.

Not sure which system emails they were though.

Edit: this is on CentOS Linux 7.7.1908

Final update: commenting out that code block has also fixed the email sending issue.

It’s curious that a code block that says it is for appending a domian name was actually stripping it? Shame I’m rubbish at Perl, but it looks to be checking for the domain or search parameters in /etc/resolv.conf to set the domain. I don’t remember Webmin ever setting those, and I rarely do. The VPS providers I use often configure the /etc/resolv.conf in their OS install images with Google’s DNS, and short of adding a ‘nameserver’ line, there’s usually no other changes. Surely this method of getting the fqdn is fragile?