From 033ee4956d9ecab6967d64408356fa2c81a71ce3 Mon Sep 17 00:00:00 2001 From: John Olten Date: Sun, 5 Nov 2017 18:22:59 +0100 Subject: [PATCH 1/3] Add support for DNS wildcard --- management/dns_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/dns_update.py b/management/dns_update.py index b5daef2d..4f8e897a 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -16,7 +16,7 @@ from utils import shell, load_env_vars_from_file, safe_domain_name, sort_domains # This regular expression matches domain names according to RFCs, it also accepts fqdn with an leading dot, # as well as underscores which are allowed in domain names but not hostnames (i.e. allowed in # DNS but not in URLs), which are common in certain record types like for DKIM. -DOMAIN_RE = "^(?!\-)(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" +DOMAIN_RE = "^(?!\-)(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_*]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" def get_dns_domains(env): # Add all domain names in use by email users and mail aliases and ensure From f8216683b6b8c5f54653dfb5fb5d1c2ce5546b05 Mon Sep 17 00:00:00 2001 From: John Olten Date: Sun, 5 Nov 2017 20:11:23 +0100 Subject: [PATCH 2/3] stricter regex --- management/dns_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/dns_update.py b/management/dns_update.py index 4f8e897a..77991052 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -16,7 +16,7 @@ from utils import shell, load_env_vars_from_file, safe_domain_name, sort_domains # This regular expression matches domain names according to RFCs, it also accepts fqdn with an leading dot, # as well as underscores which are allowed in domain names but not hostnames (i.e. allowed in # DNS but not in URLs), which are common in certain record types like for DKIM. -DOMAIN_RE = "^(?!\-)(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_*]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" +DOMAIN_RE = "^(?!\-)(?:^[*][.])?(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" def get_dns_domains(env): # Add all domain names in use by email users and mail aliases and ensure From 9a51b00b633fe8e256a019c5871814746446183d Mon Sep 17 00:00:00 2001 From: John Olten Date: Mon, 6 Nov 2017 01:01:49 +0100 Subject: [PATCH 3/3] cleanup --- management/dns_update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index 77991052..52dbf38e 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -14,9 +14,9 @@ from utils import shell, load_env_vars_from_file, safe_domain_name, sort_domains # From https://stackoverflow.com/questions/3026957/how-to-validate-a-domain-name-using-regex-php/16491074#16491074 # This regular expression matches domain names according to RFCs, it also accepts fqdn with an leading dot, -# as well as underscores which are allowed in domain names but not hostnames (i.e. allowed in +# underscores, as well as asteriks which are allowed in domain names but not hostnames (i.e. allowed in # DNS but not in URLs), which are common in certain record types like for DKIM. -DOMAIN_RE = "^(?!\-)(?:^[*][.])?(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" +DOMAIN_RE = "^(?!\-)(?:[*][.])?(?:[a-zA-Z\d\-_]{0,62}[a-zA-Z\d_]\.){1,126}(?!\d+)[a-zA-Z\d_]{1,63}(\.?)$" def get_dns_domains(env): # Add all domain names in use by email users and mail aliases and ensure