From 7cf47a389edecc6c05590468a10b6aa916881cc5 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Wed, 25 Dec 2024 22:01:13 -0600 Subject: ddclient: T6981: Remove defunct googledomains Since googledomains (domains.google.com) has been shut down, we need to remove any configuration path that refers to googledomains. 1. Remove 'googledomains' as the default web resolver in ddclient.conf.j2 2. Apply migration to remove googledomains from dynamic DNS service configurations. The migration is also necessary to undo a previous migration where we added 'googledomains' as default web resolver to work around lack of tls (ssl) support with default web resolver 'dyndns' (checkip.dyndns.org) in ddclient v3.x. --- interface-definitions/include/version/dns-dynamic-version.xml.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'interface-definitions') diff --git a/interface-definitions/include/version/dns-dynamic-version.xml.i b/interface-definitions/include/version/dns-dynamic-version.xml.i index 346385ccb..98123035d 100644 --- a/interface-definitions/include/version/dns-dynamic-version.xml.i +++ b/interface-definitions/include/version/dns-dynamic-version.xml.i @@ -1,3 +1,3 @@ - + -- cgit v1.2.3 From 381869d06314bbe98c8f29f37548fd729cb58262 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Mon, 30 Dec 2024 19:01:53 -0600 Subject: ddclient: T6981: Enable support for porkbun In ddclient, 'porkbun' protocol uses properties that are different from the ones used by VyOS configuration. Support for 'porkbun' is enabled by adding the necessary property remaping before applying them to the template to render the final ddclient config. --- data/templates/dns-dynamic/ddclient.conf.j2 | 11 +++++++---- interface-definitions/service_dns_dynamic.xml.in | 4 ++-- src/completion/list_ddclient_protocols.sh | 2 +- src/conf_mode/service_dns_dynamic.py | 16 +++++++++++++--- src/validators/ddclient-protocol | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) (limited to 'interface-definitions') diff --git a/data/templates/dns-dynamic/ddclient.conf.j2 b/data/templates/dns-dynamic/ddclient.conf.j2 index fd50a529d..41aae729e 100644 --- a/data/templates/dns-dynamic/ddclient.conf.j2 +++ b/data/templates/dns-dynamic/ddclient.conf.j2 @@ -15,7 +15,7 @@ if{{ ipv }}={{ address }}, \ {% endfor %} {# Other service options with special treatment for password #} {% for k,v in kwargs.items() if v is vyos_defined %} -{{ k | replace('_', '-') }}={{ "'%s'" % (v) if k == 'password' else v }}{{ ',' if not loop.last }} \ +{{ k | replace('_', '-') }}={{ "'%s'" % (v) if k in ['password', 'secretapikey'] else v }}{{ ',' if not loop.last }} \ {% endfor %} {# Actual hostname for the service #} {{ host }} @@ -38,9 +38,12 @@ if{{ ipv }}={{ address }}, \ # Web service dynamic DNS configuration for {{ service }}: [{{ config.protocol }}, {{ host }}] {{ render_config(host, address, web_options, ip_suffixes, - protocol=config.protocol, server=config.server, zone=config.zone, - login=config.username, password=config.password, ttl=config.ttl, - min_interval=config.wait_time, max_interval=config.expiry_time) }} + protocol=config.protocol, server=config.server, + zone=config.zone, root_domain=config.root_domain, + login=config.username, apikey=config.apikey, + password=config.password, secretapikey=config.secretapikey, + ttl=config.ttl, min_interval=config.wait_time, + max_interval=config.expiry_time) }} {% endfor %} {% endfor %} {% endif %} diff --git a/interface-definitions/service_dns_dynamic.xml.in b/interface-definitions/service_dns_dynamic.xml.in index 99103ec73..e352f88e4 100644 --- a/interface-definitions/service_dns_dynamic.xml.in +++ b/interface-definitions/service_dns_dynamic.xml.in @@ -123,10 +123,10 @@ - DNS zone to be updated + DNS zone or root domain to be updated txt - Name of DNS zone + Name of DNS zone or root domain diff --git a/src/completion/list_ddclient_protocols.sh b/src/completion/list_ddclient_protocols.sh index 0e66b006a..d92239270 100755 --- a/src/completion/list_ddclient_protocols.sh +++ b/src/completion/list_ddclient_protocols.sh @@ -14,4 +14,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -echo -n $(ddclient --list-protocols | grep -vE 'cloudns|directnic|emailonly|porkbun') +echo -n $(ddclient --list-protocols | grep -vE 'cloudns|directnic|emailonly') diff --git a/src/conf_mode/service_dns_dynamic.py b/src/conf_mode/service_dns_dynamic.py index 167c67a6a..27b7e0690 100755 --- a/src/conf_mode/service_dns_dynamic.py +++ b/src/conf_mode/service_dns_dynamic.py @@ -35,7 +35,7 @@ systemd_override = r'/run/systemd/system/ddclient.service.d/override.conf' # Protocols that require zone zone_necessary = ['cloudflare', 'digitalocean', 'godaddy', 'hetzner', 'gandi', 'nfsn', 'nsupdate'] -zone_supported = zone_necessary + ['dnsexit2', 'zoneedit1'] +zone_supported = zone_necessary + ['dnsexit2', 'porkbun', 'zoneedit1'] # Protocols that do not require username username_unnecessary = ['1984', 'cloudflare', 'cloudns', 'ddns.fm', 'digitalocean', @@ -44,14 +44,14 @@ username_unnecessary = ['1984', 'cloudflare', 'cloudns', 'ddns.fm', 'digitalocea # Protocols that support TTL ttl_supported = ['cloudflare', 'dnsexit2', 'gandi', 'hetzner', 'godaddy', 'nfsn', - 'nsupdate'] + 'nsupdate', 'porkbun'] # Protocols that support both IPv4 and IPv6 dualstack_supported = ['cloudflare', 'ddns.fm', 'digitalocean', 'dnsexit2', 'domeneshop', 'duckdns', 'dyndns2', 'easydns', 'freedns', 'gandi', 'godaddy', 'he.net', 'hetzner', 'infomaniak', 'inwx', 'mythicdyn', 'njalla', 'noip', 'nsupdate', - 'regfishde'] + 'porkbun', 'regfishde'] # dyndns2 protocol in ddclient honors dual stack for selective servers # because of the way it is implemented in ddclient @@ -166,6 +166,16 @@ def generate(dyndns): if dyndns['name'][name]['protocol'] == 'nsupdate': dyndns['name'][name]['password'] = dyndns['name'][name].pop('key') + # porkbun uses: + # - 'root-domain' in ddclient.conf instead of 'zone' in vyos conf + # - 'apikey' in ddclient.conf instead of 'username' in vyos conf + # - 'secretapikey' in ddclient.conf instead of 'password' in vyos conf + if dyndns['name'][name]['protocol'] == 'porkbun': + dyndns['name'][name]['apikey'] = dyndns['name'][name].pop('username') + dyndns['name'][name]['secretapikey'] = dyndns['name'][name].pop('password') + if 'zone' in dyndns['name'][name]: + dyndns['name'][name]['root_domain'] = dyndns['name'][name].pop('zone') + render(config_file, 'dns-dynamic/ddclient.conf.j2', dyndns, permission=0o600) render(systemd_override, 'dns-dynamic/override.conf.j2', dyndns) return None diff --git a/src/validators/ddclient-protocol b/src/validators/ddclient-protocol index 217853939..bcb2ab8ed 100755 --- a/src/validators/ddclient-protocol +++ b/src/validators/ddclient-protocol @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -ddclient --list-protocols | grep -vE 'cloudns|directnic|emailonly|porkbun' | grep -qw $1 +ddclient --list-protocols | grep -vE 'cloudns|directnic|emailonly' | grep -qw $1 if [ $? -gt 0 ]; then echo "Error: $1 is not a valid protocol, please choose from the supported list of protocols" -- cgit v1.2.3