Commit graph

677 commits

Author SHA1 Message Date
Richard Hansen
7bdb554e36 duckdns: Update multiple hosts simultaneously 2024-07-27 04:40:34 -04:00
Richard Hansen
1eccfb8c77 duckdns: Invert condition to improve readability 2024-07-27 04:40:34 -04:00
Richard Hansen
91fd9e3842 duckdns: Simplify response processing 2024-07-27 04:40:34 -04:00
Richard Hansen
971e88452d duckdns: Improve log messages 2024-07-27 04:40:34 -04:00
Richard Hansen
8a334fd9cf duckdns: Consolidate lines to improve readability 2024-07-27 04:40:34 -04:00
Richard Hansen
98ed129b20 duckdns: Whitespace fixes 2024-07-27 04:40:34 -04:00
Richard Hansen
b80fe1b505 duckdns: Delete unnecessary comments 2024-07-27 04:40:34 -04:00
Richard Hansen
459970c5e3 yandex: Check for presence of success, not lack of error
This is more resilient to bugs.
2024-07-27 04:40:34 -04:00
Richard Hansen
f807ba58ac yandex: Don't treat an error as success 2024-07-27 04:40:34 -04:00
Richard Hansen
58c6caa5ff nfsn: Include host in failure message 2024-07-27 04:40:34 -04:00
Richard Hansen
ef8bf634fe domeneshop: Add IPv6 support 2024-07-27 04:40:34 -04:00
Richard Hansen
61fff1c344 domeneshop: Inline an unnecessary variable 2024-07-27 04:40:34 -04:00
Richard Hansen
d391f41074 domeneshop: Treat all 2xx as success 2024-07-27 04:40:34 -04:00
Richard Hansen
b4e08ae3ae domeneshop: Improve log messages 2024-07-27 04:40:34 -04:00
Richard Hansen
231601ae54 domeneshop: Whitespace fixes 2024-07-27 04:40:34 -04:00
Richard Hansen
f0edd7f781 domeneshop: Delete unnecessary comments 2024-07-27 04:40:34 -04:00
Richard Hansen
2534375cfd dyndns1: Move else case up a level for readability 2024-07-27 04:40:34 -04:00
Richard Hansen
02c80fdf09 dslreports1: Move out else case to improve readability 2024-07-27 04:40:34 -04:00
Richard Hansen
95a10e2595 dslreports1: Log message improvements 2024-07-27 04:40:34 -04:00
Richard Hansen
2d60183e93 noip: Log message improvements 2024-07-27 04:40:34 -04:00
Richard Hansen
c0b28f344f noip: Simplify response processing 2024-07-27 04:40:34 -04:00
Richard Hansen
5b433c3cd5 noip: Delete redundant response check 2024-07-27 04:40:34 -04:00
Richard Hansen
27143db56e dnsexit2: Pass an arrayref of headers for readability 2024-07-27 04:40:34 -04:00
Richard Hansen
1c94ed6063 dnsexit2: Check for JSON object, not just truthiness 2024-07-27 04:40:34 -04:00
Richard Hansen
4a394f4562 dnsexit2: Delete rogue semicolon 2024-07-27 04:40:34 -04:00
Richard Hansen
56f0d931a4 dnsexit2: Delete redundant check
`header_ok` already checks whether the response is `undef`.
2024-07-27 04:40:34 -04:00
Richard Hansen
e5b00216ec dnsexit2: Log message improvements 2024-07-27 04:40:34 -04:00
Richard Hansen
073fe5a51d dnsexit2: Delete redundant HTTP status code check
`header_ok` already checks for non-2xx codes.
2024-07-27 04:40:34 -04:00
Richard Hansen
3d894364bf dnsexit2: Delete redundant debug message
`geturl` already debug logs the response.
2024-07-27 04:40:34 -04:00
Richard Hansen
2ac61250e5 dnsexit2: Fix compatibility with old versions of Perl
The non-destructive substitution modifier wasn't added until Perl
v5.14.0.
2024-07-27 04:40:34 -04:00
Richard Hansen
962abfbbc3 use=web, use=<fw>: Don't treat non-2xx results as successes 2024-07-27 04:40:34 -04:00
Richard Hansen
e272caa385 use=web, use=<fw>: Strip HTTP headers before searching for IP 2024-07-27 04:40:34 -04:00
Richard Hansen
08626482c3 header_ok: Don't assume that it is only used for host updates 2024-07-27 03:59:52 -04:00
Richard Hansen
d48b482269 geturl: Log message improvements 2024-07-27 03:59:52 -04:00
Richard Hansen
b1752c2622 logging: Delete unused msg function 2024-07-27 03:59:29 -04:00
Richard Hansen
6aa68f72a7 logging: Change multi-line log message designation style
Before, the first line of a multi-line log message was prefixed with a
space while all subsequent messages were prefixed with `|`.  Now the
first line is prefixed with `>` and all subsequent lines with a space.
This makes it easier to quickly discern message boundaries.
2024-07-27 03:47:47 -04:00
Richard Hansen
bd437a0abf nic_updateable: Log message improvements 2024-07-26 23:58:20 -04:00
Richard Hansen
8262f112ea nic_updateable: Read option value after loading config 2024-07-26 23:58:20 -04:00
Richard Hansen
1ad9b565bd nic_updateable: Don't warn about success
Why issue a warning that things have suddenly started going well?
It's bizarre.
2024-07-26 23:58:20 -04:00
Richard Hansen
1054e162fa query_cisco: Use host-specific option value 2024-07-26 23:50:14 -04:00
Richard Hansen
0392c5e725 query_cisco: Delete redundant warning
The same message is already logged in `get_ipv4`.
2024-07-26 23:50:14 -04:00
Richard Hansen
e891f53345 update_nics: Consistently use --opt instead of opt 2024-07-26 23:50:04 -04:00
Richard Hansen
5d68b11d78 get_ipv6: Factor out check for deprecated value 2024-07-26 23:50:04 -04:00
Richard Hansen
2530adb39e get_ip: Log message improvements 2024-07-26 23:50:04 -04:00
Richard Hansen
b9d372c12d get_ip: Allow $arg to be undefined
This is simpler, and makes it possible to distinguish unset from set
to an empty string.
2024-07-26 23:49:48 -04:00
Richard Hansen
0ea2f06513 get_ip: Don't mutate $arg
This makes log messages easier to understand.
2024-07-26 19:05:47 -04:00
Richard Hansen
ccc205301a Delete old test code
It's better to start a test HTTP server or override `@curl` from tests
in `t/*.pl`.
2024-07-26 19:05:47 -04:00
Richard Hansen
6ddecb4ecc Replace use vars with our
From the documentation for `vars`:

