mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-20 02:52:11 +00:00
more python like string replacments
This commit is contained in:
parent
8d63505ba4
commit
584f621260
@ -308,12 +308,11 @@ def build_zone(domain, all_domains, additional_records, www_redirect_domains, en
|
|||||||
mta_sts_records = [
|
mta_sts_records = [
|
||||||
("mta-sts", "A", env["PUBLIC_IP"], "Provides MTA-STS support"),
|
("mta-sts", "A", env["PUBLIC_IP"], "Provides MTA-STS support"),
|
||||||
("mta-sts", "AAAA", env.get('PUBLIC_IPV6'), "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.
|
# Skip if the user has set a custom _smtp._tls record.
|
||||||
if not has_rec("_smtp._tls", "TXT", prefix="v=TLSRPTv1;"):
|
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:
|
for qname, rtype, value, explanation in mta_sts_records:
|
||||||
if value is None or value.strip() == "": continue # skip IPV6 if not set
|
if value is None or value.strip() == "": continue # skip IPV6 if not set
|
||||||
|
@ -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
|
# Create a generic mta-sts.txt file which is exposed via the
|
||||||
# nginx configuration at /.well-known/mta-sts.txt
|
# nginx configuration at /.well-known/mta-sts.txt
|
||||||
# more documentation is available on:
|
# 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 \
|
cat conf/mta-sts.txt \
|
||||||
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
|
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
|
||||||
> /var/lib/mailinabox/mta-sts.txt
|
> /var/lib/mailinabox/mta-sts.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user