Merge pull request #3811 from trunet/add-cloudns-to-dynamicdns

This commit is contained in:
Steve Beaver 2017-10-24 09:06:57 -04:00
commit 8d90095ae6
4 changed files with 66 additions and 4 deletions

View File

@ -62,6 +62,7 @@
* - DuiaDNS IPv6 (www.duiadns.net)
* - Hover (www.hover.com)
* - DreamHost DNS (www.dreamhost.com)
* - ClouDNS (www.cloudns.net)
* +----------------------------------------------------+
* Requirements:
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
@ -118,6 +119,7 @@
* Hover - Last Tested: 15 February 2017
* DreamHost - Last Tested: 30 April 2017
* DreamHost IPv6 - Not Yet Tested
* ClouDNS - Last Tested: 22 August 2017
* +====================================================+
*
* @author E.Kristensen
@ -226,6 +228,13 @@
if (!$dnsZoneID) $this->_error(8);
if (!$dnsTTL) $this->_error(9);
break;
case 'cloudns':
if (!$dnsUser) $this->_error(3);
if (!$dnsPass) $this->_error(4);
if (!$dnsHost) $this->_error(5);
if (!$dnsDomain) $this->_error(5);
if (!$dnsTTL) $this->_error(9);
break;
case 'custom':
if (!$dnsUpdateURL) $this->_error(7);
break;
@ -327,6 +336,7 @@
case 'spdyn':
case 'spdyn-v6':
case 'all-inkl':
case 'cloudns':
case 'hover':
$this->_update();
if ($this->_dnsDummyUpdateDone == true) {
@ -909,6 +919,36 @@
curl_setopt($ch, CURLOPT_URL, $server . $port);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
break;
case 'cloudns':
/* Uses ClouDNS REST API
Requires auth-id or sub-auth-id or sub-auth-user */
// Step 1: Find the Record ID
$url = 'https://api.cloudns.net/dns/records.json';
$post_data['auth-id'] = $this->_dnsUser;
$post_data['auth-password'] = $this->_dnsPass;
$post_data['domain-name'] = $this->_dnsDomain;
$post_data['host'] = $this->_dnsHost;
$post_data['type'] = 'a';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = json_decode(curl_exec($ch));
$recordID = key(get_object_vars($output));
// Step 2: Set the record
$needsIP = TRUE;
$url = 'https://api.cloudns.net/dns/mod-record.json';
$post_data = array();
$post_data['auth-id'] = $this->_dnsUser;
$post_data['auth-password'] = $this->_dnsPass;
$post_data['domain-name'] = $this->_dnsDomain;
$post_data['record-id'] = $recordID;
$post_data['host'] = $this->_dnsHost;
$post_data['record'] = $this->_dnsIP;
$post_data['ttl'] = $this->_dnsTTL;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
break;
default:
break;
}
@ -1768,6 +1808,14 @@
$this->_debug($data);
}
break;
case 'cloudns':
$result = json_decode($data, true);
if ($result['status'] == 'Success') {
$successful_update = true;
} else {
log_error($result['status'] . "(" . $result['statusDescription'] . ")");
}
break;
case 'dreamhost':
case 'dreamhost-v6':
$result = json_decode($data,true);

View File

@ -208,5 +208,5 @@ $factory_default_checkipservice = array(
"descr" => 'Default Check IP Service'
);
$dyndns_split_domain_types = array("namecheap", "cloudflare", "cloudflare-v6", "gratisdns");
$dyndns_split_domain_types = array("namecheap", "cloudflare", "cloudflare-v6", "gratisdns", "cloudns");
?>

View File

@ -23,8 +23,8 @@
* limitations under the License.
*/
define('DYNDNS_PROVIDER_VALUES', 'all-inkl citynetwork cloudflare cloudflare-v6 custom custom-v6 dnsexit dnsimple dnsmadeeasy dnsomatic dreamhost dreamhost-v6 duiadns duiadns-v6 dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns freedns-v6 glesys googledomains gratisdns he-net he-net-v6 he-net-tunnelbroker hover loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost spdyn spdyn-v6 zoneedit');
define('DYNDNS_PROVIDER_DESCRIPTIONS', 'All-Inkl.com,City Network,CloudFlare,CloudFlare (v6),Custom,Custom (v6),DNSexit,DNSimple,DNS Made Easy,DNS-O-Matic,DreamHost,Dreamhost (v6),DuiaDns.net,DuiaDns.net (v6),DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,freeDNS (v6),GleSYS,Google Domains,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Hover,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,SPDYN,SPDYN (v6),ZoneEdit');
define('DYNDNS_PROVIDER_VALUES', 'all-inkl citynetwork cloudflare cloudflare-v6 cloudns custom custom-v6 dnsexit dnsimple dnsmadeeasy dnsomatic dreamhost dreamhost-v6 duiadns duiadns-v6 dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns freedns-v6 glesys googledomains gratisdns he-net he-net-v6 he-net-tunnelbroker hover loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost spdyn spdyn-v6 zoneedit');
define('DYNDNS_PROVIDER_DESCRIPTIONS', 'All-Inkl.com,City Network,CloudFlare,CloudFlare (v6),ClouDNS,Custom,Custom (v6),DNSexit,DNSimple,DNS Made Easy,DNS-O-Matic,DreamHost,Dreamhost (v6),DuiaDns.net,DuiaDns.net (v6),DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,freeDNS (v6),GleSYS,Google Domains,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Hover,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,SPDYN,SPDYN (v6),ZoneEdit');
/* implement ipv6 route advertising daemon */
function services_radvd_configure($blacklist = array()) {

View File

@ -299,7 +299,7 @@ $group->setHelp('Enter the complete fully qualified domain name. Example: myhost
'he.net tunnelbroker: Enter the tunnel ID.%1$s' .
'GleSYS: Enter the record ID.%1$s' .
'DNSimple: Enter only the domain name.%1$s' .
'Namecheap, Cloudflare, GratisDNS, Hover: Enter the hostname and the domain separately, with the domain being the domain or subdomain zone being handled by the provider.', '<br />');
'Namecheap, Cloudflare, GratisDNS, Hover, ClouDNS: Enter the hostname and the domain separately, with the domain being the domain or subdomain zone being handled by the provider.', '<br />');
$section->add($group);
@ -487,6 +487,20 @@ events.push(function() {
hideInput('zoneid', true);
hideInput('ttl', true);
break;
case "cloudns":
hideGroupInput('domainname', false);
hideInput('resultmatch', true);
hideInput('updateurl', true);
hideInput('requestif', true);
hideCheckbox('curl_ipresolve_v4', true);
hideCheckbox('curl_ssl_verifypeer', true);
hideInput('host', false);
hideInput('mx', false);
hideCheckbox('wildcard', false);
hideCheckbox('proxied', true);
hideInput('zoneid', true);
hideInput('ttl', false);
break;
case 'dreamhost':
case 'dreamhost-v6':
hideGroupInput('domainname', true);