> NOTE: For use with variables in the current package for a single
> scope, the functionality provided by this pragma has been superseded
> by "our" declarations, available in Perl v5.6.0 or later, and use of
> this pragma is discouraged.
2024-07-26 19:05:47 -04:00
Richard Hansen
89d7193f69 nic_updateable: Simplify option changed detection logic 2024-07-26 18:15:21 -04:00
Richard Hansen
38a4e9eeef nic_updateable: Remove unnecessary force_update parameter
`nic_updateable` can look up the host's `force_update` function itself
so there's no need to pass it as an argument.
2024-07-26 17:24:49 -04:00
Richard Hansen
0ffffb1400 Delete unnecessary force_update => undef lines 2024-07-26 17:21:11 -04:00
Richard Hansen
5a8bee1e4d Delete unnecessary nic_dyndns2_force_update
The `nic_updateable` function already checks the variables to see if
they have changed, so this function is redundant.
2024-07-26 17:06:09 -04:00
Richard Hansen
2a9abc9d4c Delete unused nic_easydns_force_update function 2024-07-26 17:04:12 -04:00
jameskimmel
bcfdf70c34
delete unused zoneedit force update
I think this sub is never used.
2024-07-23 18:53:27 +02:00
Richard Hansen
9996c1b7d4 googledomains: Remove support for defunct service 2024-07-22 23:28:33 -04:00
Richard Hansen
ddfa8663ad woima: Remove support for defunct service 2024-07-22 23:26:41 -04:00
Richard Hansen
3c68abe551 easydns: Fix incorrect status value on success 2024-07-20 03:44:05 -04:00
Richard Hansen
a7feb95091 easydns: Add missing OK and NO_AUTH result codes 2024-07-20 03:44:05 -04:00
Richard Hansen
d8c74169ee easydns: Include the full ILLEGAL INPUT result code in log messages 2024-07-20 03:44:05 -04:00
Richard Hansen
a724084114 easydns: Fix extraction of result code from response body
The server returns a full HTML document, not just the result code.
Change equality check to a regex match that is resilient to
server-side changes.
2024-07-20 03:44:05 -04:00
Richard Hansen
435357ac50 easydns: Invert condition to improve readability 2024-07-20 03:44:04 -04:00
Richard Hansen
da26fe76e0 easydns: Update IPv4 and IPv6 separately
https://kb.easydns.com/knowledge/dynamic-dns/ doesn't say anything
about repeating the `myip` parameter, or that both IPv4 and IPv6
addresses can be included in the same `myip` parameter.

Unfortunately it also doesn't say whether updating the IPv4 address
alone will nuke the IPv6 AAAA record, or whether updating the IPv6
address alone will nuke the IPv4 A record (like Google Domains used to
do).  Here's hoping that the A and AAAA records are truly independent.
2024-07-20 03:44:04 -04:00
Richard Hansen
7a4b96e04e easydns: Delete incorrect handling of TOOSOON error
Before:
  * `$scale` was ignored causing it to set `wtime` to 5s in the
    future, which is too brief.  Fortunately, `min-error-interval`
    applied which prevented overly aggressive retries.
  * The lack of call to `failed` meant that `$result` was not set to
    "FAILED" and thus `mail-failure` recipients were not emailed.

Now `TOOSOON` is treated like any other error and will result in a
retry after `min-error-interval` (default: 5m).
2024-07-20 03:35:56 -04:00
Richard Hansen
fb990208b3 easydns: Consolidate lines for readability 2024-07-20 03:35:56 -04:00
Richard Hansen
6992a34028 easydns: Simplify response processing 2024-07-20 03:35:56 -04:00
Richard Hansen
7a2625b7a7 easydns: Refine log messages
* Consistently use just the hostname as the log message prefix.
  * Delete redundant verbose log message.
  * Log IPv4 and IPv6 separately in case `$ipv4` or `$ipv6` is
    `undef`.
  * Don't log the full line when a known error result is returned.
  * For unknown results, don't wrap the line in parentheses.
  * Use string interpolation for readability.
