Merge branch 'master' into SuperSandro2000-patch-1
This commit is contained in:
commit
3b37d3c78d
6 changed files with 307 additions and 34 deletions
46
README.md
46
README.md
|
@ -28,29 +28,32 @@ Dynamic DNS services currently supported include:
|
||||||
Duckdns - See https://duckdns.org/ for details
|
Duckdns - See https://duckdns.org/ for details
|
||||||
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
|
||||||
|
DonDominio - See https://www.dondominio.com for details
|
||||||
|
|
||||||
DDclient now supports many of cable/dsl broadband routers.
|
DDclient now supports many of cable/dsl broadband routers.
|
||||||
|
|
||||||
Comments, suggestions and requests: use the forums on
|
Comments, suggestions and requests: use the forums on
|
||||||
http://sourceforge.net/projects/ddclient/
|
http://sourceforge.net/projects/ddclient/
|
||||||
|
|
||||||
The code was originally written by Paul Burry and is now hosted and maintained
|
The code was originally written by Paul Burry and is now hosted and maintained
|
||||||
through sourceforge.net. Please check out http://ddclient.sf.net
|
through sourceforge.net. Please check out http://ddclient.sf.net
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
REQUIREMENTS:
|
## REQUIREMENTS:
|
||||||
|
|
||||||
- one or more accounts from one of the dynamic DNS services
|
- one or more accounts from one of the dynamic DNS services
|
||||||
|
|
||||||
- Perl 5.014 or later
|
- Perl 5.014 or later
|
||||||
(you need the IO::Socket::SSL perl library for ssl-support,
|
- `Data::Validate::IP` perl library
|
||||||
JSON::PP perl library for JSON support and
|
- `IO::Socket::SSL` perl library for ssl-support
|
||||||
IO::Socket:INET6 perl library for ipv6-support)
|
- `JSON::PP` perl library for JSON support
|
||||||
|
- `IO::Socket:INET6` perl library for ipv6-support
|
||||||
|
|
||||||
- Linux or probably any common Unix system
|
- Linux or probably any common Unix system
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
INSTALLATION:
|
## INSTALLATION:
|
||||||
|
|
||||||
cp ddclient /usr/sbin/
|
cp ddclient /usr/sbin/
|
||||||
mkdir /etc/ddclient
|
mkdir /etc/ddclient
|
||||||
|
@ -59,6 +62,13 @@ INSTALLATION:
|
||||||
vi /etc/ddclient/ddclient.conf
|
vi /etc/ddclient/ddclient.conf
|
||||||
-- and change hostnames, logins, and passwords appropriately
|
-- 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:
|
## 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
|
cp sample-etc_rc.d_init.d_ddclient /etc/rc.d/init.d/ddclient
|
||||||
## enable automatic startup when booting
|
## enable automatic startup when booting
|
||||||
|
@ -91,7 +101,7 @@ INSTALLATION:
|
||||||
## as described below.
|
## as described below.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
TROUBLESHOOTING:
|
## TROUBLESHOOTING:
|
||||||
|
|
||||||
1. enable debugging and verbose messages.
|
1. enable debugging and verbose messages.
|
||||||
``$ ddclient -daemon=0 -debug -verbose -noquiet``
|
``$ ddclient -daemon=0 -debug -verbose -noquiet``
|
||||||
|
@ -111,10 +121,10 @@ TROUBLESHOOTING:
|
||||||
``fw=url-to-your-router``'s-status-page
|
``fw=url-to-your-router``'s-status-page
|
||||||
``fw-skip=any-string-preceding-your-IP-address``
|
``fw-skip=any-string-preceding-your-IP-address``
|
||||||
|
|
||||||
ddclient does something like this to provide builtin support for
|
ddclient does something like this to provide builtin support for
|
||||||
common routers.
|
common routers.
|
||||||
For example, the Linksys routers could have been added with:
|
For example, the Linksys routers could have been added with:
|
||||||
|
|
||||||
fw=192.168.1.1/Status.htm
|
fw=192.168.1.1/Status.htm
|
||||||
fw-skip=WAN.*?IP Address
|
fw-skip=WAN.*?IP Address
|
||||||
|
|
||||||
|
@ -136,7 +146,7 @@ TROUBLESHOOTING:
|
||||||
while some others accept anything.
|
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
|
If you are using a ppp connection, you can easily update your DynDNS
|
||||||
entry with each connection, with:
|
entry with each connection, with:
|
||||||
|
@ -148,7 +158,7 @@ Alternatively, you may just configure ddclient to operate as a daemon
|
||||||
and monitor your ppp interface.
|
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
|
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
|
configure cron to force an update once a month so that the dns entry will
|
||||||
|
@ -159,7 +169,7 @@ not become stale.
|
||||||
vi /etc/cron.d/ddclient
|
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
|
If you are using dhcpcd-1.3.17 or thereabouts, you can easily update
|
||||||
your DynDNS entry automatically every time your lease is obtained
|
your DynDNS entry automatically every time your lease is obtained
|
||||||
|
@ -173,19 +183,19 @@ In my case, it is named dhcpcd-eth0.exe and contains the lines:
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
PATH=/usr/sbin:/root/bin:${PATH}
|
PATH=/usr/sbin:/root/bin:${PATH}
|
||||||
logger -t dhcpcd IP address changed to $1
|
logger -t dhcpcd IP address changed to $1
|
||||||
ddclient -proxy fasthttp.sympatico.ca -wildcard -ip $1 | logger -t ddclient
|
ddclient -proxy fasthttp.sympatico.ca -wildcard -ip $1 | logger -t ddclient
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
Other DHCP clients may have another method of calling out to programs
|
Other DHCP clients may have another method of calling out to programs
|
||||||
for updating DNS entries.
|
for updating DNS entries.
|
||||||
|
|
||||||
Alternatively, you may just configure ddclient to operate as a daemon
|
Alternatively, you may just configure ddclient to operate as a daemon
|
||||||
and monitor your ethernet interface.
|
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
|
If you are using the ISC DHCP client (dhclient), you can update
|
||||||
your DynDNS entry automatically every time your lease is obtained
|
your DynDNS entry automatically every time your lease is obtained
|
||||||
or renewed by creating an executable file named:
|
or renewed by creating an executable file named:
|
||||||
/etc/dhclient-exit-hooks
|
/etc/dhclient-exit-hooks
|
||||||
|
|
|
@ -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
|
||||||
|
- dondominio.com
|
||||||
|
|
246
ddclient
246
ddclient
|
@ -483,6 +483,12 @@ my %variables = (
|
||||||
'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
|
'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
|
||||||
'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
|
'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
|
||||||
},
|
},
|
||||||
|
'yandex-common-defaults' => {
|
||||||
|
'server' => setv(T_FQDNP, 1, 0, 1, 'pddimp.yandex.ru', undef),
|
||||||
|
},
|
||||||
|
'dondominio-common-defaults' => {
|
||||||
|
'server' => setv(T_FQDNP, 1, 0, 1, 'dondns.dondominio.com', undef),
|
||||||
|
},
|
||||||
);
|
);
|
||||||
my %services = (
|
my %services = (
|
||||||
'dyndns1' => {
|
'dyndns1' => {
|
||||||
|
@ -685,11 +691,30 @@ my %services = (
|
||||||
$variables{'woima-service-common-defaults'},
|
$variables{'woima-service-common-defaults'},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
'yandex' => {
|
||||||
|
'updateable' => undef,
|
||||||
|
'update' => \&nic_yandex_update,
|
||||||
|
'examples' => \&nic_yandex_examples,
|
||||||
|
'variables' => merge(
|
||||||
|
{ 'min-interval' => setv(T_DELAY, 0, 0, 1, interval('5m'), 0),},
|
||||||
|
$variables{'yandex-common-defaults'},
|
||||||
|
$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{'merged'} = merge($variables{'global-defaults'},
|
||||||
$variables{'service-common-defaults'},
|
$variables{'service-common-defaults'},
|
||||||
$variables{'dyndns-common-defaults'},
|
$variables{'dyndns-common-defaults'},
|
||||||
map { $services{$_}{'variables'} } keys %services,
|
map { $services{$_}{'variables'} } keys %services,
|
||||||
);
|
);
|
||||||
|
|
||||||
my @opt = (
|
my @opt = (
|
||||||
|
@ -2009,16 +2034,23 @@ sub geturl {
|
||||||
verbose("CONNECT:", "%s", $to);
|
verbose("CONNECT:", "%s", $to);
|
||||||
|
|
||||||
$request = "$method ";
|
$request = "$method ";
|
||||||
$request .= "http://$server" if $proxy;
|
if (!$use_ssl) {
|
||||||
|
$request .= "http://$server" if $proxy;
|
||||||
|
} else {
|
||||||
|
$request .= "https://$server" if $proxy;
|
||||||
|
}
|
||||||
$request .= "/$url HTTP/1.0\n";
|
$request .= "/$url HTTP/1.0\n";
|
||||||
$request .= "Host: $server\n";
|
$request .= "Host: $server\n";
|
||||||
|
|
||||||
my $auth = encode_base64("${login}:${password}", "");
|
my $auth = encode_base64("${login}:${password}", "");
|
||||||
$request .= "Authorization: Basic $auth\n" if $login || $password;
|
$request .= "Authorization: Basic $auth\n" if $login || $password;
|
||||||
$request .= "User-Agent: ${program}/${version}\n";
|
$request .= "User-Agent: ${program}/${version}\n";
|
||||||
|
if ($data) {
|
||||||
|
$request .= "Content-Type: application/x-www-form-urlencoded\n" if ! $headers =~ /^Content-Type: /;
|
||||||
|
$request .= "Content-Length: " . length($data) . "\n";
|
||||||
|
}
|
||||||
$request .= "Connection: close\n";
|
$request .= "Connection: close\n";
|
||||||
$request .= "$headers\n";
|
$request .= "$headers\n";
|
||||||
$request .= "Content-Length: ".length($data)."\n" if $data;
|
|
||||||
$request .= "\n";
|
$request .= "\n";
|
||||||
$request .= $data;
|
$request .= $data;
|
||||||
|
|
||||||
|
@ -3600,12 +3632,12 @@ Configuration variables applicable to the 'namecheap' protocol are:
|
||||||
server=fqdn.of.service ## defaults to dynamicdns.park-your-domain.com
|
server=fqdn.of.service ## defaults to dynamicdns.park-your-domain.com
|
||||||
login=service-login ## login name and password registered with the service
|
login=service-login ## login name and password registered with the service
|
||||||
password=service-password ##
|
password=service-password ##
|
||||||
hostname ## the hostname to update.
|
fully.qualified.host ## the hostname to update.
|
||||||
|
|
||||||
Example ${program}.conf file entries:
|
Example ${program}.conf file entries:
|
||||||
## single host update
|
## single host update
|
||||||
protocol=namecheap, \\
|
protocol=namecheap \\
|
||||||
login=my-namecheap.com-login, \\
|
login=my-namecheap.com-login \\
|
||||||
password=my-namecheap.com-password \\
|
password=my-namecheap.com-password \\
|
||||||
myhost
|
myhost
|
||||||
|
|
||||||
|
@ -3630,15 +3662,17 @@ sub nic_namecheap_update {
|
||||||
|
|
||||||
## update each configured host
|
## update each configured host
|
||||||
foreach my $h (@_) {
|
foreach my $h (@_) {
|
||||||
my $ip = delete $config{$h}{'wantip'};
|
my $ip = delete $config{$h}{'wantip'};
|
||||||
info("setting IP address to %s for %s", $ip, $h);
|
info("setting IP address to %s for %s", $ip, $h);
|
||||||
verbose("UPDATE:","updating %s", $h);
|
verbose("UPDATE:","updating %s", $h);
|
||||||
|
|
||||||
my $url;
|
my $url;
|
||||||
$url = "https://$config{$h}{'server'}/update";
|
$url = "https://$config{$h}{'server'}/update";
|
||||||
my $domain = $config{$h}{'login'};
|
my $domain = $config{$h}{'login'};
|
||||||
$url .= "?host=$h";
|
my $host = $h;
|
||||||
$url .= "&domain=$domain";
|
$host =~ s/(.*)\.$domain(.*)/$1$2/;
|
||||||
|
$url .= "?host=$host";
|
||||||
|
$url .= "&domain=$domain";
|
||||||
$url .= "&password=$config{$h}{'password'}";
|
$url .= "&password=$config{$h}{'password'}";
|
||||||
$url .= "&ip=";
|
$url .= "&ip=";
|
||||||
$url .= $ip if $ip;
|
$url .= $ip if $ip;
|
||||||
|
@ -4346,6 +4380,120 @@ sub nic_cloudflare_update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
######################################################################
|
||||||
|
## nic_yandex_examples
|
||||||
|
######################################################################
|
||||||
|
sub nic_yandex_examples {
|
||||||
|
return <<EoEXAMPLE;
|
||||||
|
o Yandex
|
||||||
|
|
||||||
|
The 'yandex' protocol is used to by DNS service offered by Yandex.
|
||||||
|
|
||||||
|
Configuration variables applicable to the 'yandex' protocol are:
|
||||||
|
protocol=yandex ##
|
||||||
|
server=fqdn.of.service ## defaults to pddimp.yandex.ru
|
||||||
|
login=dns.zone ## Your zone name
|
||||||
|
password=pdd-token ## PDD token for authentication
|
||||||
|
fully.qualified.host ## the host registered with the service.
|
||||||
|
|
||||||
|
Example ${program}.conf file entries:
|
||||||
|
## single host update
|
||||||
|
protocol=yandex, \\
|
||||||
|
login=myhost.com, \\
|
||||||
|
password=123456789ABCDEF0000000000000000000000000000000000000 \\
|
||||||
|
record.myhost.com
|
||||||
|
|
||||||
|
## multiple host update
|
||||||
|
protocol=yandex, \\
|
||||||
|
login=myhost.com, \\
|
||||||
|
password=123456789ABCDEF0000000000000000000000000000000000000 \\
|
||||||
|
record.myhost.com,other.myhost.com
|
||||||
|
EoEXAMPLE
|
||||||
|
}
|
||||||
|
######################################################################
|
||||||
|
## nic_yandex_update
|
||||||
|
##
|
||||||
|
## written by Denis Akimkin
|
||||||
|
##
|
||||||
|
######################################################################
|
||||||
|
sub nic_yandex_update {
|
||||||
|
debug("\nnic_yandex_update -------------------");
|
||||||
|
|
||||||
|
## group hosts with identical attributes together
|
||||||
|
my %groups = group_hosts_by([ @_ ], [ qw(server login pasword) ]);
|
||||||
|
|
||||||
|
## update each set of hosts that had similar configurations
|
||||||
|
foreach my $sig (keys %groups) {
|
||||||
|
my @hosts = @{$groups{$sig}};
|
||||||
|
my $key = $hosts[0];
|
||||||
|
my $ip = $config{$key}{'wantip'};
|
||||||
|
my $headers = 'PddToken: ' . $config{$key}{'password'};
|
||||||
|
|
||||||
|
# FQDNs
|
||||||
|
for my $host (@hosts) {
|
||||||
|
delete $config{$host}{'wantip'};
|
||||||
|
|
||||||
|
info("setting IP address to %s for %s", $ip, $host);
|
||||||
|
verbose("UPDATE:","updating %s", $host);
|
||||||
|
|
||||||
|
# Get record ID for host
|
||||||
|
my $url = "https://$config{$host}{'server'}/api2/admin/dns/list?";
|
||||||
|
$url .= "domain=";
|
||||||
|
$url .= $config{$key}{'login'};
|
||||||
|
my $reply = geturl(opt('proxy'), $url, '', '', $headers);
|
||||||
|
unless ($reply) {
|
||||||
|
failed("updating %s: Could not connect to %s.", $host, $config{$key}{'server'});
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
last if !header_ok($host, $reply);
|
||||||
|
|
||||||
|
# Strip header
|
||||||
|
$reply =~ s/^.*?\n\n//s;
|
||||||
|
my $response = JSON::Any->jsonToObj($reply);
|
||||||
|
if ($response->{success} eq 'error') {
|
||||||
|
failed ("%s", $response->{error});
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pull the ID out of the json
|
||||||
|
my ($id) = map { $_->{fqdn} eq $host ? $_->{record_id} : () } @{ $response->{records} };
|
||||||
|
unless($id) {
|
||||||
|
failed("updating %s: DNS record ID not found.", $host);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update the DNS record
|
||||||
|
$url = "https://$config{$host}{'server'}/api2/admin/dns/edit";
|
||||||
|
my $data = "domain=";
|
||||||
|
$data .= $config{$key}{'login'};
|
||||||
|
$data .= "&record_id=";
|
||||||
|
$data .= $id;
|
||||||
|
$data .= "&content=";
|
||||||
|
$data .= $ip if $ip;
|
||||||
|
|
||||||
|
$reply = geturl(opt('proxy'), $url, '', '', $headers, 'POST', $data);
|
||||||
|
unless ($reply) {
|
||||||
|
failed("updating %s: Could not connect to %s.", $host, $config{$host}{'server'});
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
last if !header_ok($host, $reply);
|
||||||
|
|
||||||
|
# Strip header
|
||||||
|
$reply =~ s/^.*?\n\n//s;
|
||||||
|
$response = JSON::Any->jsonToObj($reply);
|
||||||
|
if ($response->{success} eq 'error') {
|
||||||
|
failed ("%s", $response->{error});
|
||||||
|
} else {
|
||||||
|
success ("%s -- Updated Successfully to %s", $host, $ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
$config{$host}{'ip'} = $ip;
|
||||||
|
$config{$host}{'mtime'} = $now;
|
||||||
|
$config{$host}{'status'} = 'good';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## nic_duckdns_examples
|
## nic_duckdns_examples
|
||||||
|
@ -4676,6 +4824,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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# vim: ai ts=4 sw=4 tw=78 :
|
# vim: ai ts=4 sw=4 tw=78 :
|
||||||
|
|
|
@ -161,7 +161,7 @@ ssl=yes # use ssl-support. Works with
|
||||||
# server=dynamicdns.park-your-domain.com, \
|
# server=dynamicdns.park-your-domain.com, \
|
||||||
# login=my-namecheap.com-login, \
|
# login=my-namecheap.com-login, \
|
||||||
# password=my-namecheap.com-password \
|
# password=my-namecheap.com-password \
|
||||||
# myhost.namecheap.com
|
# fully.qualified.host
|
||||||
|
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
|
@ -240,3 +240,32 @@ ssl=yes # use ssl-support. Works with
|
||||||
# login=your-myonlineportal-username
|
# login=your-myonlineportal-username
|
||||||
# password=your-myonlineportal-password
|
# password=your-myonlineportal-password
|
||||||
# domain.myonlineportal.net
|
# domain.myonlineportal.net
|
||||||
|
|
||||||
|
##
|
||||||
|
## nsupdate.info IPV4(https://www.nsupdate.info)
|
||||||
|
##
|
||||||
|
#protocol=dyndns2
|
||||||
|
#use=web, web=http://ipv4.nsupdate.info/myip
|
||||||
|
#server=ipv4.nsupdate.info
|
||||||
|
#login=domain.nsupdate.info
|
||||||
|
#password='123'
|
||||||
|
#domain.nsupdate.info
|
||||||
|
|
||||||
|
##
|
||||||
|
## nsupdate.info IPV6 (https://www.nsupdate.info)
|
||||||
|
## ddclient releases <= 3.8.1 do not support IPv6
|
||||||
|
##
|
||||||
|
#protocol=dyndns2
|
||||||
|
#usev6=if, if=eth0
|
||||||
|
#server=ipv6.nsupdate.info
|
||||||
|
#login=domain.nsupdate.info
|
||||||
|
#password='123'
|
||||||
|
#domain.nsupdate.info
|
||||||
|
|
||||||
|
##
|
||||||
|
## Yandex.Mail for Domain (domain.yandex.com)
|
||||||
|
##
|
||||||
|
# protocol=yandex, \
|
||||||
|
# login=domain.tld, \
|
||||||
|
# password=yandex-pdd-token \
|
||||||
|
# my.domain.tld,other.domain.tld \
|
||||||
|
|
11
sample-etc_systemd.service
Normal file
11
sample-etc_systemd.service
Normal 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
|
|
@ -15,6 +15,6 @@
|
||||||
|
|
||||||
curl -s -H 'Content-Type: text/xml; charset="utf-8"' \
|
curl -s -H 'Content-Type: text/xml; charset="utf-8"' \
|
||||||
-H 'SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress' \
|
-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>' \
|
-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://169.254.1.1:49000/upnp/control/WANCommonIFC1 | \
|
'http://fritz.box:49000/igdupnp/control/WANIPConn1' | \
|
||||||
sed -n -e 's#^.*<NewExternalIPAddress>\(.*\)</NewExternalIPAddress>.*$#\1#p'
|
grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
|
||||||
|
|
Loading…
Reference in a new issue