[pmg-devel] [PATCH pmg-api 1/1] fix #3712: strip trailing dot from searchdomain

Stoiko Ivanov s.ivanov at proxmox.com
Mon Nov 22 20:49:39 CET 2021


having a trailing '.' in the search domain is perfectly legal syntax
(for domain names in general). postfix refuses to use a fqdn with
trailing dot as hostname[0].

The restriction might be due to section 2.3.5 (Domain Names) of
RFC5321 (a top-level domain is a single string without any dots) [1]

[0] src/util/valid_hostname.c in the postfix source
[1] https://datatracker.ietf.org/doc/html/rfc5321#section-2.3.5

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/Config.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index cbcda6e..31f9c6f 100755
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1278,6 +1278,8 @@ sub get_host_dns_info {
     my $resolv = PVE::INotify::read_file('resolvconf');
 
     my $domain = $resolv->{search} // 'localdomain';
+    # postfix will not parse a hostname with trailing '.'
+    $domain =~ s/^(.*)\.$/$1/;
     $dnsinfo->{domain} = $domain;
 
     $dnsinfo->{fqdn} = "$nodename.$domain";
-- 
2.30.2





More information about the pmg-devel mailing list