2024-07-20 03:35:56 -04:00
Richard Hansen
94c304601e easydns: Increase default min-interval to 10m 2024-07-20 03:35:56 -04:00
Richard Hansen
e7ad0e8e6e easydns: Whitespace fixes 2024-07-20 03:35:46 -04:00
Richard Hansen
3a57ca1374 Delete --geturl command-line argument and geturl option
They are not used in any tests, and `curl` is a better choice anyway.
2024-07-19 18:06:28 -04:00
Richard Hansen
12b2c0d03d godaddy: Inline some unnecessary variables 2024-07-19 16:21:37 -04:00
Richard Hansen
bdc69d879f geturl: Accept an arrayref for headers 2024-07-19 16:21:37 -04:00
Richard Hansen
b9144c01c2 godaddy: Use eq for string equality
`==` is for numeric equality.
2024-07-19 16:21:37 -04:00
Richard Hansen
4b2155a43c godaddy: Combine URL lines to improve readability
Also drop unnecessary curly braces for consistency.
2024-07-19 16:18:14 -04:00
Richard Hansen
6e98c0cdb2 godaddy: Invert conditional to improve readability 2024-07-19 16:17:50 -04:00
Richard Hansen
b1c0029604 godaddy: Simplify for loop 2024-07-19 16:17:49 -04:00
Richard Hansen
3258ea34c0 godaddy: Shorten variables for brevity and consistency 2024-07-19 16:17:19 -04:00
Richard Hansen
56f4a2afe2 godaddy: Don't bother setting status on error
It's initialized to a non-'good' value before the function is called,
and ddclient doesn't distinguish between different non-good values, so
it is sufficient to leave it alone.
2024-07-19 16:16:44 -04:00
Richard Hansen
e01ed55a58 godaddy: Simplify and improve error messages 2024-07-19 16:16:21 -04:00
Richard Hansen
c63eb0f060 godaddy: Fix dubious response body check
It doesn't make sense to continue processing if the response body
can't be parsed.  Maybe GoDaddy returned 200 and there's a bug in the
body parsing logic, in which case the `bad` result should actually be
`good`.  But it's better to assume that the update wasn't saved, in
case the server returns 200 with a JSON object that semantically means
"failed to update".
2024-07-19 16:15:37 -04:00
Richard Hansen
f82d2af0f2 godaddy: Whitespace fixes 2024-07-19 16:15:30 -04:00
Richard Hansen
53b373fc9e godaddy: Delete unnecessary comments 2024-07-19 16:08:41 -04:00
Starkstromkonsument
83ef1fa99a Add new protocol inwx
Adoption of protocol dyndns2 to support their custom URL:

'https://dyndns.inwx.com/nic/update?myip=<ipaddr>&myipv6=<ip6addr>'
2024-07-19 02:26:25 -04:00
Richard Hansen
30a7c5ad78 dyndns2: Delete obsolete custom and static options
<https://help.dyn.com/remote-access-api/perform-update/> says:

> We will accept these parameters without generating error messages:
>
>   * `system`, previously used to identify update type
2024-07-19 02:12:53 -04:00
Richard Hansen
26f57bf36a dyndns2: Delete obsolete(?) "wait" response handling 2024-07-19 01:33:02 -04:00
Richard Hansen
adfd68d5e0 dyndns2: Refine log messages 2024-07-18 05:42:49 -04:00
Richard Hansen
1e73f4a51a dyndns2: Wrap long list of group by attributes 2024-07-18 05:42:49 -04:00
Richard Hansen
90de2f9606 dyndns2: Improve readability of status parsing 2024-07-18 05:42:49 -04:00
Richard Hansen
88f140d470 dyndns2: Invert condition to improve readability 2024-07-18 05:42:48 -04:00
Richard Hansen
8a667e3f57 dyndns2: Treat nochg as good to eliminate duplicate code 2024-07-18 05:42:30 -04:00
Richard Hansen
db3472a7ce dyndns2: Simplify response parsing 2024-07-18 05:42:29 -04:00
Richard Hansen
0892655fd6 dyndns2: Add response handling TODO comments 2024-07-18 05:41:59 -04:00
Richard Hansen
d88e6438ef Revert "Merge pull request #702 from rhansen/dyndns2"
I misread the original code and introduced a bug.  This reverts the
entire PR so that I can redo it.

