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.
This commit is contained in:
Franco Fichtner
2023-08-18 13:49:26 +02:00
parent 9e9be78ee6
commit 9894a03b79
4 changed files with 16 additions and 15 deletions
+2
View File
@@ -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
@@ -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 %}
@@ -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"
@@ -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 %}