dns/ddclient - work in progress, replacement for dyndns using ddclient package

This commit is contained in:
Ad Schellevis
2022-01-02 16:45:15 +01:00
parent 142ea68c06
commit 62a13562c9
6 changed files with 74 additions and 9 deletions
@@ -23,6 +23,13 @@
<type>password</type>
<help>Password associated with this account</help>
</field>
<field>
<id>account.wildcard</id>
<label>Wildcard</label>
<type>checkbox</type>
<style>optional_setting service_dyndns2 service_easydns</style>
<help>add a DNS wildcard CNAME record that points to the configured host.</help>
</field>
<field>
<id>account.hostnames</id>
<label>Hostname(s)</label>
@@ -5,6 +5,19 @@
<type>checkbox</type>
<help>Enable ddclient</help>
</field>
<field>
<id>ddclient.general.verbose</id>
<label>Verbose</label>
<type>checkbox</type>
<advanced>true</advanced>
<help>Enable verbose logging</help>
</field>
<field>
<id>ddclient.general.daemon_delay</id>
<label>Interval</label>
<type>text</type>
<help>Interval in seconds to check for address changes</help>
</field>
<field>
<id>ddclient.general.checkip</id>
<label>Check ip method</label>
@@ -10,6 +10,16 @@
<default>1</default>
<Required>Y</Required>
</enabled>
<verbose type="BooleanField">
<default>0</default>
<Required>Y</Required>
</verbose>
<daemon_delay type="IntegerField">
<default>300</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>86400</MaximumValue>
</daemon_delay>
<checkip type="OptionField">
<Required>Y</Required>
<default>web_dyndns</default>
@@ -28,7 +38,7 @@
<web_noip_ipv4 value="web_noip-ipv4">noip-ipv4</web_noip_ipv4>
<web_noip_ipv6 value="web_noip-ipv6">noip-ipv6</web_noip_ipv6>
<web_nsupdate_info_ipv4 value="web_nsupdate.info-ipv4">nsupdate.info-ipv4</web_nsupdate_info_ipv4>
<web_nsupdate_info_ipv6 value="web_nsupdate.info-ipv6">nsupdate.info-ipv4</web_nsupdate_info_ipv6>
<web_nsupdate_info_ipv6 value="web_nsupdate.info-ipv6">nsupdate.info-ipv6</web_nsupdate_info_ipv6>
<web_zoneedit>zoneedit</web_zoneedit>
</OptionValues>
</checkip>
@@ -43,9 +53,18 @@
<Required>Y</Required>
<ValidationMessage>A service type is required.</ValidationMessage>
<OptionValues>
<changeip>Changeip</changeip>
<dyndns2>DynDNS.com</dyndns2>
<dnspark>DnsPark</dnspark>
<dslreports1>DslReports</dslreports1>
<duckdns>DuckDNS</duckdns>
<easydns>EasyDNS</easydns>
<googledomains>Google</googledomains>
<namecheap>NameCheap</namecheap>
<noip>Noip</noip>
<nsupdatev4>nsupdate (IPv4)</nsupdatev4>
<nsupdatev6>nsupdate (IPv6)</nsupdatev6>
<nsupdatev4>nsupdate.info (IPv4)</nsupdatev4>
<nsupdatev6>nsupdate.info (IPv6)</nsupdatev6>
<zoneedit1>Zoneedit</zoneedit1>
</OptionValues>
</service>
<username type="TextField">
@@ -63,6 +82,10 @@
<AsList>Y</AsList>
<FieldSeparator>,</FieldSeparator>
</hostnames>
<wildcard type="BooleanField">
<default>0</default>
<Required>Y</Required>
</wildcard>
<description type="TextField">
<Required>N</Required>
<mask>/^([\t\n\v\f\r 0-9a-zA-Z.,_\x{00A0}-\x{FFFF}]){1,255}$/u</mask>
@@ -1,7 +1,7 @@
<menu>
<Services>
<DynamicDNS VisibleName="Dynamic DNS" cssClass="fa fa-tags fa-fw">
<settings order="10" url="/ui/dyndns/"/>
<Settings order="10" url="/ui/dyndns/"/>
<log order="100" VisibleName="Log File" url="/ui/diagnostics/log/core/ddclient"/>
</DynamicDNS>
</Services>
@@ -54,6 +54,22 @@ POSSIBILITY OF SUCH DAMAGE.
return dfObj;
}
});
$('#DialogAccount').on('shown.bs.modal', function (e) {
$("#account\\.service").change(function(){
let service = $(this).val();
$(".optional_setting").each(function(){
let this_item = $(this);
if (this_item.hasClass("service_"+service)) {
this_item.prop( "disabled", false );
this_item.closest("tr").show();
} else {
this_item.closest("tr").hide();
this_item.prop( "disabled", true );
}
});
});
$("#account\\.service").change();
});
});
</script>
@@ -1,6 +1,9 @@
daemon=300 # check every 300 seconds
daemon={{OPNsense.DynDNS.general.daemon_delay|default('300')}}
syslog=yes # log update msgs to syslog
pid=/var/run/ddclient.pid # record PID in file.
{% if not helpers.empty('OPNsense.DynDNS.general.verbose') %}
verbose=yes
{% endif %}
#
# setup how we expect to retrieve an IP address
@@ -43,10 +46,7 @@ use=web, web=http://dynamic.zoneedit.com/checkip.html
{% if helpers.exists('OPNsense.DynDNS.accounts.account') %}
{% for account in helpers.toList('OPNsense.DynDNS.accounts.account') %}
{% if account.enabled|default('0') == '1' %}
{% if account.service == 'noip' %}
protocol=noip
ssl=yes
{% elif account.service == 'nsupdatev4' %}
{% if account.service == 'nsupdatev4' %}
protocol=dyndns2
ssl=yes
server=ipv4.nsupdate.info
@@ -54,7 +54,13 @@ server=ipv4.nsupdate.info
protocol=dyndns2
ssl=yes
server=ipv6.nsupdate.info
{% else %}
protocol={{account.service}}
ssl=yes
{% endif %}
{% if account.wildcard|default('0') == '1' %}
wildcard=yes
{% endif}
login={{account.username}}
password={{account.password}}
{{account.hostnames}}