Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
5ab9881b4d
5 changed files with 135 additions and 15 deletions
|
|
@ -26,6 +26,7 @@ Dynamic DNS services currently supported include:
|
||||||
CloudFlare - See https://www.cloudflare.com/ for details
|
CloudFlare - See https://www.cloudflare.com/ for details
|
||||||
Google - See http://www.google.com/domains for details
|
Google - See http://www.google.com/domains for details
|
||||||
Duckdns - See https://duckdns.org/ for details
|
Duckdns - See https://duckdns.org/ 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
|
||||||
|
|
||||||
DDclient now supports many of cable/dsl broadband routers.
|
DDclient now supports many of cable/dsl broadband routers.
|
||||||
|
|
@ -43,7 +44,7 @@ REQUIREMENTS:
|
||||||
|
|
||||||
- Perl 5.014 or later
|
- Perl 5.014 or later
|
||||||
(you need the IO::Socket::SSL perl library for ssl-support,
|
(you need the IO::Socket::SSL perl library for ssl-support,
|
||||||
JSON::Any perl library for JSON support and
|
JSON::PP perl library for JSON support and
|
||||||
IO::Socket:INET6 perl library for ipv6-support)
|
IO::Socket:INET6 perl library for ipv6-support)
|
||||||
|
|
||||||
- Linux or probably any common Unix system
|
- Linux or probably any common Unix system
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,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
|
||||||
|
|
|
||||||
114
ddclient
114
ddclient
|
|
@ -487,6 +487,10 @@ my %variables = (
|
||||||
'server' => setv(T_FQDNP, 1, 0, 1, 'www.duckdns.org', undef),
|
'server' => setv(T_FQDNP, 1, 0, 1, 'www.duckdns.org', undef),
|
||||||
'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef),
|
'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef),
|
||||||
},
|
},
|
||||||
|
'freemyip-common-defaults' => {
|
||||||
|
'server' => setv(T_FQDNP, 1, 0, 1, 'freemyip.com', undef),
|
||||||
|
'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef),
|
||||||
|
},
|
||||||
'woima-common-defaults' => {
|
'woima-common-defaults' => {
|
||||||
'static' => setv(T_BOOL, 0, 1, 1, 0, undef),
|
'static' => setv(T_BOOL, 0, 1, 1, 0, undef),
|
||||||
'wildcard' => setv(T_BOOL, 0, 1, 1, 0, undef),
|
'wildcard' => setv(T_BOOL, 0, 1, 1, 0, undef),
|
||||||
|
|
@ -694,6 +698,15 @@ my %services = (
|
||||||
$variables{'service-common-defaults'},
|
$variables{'service-common-defaults'},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
'freemyip' => {
|
||||||
|
'updateable' => undef,
|
||||||
|
'update' => \&nic_freemyip_update,
|
||||||
|
'examples' => \&nic_freemyip_examples,
|
||||||
|
'variables' => merge(
|
||||||
|
$variables{'freemyip-common-defaults'},
|
||||||
|
$variables{'service-common-defaults'},
|
||||||
|
),
|
||||||
|
},
|
||||||
'woima' => {
|
'woima' => {
|
||||||
'updateable' => undef,
|
'updateable' => undef,
|
||||||
'update' => \&nic_woima_update,
|
'update' => \&nic_woima_update,
|
||||||
|
|
@ -2036,13 +2049,13 @@ EOM
|
||||||
## load_json_support
|
## load_json_support
|
||||||
######################################################################
|
######################################################################
|
||||||
sub load_json_support {
|
sub load_json_support {
|
||||||
my $json_loaded = eval {require JSON::Any};
|
my $json_loaded = eval {require JSON::PP};
|
||||||
unless ($json_loaded) {
|
unless ($json_loaded) {
|
||||||
fatal(<<"EOM");
|
fatal(<<"EOM");
|
||||||
Error loading the Perl module JSON::Any needed for cloudflare update.
|
Error loading the Perl module JSON::PP needed for cloudflare update.
|
||||||
EOM
|
EOM
|
||||||
}
|
}
|
||||||
import JSON::Any;
|
import JSON::PP (qw/decode_json/);
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
## geturl
|
## geturl
|
||||||
|
|
@ -3983,7 +3996,10 @@ EoEXAMPLE
|
||||||
##
|
##
|
||||||
######################################################################
|
######################################################################
|
||||||
sub nic_freedns_update {
|
sub nic_freedns_update {
|
||||||
|
|
||||||
|
|
||||||
debug("\nnic_freedns_update -------------------");
|
debug("\nnic_freedns_update -------------------");
|
||||||
|
|
||||||
## First get the list of updatable hosts
|
## First get the list of updatable hosts
|
||||||
my $url;
|
my $url;
|
||||||
# note, use '&v=2' in $url in order to pull IPv6 AAAA records as well as IPv4 A records
|
# note, use '&v=2' in $url in order to pull IPv6 AAAA records as well as IPv4 A records
|
||||||
|
|
@ -4561,9 +4577,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
my $response = JSON::Any->jsonToObj($reply);
|
my $response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4588,9 +4604,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
$response = JSON::Any->jsonToObj($reply);
|
$response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4614,9 +4630,9 @@ sub nic_cloudflare_update {
|
||||||
|
|
||||||
# Strip header
|
# Strip header
|
||||||
$reply =~ s/^.*?\n\n//s;
|
$reply =~ s/^.*?\n\n//s;
|
||||||
$response = JSON::Any->jsonToObj($reply);
|
$response = eval {decode_json($reply)};
|
||||||
if ($response->{result} eq 'error') {
|
if (!defined $response || !defined $response->{result}) {
|
||||||
failed ("%s", $response->{msg});
|
failed ("invalid json or result.");
|
||||||
} else {
|
} else {
|
||||||
success ("%s -- Updated Successfully to %s", $domain, $ip);
|
success ("%s -- Updated Successfully to %s", $domain, $ip);
|
||||||
|
|
||||||
|
|
@ -4710,6 +4726,80 @@ sub nic_duckdns_update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
## nic_freemyip_examples
|
||||||
|
######################################################################
|
||||||
|
sub nic_freemyip_examples {
|
||||||
|
return <<EoEXAMPLE;
|
||||||
|
o 'freemyip'
|
||||||
|
|
||||||
|
The 'freemyip' protocol is used by the free
|
||||||
|
dynamic DNS service available at freemyip.com.
|
||||||
|
API is documented here: https://freemyip.com/help.py
|
||||||
|
|
||||||
|
Configuration variables applicable to the 'freemyip' protocol are:
|
||||||
|
protocol=freemyip ##
|
||||||
|
password=service-token ## token for your domain
|
||||||
|
non-fully.qualified.host ## the host registered with the service.
|
||||||
|
|
||||||
|
Example ${program}.conf file entries:
|
||||||
|
## single host update
|
||||||
|
protocol=freemyip, \\
|
||||||
|
password=35a6b8d65c6e67c7f78cca65cd \\
|
||||||
|
myhost
|
||||||
|
|
||||||
|
EoEXAMPLE
|
||||||
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
## nic_freemyip_update
|
||||||
|
## by Cadence (reused code from nic_duckdns)
|
||||||
|
## http://freemyip.com/update?token=ec54b4b64db27fe8873c7f7&domain=myhost
|
||||||
|
## response contains OK or ERROR
|
||||||
|
######################################################################
|
||||||
|
sub nic_freemyip_update {
|
||||||
|
debug("\nnic_freemyip_update -------------------");
|
||||||
|
|
||||||
|
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 = "http://$config{$h}{'server'}/update";
|
||||||
|
$url .= "?token=";
|
||||||
|
$url .= $config{$h}{'password'};
|
||||||
|
$url .= "&domain=";
|
||||||
|
$url .= $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 =~ /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_woima_examples
|
## nic_woima_examples
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,14 @@ ssl=yes # use ssl-support. Works with
|
||||||
# password=my-auto-generated-password
|
# password=my-auto-generated-password
|
||||||
# protocol=duckdns hostwithoutduckdnsorg
|
# protocol=duckdns hostwithoutduckdnsorg
|
||||||
|
|
||||||
|
##
|
||||||
|
## Freemyip (http://freemyip.com/)
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# protocol=freemyip,
|
||||||
|
# password=my-token
|
||||||
|
# myhost
|
||||||
|
|
||||||
##
|
##
|
||||||
## MyOnlinePortal (http://myonlineportal.net)
|
## MyOnlinePortal (http://myonlineportal.net)
|
||||||
##
|
##
|
||||||
|
|
|
||||||
20
sample-get-ip-from-fritzbox
Executable file
20
sample-get-ip-from-fritzbox
Executable file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Scirpt to fetch IP from fritzbox
|
||||||
|
#
|
||||||
|
# Contributed by @Rusk85 in request #45
|
||||||
|
# Script can be used in the configuration by adding
|
||||||
|
#
|
||||||
|
# use=cmd, cmd=/etc/ddclient/get-ip-from-fritzbox
|
||||||
|
#
|
||||||
|
# All credits for this one liner go to the author of this blog:
|
||||||
|
# http://scytale.name/blog/2010/01/fritzbox-wan-ip
|
||||||
|
# As the author explains its not required to tamper with the provided IP for the FritzBox
|
||||||
|
# as it always binds to that address for UPnP.
|
||||||
|
# Disclaimer: It might be necessary to make the script executable
|
||||||
|
|
||||||
|
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'
|
||||||
Loading…
Reference in a new issue