From 280eecf00a17da7b74922fe8b5d085742c8b4ae5 Mon Sep 17 00:00:00 2001 From: User1000001 Date: Sat, 17 Apr 2021 21:13:00 +0200 Subject: [PATCH 1/5] 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. From 0c618d72da9106e796edf186dee1df3016d85ec9 Mon Sep 17 00:00:00 2001 From: User1000001 Date: Sun, 18 Apr 2021 20:42:16 +0200 Subject: [PATCH 2/5] added helper scripts to change the TTL --- tools/set_ttl_to_1_day.sh | 2 ++ tools/set_ttl_to_5_minutes.sh | 2 ++ 2 files changed, 4 insertions(+) create mode 100755 tools/set_ttl_to_1_day.sh create mode 100755 tools/set_ttl_to_5_minutes.sh 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_5_minutes.sh b/tools/set_ttl_to_5_minutes.sh new file mode 100755 index 00000000..312fb5e3 --- /dev/null +++ b/tools/set_ttl_to_5_minutes.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -i "s/^TTL=.*/TTL=1800/" /etc/mailinabox.conf \ No newline at end of file From 5a07ffd364072a122f1dc156f171cc350c2098cf Mon Sep 17 00:00:00 2001 From: User1000001 Date: Thu, 29 Apr 2021 20:40:28 +0200 Subject: [PATCH 3/5] Corrected script file name --- tools/set_ttl_to_30_minutes.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 tools/set_ttl_to_30_minutes.sh 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 From a4ea1f324382a02453e69935776b3575f1b89a73 Mon Sep 17 00:00:00 2001 From: User1000001 Date: Mon, 28 Jun 2021 20:20:35 +0200 Subject: [PATCH 4/5] Correcting time in 5 minute script. --- tools/set_ttl_to_5_minutes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/set_ttl_to_5_minutes.sh b/tools/set_ttl_to_5_minutes.sh index 312fb5e3..cd1baa2e 100755 --- a/tools/set_ttl_to_5_minutes.sh +++ b/tools/set_ttl_to_5_minutes.sh @@ -1,2 +1,2 @@ #!/bin/bash -sed -i "s/^TTL=.*/TTL=1800/" /etc/mailinabox.conf \ No newline at end of file +sed -i "s/^TTL=.*/TTL=300/" /etc/mailinabox.conf From f8407a04ac6c19045031630986c50615cab8bce8 Mon Sep 17 00:00:00 2001 From: User1000001 Date: Mon, 28 Jun 2021 21:39:23 +0200 Subject: [PATCH 5/5] Fixed retry value to 3600 --- 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 b9995a9f..16dc0010 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -480,7 +480,7 @@ $TTL {ttl} ; default time to live @ IN SOA ns1.{primary_domain}. hostmaster.{primary_domain}. ( __SERIAL__ ; serial number 7200 ; Refresh (secondary nameserver update interval) - {ttl} ; 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) {ttl} ; Negative TTL (how long negative responses are cached) )