Added OVH DynHost support

This commit is contained in:
xlammertink 2020-01-03 10:17:04 +01:00 committed by Sandro Jäckel
parent 3e872e890e
commit d71beb0f7f
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5
4 changed files with 122 additions and 25 deletions

View file

@ -34,6 +34,7 @@ Dynamic DNS services currently supported include:
NearlyFreeSpeech.net - See https://www.nearlyfreespeech.net/services/dns for details NearlyFreeSpeech.net - See https://www.nearlyfreespeech.net/services/dns for details
MyDNS.JP - See https://www.mydns.jp/ for details MyDNS.JP - See https://www.mydns.jp/ for details
dnsexit - See https://dnsexit.com/ for details dnsexit - See https://dnsexit.com/ for details
OVH - See https://www.ovh.com for details
DDclient now supports many of cable/dsl broadband routers. DDclient now supports many of cable/dsl broadband routers.

View file

@ -7,6 +7,7 @@ A detailed overview can be found in ChangeLog but here's a quick overview:
* adding configurable TTL to Cloudflare * adding configurable TTL to Cloudflare
* added support for woima.fi dyndns service * added support for woima.fi dyndns service
* added support for google domain * added support for google domain
* added support for OVH DynHost
A very big thank you for everyone who created a pull request on github and A very big thank you for everyone who created a pull request on github and
for everyone who helped to fix the little issues caused by the new providers. for everyone who helped to fix the little issues caused by the new providers.

View file

@ -533,6 +533,12 @@ my %variables = (
'server' => setv(T_FQDNP, 0, 1, 1, 'update.dnsexit.com', undef), 'server' => setv(T_FQDNP, 0, 1, 1, 'update.dnsexit.com', undef),
'script' => setv(T_STRING, 0, 1, 1, '/RemoteUpdate.sv', undef), 'script' => setv(T_STRING, 0, 1, 1, '/RemoteUpdate.sv', undef),
}, },
'ovh-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'www.ovh.com', undef),
'script' => setv(T_STRING, 1, 1, 1, '/nic/update', undef),
'login' => setv(T_LOGIN, 1, 0, 1, '', undef),
'password' => setv(T_PASSWD, 1, 0, 1, '', undef),
},
); );
my %services = ( my %services = (
'dyndns1' => { 'dyndns1' => {
@ -793,6 +799,15 @@ my %services = (
$variables{'service-common-defaults'}, $variables{'service-common-defaults'},
), ),
}, },
'ovh' => {
'updateable' => undef,
'update' => \&nic_ovh_update,
'examples' => \&nic_ovh_examples,
'variables' => merge(
$variables{'ovh-common-defaults'},
$variables{'service-common-defaults'},
),
},
); );
$variables{'merged'} = merge($variables{'global-defaults'}, $variables{'merged'} = merge($variables{'global-defaults'},
$variables{'service-common-defaults'}, $variables{'service-common-defaults'},
@ -5772,6 +5787,77 @@ sub nic_dnsexit_update {
} }
} }
######################################################################
## nic_ovh_examples
######################################################################
sub nic_ovh_examples {
return <<EoEXAMPLE;
o 'ovh'
The 'ovh' protocol is used by DNS services offered by www.ovh.com.
API information and user instructions available at: https://docs.ovh.com/gb/en/domains/hosting_dynhost/
Configuration variables applicable to the 'ovh' protocol are:
protocol=ovh ##
login=dnsdomain-userid ## The username/id registered with the service
password=userid-password ## The password related to the username/id
fully.qualified.host ## the hostiname registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=ovh, \\
login=example.com-dynhostuser, \\
password=s3cuRePaSsw0rd \\
test.example.com
EoEXAMPLE
}
######################################################################
## nic_ovh_examples
######################################################################
sub nic_ovh_update {
debug("\nnic_ovh_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://";
$url .= "$config{$h}{'server'}$config{$h}{'script'}";
$url .= "?system=dyndns";
$url .= "&hostname=";
$url .= $h;
$url .= "&myip=";
$url .= $ip if $ip;
my $reply = geturl(opt('proxy'), $url, "$config{$h}{'login'}", "$config{$h}{'password'}");
if (!defined($reply) || !$reply) {
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
next;
}
my @reply = split /\n/, $reply;
my $returned = pop(@reply);
if ($returned =~ /good/ || $returned =~ /nochg/) {
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
if ($returned =~ /good/) {
success("updating %s: good: IP address set to %s", $h, $ip);
} else {
success("updating %s: skipped: IP address was already 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 : # vim: ai ts=4 sw=4 tw=78 :

View file

@ -288,6 +288,7 @@ ssl=yes # use ssl-support. Works with
# password=yandex-pdd-token \ # password=yandex-pdd-token \
# my.domain.tld,other.domain.tld \ # my.domain.tld,other.domain.tld \
##
## DNS Made Easy (https://dnsmadeeasy.com) ## DNS Made Easy (https://dnsmadeeasy.com)
## ##
# protocol=dnsmadeeasy, # protocol=dnsmadeeasy,
@ -310,3 +311,11 @@ ssl=yes # use ssl-support. Works with
#login=myusername #login=myusername
#password=mypassword #password=mypassword
#subdomain-1.domain.com,subdomain-2.domain.com,subdomain-3.domain.com #subdomain-1.domain.com,subdomain-2.domain.com,subdomain-3.domain.com
##
## OVH DynHost (https://ovh.com)
##
# protocol=ovh,
# login=example.com-dynhostuser,
# password=s3cuRePaSsw0rd
# test.example.com