ddclient configurable checkip timeout (#3136)

* checkip configurable timeout
This commit is contained in:
Christian Schulze
2022-09-22 21:50:55 +10:00
committed by GitHub
parent adab25c3cd
commit 522a717300
4 changed files with 17 additions and 4 deletions
@@ -65,6 +65,12 @@
<type>dropdown</type>
<help>How to determine the address to use for this host</help>
</field>
<field>
<id>account.checkip_timeout</id>
<label>Check ip timeout</label>
<type>text</type>
<help>How long to wait before the checkip process times out</help>
</field>
<field>
<id>account.force_ssl</id>
<label>Force SSL</label>
@@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/DynDNS</mount>
<version>1.4.0</version>
<version>1.5.0</version>
<description>
Dynamic DNS client
</description>
@@ -126,6 +126,12 @@
<if>Interface</if>
</OptionValues>
</checkip>
<checkip_timeout type="IntegerField">
<default>10</default>
<Required>Y</Required>
<MinimumValue>10</MinimumValue>
<MaximumValue>60</MaximumValue>
</checkip_timeout>
<force_ssl type="BooleanField">
<default>1</default>
<Required>Y</Required>
@@ -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)
@@ -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' %}