Merge pull request #92 from xlammertink/ovhsupport

Added OVH DynHost support
This commit is contained in:
Sandro 2020-06-02 00:08:25 +02:00 committed by GitHub
commit 2ab9afbc79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 0 deletions

View file

@ -31,6 +31,7 @@ Dynamic DNS services currently supported include:
DNS Made Easy - See https://dnsmadeeasy.com/ for details
DonDominio - See https://www.dondominio.com for details
NearlyFreeSpeech.net - See https://www.nearlyfreespeech.net/services/dns for details
OVH - See https://www.ovh.com for details
DDclient now supports many of cable/dsl broadband routers.

View file

@ -11,6 +11,7 @@ A detailed overview can be found in git log but here's a quick overview:
* updated fritzbox instructions
* fixed multidomain support for namecheap
* fixed support for Yandex
* added support for OVH DynHost
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.

View file

@ -490,6 +490,12 @@ my %variables = (
'dondominio-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'dondns.dondominio.com', 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 = (
'dyndns1' => {
@ -720,6 +726,15 @@ my %services = (
$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{'service-common-defaults'},
@ -5055,6 +5070,80 @@ sub nic_dnsmadeeasy_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=your_password, \\
test.example.com
EoEXAMPLE
}
######################################################################
## nic_ovh_update
######################################################################
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://$config{$h}{'server'}$config{$h}{'script'}?system=dyndns";
$url .= "&hostname=$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 et ts=4 sw=4 tw=78:

View file

@ -279,9 +279,18 @@ ssl=yes # use ssl-support. Works with
# password=yandex-pdd-token \
# my.domain.tld,other.domain.tld \
##
## DNS Made Easy (https://dnsmadeeasy.com)
##
# protocol=dnsmadeeasy,
# login=your-account-email-address
# password=your-generated-password
# your-numeric-record-id-1,your-numeric-record-id-2,...
##
## OVH DynHost (https://ovh.com)
##
# protocol=ovh,
# login=example.com-dynhostuser,
# password=your_password
# test.example.com