Add support for dondominio.com

This commit is contained in:
root 2019-04-06 17:27:22 +02:00
parent 02c983a991
commit 30dce80ad0
3 changed files with 91 additions and 0 deletions

View file

@ -28,6 +28,7 @@ Dynamic DNS services currently supported include:
Duckdns - See https://duckdns.org/ for details
Freemyip - See https://freemyip.com for details
woima.fi - See https://woima.fi/ for details
DonDominio - See https://www.dondominio.com for details
DDclient now supports many of cable/dsl broadband routers.

View file

@ -9,3 +9,4 @@ On alpine, you need perl-io-socket-ssl to have IO::Socket::SSL
ssl support is tested on folowing dynamic dns providers:
- dyndns.com
- freemyip.com
- dondominio.com

View file

@ -483,6 +483,9 @@ my %variables = (
'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
},
'dondominio-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'dondns.dondominio.com', undef),
},
);
my %services = (
'dyndns1' => {
@ -685,6 +688,15 @@ my %services = (
$variables{'woima-service-common-defaults'},
),
},
'dondominio' => {
'updateable' => undef,
'update' => \&nic_dondominio_update,
'examples' => \&nic_dondominio_examples,
'variables' => merge(
$variables{'dondominio-common-defaults'},
$variables{'service-common-defaults'},
),
},
);
$variables{'merged'} = merge($variables{'global-defaults'},
$variables{'service-common-defaults'},
@ -4676,6 +4688,83 @@ sub nic_woima_update {
}
}
######################################################################
## nic_dondominio_examples
######################################################################
sub nic_dondominio_examples {
return <<EoEXAMPLE;
o 'dondominio'
The 'dondominio' protocol is used by DNS service offered by www.dondominio.com/ .
API information and user instructions available at: https://dev.dondominio.com/dondns/docs/api/
Configuration variables applicable to the 'dondominio' protocol are:
protocol=dondominio ##
login=service-login ## the username registered with the service
password=dondominio-apikey ## API key provided by dondominio -see link above-
fully.qualified.host ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=dondominio, \\
login=my-generated-user-name, \\
password=dondominio-apikey \\
myhost.tld
EoEXAMPLE
}
######################################################################
## nic_dondominio_examples
######################################################################
sub nic_dondominio_update {
debug("\nnic_duckdns_update -------------------");
## update each configured host
## should improve to update in one pass
foreach my $h (@_) {
my $ip = delete $config{$h}{'wantip'};
info("setting IP address to %s for %s", $ip, $h);
verbose("UPDATE:","updating %s", $h);
# Set the URL that we're going to update
my $url;
$url = "https://$config{$h}{'server'}/plain/";
$url .= "?user=";
$url .= $config{$h}{'login'};
$url .= "&password=";
$url .= $config{$h}{'password'};
$url .= "&host=";
$url .= $h;
$url .= "&ip=";
$url .= $ip if $ip;
# Try to get URL
my $reply = geturl(opt('proxy'), $url);
# No response, declare as failed
if (!defined($reply) || !$reply) {
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
last;
}
last if !header_ok($h, $reply);
my @reply = split /\n/, $reply;
my $returned = pop(@reply);
if ($returned =~ /OK/)
{
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
success("updating %s: good: IP address set to %s", $h, $ip);
}
else
{
$config{$h}{'status'} = 'failed';
failed("updating %s: Server said: '$returned'", $h);
}
}
}
######################################################################
# vim: ai ts=4 sw=4 tw=78 :