summaryrefslogtreecommitdiff
path: root/src/conf_mode/dns_dynamic.py
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2023-09-21 21:35:18 -0500
committerIndrajit Raychaudhuri <irc@indrajit.com>2023-11-30 21:42:23 -0600
commitc545758552ababa069fc090ac50b79a69ad72457 (patch)
tree5b9a7ecab14665aa82fa3f688d1bbd9e45db1e8a /src/conf_mode/dns_dynamic.py
parentf24763c416a3726e1a20c76947c3cd6801a9d0f2 (diff)
downloadvyos-1x-c545758552ababa069fc090ac50b79a69ad72457.tar.gz
vyos-1x-c545758552ababa069fc090ac50b79a69ad72457.zip
ddclient: T5612: Enable TTL support for web-service based protocols
Enable TTL support for web-service based protocols in addition to RFC2136 based (nsupdate) protocol. Since TTL is not supported by all protocols, and thus cannot have a configuration default, the existing XML snippet `include/dns/time-to-live.xml.i` does not have common `<defaultValue>300</defaultValue>` anymore and is instead added explicitly whenever necessary.
Diffstat (limited to 'src/conf_mode/dns_dynamic.py')
-rwxr-xr-xsrc/conf_mode/dns_dynamic.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/dns_dynamic.py b/src/conf_mode/dns_dynamic.py
index 712889f68..2885f3e37 100755
--- a/src/conf_mode/dns_dynamic.py
+++ b/src/conf_mode/dns_dynamic.py
@@ -35,6 +35,9 @@ zone_allowed = ['cloudflare', 'godaddy', 'hetzner', 'gandi', 'nfsn']
# Protocols that do not require username
username_unnecessary = ['1984', 'cloudflare', 'cloudns', 'duckdns', 'freemyip', 'hetzner', 'keysystems', 'njalla']
+# Protocols that support TTL
+ttl_supported = ['cloudflare', 'gandi', 'hetzner', 'dnsexit', 'godaddy', 'nfsn']
+
# Protocols that support both IPv4 and IPv6
dualstack_supported = ['cloudflare', 'dyndns2', 'freedns', 'njalla']
@@ -93,6 +96,9 @@ def verify(dyndns):
if 'username' not in config:
raise ConfigError(f'"username" {error_msg}')
+ if config['protocol'] not in ttl_supported and 'ttl' in config:
+ raise ConfigError(f'"{config["protocol"]}" does not support "ttl"')
+
if config['ip_version'] == 'both':
if config['protocol'] not in dualstack_supported:
raise ConfigError(f'"{config["protocol"]}" does not support '