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.
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).
* 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.
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.
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".
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.
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
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.
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
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);
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.
* 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.)
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.
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.
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.
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).
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.
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.
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.
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.
`$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.
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.
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.
Perl version strings are flawed in a few ways. Convert them to
user-friendly strings when printed so that Git tags and tarball names
are easier for downstream distributions to work with.
Passing `--version=short` simply prints the version and exits. This
will make it possible for a future commit to change `configure.ac` to
extract the version string from `ddclient.in` to avoid maintaining the
same version string in two places.
This prevents the `%builtinweb` or `%builtinfw` skip defaults from
overriding a user's explicitly empty `--web-skip=` or `--fw-skip=`
setting.
This is technically a backwards-incompatible change: Any config that
explicitly sets `--web-skip` or `--fw-skip` to the empty string but
depends on the built-in skip behavior will fail. This is unlikely to
affect many (if any) users; compatibility concerns are believed to be
far less significant than the potential need to turn off the built-in
skip.
`--arg` is preferred over `-arg` because the broader convention is to
use double hyphens for long option names. Perl accepts either.
`--arg` is preferred over `arg` to avoid confusion between `--use=ip`
and `--ip` and similar option pairs.
The `ciscov4`, `ciscov6`, `cisco-asav4`, and `cisco-asav6` strategies
were never implemented, and it doesn't make sense to implement them
because the `v4` and `v6` variants don't follow the pattern
established by the `%builtinfw` strategies.
The `%builtinfw` strategies were never implemented for `--usev6`.
Porkbun API requires separation of the root domain and subdomains.
Previously ddclient only supported one layer of subdomain or the root domain
by selecting between the two with the boolean 'on-root-domain'.
This change now allows to specify the root domain via the 'root-domain' parameter
ddclient will then split the host domain into root and subdomain
- curl: enable a configurable number of redirections (-redirects=<max>) to
follow when making HTTP(S) requests.
- docs: update Infomaniak example to prefer 'dyndns2' instead of obsolete
protocol.
Signed-off-by: Marco Emilio "sphakka" Poleggi <7766137+sphakka@users.noreply.github.com>
The mythicdyn module is modified so that it will update either or both V4 and/or V6 addresses depending upon which specific address parameters have been defined in the config file. The module examines the wantipv4 and wantipv6 parameters.
If required, both addresses will be updated in a single invocation.
The cloudflare documentation example had lines with a comment after a
backslash. This actually did not work in the parser until now.
The lines in question:
#protocol=cloudflare, \
#zone=domain.tld, \
#ttl=1, \
#login=your-login-email, \ # Only needed if you are using your global API key. If you are using an API token, set it to "token" (without double quotes).
#password=APIKey \ # This is either your global API key, or an API token. If you are using an API token, it must have the permissions "Zone - DNS - Edit" and "Zone - Zone - Read". The Zone resources must be "Include - All zones".
#domain.tld,my.domain.tld
Adjust `nic_nsupdate_update` to use `wantipv4` and `wantipv6` and
support simultaneous IPv4 and IPv6 updates.
Also, set proper `status-ipv4` and `status-ipv6` values after successful
update.
Adjust `nic_noip_update` to use `wantipv4` and `wantipv6` and support
simultaneous IPv4 and IPv6 updates.
Note: Unlike `nic_dyndns2_update`, `$returnedips` actually contains
valid IPv4 and IPv6 addresses, so we can use the response to update the
status.
When the configuration used the legacy 'use' parameter, we already
populated the new internal 'wantipv*' field alongside the legacy
'wantip' field. This allows both old and new providers to work.
The legacy providers set 'status'/'ip'.
The new providers then set 'status-ipv*'/'ipv*'.
The caching logic would look for 'status' and 'ip' when encountering a
'use' parameter in the config. We previously already changed ddclient to
set 'status' when 'status-ipv*' was set. Now we also set 'ip' from
'ipv*'. This ensures caching correctly works.
This reverts the changes from 36744e5. This will be reimplemented once
the build process is better documented and properly implemented
by any downstream not yet using it (as of now linuxserver.io).
See https://github.com/linuxserver/docker-ddclient/issues/77
- Support wantipv4 and wantipv6 configs automatically
- Remove manual record type setting
- Add support for hosts on your zone (subdomain)
- Update config examples
- Code/logic improvements
This fixes caching issues when using the 'usev4' or 'usev6' parameters.
Without this, the "min-interval" and "warned-min-interval" limits will
not work.
For the legacy 'use' parameter, the wrapping code takes care of
translating 'status-ipv*' to 'status'.
With this change, any config value may be set through an environment
variable by appending '_env' to the keyword (i.e. 'password_env' instead
of 'password') and setting the value to the name of the environment
variable that contains the actual configuration value.
This allows keeping sensitive info (i.e. login and password)
out of the configuration file.
Example configuration snippet:
protocol=namecheap, \
server=dynamicdns.park-your-domain.com, \
login_env=DD_LOGIN, \
password_env=DD_PASSWORD \
@
With this configuration snippet, ddclient will use the contents of
DD_LOGIN as the login value and the contents of DD_PASSWORD as the
password value.
These can in turn be supplied via the command line, .env files or any
other mechanism to safeguard sensitive information.
The password regex searches for password assignments, extracts the
password and replaces it with a dummy value to prevent it being logged.
This change adjusts the password regex to no longer accept trailing
characters behind the password string
Looks like there is a bug in line 542 in ddclient.in. The syntax of how the server URL is being set is different to all the other dynamic DNS services. To be precise there is one additional parameter. Instead of handing over the URL, the server variable receives the second "1" in the code below.
$globals{postscript} can now contain a full command string including
arguments. In order to facilitate this, the file executability check
(-x) has been modified such that the first substring up to the first
space (if it exists) is what is checked, rather than the whole string.