Add dnsexit support
Based on https://github.com/ddclient/ddclient/pull/52 Closes #52
This commit is contained in:
parent
3a0311a83a
commit
8e32c32b20
3 changed files with 106 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ Dynamic DNS services currently supported include:
|
|||
DonDominio - See https://www.dondominio.com for details
|
||||
NearlyFreeSpeech.net - See https://www.nearlyfreespeech.net/services/dns for details
|
||||
MyDNS.JP - See https://www.mydns.jp/ for details
|
||||
dnsexit - See https://dnsexit.com/ for details
|
||||
|
||||
DDclient now supports many of cable/dsl broadband routers.
|
||||
|
||||
|
|
|
|||
97
ddclient
97
ddclient
|
|
@ -527,6 +527,12 @@ my %variables = (
|
|||
'server' => setv(T_FQDNP, 1, 0, 1, 'www.mydns.jp', undef),
|
||||
'max-interval' => setv(T_DELAY, 0, 0, 1, interval('6d'), 0),
|
||||
},
|
||||
'dnsexit-common-defaults' => {
|
||||
'ssl' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||
'use' => setv(T_USE, 0, 1, 1, 'web', undef),
|
||||
'server' => setv(T_FQDNP, 0, 1, 1, 'update.dnsexit.com', undef),
|
||||
'script' => setv(T_STRING, 0, 1, 1, '/RemoteUpdate.sv', undef),
|
||||
},
|
||||
);
|
||||
my %services = (
|
||||
'dyndns1' => {
|
||||
|
|
@ -778,6 +784,15 @@ my %services = (
|
|||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
'dnsexit' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_dnsexit_update,
|
||||
'examples' => \&nic_dnsexit_examples,
|
||||
'variables' => merge(
|
||||
$variables{'dnsexit-common-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
);
|
||||
$variables{'merged'} = merge($variables{'global-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
|
|
@ -5654,6 +5669,88 @@ sub nic_mydns_update {
|
|||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_dnsexit_examples
|
||||
######################################################################
|
||||
sub nic_dnsexit_examples {
|
||||
return <<EoEXAMPLE;
|
||||
o 'dnsexit'
|
||||
|
||||
The 'dnsexit' protocol is the protocol used by the dynamic hostname services
|
||||
of the 'DnsExit' dns services. This is currently used by the free
|
||||
dynamic DNS service offered by www.dnsexit.com.
|
||||
|
||||
Configuration variables applicable to the 'dnsexit' protocol are:
|
||||
ssl=no ## turn off ssl
|
||||
protocol=dnsexit ##
|
||||
server=update.dnsexit.com ## defaults to update.dnsexit.com
|
||||
use=web ## defaults to web
|
||||
web=update.dnsexit.com ## defaults to update.dnsexit.com
|
||||
script=/RemoteUpdate.sv ## defaults to /RemoteUpdate.sv
|
||||
login=service-userid ## userid registered with the service
|
||||
password=service-password ## password registered with the service
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=dnsexit \\
|
||||
login=service-userid \\
|
||||
password=service-password \\
|
||||
fully.qualified.host
|
||||
|
||||
EoEXAMPLE
|
||||
}
|
||||
######################################################################
|
||||
## nic_dnsexit_update
|
||||
######################################################################
|
||||
sub nic_dnsexit_update {
|
||||
debug("\nnic_dnsexit_update -------------------");
|
||||
|
||||
## update each configured host
|
||||
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 = "http://$config{$h}{'server'}$config{$h}{'script'}";
|
||||
$url .= "?login=";
|
||||
$url .= $config{$h}{'login'};
|
||||
$url .= "&password=";
|
||||
$url .= $config{$h}{'password'};
|
||||
$url .= "&host=";
|
||||
$url .= $h;
|
||||
$url .= "&myip=";
|
||||
$url .= $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);
|
||||
|
||||
# Response found
|
||||
if ($reply =~ /(\d+)=(.+)/)
|
||||
{
|
||||
$config{$h}{'ip'} = $ip;
|
||||
$config{$h}{'mtime'} = $now;
|
||||
$config{$h}{'status'} = 'good';
|
||||
success("updating %s: good: IP address set to %s", $h, $ip);
|
||||
}
|
||||
else
|
||||
{
|
||||
my @reply = split /\n/, $reply;
|
||||
my $returned = pop(@reply);
|
||||
$config{$h}{'status'} = 'failed';
|
||||
failed("updating %s: Server said: '$returned'", $h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# vim: ai ts=4 sw=4 tw=78 :
|
||||
|
||||
|
|
|
|||
|
|
@ -293,3 +293,11 @@ ssl=yes # use ssl-support. Works with
|
|||
# login=my-mydns.jp-login,
|
||||
# password=my-mydns.jp-password
|
||||
# myhost.mydns.jp
|
||||
|
||||
##
|
||||
## dnsexit (www.dnsexit.com)
|
||||
##
|
||||
#protocol=dnsexit
|
||||
#login=myusername
|
||||
#password=mypassword
|
||||
#subdomain-1.domain.com,subdomain-2.domain.com,subdomain-3.domain.com
|
||||
|
|
|
|||
Loading…
Reference in a new issue