From 9894a03b79511e12648256e92a9db70522b06a84 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 18 Aug 2023 13:45:47 +0200 Subject: [PATCH] dns/ddclient: add missing dynurl for cloudns; closes #3430 * Remove the "default" handling for backend: it was properly migrated and is required. It will make flipping to the native backend easier later. * Make the ddclient.conf file easier to read: global block, then one block for each account. * Adjust the templating to sprinke missing "\" at the end of the line and replace hardcoded values where we can easily use service.name. Switching back and forth between backends is a bit annoying as the other backend can break using the correct account data from the other one, because not all the services are shared equally between the two. Maybe long term it would be better to build a plugin variant for ddclient and dyndns so we could revive os-dyndns and just share the code in this one directory. The backend switch would then be carried out over which plugin is installed a bit similar to what WireGuard is doing. --- dns/ddclient/pkg-descr | 2 ++ .../templates/OPNsense/ddclient/ddclient.conf | 25 +++++++++---------- .../OPNsense/ddclient/ddclient_opn.rc.conf.d | 2 +- .../templates/OPNsense/ddclient/rc.conf.d | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dns/ddclient/pkg-descr b/dns/ddclient/pkg-descr index 6c11a2886..361b37624 100644 --- a/dns/ddclient/pkg-descr +++ b/dns/ddclient/pkg-descr @@ -11,6 +11,8 @@ Plugin Changelog * Add AWS Route53 and DuckDNS to native backend (contributed by Greg Glockner) * Fix JSON output with disabled trailing accounts and empty stats in AccountField * Rename Python-based "OPNsense" backend to "native" to prevent ambiguity +* Fix ClouDNS missing dynurl= parameter +* Clean up ddclient.conf template 1.14 diff --git a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf index 4ac621862..3229e9b56 100644 --- a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf +++ b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf @@ -4,10 +4,9 @@ pid=/var/run/ddclient.pid # record PID in file. {% if not helpers.empty('OPNsense.DynDNS.general.verbose') %} verbose=yes {% endif %} - {% set accounts = [] %} {% set force_ssl = [] %} -{% if helpers.exists('OPNsense.DynDNS.accounts.account') and OPNsense.DynDNS.general.backend|default('ddclient') == 'ddclient' %} +{% if helpers.exists('OPNsense.DynDNS.accounts.account') and OPNsense.DynDNS.general.backend == 'ddclient' %} {% for account in helpers.toList('OPNsense.DynDNS.accounts.account') %} {% if account.enabled|default('0') == '1' %} {% do accounts.append(account) %} @@ -20,8 +19,8 @@ verbose=yes {% if force_ssl %} ssl=yes {% endif %} - {% for account in accounts %} + {% if account.checkip == 'if' %} {% if not helpers.empty('OPNsense.DynDNS.general.allowipv6') %} usev6=ifv6, ifv6={{physical_interface(account.interface)}}, \ @@ -29,38 +28,39 @@ usev6=ifv6, ifv6={{physical_interface(account.interface)}}, \ usev4=ifv4, ifv4={{physical_interface(account.interface)}}, \ {% elif account.checkip.startswith('web_') %} {% if account.interface %} -use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -i {{physical_interface(account.interface)}} -t {{account.force_ssl}} -s {{account.checkip[4:]}} --timeout {{account.checkip_timeout|default('10')}}", +use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -i {{physical_interface(account.interface)}} -t {{account.force_ssl}} -s {{account.checkip[4:]}} --timeout {{account.checkip_timeout|default('10')}}", \ {% else %} -use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -t {{account.force_ssl}} -s {{account.checkip[4:]}} --timeout {{account.checkip_timeout|default('10')}}", +use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -t {{account.force_ssl}} -s {{account.checkip[4:]}} --timeout {{account.checkip_timeout|default('10')}}", \ {% endif %} {% endif %} {% if account.service == 'custom' %} protocol={{account.protocol}}, \ server={{account.server}}, \ {% elif account.service == 'cloudflare' %} -protocol=cloudflare, \ +protocol={{account.service}}, \ zone={{account.zone}}, \ +{% elif account.service == 'cloudns' %} +protocol={{account.service}}, \ +dynurl=https://ipv4.cloudns.net/api/dynamicURL/?q={{account.password}}, \ {% elif account.service == 'hosting1984' %} protocol=1984, \ {% elif account.service == 'godaddy' %} -protocol=godaddy, \ +protocol={{account.service}}, \ zone={{account.zone}}, \ {% elif account.service == 'hetzner' %} -protocol=hetzner, \ +protocol={{account.service}}, \ zone={{account.zone}}, \ -{% elif account.service == 'dnsmadeeasy' %} -protocol=dnsmadeeasy, \ {% elif account.service == 'dns-o-matic' %} protocol=dyndns2, \ server=updates.dnsomatic.com, \ {% elif account.service == 'freedns' %} -protocol=freedns, \ +protocol={{account.service}}, \ server=freedns.afraid.org, \ {% elif account.service == 'dynu' %} protocol=dyndns2, \ server=api.dynu.com, \ {% elif account.service == 'gandi' %} -protocol=gandi +protocol={{account.service}}, \ zone={{account.zone}}, \ {% elif account.service == 'he-net' %} protocol=dyndns2, \ @@ -103,5 +103,4 @@ login={{account.username}}, \ {% endif %} password={{account.password}} \ {{account.hostnames}} - {% endfor %} diff --git a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient_opn.rc.conf.d b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient_opn.rc.conf.d index 42ac2302c..df8079f83 100644 --- a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient_opn.rc.conf.d +++ b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient_opn.rc.conf.d @@ -1,4 +1,4 @@ -{% if not helpers.empty('OPNsense.DynDNS.general.enabled') and OPNsense.DynDNS.general.backend|default('ddclient') == 'opnsense' %} +{% if not helpers.empty('OPNsense.DynDNS.general.enabled') and OPNsense.DynDNS.general.backend == 'opnsense' %} ddclient_opn_enable="YES" {% else %} ddclient_opn_enable="NO" diff --git a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/rc.conf.d b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/rc.conf.d index 245334398..dae5683f0 100644 --- a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/rc.conf.d +++ b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/rc.conf.d @@ -1,4 +1,4 @@ -{% if not helpers.empty('OPNsense.DynDNS.general.enabled') and OPNsense.DynDNS.general.backend|default('ddclient') == 'ddclient' %} +{% if not helpers.empty('OPNsense.DynDNS.general.enabled') and OPNsense.DynDNS.general.backend == 'ddclient' %} ddclient_enable="YES" ddclient_flags="-daemon {{OPNsense.DynDNS.general.daemon_delay|default('300')}}" {% else %}