This reverts commit 9eff7404e3, reversing
changes made to 60f931e7da.
2024-07-18 03:30:34 -04:00
Richard Hansen
23dad564be dyndns2: Expand rationale for not checking returned IP 2024-07-17 22:54:02 -04:00
woolflare
2f4b0859bd Add DDNS.FM support 2024-07-15 03:50:07 -04:00
Richard Hansen
c6581b03f2 Bump version to v4.0.0~alpha
The list of breaking changes has become significant enough to warrant
bumping the major version number.
2024-07-14 19:07:55 -04:00
Richard Hansen
f0de73e8c4 Enable --ssl by default
In this day and age there's no good reason to prefer plain HTTP over
HTTPS, and security is more important than potential compatibility
concerns.
2024-07-14 19:00:53 -04:00
Richard Hansen
13369804a0 Improve documentation for --ssl option
Also move it to the top of the sample config file due to its
importance.
2024-07-14 19:00:24 -04:00
Richard Hansen
7754c65103 woima: Honor http: or https: scheme in server variable 2024-07-13 18:38:53 -04:00
Richard Hansen
0ed2970852 keysystems: Honor http: or https: scheme in server variable
or fall back to the value of the `ssl` variable if neither `http:` nor
`https:` is present.
2024-07-13 18:38:44 -04:00
Richard Hansen
469c5a072e dnsmadeeasy: Honor http: or https: scheme in server variable 2024-07-13 18:38:36 -04:00
Richard Hansen
6fbb7eb3dc domeneshop: Honor http: or https: scheme in server variable 2024-07-13 18:38:26 -04:00
Richard Hansen
c31668b413 dyndns2: Honor http: or https: scheme in server variable
or fall back to the value of the `ssl` variable if no `http:` or
`https:` scheme is present.
2024-07-13 18:38:18 -04:00
Richard Hansen
4d5a416725 Omit deprecated services from --list-web-services
This also makes the handling of deprecated services a bit more
general.
2024-07-13 17:50:10 -04:00
Indrajit Raychaudhuri
0973e9d83c Deprecate 'builtinweb' 'he' for 'he.net' for consistency with protocol 2024-07-13 17:31:52 -04:00
Indrajit Raychaudhuri
ecf935a4e2 he.net: Add support for Hurricane Electric provider
The implementation is based on the existing
dyndns2 protocol with a few differences:
- The IPv4 and IPv6 addresses must be updated in
  separate calls. This is different from most of
  the other providers where both IPv4 and IPv6
  addresses can be updated in a single call. Thus
  the existing dyndns2 protocol implementation
  cannot be reused for dns.he.net.
- Multiple hosts are not supported by the provider.

See: https://dns.he.net/docs.html
2024-07-13 17:31:52 -04:00
Richard Hansen
d489cea344 dyndns2: Wrap long list of group by attributes 2024-07-13 04:52:05 -04:00
Richard Hansen
203bf12245 dyndns2: Improve readability of status parsing 2024-07-13 04:45:35 -04:00
Richard Hansen
ad4e3769eb dyndns2: Invert condition to improve readability 2024-07-13 04:45:35 -04:00
Richard Hansen
0882712ec2 dyndns2: Treat nochg as good to eliminate duplicate code 2024-07-13 04:45:35 -04:00
Richard Hansen
45e3603918 dyndns2: Simplify response parsing 2024-07-13 04:45:35 -04:00
Richard Hansen
8a65264841 group_hosts_by: Return the common group configuration
This should make it easier to detect missing attribute names passed to
`group_hosts_by`.
2024-07-13 04:09:24 -04:00
Richard Hansen
b8df93febe group_hosts_by: Return a list, not a hashref
The hash key value is an implementation detail that should not be
leaked to the caller.
2024-07-13 04:08:35 -04:00
Richard Hansen
08ccc41650 group_hosts_by: Use arg list instead of arrayref
This is more idiomatic.
2024-07-13 04:08:35 -04:00
Richard Hansen
64af205cfc group_hosts_by: Readability improvements 2024-07-13 04:08:35 -04:00
Richard Hansen
5d2a1e864a yandex: Remove unnecessary host groupings
Each host is already updated individually so there's no point in
grouping the hosts.
2024-07-13 04:08:35 -04:00
Richard Hansen
216c9c6010 hetzner: Remove unnecessary host groupings
Each host is already updated individually so there's no point in
grouping the hosts.
2024-07-13 04:08:35 -04:00
Richard Hansen
5ae0fd3024 hetzner: Delete unused login variable 2024-07-13 04:08:35 -04:00
Richard Hansen
45677c0403 cloudflare: Remove unnecessary attributes from group_hosts_by args 2024-07-13 04:08:35 -04:00
Richard Hansen
8e20185323 googledomains: Remove unnecessary host groupings
Each host is already updated individually so there's no point in
grouping the hosts.
2024-07-13 04:08:35 -04:00
Richard Hansen
40e4aee74f nsupdate: Add missing tcp to group_hosts_by attributes 2024-07-13 04:08:35 -04:00
Richard Hansen
e8a6d1479f godaddy: Remove unnecessary host groupings
Each host is already updated individually so there's no point in
grouping the hosts.
2024-07-13 04:08:35 -04:00
Richard Hansen
5db77f7c31 zoneedit1: Add TODO comments for problematic bits of code 2024-07-13 04:08:35 -04:00
Richard Hansen
217bc998fc easydns: Remove unnecessary single host groupings 2024-07-13 04:08:35 -04:00
Richard Hansen
c8ee25ef82 noip: Remove unused attributes from group_hosts_by arguments 2024-07-13 04:08:35 -04:00
Richard Hansen
1faa315794 noip: Delete unused variables 2024-07-13 04:08:35 -04:00
Richard Hansen
39e3322fc0 dyndns2: Add missing script to group_hosts_by attributes 2024-07-13 04:08:35 -04:00
Richard Hansen
161c623557 Whitespace fixes 2024-07-13 04:08:33 -04:00
Richard Hansen
b488cb2235 Unwrap error message
Normally I prefer lines to be less than 100 characters long, but error
messages are an exception because it makes it easier to search the
source code for the error message.
2024-07-12 18:00:38 -04:00
Richard Hansen
4d9d0646cf Delete unnecessary comments 2024-07-12 18:00:38 -04:00
Richard Hansen
f5b369a7ef Fix undef warning when encountering an unset but required var
This fixes a bug probably introduced in commit
b8a0a26441
2024-06-29 04:14:57 -04:00
Richard Hansen
89c84f9f07 Ignore (with warning) unknown vars in --options 2024-06-29 04:14:35 -04:00
Richard Hansen
1f31b0e570 Prevent autovivification of empty definitions for unknown variables 2024-06-29 04:14:35 -04:00
Richard Hansen
d8317a730d Fix die that should be return undef
I got ahead of myself -- I intend to replace `return undef` with `die`
in a future commit, and somehow this one jumped the gun.

