111 Commits

Author SHA1 Message Date
Fabian Zimmermann
0201efd635 ddns-script: removes linefeed which causes 401 err
The linefeed at the end causes ovh-api to return 401 even if the
password is correct.

Fixes #27693

Signed-off-by: Fabian Zimmermann <dev.faz@gmail.com>
2025-10-24 09:13:50 +02:00
David Andreoletti
104aabdd5b ddns-scripts: fixed ovh dns record update
OVH changed its API to update DNS records. It now requires HTTP Basic
Authorization header. As such the default ddns-script method to update
the DNS record is failing. The fix is to move DNS record updates into
its own script/package.

Signed-off-by: David Andreoletti <david@andreoletti.net>
2025-10-07 16:32:37 +02:00
Dominic Greenberg
00310cf88b ddns-scripts-cloudflare: document API Token auth in comments
adjust comments documenting the already supported API Token auth
adjust comments with URLs that changed in the meantime
adjust comment regarding CF API documentation URL, points to the scripts relevant DNS section

Signed-off-by: Dominic Greenberg <daroel@riseup.net>
2025-10-06 08:08:38 +02:00
Paul Donald
1463d79bdf ddns-scripts: stash the next check time
Calculating the next check time based on the last update time is not
very accurate if the next check is a large multiple forwards from the
last update time because the cumulative sleeps and wake times are not
exact but best effort of the OS. Other factors including clock-drift
give rise to a larger time discrepancy the further the next update is in
the future.

Stash the next check time which should be quite accurate since it's
only one sleep instance away. This is also for use in the GUI.

Tested on 24.10.2

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-09-23 09:12:10 +02:00
Qian Suyao
65a9d7d450 ddns-scripts: fix getting IP address via web in get_current_ip()
Add back the regex searching for valid IP address when getting IP
address via web.

Fixes: 9cdd1a1660 ("ddns-scripts: refactor get_current_ip()")
Signed-off-by: Qian Suyao <qiansuyao@gmail.com>
2025-08-05 08:37:41 +02:00
Eric Leung
dadafe3ac9 ddns-scripts: (cloudflare) add support for custom zone ID and DNS record ID
User can (optionally) set zone_id and dns_record_id in param_opt.
This allows round robin DNS setup in Cloudflare.

Signed-off-by: Eric Leung <contact@ericleung.dev>
2025-07-09 09:48:00 +02:00
Shin Rag
e9c1321e8b ddns-scripts: add aliyun.com
Adds support for aliyun.com to the ddns-scripts package.

Signed-off-by: Shin Rag <zhdlcc@gmail.com>
2025-06-26 10:57:42 +02:00
Paul Donald
88dc8e8b88 ddns-scripts: refactor verify_proxy()
no calls to external utilities - use variable substitution.
no regex.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-25 15:40:21 +02:00
Paul Donald
38e02fbd57 ddns-scripts: drop split_FQDN()
The function is unused - it can be removed.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-25 15:40:21 +02:00
Paul Donald
9cdd1a1660 ddns-scripts: refactor get_current_ip()
Remove the awk based ifconfig output handling violence (omg) and instead
use the ip utility and its JSON output: this uses the available
system utility jsonfilter. Much cleaner and less brittle.

This fixes alias interface handling
Fixes issue #24922

Add dep 'ip' (iproute2: ip-tiny, ip-full)

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-25 15:40:21 +02:00
Paul Donald
727cdeff68 ddns-scripts: refactor verify_dns()
quote variables
coalesce error conditions
code reads more cleanly and less 'stabby'.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-25 15:40:21 +02:00
Paul Donald
b953ed23f7 ddns-scripts: refactor verify_host_port()
Leverage the resolveip utility - it does the same job that several
different resolvers do for a fraction of the resource usage. This...
to verify a host's connectivity.

resolveip dependency net delta: +2-3Kbytes

Also uses the ddns-scripts built-in 'timeout' function.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-06-25 15:40:21 +02:00
Liangbin Lian
150d88585b ddns-scripts: fix parsing of parameters for cloudflare.com
Compatible with domain without the `@` symbol, consistent with the previous.

