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

This commit is contained in:
Dave Smith 2019-09-12 10:25:59 -05:00
commit 9d2cdb9fb2
No known key found for this signature in database
GPG key ID: 17ABEFC537939108
5 changed files with 139 additions and 29 deletions

View file

@ -30,6 +30,7 @@ Dynamic DNS services currently supported include:
woima.fi - See https://woima.fi/ for details
Yandex - See https://domain.yandex.com/ for details
DNS Made Easy - See https://dnsmadeeasy.com/ for details
DonDominio - See https://www.dondominio.com for details
DDclient now supports many of cable/dsl broadband routers.
@ -40,19 +41,20 @@ The code was originally written by Paul Burry and is now hosted and maintained
through sourceforge.net. Please check out http://ddclient.sf.net
-------------------------------------------------------------------------------
REQUIREMENTS:
## REQUIREMENTS:
- one or more accounts from one of the dynamic DNS services
- Perl 5.014 or later
(you need the IO::Socket::SSL perl library for ssl-support,
JSON::PP perl library for JSON support and
IO::Socket:INET6 perl library for ipv6-support)
- `Data::Validate::IP` perl library
- `IO::Socket::SSL` perl library for ssl-support
- `JSON::PP` perl library for JSON support
- `IO::Socket:INET6` perl library for ipv6-support
- Linux or probably any common Unix system
-------------------------------------------------------------------------------
INSTALLATION:
## INSTALLATION:
cp ddclient /usr/sbin/
mkdir /etc/ddclient
@ -61,6 +63,13 @@ INSTALLATION:
vi /etc/ddclient/ddclient.conf
-- and change hostnames, logins, and passwords appropriately
## For those using systemd:
cp sample-etc_systemd.service /etc/systemd/system/ddclient.service
## enable automatic startup when booting
systemctl enable ddclient.service
## start the first time by hand
systemctl start ddclient.service
## For those using Redhat style rc files and using daemon-mode:
cp sample-etc_rc.d_init.d_ddclient /etc/rc.d/init.d/ddclient
## enable automatic startup when booting
@ -82,8 +91,10 @@ INSTALLATION:
cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient
## enable automatic startup when booting
update-rc.d ddclient defaults
## make sure you have perl installed
apt-get install perl
## make sure you have perl and the required modules installed
apt-get install perl libdata-validate-ip-perl
## if you plan to use cloudflare or feedns you need the perl json module
apt-get install libjson-any-perl
## start the first time by hand
service ddclient start
@ -91,7 +102,7 @@ INSTALLATION:
## as described below.
-------------------------------------------------------------------------------
TROUBLESHOOTING:
## TROUBLESHOOTING:
1. enable debugging and verbose messages.
``$ ddclient -daemon=0 -debug -verbose -noquiet``
@ -136,7 +147,7 @@ TROUBLESHOOTING:
while some others accept anything.
-------------------------------------------------------------------------------
USING DDCLIENT WITH ppp
## USING DDCLIENT WITH ppp
If you are using a ppp connection, you can easily update your DynDNS
entry with each connection, with:
@ -148,7 +159,7 @@ Alternatively, you may just configure ddclient to operate as a daemon
and monitor your ppp interface.
-------------------------------------------------------------------------------
USING DDCLIENT WITH cron
## USING DDCLIENT WITH cron
If you have not configured ddclient to use daemon-mode, you'll need to
configure cron to force an update once a month so that the dns entry will
@ -159,7 +170,7 @@ not become stale.
vi /etc/cron.d/ddclient
-------------------------------------------------------------------------------
USING DDCLIENT WITH dhcpcd-1.3.17
## USING DDCLIENT WITH dhcpcd-1.3.17
If you are using dhcpcd-1.3.17 or thereabouts, you can easily update
your DynDNS entry automatically every time your lease is obtained
@ -183,7 +194,7 @@ Alternatively, you may just configure ddclient to operate as a daemon
and monitor your ethernet interface.
-------------------------------------------------------------------------------
USING DDCLIENT WITH dhclient
## USING DDCLIENT WITH dhclient
If you are using the ISC DHCP client (dhclient), you can update
your DynDNS entry automatically every time your lease is obtained

View file

@ -10,3 +10,4 @@ ssl support is tested on folowing dynamic dns providers:
- dyndns.com
- freemyip.com
- DNS Made Easy
- dondominio.com

View file

@ -490,6 +490,9 @@ my %variables = (
'server' => setv(T_FQDNP, 1, 0, 1, 'cp.dnsmadeeasy.com', undef),
'script' => setv(T_STRING, 1, 1, 1, '/servlet/updateip', undef),
},
'dondominio-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'dondns.dondominio.com', undef),
},
);
my %services = (
'dyndns1' => {
@ -711,11 +714,20 @@ my %services = (
$variables{'service-common-defaults'},
),
},
'dondominio' => {
'updateable' => undef,
'update' => \&nic_dondominio_update,
'examples' => \&nic_dondominio_examples,
'variables' => merge(
$variables{'dondominio-common-defaults'},
$variables{'service-common-defaults'},
),
},
);
$variables{'merged'} = merge($variables{'global-defaults'},
$variables{'service-common-defaults'},
$variables{'dyndns-common-defaults'},
map { $services{$_}{'variables'} } keys %services,
$variables{'service-common-defaults'},
$variables{'dyndns-common-defaults'},
map { $services{$_}{'variables'} } keys %services,
);
my @opt = (
@ -4825,6 +4837,80 @@ sub nic_woima_update {
}
}
######################################################################
## nic_dondominio_examples
######################################################################
sub nic_dondominio_examples {
return <<EoEXAMPLE;
o 'dondominio'
The 'dondominio' protocol is used by DNS service offered by www.dondominio.com/ .
API information and user instructions available at: https://dev.dondominio.com/dondns/docs/api/
Configuration variables applicable to the 'dondominio' protocol are:
protocol=dondominio ##
login=service-login ## the username registered with the service
password=dondominio-apikey ## API key provided by dondominio -see link above-
fully.qualified.host ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=dondominio, \\
login=my-generated-user-name, \\
password=dondominio-apikey \\
myhost.tld
EoEXAMPLE
}
######################################################################
## nic_dondominio_examples
######################################################################
sub nic_dondominio_update {
debug("\nnic_duckdns_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'}/plain/";
$url .= "?user=";
$url .= $config{$h}{'login'};
$url .= "&password=";
$url .= $config{$h}{'password'};
$url .= "&host=";
$url .= $h;
$url .= "&ip=";
$url .= $ip if $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);
my @reply = split /\n/, $reply;
my $returned = pop(@reply);
if ($returned =~ /OK/) {
$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'", $h);
}
}
}
######################################################################
## nic_dnsmadeeasy_examples
######################################################################
@ -4871,6 +4957,8 @@ sub nic_dnsmadeeasy_update {
'success' => 'Record successfully updated!',
);
## 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);
@ -4912,7 +5000,6 @@ sub nic_dnsmadeeasy_update {
}
}
######################################################################
# vim: ai ts=4 sw=4 tw=78 :

View file

@ -0,0 +1,11 @@
[Unit]
Description=Dynamic DNS Update Client
After=network.target
[Service]
Type=forking
PIDFile=/var/run/ddclient.pid
ExecStart=/usr/sbin/ddclient
[Install]
WantedBy=multi-user.target

View file

@ -15,6 +15,6 @@
curl -s -H 'Content-Type: text/xml; charset="utf-8"' \
-H 'SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress' \
--data-binary '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" /></s:Body></s:Envelope>' \
http://169.254.1.1:49000/upnp/control/WANCommonIFC1 | \
sed -n -e 's#^.*<NewExternalIPAddress>\(.*\)</NewExternalIPAddress>.*$#\1#p'
-d '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" /></s:Body></s:Envelope>' \
'http://fritz.box:49000/igdupnp/control/WANIPConn1' | \
grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'