This fixes a bug introduced in commit
eab72ef6d7
2024-06-29 04:14:31 -04:00
Richard Hansen
04bdd68415 Always set the host variable
The `host` variable is required, so always set it to avoid error
messages when validating the host configuration.
2024-06-29 04:14:02 -04:00
Richard Hansen
be3c2060eb Fix undefined hash reference warning
This fixes a bug introduced in commit
5e3e10d32e

For some reason Perl is OK with:

    my $x = undef;
    my @k = keys(%$x);  # empty list, no warnings

but not:

    my $x = undef;
    my %h = %$x;
    my @k = keys(%h);
2024-06-29 04:13:57 -04:00
Richard Hansen
de39ac7bcc Fix undef warning when daemon is unset
This fixes a bug introduced in commit
88eb2ed4fe
2024-06-29 03:10:51 -04:00
Richard Hansen
ae7a9dce2a Fix variable name typo
This fixes a bug introduced in commit
b154d8ef98
2024-06-29 03:10:51 -04:00
Richard Hansen
49f5551764 Add variable default value tests 2024-06-28 15:53:40 -04:00
Richard Hansen
eab72ef6d7 Require a defined value if the variable is required 2024-06-28 15:53:40 -04:00
Richard Hansen
399f8a8b32 Adjust variable defaults to pass validity checks
Change the default of every variable whose default (non-`undef`)
doesn't pass through `check_value` unmodified.
2024-06-28 15:53:40 -04:00
Richard Hansen
88eb2ed4fe Use undef as the default of truly optional variables 2024-06-28 15:53:39 -04:00
Richard Hansen
ba6a279186 Convert unnecessarily required variables to optional
Users are not required to provide values for these variables; either
the default is reasonable or the variable can be left unset.
2024-06-28 15:53:06 -04:00
Richard Hansen
b8a0a26441 Remove defaults from required variables without sensible defaults
Required variables with defaults don't make sense; remove the default
values on variables that don't have sensible defaults, such as login
and password.
2024-06-28 15:50:35 -04:00
Richard Hansen
be9e305e73 Fix definition of wtime variable 2024-06-28 15:28:44 -04:00
Richard Hansen
e32b9436fb nfsn: Fix type of min-interval variable 2024-06-28 15:28:44 -04:00
Richard Hansen
66bb07450f nfsn: Fix spelling of min-interval variable name 2024-06-28 15:28:44 -04:00
Richard Hansen
5757f7e07d Restore accidentally deleted --fw command-line argument
This was mistakenly deleted in commit
908b728503.
2024-06-27 00:10:35 -04:00
Richard Hansen
948567c456 infomaniak: Unrequire server setting
The `infomaniak` protocol doesn't use `server`.
2024-06-25 22:53:23 -04:00
Richard Hansen
9ba583175a infomaniak: Fail if the HTTP status code is not 2xx 2024-06-25 22:53:23 -04:00
Richard Hansen
7d99da77cc header_ok: Fail if the reply is falsy 2024-06-25 22:53:23 -04:00
Richard Hansen
8e24c92b1e infomaniak: Fix response parsing 2024-06-25 22:53:23 -04:00
Richard Hansen
d2f0e042f4 infomaniak: Invert condition to improve readability 2024-06-25 22:47:26 -04:00
Richard Hansen
29e86d9a91 infomaniak: Rename variable for readability 2024-06-25 22:47:25 -04:00
Richard Hansen
a5dedeed3c infomaniak: Fix geturl call
* Pass login and password via `login` and `password` options to
    avoid issues with escaping special characters.
  * Don't attempt twice -- if the first attempt fails, the second will
    almost certainly fail as well.  (The two attempted URLs were
    equivalent, differing only in how the login and password were
    passed.)
2024-06-25 22:47:25 -04:00
Richard Hansen
ac9f937c88 infomaniak: Delete unnecessary defined checks
`undef` is falsy so there's no need to check whether the value is
defined.
2024-06-25 22:46:00 -04:00
Richard Hansen
bab9d9483e infomaniak: Move variable declaration to definition 2024-06-25 21:55:46 -04:00
Richard Hansen
134e47b61d infomaniak: Delete unnecessary newlines 2024-06-25 21:50:51 -04:00
Richard Hansen
9d49a33ac6 regfishde: Fix IPv6 support 2024-06-25 02:58:09 -04:00
Richard Hansen
0cde2e3f96 infomaniak: Fix mtime update
`mtime` should always be updated whenever the IP address is updated,
otherwise ddclient will keep force updating over and over.
2024-06-25 02:57:42 -04:00
Richard Hansen
61577d29ae njalla: Fix configuration change during update
If the user enabled `quietreply`, it should not become false after the
first update.

