diff --git a/management/dns_update.py b/management/dns_update.py index b79e266a..3b72c949 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -492,19 +492,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) + 3600 ; 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 bd743ac5..9c462ceb 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=${DEFAULT_MTA_STS_MODE:-enforce} +TTL=${DEFAULT_TTL:-86400} EOF # Start service configuration. diff --git a/tools/set_ttl_to_1_day.sh b/tools/set_ttl_to_1_day.sh new file mode 100755 index 00000000..639b437f --- /dev/null +++ b/tools/set_ttl_to_1_day.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -i "s/^TTL=.*/TTL=86400/" /etc/mailinabox.conf \ No newline at end of file diff --git a/tools/set_ttl_to_30_minutes.sh b/tools/set_ttl_to_30_minutes.sh new file mode 100755 index 00000000..312fb5e3 --- /dev/null +++ b/tools/set_ttl_to_30_minutes.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -i "s/^TTL=.*/TTL=1800/" /etc/mailinabox.conf \ No newline at end of file diff --git a/tools/set_ttl_to_5_minutes.sh b/tools/set_ttl_to_5_minutes.sh new file mode 100755 index 00000000..cd1baa2e --- /dev/null +++ b/tools/set_ttl_to_5_minutes.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -i "s/^TTL=.*/TTL=300/" /etc/mailinabox.conf