Fixes 8c55d089 ("ddns-scripts: fix parsing of parameters for cloudflare.com")

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
2025-06-04 13:54:01 +02:00
Liangbin Lian
8c55d089cd ddns-scripts: fix parsing of parameters for cloudflare.com
There is an obvious bug here:
if we want to update example.com.example.com in zone example.com,
so `domain=example.com@example.com`, after parsing,
the `__HOST` will be `example.com`, not expected `example.com.example.com`.

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
2025-05-27 08:05:06 +02:00
Rikki Vizcarra
1de23c1c12 ddns-script: Change CURL call and redirect output in update_porkbun_v3
This also fixes: https://github.com/openwrt/packages/issues/26181

CURL funciton change was patterned on other ddns update scripts
that uses also JSON request/response payloads similar to
update_digitalocean_v2.sh: 15014f93e1/net/ddns-scripts/files/usr/lib/ddns/update_digitalocean_com_v2.sh (L29)
update_gcp_v1.sh: 15014f93e1/net/ddns-scripts/files/usr/lib/ddns/update_gcp_v1.sh (L212)

rebased and bumbped ddns-script version

Signed-off-by: Rikki Vizcarra <rikki.vizcarra@gmail.com>
2025-04-20 22:10:44 +02:00
Paul Donald
9f3d6fed24 ddns-scripts: fix daemon to reload instead of kill
Instead of just killing all the processes, let's actually reload them,
since that's what the user would expect when issuing a 'reload' command.

Move the killall portion to a kill function

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-18 18:06:14 +02:00
Paul Donald
081f1856a5 ddns-scripts: fix daemon start - background the script
omitted the ampersand in the re-factor in commit
a361672882

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-18 18:06:14 +02:00
Paul Donald
5b277eb855 ddns-scripts: refactor get_uptime() and avoid cat in sub-shell
no sub-shell is spawned to get uptime.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
2bf1916a34 ddns-scripts: refactor load_all_config_options()
Same functionality - code reads less 'shouty' and 'stabby'.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
77933a45ea ddns-scripts: add stop action for individual sections
it is now possible to stop an individual instance, and not all of them.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
a361672882 ddns-scripts: refactor start_daemon_for_all_ddns_sections()
Removed redundant if else condition. updater is launched
with the same verbosity value anyway.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
99da7eded2 ddns-scripts: refactor stop_daemon_for_all_ddns_sections()
Same functionality - code reads less 'shouty' and 'stabby'.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
2ab29cc06c ddns-scripts: refactor stop_section_processes()
Now a single xargs calls instead of grepping ps output (unreliable).

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
91954f4b69 ddns-scripts: refactor update_url checks to avoid echo|grep sub-shells
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Paul Donald
6706a5bd78 ddns-scripts: variable quoting
in case spaces should creep into path names

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-10 09:34:38 +02:00
Florian Eckert
ea285eb460 ddns-scripts: always use the 'ps' output from busybox
The 'ps' command from 'procps-ng' is used in favour of 'ps' from 'busybox'
when 'procps-ng' is installed. The problem is that the outputs are not
compatible and the ‘grep’ is different for further processing. To fix this,
always use the 'ps' command from 'busybox'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 15:40:58 +02:00
Lars Kaiser
a7867016c8 ddns-scripts: add support for Scaleway DNS
Signed-off-by: Lars Kaiser <lars@kaiser.yt>
2025-04-01 08:57:10 +02:00
Lehua Zhang
bb4861efb1 ddns-scripts: Fixup huaweicloud
Script will exit when an error occurred.

Modify write_log 14 to write_log 4,
write_log 14 and write_log 4 can also print the same message,
but write_log 14 will exist script when printed.

