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
This commit is contained in:
parent
9eff7404e3
commit
ecf935a4e2
4 changed files with 100 additions and 1 deletions
|
@ -47,6 +47,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
|||
[#676](https://github.com/ddclient/ddclient/pull/676)
|
||||
* `emailonly`: New `protocol` option that simply emails you when your IP
|
||||
address changes. [#654](https://github.com/ddclient/ddclient/pull/654)
|
||||
* `he.net`: Added support for updating Hurricane Electric records.
|
||||
[#682](https://github.com/ddclient/ddclient/pull/682)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ Dynamic DNS services currently supported include:
|
|||
* [Gandi](https://gandi.net)
|
||||
* [GoDaddy](https://www.godaddy.com)
|
||||
* [Google](https://domains.google)
|
||||
* [Hurricane Electric](https://dns.he.net)
|
||||
* [Infomaniak](https://faq.infomaniak.com/2376)
|
||||
* [Loopia](https://www.loopia.se)
|
||||
* [Mythic Beasts](https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns)
|
||||
|
|
|
@ -222,6 +222,13 @@ ssl=yes # use ssl-support. Works with
|
|||
# password=my-auto-generated-password
|
||||
# my.domain.tld, otherhost.domain.tld
|
||||
|
||||
##
|
||||
## Hurricane Electric (dns.he.net)
|
||||
##
|
||||
# protocol=he.net, \
|
||||
# password=my-genereated-password \
|
||||
# myhost.example.com
|
||||
|
||||
##
|
||||
## Duckdns (http://www.duckdns.org/)
|
||||
##
|
||||
|
|
89
ddclient.in
89
ddclient.in
|
@ -915,6 +915,17 @@ our %protocols = (
|
|||
'server' => setv(T_FQDNP, 0, 0, 'domains.google.com', undef),
|
||||
},
|
||||
},
|
||||
'he.net' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_henet_update,
|
||||
'examples' => \&nic_henet_examples,
|
||||
'variables' => {
|
||||
%{$variables{'protocol-common-defaults'}},
|
||||
'login' => undef,
|
||||
'min-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0),
|
||||
'server' => setv(T_FQDNP, 0, 0, 'dyn.dns.he.net', undef),
|
||||
},
|
||||
},
|
||||
'hetzner' => {
|
||||
'force_update' => undef,
|
||||
'update' => \&nic_hetzner_update,
|
||||
|
@ -5862,6 +5873,84 @@ sub nic_googledomains_update {
|
|||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_henet_examples
|
||||
##
|
||||
## written by Indrajit Raychaudhuri
|
||||
##
|
||||
######################################################################
|
||||
sub nic_henet_examples {
|
||||
return <<"EoEXAMPLE";
|
||||
o 'he.net'
|
||||
|
||||
The 'he.net' protocol is used by DNS service offered by dns.he.net.
|
||||
|
||||
Configuration variables applicable to the 'he.net' protocol are:
|
||||
protocol=he.net ##
|
||||
password=service-password ## the password provided by the admin interface
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=he.net, \\
|
||||
password=my-genereated-password \\
|
||||
myhost.example.com
|
||||
EoEXAMPLE
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_henet_update
|
||||
######################################################################
|
||||
sub nic_henet_update {
|
||||
debug("\nnic_henet_update -------------------");
|
||||
|
||||
my %errors = (
|
||||
'badauth' => 'Bad authorization (username or password)',
|
||||
'badsys' => 'The system parameter given was not valid',
|
||||
'nohost' => 'The hostname specified does not exist in the database',
|
||||
'abuse' => 'The hostname specified is blocked for abuse',
|
||||
'nochg' => 'No update required; unnecessary attempts to change to the current address are considered abusive',
|
||||
);
|
||||
|
||||
for my $h (@_) {
|
||||
# The IPv4 and IPv6 addresses must be updated in separate API call.
|
||||
for my $ipv ('4', '6') {
|
||||
my $ip = delete($config{$h}{"wantipv$ipv"}) or next;
|
||||
info("Setting IPv%s address to %s for %s", $ipv, $ip, $h);
|
||||
verbose("UPDATE:", "updating %s", $h);
|
||||
my $reply = geturl(
|
||||
proxy => opt('proxy'),
|
||||
url => "https://$config{$h}{'server'}/nic/update?hostname=$h&myip=$ip",
|
||||
login => $h,
|
||||
password => $config{$h}{'password'},
|
||||
) // '';
|
||||
if ($reply eq '') {
|
||||
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
|
||||
next;
|
||||
}
|
||||
next if !header_ok($h, $reply);
|
||||
# dyn.dns.he.net can return 200 OK even if there is an error (e.g., bad authentication,
|
||||
# updates too frequent) so the body of the response must also be checked.
|
||||
(my $body = $reply) =~ s/^.*?\n\n//s;
|
||||
my ($line) = split(/\n/, $body, 2);
|
||||
my ($status, $returnedip) = split(/ /, lc($line));
|
||||
$status = 'good' if $status eq 'nochg';
|
||||
$config{$h}{"status-ipv$ipv"} = $status;
|
||||
if ($status ne 'good') {
|
||||
if (exists($errors{$status})) {
|
||||
failed("updating %s: %s: %s", $h, $status, $errors{$status});
|
||||
} else {
|
||||
failed("updating %s: unexpected status: %s", $h, $line);
|
||||
}
|
||||
next;
|
||||
}
|
||||
success("updating %s: %s: IPv%s address set to %s", $h, $status, $ipv, $returnedip);
|
||||
$config{$h}{"ipv$ipv"} = $returnedip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_mythicdyn_examples
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue