Add support for Mythic Beasts Dynamic DNS (#312)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Reuben Thomas 2023-01-14 02:24:03 +01:00 committed by GitHub
parent 8d3a383587
commit e910204b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 1 deletions

View file

@ -37,6 +37,7 @@ Dynamic DNS services currently supported include:
Njal.la - See https://njal.la/docs/ddns/ Njal.la - See https://njal.la/docs/ddns/
regfish.de - See https://www.regfish.de/domains/dyndns/ for details regfish.de - See https://www.regfish.de/domains/dyndns/ for details
domenehsop - See https://api.domeneshop.no/docs/#tag/ddns/paths/~1dyndns~1update/get domenehsop - See https://api.domeneshop.no/docs/#tag/ddns/paths/~1dyndns~1update/get
Mythic Beasts - See https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns for details
`ddclient` now supports many cable and DSL broadband routers. `ddclient` now supports many cable and DSL broadband routers.

View file

@ -753,6 +753,16 @@ my %services = (
'zone' => setv(T_FQDN, 1, 0, '', undef), 'zone' => setv(T_FQDN, 1, 0, '', undef),
}, },
}, },
'mythicdyn' => {
'updateable' => undef,
'update' => \&nic_mythicdyn_update,
'examples' => \&nic_mythicdyn_examples,
'variables' => {
%{$variables{'service-common-defaults'}},
'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0),
'server' => setv(T_FQDNP, 1, 0, 'api.mythic-beasts.com', undef),
},
},
'namecheap' => { 'namecheap' => {
'updateable' => undef, 'updateable' => undef,
'update' => \&nic_namecheap_update, 'update' => \&nic_namecheap_update,
@ -3852,7 +3862,9 @@ sub header_ok {
$ok = 1; $ok = 1;
} elsif ($result eq '401') { } elsif ($result eq '401') {
failed("updating %s: authorization failed (%s)", $host, $line); failed("updating %s: authentication failed (%s)", $host, $line);
} elsif ($result eq '403') {
failed("updating %s: not authorized (%s)", $host, $line);
} }
} else { } else {
@ -5851,6 +5863,82 @@ sub nic_googledomains_update {
} }
} }
######################################################################
## nic_mythicdyn_examples
##
## written by Reuben Thomas
##
######################################################################
sub nic_mythicdyn_examples {
return <<"EoEXAMPLE";
o 'mythicdyn'
The 'mythicdyn' protocol is used by the Dynamic DNS service offered by
www.mythic-beasts.com.
Configuration variables applicable to the 'mythicdyn' protocol are:
protocol=mythicdyn ##
ipv6=no|yes ## whether to set an A record (default, ipv6=no)
## or AAAA record (ipv6=yes).
login=service-login ## the user name provided by the admin interface
password=service-password ## the password provided by the admin interface
fully.qualified.host ## the host registered with the service
Note: this service automatically sets the IP address to that from which the
request comes, so the IP address detected by ddclient is only used to keep
track of when it needs updating.
Example ${program}.conf file entries:
## Single host update.
protocol=mythicdyn, \\
login=service-login \\
password=service-password, \\
host.example.com
## Multiple host update.
protocol=mythicdyn, \\
login=service-login \\
password=service-password, \\
hosta.example.com,hostb.sub.example.com
EoEXAMPLE
}
######################################################################
## nic_mythicdyn_update
######################################################################
sub nic_mythicdyn_update {
debug("\nnic_mythicdyn_update --------------------");
# Update each set configured host.
foreach my $h (@_) {
info("%s -- Setting IP address.", $h);
my $ipversion = $config{$h}{'ipv6'} ? '6' : '4';
my $reply = geturl(
proxy => opt('proxy'),
url => "https://ipv$ipversion.$config{$h}{'server'}/dns/v2/dynamic/$h",
method => 'POST',
login => $config{$h}{'login'},
password => $config{$h}{'password'},
ipversion => $ipversion,
);
unless ($reply) {
failed("Updating service %s failed: %s", $h, $config{$h}{'server'});
next;
}
my $ok = header_ok($h, $reply);
if ($ok) {
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = "good";
success("%s -- Updated successfully.", $h);
} else {
failed("%s -- Failed to update.", $h);
}
}
}
###################################################################### ######################################################################
## nic_nsupdate_examples ## nic_nsupdate_examples
###################################################################### ######################################################################