From 522a7173009a3f287c90906bf74d83d4e7945c21 Mon Sep 17 00:00:00 2001 From: Christian Schulze Date: Thu, 22 Sep 2022 21:50:55 +1000 Subject: [PATCH] ddclient configurable checkip timeout (#3136) * checkip configurable timeout --- .../controllers/OPNsense/DynDNS/forms/dialogAccount.xml | 6 ++++++ .../opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml | 8 +++++++- dns/ddclient/src/opnsense/scripts/ddclient/checkip | 3 ++- .../service/templates/OPNsense/ddclient/ddclient.conf | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dns/ddclient/src/opnsense/mvc/app/controllers/OPNsense/DynDNS/forms/dialogAccount.xml b/dns/ddclient/src/opnsense/mvc/app/controllers/OPNsense/DynDNS/forms/dialogAccount.xml index bb7e48fd4..873637452 100644 --- a/dns/ddclient/src/opnsense/mvc/app/controllers/OPNsense/DynDNS/forms/dialogAccount.xml +++ b/dns/ddclient/src/opnsense/mvc/app/controllers/OPNsense/DynDNS/forms/dialogAccount.xml @@ -65,6 +65,12 @@ dropdown How to determine the address to use for this host + + account.checkip_timeout + + text + How long to wait before the checkip process times out + account.force_ssl diff --git a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml index a010321c8..bcee85f31 100644 --- a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml +++ b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml @@ -1,6 +1,6 @@ //OPNsense/DynDNS - 1.4.0 + 1.5.0 Dynamic DNS client @@ -126,6 +126,12 @@ Interface + + 10 + Y + 10 + 60 + 1 Y diff --git a/dns/ddclient/src/opnsense/scripts/ddclient/checkip b/dns/ddclient/src/opnsense/scripts/ddclient/checkip index 19d665835..35e224405 100755 --- a/dns/ddclient/src/opnsense/scripts/ddclient/checkip +++ b/dns/ddclient/src/opnsense/scripts/ddclient/checkip @@ -70,10 +70,11 @@ if __name__ == '__main__': parser.add_argument('-s', '--service', help='service name', choices=service_list.keys(), required=True) parser.add_argument('-i', '--interface', help='interface', type=str, default='') parser.add_argument('-t', '--tls', help='enforce tls', choices=['0', '1'], default='0') + parser.add_argument('--timeout', help='timeout', type=str, default='10') inputargs = parser.parse_args() # use curl to fetch data, so we can optionally use "--interface" - params = ['/usr/local/bin/curl', '-m', '10'] + params = ['/usr/local/bin/curl', '-m', inputargs.timeout] if inputargs.interface.strip() != "": params.append("--interface") params.append(inputargs.interface) 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 8a6b263eb..89e6928cc 100644 --- a/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf +++ b/dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf @@ -29,9 +29,9 @@ ssl=yes 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:]}}", +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:]}}", +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' %}