Merge branch 'master' of github.com:okeeblow/ddclient

This commit is contained in:
Dave Smith 2019-09-12 09:55:51 -05:00
commit 01cf5bdd2d
No known key found for this signature in database
GPG key ID: 17ABEFC537939108
4 changed files with 110 additions and 1 deletions

View file

@ -29,6 +29,7 @@ Dynamic DNS services currently supported include:
Freemyip - See https://freemyip.com for details Freemyip - See https://freemyip.com for details
woima.fi - See https://woima.fi/ for details woima.fi - See https://woima.fi/ for details
Yandex - See https://domain.yandex.com/ for details Yandex - See https://domain.yandex.com/ for details
DNS Made Easy - See https://dnsmadeeasy.com/ for details
DDclient now supports many of cable/dsl broadband routers. 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: ssl support is tested on folowing dynamic dns providers:
- dyndns.com - dyndns.com
- freemyip.com - freemyip.com
- DNS Made Easy

100
ddclient
View file

@ -486,6 +486,10 @@ my %variables = (
'yandex-common-defaults' => { 'yandex-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'pddimp.yandex.ru', undef), 'server' => setv(T_FQDNP, 1, 0, 1, 'pddimp.yandex.ru', undef),
}, },
'dnsmadeeasy-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'cp.dnsmadeeasy.com', undef),
'script' => setv(T_STRING, 1, 1, 1, '/servlet/updateip', undef),
},
); );
my %services = ( my %services = (
'dyndns1' => { 'dyndns1' => {
@ -698,6 +702,15 @@ my %services = (
$variables{'service-common-defaults'}, $variables{'service-common-defaults'},
), ),
}, },
'dnsmadeeasy' => {
'updateable' => undef,
'update' => \&nic_dnsmadeeasy_update,
'examples' => \&nic_dnsmadeeasy_examples,
'variables' => merge(
$variables{'dnsmadeeasy-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'},
@ -4812,6 +4825,93 @@ sub nic_woima_update {
} }
} }
######################################################################
## nic_dnsmadeeasy_examples
######################################################################
sub nic_dnsmadeeasy_examples {
return <<EoEXAMPLE;
o 'dnsmadeeasy'
The 'dnsmadeeasy' protocol is used by the DNS Made Easy service at https://www.dnsmadeeasy.com.
API is documented here: https://dnsmadeeasy.com/technology/dynamic-dns/
Configuration variables applicable to the 'dnsmadeeasy' protocol are:
protocol=dnsmadeeasy ##
login=email-address ## Email address used to log in to your account.
password=dynamic-record-password ## Generated password for your dynamic DNS record.
record-id-1,record-id-2,... ## Numeric dynamic DNS record IDs, comma-separated if updating multiple.
Note: Dynamic record ID is generated when you create a new Dynamic DNS record in the DNS Made Easy control panel.
Example ${program}.conf file entries:
## single host update
protocol=dnsmadeeasy, \\
username=dme\@example.com, \\
password=myg3nerat3dp4ssword, \\
1007,1008
EoEXAMPLE
}
######################################################################
## nic_dnsmadeeasy_update
######################################################################
sub nic_dnsmadeeasy_update {
debug("\nnic_dnsmadeeasy_update -------------------");
my %messages = (
'error-auth' => 'Invalid username or password, or invalid IP syntax',
'error-auth-suspend' => 'User has had their account suspended due to complaints or misuse of the service.',
'error-auth-voided' => 'User has had their account permanently revoked.',
'error-record-invalid' =>'Record ID number does not exist in the system.',
'error-record-auth' => 'User does not have access to this record.',
'error-record-ip-same' => 'No update required.',
'error-system' => 'General system error which is caught and recognized by the system.',
'error' => 'General system error unrecognized by the system.',
'success' => 'Record successfully updated!',
);
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 to update
my $url;
$url = $globals{'ssl'} ? "https://" : "http://";
$url .= $config{$h}{'server'}.$config{$h}{'script'};
$url .= "?username=$config{$h}{'login'}";
$url .= "&password=$config{$h}{'password'}";
$url .= "&ip=$ip";
$url .= "&id=$h";
# 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 =~ 'success')
{
$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': $messages{$returned}", $h);
}
}
}
###################################################################### ######################################################################
# vim: ai ts=4 sw=4 tw=78 : # vim: ai ts=4 sw=4 tw=78 :

View file

@ -269,3 +269,10 @@ ssl=yes # use ssl-support. Works with
# login=domain.tld, \ # login=domain.tld, \
# 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)
##
# protocol=dnsmadeeasy,
# login=your-account-email-address
# password=your-generated-password
# your-numeric-record-id-1,your-numeric-record-id-2,...