Users might not notice a problem because I think ddclient re-reads the
config file before every check.
2024-06-25 02:52:22 -04:00
Richard Hansen
32bf975bfa Fix call to wrong function name with bad --usev6 2024-06-25 02:52:22 -04:00
Richard Hansen
99dfd7f84d Don't assume that --use is defined 2024-06-25 02:51:58 -04:00
Richard Hansen
b154d8ef98 Fix missing v4, v6 variants in recap update
Fixes an oversight when IPv6 support was added.
2024-06-25 02:48:51 -04:00
Richard Hansen
dafde8becb Fix erroneous backupmx recap check for dyndns1, dyndns2 2024-06-25 01:38:43 -04:00
Richard Hansen
7ac6eda7cc Fix missing local use* override in --query 2024-06-25 01:37:47 -04:00
Richard Hansen
c7c8c5f097 Fix usev4, usev6 output for --query 2024-06-25 01:32:27 -04:00
Richard Hansen
27b50a3b93 Fix --usev4=cisco, --usev4=cisco-asa warning messages 2024-06-25 01:29:29 -04:00
Richard Hansen
e1e8d5711a Fix get_ip argument in --query when testing --fw 2024-06-25 01:20:30 -04:00
Richard Hansen
b363fb48a5 Fix string equality check
The `$proto` interpolation wasn't quoted with `\Q` and `\E`, so
metacharacters in `$proto` could break the matching.  Switch from a
regex to an expression to fix the equality check and improve
readability.
2024-06-25 00:50:22 -04:00
Richard Hansen
1be8438c70 Rename updateable to force_update for readability 2024-06-22 03:07:49 -04:00
Richard Hansen
b426b370fd Rename %cache to %recap for readability 2024-06-22 02:48:03 -04:00
Richard Hansen
49bd1b7347 Rename %services to %protocols for consistency 2024-06-22 02:42:51 -04:00
Richard Hansen
1718ceab70 Add comments documenting the cached variables 2024-06-22 02:35:01 -04:00
Richard Hansen
3d73e7c231 Add TODO comments for confusing bits of code 2024-06-22 02:30:01 -04:00
Richard Hansen
9a5500a667 Improve readability via minor logic tweaks
Change some code that is unnecessarily complicated or otherwise not
the right tool for the job to improve readability.
2024-06-22 02:30:01 -04:00
Richard Hansen
ab60675660 Improve readability of cache var update logic 2024-06-22 02:30:01 -04:00
Richard Hansen
0d712f7bbc Improve readability of wantip, wantipv4, wantipv6 fallback 2024-06-22 02:30:01 -04:00
Richard Hansen
5c38af2ed5 Improve readability by moving code out of unnecessary blocks
Invert conditions and move out unnecessary blocks to reduce
indentation and make it easier to see control flow.
2024-06-22 02:28:12 -04:00
Richard Hansen
160344514f Improve readability by simplifying if conditions 2024-06-22 02:27:44 -04:00
Richard Hansen
288a30ab1e Whitespace fixes 2024-06-22 01:38:28 -04:00
Richard Hansen
2d4a93d5e7 header_ok: Fix typo(?) in HTTP response regular expression 2024-06-06 19:34:06 -04:00
Richard Hansen
211d59fccc header_ok: Log all non-2xx HTTP status codes 2024-06-06 19:34:06 -04:00
Richard Hansen
7fe7fd0e18 header_ok: Refactor for readability 2024-06-06 19:34:06 -04:00
Richard Hansen
adbac91be7 header_ok: Only keep first line of argument
This allows callers to pass the entire response without generating
overly long error messages.
2024-06-06 19:34:06 -04:00
Richard Hansen
bb658d763a Simplify loading of JSON::PP 2024-06-06 19:08:15 -04:00
Richard Hansen
1401ff4aea Only attempt to load Digest::SHA
`Digest::SHA` has been a core module for a long time, and
`Digest::SHA1` has not been updated in a long time.
2024-06-06 19:07:25 -04:00
Richard Hansen
1e1e100d7f Prefer Digest::SHA over Digest::SHA1
`Digest::SHA` is a core module; `Digest::SHA1` is not.
2024-06-04 18:44:25 -04:00
Richard Hansen
a0240345bf Use Module->import(...) instead of import(Module, ...)
This matches the documentation of the `use` statement.
2024-06-04 18:44:25 -04:00
Richard Hansen
31dbd8e4ed geturl: Set raw (binary) mode when reading from curl 2024-06-03 03:13:05 -04:00
Richard Hansen
8e901c3db6 geturl: Avoid the shell when invoking curl 2024-06-02 17:00:05 -04:00
Richard Hansen
09d8d0426e geturl: Don't suppress curl's STDERR
This makes it easier for users to troubleshoot problems.
2024-06-02 17:00:05 -04:00
jortkoopmans
73a67b728d dnsexit2: Move body of for loop to a separate function
For improved readability.
2024-06-02 16:58:00 -04:00
Richard Hansen
11d0c84639 dnsexit2: Don't skip remaining hosts on connect error or non-2xx
A non-2xx status code might be host-specific, so ddclient should
continue with the next host.  We could skip the remaining hosts if
there is a connection failure, but it doesn't hurt to retry.
2024-06-02 16:58:00 -04:00
jortkoopmans
216741c9ce dnsexit2: Fix when provided with a zone and a non-identical hostname
Trim the zone from the hostname in the request to fix issue.
2024-06-02 16:58:00 -04:00
Richard Hansen
282bb01e17 Bump version to v3.12.0~alpha
Enough has changed to warrant a minor revision bump.
2024-06-01 03:49:16 -04:00
Richard Hansen
e60e6e804b group_hosts_by: Use Data::Dumper to make the group signature
This is a bit more robust than manually making the group signature
because it gracefully handles corner cases such as `undef`.
2024-06-01 03:06:06 -04:00
Richard Hansen
f4802fc534 Fix group_hosts_by call for IPv6-enabled services 2024-06-01 03:05:36 -04:00
Richard Hansen
343fcff625 group_hosts_by: Add support for wantipv4, wantipv6 2024-06-01 03:05:36 -04:00
Richard Hansen
f976b771d4 dnsexit2: Fix logging of erroneous response body 2024-05-30 18:29:38 -04:00
Richard Hansen
f7f4856b93 dnsexit2: Combine related log messages 2024-05-30 18:28:57 -04:00
Richard Hansen
24a22092ca dnsexit2: Don't croak if JSON decoding fails 2024-05-30 18:22:59 -04:00
Richard Hansen
d28c8ea7ad dnsexit2: Delete unnecessary debug messages 2024-05-30 17:56:51 -04:00
Richard Hansen
7b95b379aa dnsexit2: Fix extraction and processing of JSON response body 2024-05-30 17:52:12 -04:00
Richard Hansen
2a47b17541 dnsexit2: Include the unexpected status in the error message 2024-05-30 16:26:44 -04:00
Richard Hansen
d8a1449a19 dnsexit2: Fix error message format string
This fixes a bug introduced in commit
2bf6d348b0.
2024-05-30 16:25:25 -04:00
Richard Hansen
6e5e2ab63f dnsexit2: Remove https:// from update service URL
This allows the `ssl` setting to control TLS vs. plain HTTP, and makes
it possible to create a compatible service that doesn't use TLS (e.g.,
for testing).
2024-05-30 16:21:25 -04:00
Richard Hansen
eebb1b8a47 dnsexit2: Delete redundant status-ipv* assignments 2024-05-30 16:19:41 -04:00
Richard Hansen
3c84f7a1b5 dnsexit2: Delete unnecessary debug messages 2024-05-30 04:49:46 -04:00
Richard Hansen
5b7400ae7d dnsexit2: Normalize the zone up front 2024-05-30 04:48:44 -04:00
Richard Hansen
46bca54393 dnsexit2: Fix string interpolation 2024-05-30 04:04:19 -04:00
Richard Hansen
da9f39917f dnsexit2: Inline some unnecessary variables 2024-05-29 18:29:09 -04:00
Richard Hansen
6c89eaf4ac dnsexit2: Build updates array directly, not hash to array
to improve readability, and to make it easier to use
`group_hosts_by()` in the future to update multiple hosts at the same
time.
2024-05-29 18:25:24 -04:00
Richard Hansen
2bf6d348b0 dnsexit2: Reuse the $url variable 2024-05-29 18:25:24 -04:00
Richard Hansen
4804e15c12 dnsexit2: Add final comma after last list item
for consistency, and to avoid bugs if additional items are added or
the items are reordered.
2024-05-29 18:25:24 -04:00
Richard Hansen
7c4fe28bab dnsexit2: Simplify IP version loop 2024-05-29 17:57:20 -04:00
Richard Hansen
40d1bc8e51 dnsexit2: Clarify comments 2024-05-29 17:51:54 -04:00
Richard Hansen
18007dda8a dnsexit2: Delete unnecessary comments
Comments should only be used if the code is doing something
subtle/tricky/non-obvious/unusual, otherwise they're distracting and
might get out of sync with the code (in which case it becomes
difficult to tell if it's the comment or the code that's wrong).  If
the code is difficult to understand without comments but is doing
something ordinary, then the code needs to be modified to improve
readability.
2024-05-29 17:51:54 -04:00
Richard Hansen
61d34a9157 dnsexit2: Move code meanings closer to where it is used 2024-05-29 17:42:35 -04:00
Richard Hansen
df81075e49 dnsexit2: Rename variable to avoid confusion 2024-05-29 17:41:34 -04:00
Richard Hansen
ed7f4a68a4 dnsexit2: Rewrite circuitous variable assignments 2024-05-29 17:34:51 -04:00
Richard Hansen
3e91fd02bf dnsexit2: Invert conditions to improve readability
Instead of:

    if ($success1) {
        if ($success2) {
            if ($success3) {
                # yay
            } else {
                # fail
            }
        } else {
            # fail
        }
    } else {
        # fail
    }

