From 584f62126033b131308992338c7783ece0a09a81 Mon Sep 17 00:00:00 2001 From: "A. Schippers" Date: Fri, 28 Feb 2020 22:23:19 +0100 Subject: [PATCH] more python like string replacments --- management/dns_update.py | 5 ++--- setup/web.sh | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index d3ec1464..04d156aa 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -308,12 +308,11 @@ def build_zone(domain, all_domains, additional_records, www_redirect_domains, en mta_sts_records = [ ("mta-sts", "A", env["PUBLIC_IP"], "Provides MTA-STS support"), ("mta-sts", "AAAA", env.get('PUBLIC_IPV6'), "Provides MTA-STS support"), - ("_mta-sts", "TXT", "v=STSv1; id="+datetime.datetime.now().strftime("%Y%m%d%H%M%S")+"Z", "Enables MTA-STS support") + ("_mta-sts", "TXT", "v=STSv1; id=%sZ" % datetime.datetime.now().strftime("%Y%m%d%H%M%S"), "Enables MTA-STS support") ] - # Skip if the user has set a custom _smtp._tls record. if not has_rec("_smtp._tls", "TXT", prefix="v=TLSRPTv1;"): - mta_sts_records.append(("_smtp._tls", "TXT", "v=TLSRPTv1;", "change to a custom record like 'v=TLSRPTv1; rua=mailto:email@address' for reporting")) + mta_sts_records.append(("_smtp._tls", "TXT", "v=TLSRPTv1;", "For reporting, add an mail alias, for example 'tlsrpt@%s' and a custom TXT record like 'v=TLSRPTv1; rua=mailto:tlsrpt@%s' for reporting" % (env["PRIMARY_HOSTNAME"], env["PRIMARY_HOSTNAME"]) )) for qname, rtype, value, explanation in mta_sts_records: if value is None or value.strip() == "": continue # skip IPV6 if not set diff --git a/setup/web.sh b/setup/web.sh index 9824f2e0..da0c44d9 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -125,8 +125,7 @@ chmod a+r /var/lib/mailinabox/mozilla-autoconfig.xml # Create a generic mta-sts.txt file which is exposed via the # nginx configuration at /.well-known/mta-sts.txt # more documentation is available on: -# https://www.digitalocean.com/community/tutorials/how-to-configure-mta-sts-and-tls-reporting-for-your-domain-using-apache-on-ubuntu-18-04 - +# https://www.uriports.com/blog/mta-sts-explained/ cat conf/mta-sts.txt \ | sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \ > /var/lib/mailinabox/mta-sts.txt