Signed-off-by: Lehua Zhang <sxlehua@qq.com>
2025-03-04 10:32:34 +01:00
FriesI23 Qin
6e80b3ac66 ddns-script: fix retry_max_count for luadns-v1
Fix missed modification of ‘retry_count’ to ‘retry_max_count’
in commit ‘e3292e4c97’ (rename variable: s/retry_count/retry_max_count/).

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-02-13 13:31:53 +01:00
FriesI23 Qin
37cf5f0ce9 ddns-script: fix retry_max_count for godaddy-v1
Fix missed modification of ‘retry_count’ to ‘retry_max_count’
in commit ‘e3292e4c97’ (rename variable: s/retry_count/retry_max_count/).

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-02-13 13:31:53 +01:00
FriesI23 Qin
46b6f3dec8 ddns-script: fix retry_max_count for dnspod
Fix missed modification of ‘retry_count’ to ‘retry_max_count’
in commit ‘e3292e4c97’ (rename variable: s/retry_count/retry_max_count/).

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-02-13 13:31:53 +01:00
FriesI23 Qin
e10ddcfa09 ddns-script: fix retry_max_count for cloudflare-v4
Fix missed modification of ‘retry_count’ to ‘retry_max_count’
in commit ‘e3292e4c97’ (rename variable: s/retry_count/retry_max_count/).

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-02-13 13:31:53 +01:00
Adam Beck
1302e503a3 ddns-scripts: add type field for digitalocean API
DigitalOcean API requires a "type" JSON field to update a DNS
record. This adds that while checking for IPv6 to change which
record type to use. Without it, the API call fails, making
the script unable to update the DNS records for DigitalOcean.

Signed-off-by: Adam Beck <subcursion@gmail.com>
2025-02-04 16:27:16 +01:00
Coia Prant
9cd00fb191 ddns-scripts: get l3 device for bind network using curl
If pppoe is used for wan access. script set 'eth1' as interface for curl
call. The correct interface is however 'pppoe-wan'.

These scripts use 'network_get_physdev' function to get real device for
bind_network but this is wrong. We need instead the l3_device of the the
logical interface.

In case if we don't use pppoe connection - 'l3_device' is equal to real device.

Follow P/R:
 #14431

Signed-off-by: Coia Prant <coiaprant@gmail.com>
2025-01-24 12:57:45 +01:00
FriesI23 Qin
0dceb9d0f1 ddns-scripts: Fixup dnspod.cn-v3
Migrate retry_count to retry_max_count in the script to fix infinite retry loop.

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-01-22 11:21:46 +01:00
FriesI23 Qin
9d5da216c9 ddns-scripts: Fixup dnspod.cn-v3
Fix signature expiration issue during retries.

Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-01-22 11:21:46 +01:00
Gedalya Nie
0a98b6d0ed ddns-scripts: cloudflare: use PATCH method, minimize changes
Using the PUT method recreates the DNS record with and only with
the newly provided data. This seems unnecessary. In particular,
we don't need to hardcode a TTL of 120. Any existing comment
would be lost too.

The only detail we need to change is the IP address. Leave everything
else as it was.

Signed-off-by: Gedalya Nie <gedalya@gedalya.net>
2025-01-15 08:49:24 +01:00
FriesI23 Qin
c1f247d5c2 ddns-scripts: Add dnspod.cn-v3
Signed-off-by: FriesI23 Qin <FriesI23@outlook.com>
2025-01-10 14:38:13 +01:00
Xiaolong Zhang
b962029fa8 ddns-scripts: add colon char in DNS_CHARSET
The IPv6 address is separated by ':' instead of '.', so we need to add
':' in DNS_CHARSET.

See: 'https://github.com/openwrt/packages/issues/25051'

Fixes: #25051

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* bump PKG_RELEASE
* update commit message

Signed-off-by: Xiaolong Zhang <xliilQwQ@outlook.com>
2024-11-07 08:11:03 +01:00
Dillon Dixon
b3d9e90942 ddns-scripts: porkbun bugfix for subdomain on A/AAAA record
If the "name" parameter is not provided, then updates to a subdomain
A/AAAA record result in the subdomain being removed from the record.
This change always provides the "name" parameter to correct that behavior.

Signed-off-by: Dillon Dixon <github@dillon.io>
2024-10-30 10:37:49 +01:00
Lehua Zhang
9e86e22808 ddns-scripts: add ddns-scripts for huaweicloud
Signed-off-by: Lehua Zhang <sxlehua@qq.com>
2024-10-15 09:13:52 +02:00
Florian Eckert
d9cc0e1cd4 ddns-scripts: fix update_porkbun_v3 shell syntax
The closing bracket was forgotten in a function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-09-25 16:36:22 +02:00
Ansel Horn
5f5e6cd179 ddns-scripts: add support for Porkbun
Extends DDNS support for the Porkbun v3 JSON API with a custom update
script and service configuration.

See: https://porkbun.com/api/json/v3/documentation