do:

    if (!$success1) {
        # fail
    }
    if (!$success2) {
        # fail
    }
    if (!$success3) {
        # fail
    }
    # yay
2024-05-29 17:21:39 -04:00
Richard Hansen
9b1a785c6d dnsexit2: Don't repeat the same success message 2024-05-29 17:15:24 -04:00
Richard Hansen
3a5e86b4d2 dnsexit2: Convert string interpolation to sprintf format specifier
Rationale:
  * For consistency.
  * It's generally not a good idea to mix interpolation with `sprintf`
    because the interpolated string itself might coincidentally (or
    maliciously) contain format specifiers.
2024-05-29 17:10:06 -04:00
Richard Hansen
6cdf5da9f4 dnsexit2: Rename variable for brevity 2024-05-29 17:05:54 -04:00
Richard Hansen
63989d96fb dnsexit2: Move variable declaration to loop scope 2024-05-29 17:02:46 -04:00
Richard Hansen
0040fc9608 dnsexit2: Whitespace fixes 2024-05-29 17:02:46 -04:00
Richard Hansen
a91ca7a199 s/foreach/for/g for consistency 2024-05-29 16:48:00 -04:00
Joel Croteau
61b979c49e New 'emailonly' protocol that simply sends an email on IP change
This adds a protocol to email IP address changes without needing a
dynamic DNS service.  This is useful if you don't use a DDNS service
but want to be notified when the IP of a machine changes.
2024-05-25 00:38:10 -04:00
Richard Hansen
d8a9d9d089 Add support for infinite duration 2024-05-25 00:38:10 -04:00
Richard Hansen
9c6e5fdda4 Output a | character in log message continuation lines
This makes it easier to tell where multi-line log messages begin and
end.
2024-05-23 02:04:29 -04:00
Richard Hansen
ff39ce3874 Don't use sprintf if there is only one argument
This avoids problems when logging a string that might have
metacharacters.
2024-05-23 02:04:19 -04:00
Richard Hansen
bcd57b486b Always log to STDERR, even for debug, info, etc.
Rationale:
  * Logging to STDERR enables separation of processable output (e.g.,
    `--version` or `--help`) and ephemeral status/error messages.
  * A single file descriptor for all log messages makes it easier for
    users to capture all log messages.
  * Consistency: it's what most utilities do.
