r152 : Adding sha1-patch provided by pirast in [9742ac09]
r150 : Adding support for ChangeIP based on the patch from Michele Giorato http://sourceforge.net/p/ddclient/discussion/399428/thread/e85661ad/ r148 : Updated README file
This commit is contained in:
parent
d92ef5414b
commit
9de1d24873
3 changed files with 106 additions and 8 deletions
|
@ -20,6 +20,7 @@ Dynamic DNS services currently supported include:
|
|||
Loopia - See http://www.loopia.se for details
|
||||
Noip - See http://www.noip.com/ for details
|
||||
Freedns - See http://freedns.afraid.org/ for details
|
||||
ChangeIP - See http://www.changeip.com/ for details
|
||||
dtdns - See http://www.dtdns.com/ for details
|
||||
|
||||
DDclient now supports many of cable/dsl broadband routers.
|
||||
|
@ -169,4 +170,4 @@ Alternatively, you may just configure ddclient to operate as a daemon
|
|||
and monitor your ethernet interface.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
$Id: README.md 148 2013-04-28 14:28:00Z wimpunk $
|
||||
$Id: README.md 150 2013-04-28 14:55:34Z wimpunk $
|
||||
|
|
99
ddclient
99
ddclient
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl -w
|
||||
#!/usr/local/bin/perl -w
|
||||
######################################################################
|
||||
# $Id: ddclient 127 2011-07-11 20:21:28Z wimpunk $
|
||||
# $Id: ddclient 152 2013-05-14 19:10:05Z wimpunk $
|
||||
#
|
||||
# DDCLIENT - a Perl client for updating DynDNS information
|
||||
#
|
||||
|
@ -20,7 +20,7 @@ use Getopt::Long;
|
|||
use Sys::Hostname;
|
||||
use IO::Socket;
|
||||
|
||||
my ($VERSION) = q$Revision: 127 $ =~ /(\d+)/;
|
||||
my ($VERSION) = q$Revision: 152 $ =~ /(\d+)/;
|
||||
|
||||
my $version = "3.8.0-r". $VERSION;
|
||||
my $programd = $0;
|
||||
|
@ -554,6 +554,16 @@ my %services = (
|
|||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
'changeip' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_changeip_update,
|
||||
'examples' => \&nic_changeip_examples,
|
||||
'variables' => merge(
|
||||
{ 'server' => setv(T_FQDNP, 1, 0, 1, 'nic.changeip.com', undef) },
|
||||
{ 'min-interval' => setv(T_DELAY, 0, 0, 1, 0, interval('5m')),},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
'dtdns' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_dtdns_update,
|
||||
|
@ -1779,13 +1789,18 @@ EOM
|
|||
######################################################################
|
||||
sub load_sha1_support {
|
||||
my $sha1_loaded = eval {require Digest::SHA1};
|
||||
unless ($sha1_loaded) {
|
||||
my $sha_loaded = eval {require Digest::SHA};
|
||||
unless ($sha1_loaded || $sha_loaded) {
|
||||
fatal(<<"EOM");
|
||||
Error loading the Perl module Digest::SHA1 needed for freedns update.
|
||||
On Debian, the package libdigest-sha1-perl must be installed.
|
||||
Error loading the Perl module Digest::SHA1 or Digest::SHA needed for freedns update.
|
||||
On Debian, the package libdigest-sha1-perl or libdigest-sha-perl must be installed.
|
||||
EOM
|
||||
}
|
||||
import Digest::SHA1 (qw/sha1_hex/);
|
||||
if($sha1_loaded) {
|
||||
import Digest::SHA1 (qw/sha1_hex/);
|
||||
} elsif($sha_loaded) {
|
||||
import Digest::SHA (qw/sha1_hex/);
|
||||
}
|
||||
}
|
||||
######################################################################
|
||||
## geturl
|
||||
|
@ -3588,7 +3603,79 @@ sub nic_freedns_update {
|
|||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_changeip_examples
|
||||
######################################################################
|
||||
sub nic_changeip_examples {
|
||||
return <<EoEXAMPLE;
|
||||
|
||||
o 'changeip'
|
||||
|
||||
The 'changeip' protocol is used by DNS services offered by changeip.com.
|
||||
|
||||
Configuration variables applicable to the 'changeip' protocol are:
|
||||
protocol=changeip ##
|
||||
server=fqdn.of.service ## defaults to nic.changeip.com
|
||||
login=service-login ## login name and password registered with the service
|
||||
password=service-password ##
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=changeip, \\
|
||||
login=my-my-changeip.com-login, \\
|
||||
password=my-changeip.com-password \\
|
||||
myhost.changeip.org
|
||||
|
||||
EoEXAMPLE
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_changeip_update
|
||||
##
|
||||
## adapted by Michele Giorato
|
||||
##
|
||||
## https://nic.ChangeIP.com/nic/update?hostname=host.example.org&myip=66.185.162.19
|
||||
##
|
||||
######################################################################
|
||||
sub nic_changeip_update {
|
||||
|
||||
|
||||
debug("\nnic_changeip_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);
|
||||
|
||||
my $url;
|
||||
$url = "http://$config{$h}{'server'}/nic/update";
|
||||
$url .= "?hostname=$h";
|
||||
$url .= "&ip=";
|
||||
$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'});
|
||||
last;
|
||||
}
|
||||
last if !header_ok($h, $reply);
|
||||
|
||||
my @reply = split /\n/, $reply;
|
||||
if (grep /success/i, @reply) {
|
||||
$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';
|
||||
warning("SENT: %s", $url) unless opt('verbose');
|
||||
warning("REPLIED: %s", $reply);
|
||||
failed("updating %s: Invalid reply.", $h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_dtdns_examples
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
######################################################################
|
||||
##
|
||||
## $Id: sample-etc_ddclient.conf 125 2011-05-19 20:31:20Z wimpunk $
|
||||
## $Id: sample-etc_ddclient.conf 150 2013-04-28 14:55:34Z wimpunk $
|
||||
##
|
||||
## Define default global variables with lines like:
|
||||
## var=value [, var=value]*
|
||||
|
@ -178,6 +178,16 @@ ssl=yes # use ssl-support. Works with
|
|||
# password=my-loopia.se-password
|
||||
# my.domain.tld,other.domain.tld
|
||||
|
||||
##
|
||||
##
|
||||
## ChangeIP (changeip.com)
|
||||
##
|
||||
## single host update
|
||||
# protocol=changeip, \
|
||||
# login=my-my-changeip.com-login, \
|
||||
# password=my-changeip.com-password \
|
||||
# myhost.changeip.org
|
||||
|
||||
##
|
||||
## DtDNS (www.dtdns.com)
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue