From 280eecf00a17da7b74922fe8b5d085742c8b4ae5 Mon Sep 17 00:00:00 2001 From: User1000001 Date: Sat, 17 Apr 2021 21:13:00 +0200 Subject: [PATCH] Added option to customize TTL in mailinabox.conf. --- management/dns_update.py | 8 ++++---- setup/start.sh | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index c595bc3b..b9995a9f 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -475,19 +475,19 @@ def write_nsd_zone(domain, zonefile, records, env, force): zone = """ $ORIGIN {domain}. -$TTL 86400 ; default time to live +$TTL {ttl} ; default time to live @ IN SOA ns1.{primary_domain}. hostmaster.{primary_domain}. ( __SERIAL__ ; serial number 7200 ; Refresh (secondary nameserver update interval) - 86400 ; Retry (when refresh fails, how often to try again) + {ttl} ; Retry (when refresh fails, how often to try again) 1209600 ; Expire (when refresh fails, how long secondary nameserver will keep records around anyway) - 86400 ; Negative TTL (how long negative responses are cached) + {ttl} ; Negative TTL (how long negative responses are cached) ) """ # Replace replacement strings. - zone = zone.format(domain=domain, primary_domain=env["PRIMARY_HOSTNAME"]) + zone = zone.format(domain=domain, primary_domain=env["PRIMARY_HOSTNAME"], ttl=env["TTL"]) # Add records. for subdomain, querytype, value, explanation in records: diff --git a/setup/start.sh b/setup/start.sh index cedc426d..272b929e 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -95,6 +95,7 @@ PUBLIC_IPV6=$PUBLIC_IPV6 PRIVATE_IP=$PRIVATE_IP PRIVATE_IPV6=$PRIVATE_IPV6 MTA_STS_MODE=${MTA_STS_MODE-} +TTL=${DEFAULT_TTL:-86400} EOF # Start service configuration.