2024-05-23 02:04:19 -04:00
Richard Hansen
d6693e0175 Use the de facto standard signature separator instead of "regards" 2024-05-23 01:57:12 -04:00
Richard Hansen
065b227711 logmsg: New low-level logging interface 2024-05-23 01:57:12 -04:00
Richard Hansen
f9dafa35a1 Rename $msgs to $emailbody to improve readability 2024-05-23 01:54:09 -04:00
Richard Hansen
8ef7b13cb0 Don't set legacy status in protocols if IPv6-aware
ddclient infrastructure will update the legacy `status` variable if
necessary.
2024-05-20 01:35:21 -04:00
Richard Hansen
ba18535c51 Fix broken legacy status handling
`$config{$h}{'status'}` was always initialized to a non-`undef` value,
so the `//` fallbacks never did anything.  Instead, any protocol that
does not explicitly update the legacy `status` variable (such as
`godaddy`) would always appear to have failed even if it had
succeeded.

Change the `status*` variables to `undef` by default, and only set
them when an attempt is made so that the legacy `//` fallback works as
expected.
2024-05-20 01:33:15 -04:00
Richard Hansen
f212613526 godaddy: Fix status field name
This shouldn't matter in practice because the `status-ipv$ipversion`
field is initialized to a non-`good` value so failing to set it to
`bad` doesn't turn it `good`, but it improves readability.
2024-05-20 01:30:33 -04:00
Richard Hansen
c60aa225a1 godaddy: Rename $status to $code 2024-05-20 01:30:33 -04:00
Richard Hansen
dc92f16eb2 dnsexit2: Update new status-ipv* vars, not legacy status
The `dnsexit2` protocol reads the IP addresses from the new `ipv4` and
`ipv6` variables, so it should update the `status-ipv4` and
`status-ipv6` variables.
2024-05-20 01:30:33 -04:00
Richard Hansen
baec50d134 1984: Update cached status and IP on success 2024-05-20 01:30:33 -04:00
Richard Hansen
8b0c038d63 1984: Fix missing next on failure 2024-05-20 01:30:33 -04:00
Richard Hansen
9573051e3e njalla: Update cached status and IP on success 2024-05-20 01:30:33 -04:00
Richard Hansen
6320e6c395 Don't require login and password to be set
Not all services use them.

This change should have been included with commit
27b5c535bc.
2024-05-20 00:13:37 -04:00
Richard Hansen
23b368f5ff Add missing final comma 2024-05-19 02:18:55 -04:00
Richard Hansen
27b5c535bc Use undef to disable required variables 2024-05-19 02:18:55 -04:00
Richard Hansen
4d1b3439ea Use service-common-defaults variables
This avoids a lot of duplication and improves readability by making it
easier to see service-specific variables.
2024-05-19 01:51:06 -04:00
Richard Hansen
6da30367d0 Inline unnecessary *-common-defaults variable definitions 2024-05-19 01:49:48 -04:00
Richard Hansen
5e3e10d32e Replace unnecessary merge function with hash initializers 2024-05-19 01:49:48 -04:00
Richard Hansen
52864f2bb1 Delete redundant variable definitions 2024-05-19 01:49:45 -04:00