From 2f7e8ee2368199c2df6e1826f00431ebbe654810 Mon Sep 17 00:00:00 2001 From: Allison Reid Date: Thu, 18 Oct 2018 04:44:21 -0700 Subject: [PATCH 1/2] Add support for DNS Made Easy (https://dnsmadeeasy.com) UPDATE: Updating 77282436 DEBUG: proxy = DEBUG: url = https://cp.dnsmadeeasy.com/servlet/updateip?username=xxx@xxx.org&password=xxxxxx&ip=192.168.43.239&id=77282436 DEBUG: server = cp.dnsmadeeasy.com CONNECT: cp.dnsmadeeasy.com CONNECTED: using SSL SENDING: GET /servlet/updateip?username=xxx@xxx.org&password=xxxxxxx&ip=192.168.43.239&id=77282436 HTTP/1.0 SENDING: Host: cp.dnsmadeeasy.com SENDING: User-Agent: ddclient/3.9.0 SENDING: Connection: close SENDING: SENDING: RECEIVE: HTTP/1.1 200 OK RECEIVE: Server: Apache-Coyote/1.1 RECEIVE: Pragma: No-cache RECEIVE: Cache-Control: no-cache RECEIVE: Expires: Thu, 01 Jan 1970 00:00:00 UTC RECEIVE: x-dnsme-requestId: 496b9516-44da-48fc-b750-256f191848f5 RECEIVE: Set-Cookie: JSESSIONID=17103D9DF72BB33118DD2177BD8813A0; Path=/; Secure; HttpOnly RECEIVE: Content-Type: text/plain RECEIVE: Date: Thu, 18 Oct 2018 11:41:45 GMT RECEIVE: Connection: close RECEIVE: RECEIVE: success SUCCESS: Updating 77282436: good: IP address set to 192.168.43.239 --- README.md | 41 ++++++++-------- README.ssl | 1 + ddclient | 100 +++++++++++++++++++++++++++++++++++++++ sample-etc_ddclient.conf | 9 ++++ 4 files changed, 131 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 055b3c3..6aed61c 100644 --- a/README.md +++ b/README.md @@ -8,26 +8,27 @@ on many dynamic DNS services. Dynamic DNS services currently supported include: - DynDNS.com - See http://www.dyndns.com for details on obtaining a free account. - Hammernode - See http://www.hn.org for details on obtaining a free account. - Zoneedit - See http://www.zoneedit.com for details. - EasyDNS - See http://www.easydns.com for details. - NameCheap - See http://www.namecheap.com for details - ConCont - See http://www.dydns.za.net for details - DnsPark - See http://www.dnspark.com for details - DslReports - See http://www.dslreports.com for details - Sitelutions - See http://www.sitelutions.com for details - 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 - nsupdate - See nsupdate(1) and ddns-confgen(8) for details - CloudFlare - See https://www.cloudflare.com/ for details - Google - See http://www.google.com/domains for details - Duckdns - See https://duckdns.org/ for details - Freemyip - See https://freemyip.com for details - woima.fi - See https://woima.fi/ for details + DynDNS.com - See http://www.dyndns.com for details on obtaining a free account. + Hammernode - See http://www.hn.org for details on obtaining a free account. + Zoneedit - See http://www.zoneedit.com for details. + EasyDNS - See http://www.easydns.com for details. + NameCheap - See http://www.namecheap.com for details + ConCont - See http://www.dydns.za.net for details + DnsPark - See http://www.dnspark.com for details + DslReports - See http://www.dslreports.com for details + Sitelutions - See http://www.sitelutions.com for details + 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 + nsupdate - See nsupdate(1) and ddns-confgen(8) for details + CloudFlare - See https://www.cloudflare.com/ for details + Google - See http://www.google.com/domains for details + Duckdns - See https://duckdns.org/ for details + Freemyip - See https://freemyip.com for details + woima.fi - See https://woima.fi/ for details + DNS Made Easy - See https://dnsmadeeasy.com/ for details DDclient now supports many of cable/dsl broadband routers. diff --git a/README.ssl b/README.ssl index ed8d19b..27b9f5b 100644 --- a/README.ssl +++ b/README.ssl @@ -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: - dyndns.com - freemyip.com +- DNS Made Easy diff --git a/ddclient b/ddclient index 5f65d95..af0ab26 100755 --- a/ddclient +++ b/ddclient @@ -483,6 +483,10 @@ my %variables = ( 'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef), 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, 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 = ( 'dyndns1' => { @@ -685,6 +689,15 @@ my %services = ( $variables{'woima-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{'service-common-defaults'}, @@ -4676,6 +4689,93 @@ sub nic_woima_update { } } +###################################################################### +## nic_dnsmadeeasy_examples +###################################################################### +sub nic_dnsmadeeasy_examples { + return < '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 : diff --git a/sample-etc_ddclient.conf b/sample-etc_ddclient.conf index 30b0ca4..ec6851b 100644 --- a/sample-etc_ddclient.conf +++ b/sample-etc_ddclient.conf @@ -240,3 +240,12 @@ ssl=yes # use ssl-support. Works with # login=your-myonlineportal-username # password=your-myonlineportal-password # domain.myonlineportal.net + +## +## 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,... From c771d3f81faf1dae40ed292bd15e823f7e873c6a Mon Sep 17 00:00:00 2001 From: okeeblow Date: Thu, 18 Oct 2018 05:07:26 -0700 Subject: [PATCH 2/2] Fix errant tabs in nic_dnsmadeeasy_update --- ddclient | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ddclient b/ddclient index af0ab26..97d4f46 100755 --- a/ddclient +++ b/ddclient @@ -4742,11 +4742,11 @@ sub nic_dnsmadeeasy_update { # Set the URL that we're going to to update my $url; - $url = $globals{'ssl'} ? "https://" : "http://"; + $url = $globals{'ssl'} ? "https://" : "http://"; $url .= $config{$h}{'server'}.$config{$h}{'script'}; - $url .= "?username=$config{$h}{'login'}"; + $url .= "?username=$config{$h}{'login'}"; $url .= "&password=$config{$h}{'password'}"; - $url .= "&ip=$ip"; + $url .= "&ip=$ip"; $url .= "&id=$h"; # Try to get URL