dns/ddclient: ssl=yes is only supported on a global level, since we moved the checkbos to account, the enforcement broke. This commit will explain the account vs global settin and adjusts the template to set ssl=yes on a global level. closes https://github.com/opnsense/plugins/issues/2894

This commit is contained in:
Ad Schellevis
2022-03-18 18:13:58 +01:00
parent abc8b4a832
commit 4fcedf7201
3 changed files with 80 additions and 67 deletions
+1
View File
@@ -1,5 +1,6 @@
PLUGIN_NAME= ddclient
PLUGIN_VERSION= 1.3
PLUGIN_REVISION= 1
PLUGIN_DEPENDS= ddclient
PLUGIN_COMMENT= Dynamic DNS client
PLUGIN_MAINTAINER= ad@opnsense.org
@@ -69,7 +69,8 @@
<id>account.force_ssl</id>
<label>Force SSL</label>
<type>checkbox</type>
<help>Force update using HTTPS</help>
<help>Force update using HTTPS, please note setting this option will enforce https updates on all accounts
as ddclient only supports SSL=yes on a global level (check check ip service may still use HTTP on other services)</help>
</field>
<field>
<id>account.interface</id>
@@ -5,76 +5,87 @@ 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') %}
{% for account in helpers.toList('OPNsense.DynDNS.accounts.account') %}
{% if account.enabled|default('0') == '1' %}
{% if account.checkip == 'if' %}
use=if, if={{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:]}}",
{% else %}
use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -t {{account.force_ssl}} -s {{account.checkip[4:]}}",
{% endif %}
{% do accounts.append(account) %}
{% if account.force_ssl|default('0') == '1' %}
{% do force_ssl.append(1) %}
{% endif %}
{% if account.service == 'custom' %}
protocol={{account.protocol}}, \
server={{account.server}}, \
{% elif account.service == 'cloudflare' %}
protocol=cloudflare, \
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, \
server=freedns.afraid.org, \
{% elif account.service == 'dynu' %}
protocol=dyndns2, \
server=api.dynu.com, \
{% elif account.service == 'he-net' %}
protocol=dyndns2, \
server=dyn.dns.he.net, \
{% elif account.service == 'he-net-tunnel' %}
protocol=dyndns2, \
server=ipv4.tunnelbroker.net, \
{% elif account.service == 'inwx' %}
protocol=dyndns2, \
server=dyndns.inwx.com, \
{% elif account.service == 'loopia' %}
protocol=dyndns2, \
server=dyndns.loopia.se, \
{% elif account.service == 'nsupdatev4' %}
protocol=dyndns2, \
server=ipv4.nsupdate.info, \
{% elif account.service == 'nsupdatev6' %}
protocol=dyndns2, \
server=ipv6.nsupdate.info, \
{% elif account.service == 'spdyn' %}
protocol=dyndns2, \
server=update.spdyn.de, \
{% elif account.service == 'strato' %}
protocol=dyndns2, \
server=dyndns.strato.com, \
{% elif account.service == 'ovh' %}
protocol=dyndns2, \
server=www.ovh.com, \
{% else %}
protocol={{account.service}}, \
{% endif %}
{% if account.wildcard|default('0') == '1' %}
wildcard=yes, \
{% endif %}
{% if account.username %}
login={{account.username}}, \
{% endif %}
password={{account.password}} \
{{account.hostnames}}
{% endif %}
{% endfor %}
{% endif %}
{% if force_ssl %}
ssl=yes
{% endif %}
{% for account in accounts %}
{% if account.checkip == 'if' %}
use=if, if={{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:]}}",
{% else %}
use=cmd, cmd="/usr/local/opnsense/scripts/ddclient/checkip -t {{account.force_ssl}} -s {{account.checkip[4:]}}",
{% endif %}
{% endif %}
{% if account.service == 'custom' %}
protocol={{account.protocol}}, \
server={{account.server}}, \
{% elif account.service == 'cloudflare' %}
protocol=cloudflare, \
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, \
server=freedns.afraid.org, \
{% elif account.service == 'dynu' %}
protocol=dyndns2, \
server=api.dynu.com, \
{% elif account.service == 'he-net' %}
protocol=dyndns2, \
server=dyn.dns.he.net, \
{% elif account.service == 'he-net-tunnel' %}
protocol=dyndns2, \
server=ipv4.tunnelbroker.net, \
{% elif account.service == 'inwx' %}
protocol=dyndns2, \
server=dyndns.inwx.com, \
{% elif account.service == 'loopia' %}
protocol=dyndns2, \
server=dyndns.loopia.se, \
{% elif account.service == 'nsupdatev4' %}
protocol=dyndns2, \
server=ipv4.nsupdate.info, \
{% elif account.service == 'nsupdatev6' %}
protocol=dyndns2, \
server=ipv6.nsupdate.info, \
{% elif account.service == 'spdyn' %}
protocol=dyndns2, \
server=update.spdyn.de, \
{% elif account.service == 'strato' %}
protocol=dyndns2, \
server=dyndns.strato.com, \
{% elif account.service == 'ovh' %}
protocol=dyndns2, \
server=www.ovh.com, \
{% else %}
protocol={{account.service}}, \
{% endif %}
{% if account.wildcard|default('0') == '1' %}
wildcard=yes, \
{% endif %}
{% if account.username %}
login={{account.username}}, \
{% endif %}
password={{account.password}} \
{{account.hostnames}}
{% endfor %}