Depends on cURL (with SSL) for transport. Porkbun authentication API keys
and secret keys are passed through the ddns-scripts "username" and
"password" variables, respectively. As Porkbun DNS is currently backed by
Cloudflare, also support ddns-scripts "rec_id" variable for specific
record targeting.

Signed-off-by: Ansel Horn <dev@cahorn.net>
2024-08-22 16:02:59 +02:00
Denis Shulyaka
ebeae334d9 ddns-scripts: Update knot resolver regexp
The output format of `khost` has changed. This commit fixes the regexp
for IPv4. It fixes the issue of using a custom DNS to resolve current
address.

```bash
root@localhost:~# khost ns2.afraid.org
ns2.afraid.org. has IPv4 address 69.65.50.223
ns2.afraid.org. has IPv6 address 2001:1850:1:5:800::6b
Host ns2.afraid.org. has no MX record
root@localhost:~# khost --version
khost (Knot DNS), version 3.3.5
```

Signed-off-by: Denis Shulyaka <Shulyaka@gmail.com>
2024-07-17 13:44:36 +03:00
Florian Eckert
c90ddcaddd ddns-scripts: do not verify DNS server on start
When the ddns update script is started, the system checks whether the
configured DNS server can be reached. This is checked with the 'netcat' tool.
The tool tries to establish a TCP connection on port 53 of the configured
DNS server.

The problem with this implementation is, that this call blocks the ddns
update script until 'netcat' returns from the call.

Verfification failed:
If the IP and the port cannot be reached, the netcat call returns
immediately.

Verfification successfull:
If the IP and the port of the DNS server can be reached, the connection
remains established and so the ddns update scripts blocks until the
configured TCP session timeout of the DNS server resets the connection.

The behavior in the event of an successfull verificataion is a problem
for the ddns update script if it is called via the hotplug. Since the ddns
update script runs too long! This blocking behavior also depends on
the TCP session timeout setting of the DNS server.

> time netcat 1.1.1.1 53
netcat 1.1.1.1 53  0.00s user 0.00s system 0% cpu 10.016 total

> time netcat 8.8.8.8 53
netcat 8.8.8.8 53  0.00s user 0.00s system 0% cpu 2.012 total

The TCP session timeout is for 1.1.1.1 10 seconds and for 8.8.8.8 2 seconds.

The '--wait' option of necat or the additional integration of the 'timeout'
function of busybox was implemented for this behavior. But the used '--wait'
function of netcat of the busybox shows no effect here.

Since the used implementation is not clean, the question arise why this
is necessary for the ddns update script at all? As the nslookup throws an
error anyway if it cannot resolve the IP. This check is only informative.
The check does not affect the script behavior.

The check is therefore removed on ddns update.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-05-17 12:39:19 +02:00
Miguel Angel Mulero Martinez
525182892b ddns-scripts: fix duplication of processes when reloading
When a "service ddns reload" is issued, the ddns processes are being
duplicated.
It seems the culprit is the -1 in the 'killall' command, and removing it
fixes the issue.
The -1 means to use SIGHUP, instead of the default SIGTERM.
In this case, the idea is to kill all other processes, so SIGTERM is
appropriate. In case the processes hang, SIGKILL may be another option.

Signed-off-by: Miguel Angel Mulero Martinez <migmul@gmail.com>
2024-05-14 21:18:58 +02:00
Max Berger
86a620f644 ddns-scripts: Fix Route53 provider
This fixes the Invalid Resource Record: FATAL problem: ARRDATAIllegalIPv4Address error message described in https://forum.openwrt.org/t/route53v1-script-error/160068

Maintainer: @chris5560, @maxberger, @dibdot
Tested: Checked on local system
Signed-off-by: Max Berger <max@berger.name>
2023-11-25 16:27:18 +01:00
Jihoon Han
79257dfb7c ddns-scripts: add support for LuaDNS
Signed-off-by: Jihoon Han <rapid_renard@renard.ga>
2023-01-09 18:26:29 +09:00
Cristian Le
ff099ea53c ddns-scripts: Allow setting root record for pdns script
Signed-off-by: Cristian Le <git@lecris.me>
2022-12-31 22:21:42 +01:00
Tianling Shen
f7b73bf000 Merge pull request #19982 from golddranks/master
ddns-scripts: update_gandi_net: improve logging & add timeout
2022-12-13 03:59:46 +08:00