summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/dyndns.class63
-rw-r--r--etc/inc/services.inc4
2 files changed, 55 insertions, 12 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index 2c6f944..9f54403 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -30,7 +30,8 @@
* - Eurodns (eurodns.com)
* - GratisDNS (gratisdns.dk)
* - City Network (citynetwork.se)
- * - GleSYS (glesys.com)
+ * - GleSYS (glesys.com)
+ * - DNSimple (dnsimple.com)
* +----------------------------------------------------+
* Requirements:
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
@@ -67,13 +68,14 @@
* HE.net Tunnel - Last Tested: 28 June 2011
* SelfHost - Last Tested: 26 December 2011
* Amazon Route 53 - Last tested: 01 April 2012
- * DNS-O-Matic - Last Tested: 9 September 2010
- * CloudFlare - Last Tested: 30 May 2013
- * Eurodns - Last Tested: 27 June 2013
- * GratisDNS - Last Tested: 15 August 2012
- * OVH DynHOST - Last Tested: NEVER
- * City Network - Last Tested: 13 November 2013
- * GleSYS - Last Tested: 3 February 2015
+ * DNS-O-Matic - Last Tested: 9 September 2010
+ * CloudFlare - Last Tested: 30 May 2013
+ * Eurodns - Last Tested: 27 June 2013
+ * GratisDNS - Last Tested: 15 August 2012
+ * OVH DynHOST - Last Tested: NEVER
+ * City Network - Last Tested: 13 November 2013
+ * GleSYS - Last Tested: 3 February 2015
+ * DNSimple - Last Tested: 09 February 2015
* +====================================================+
*
* @author E.Kristensen
@@ -243,7 +245,8 @@
case 'eurodns':
case 'gratisdns':
case 'ovh-dynhost':
- case 'citynetwork':
+ case 'citynetwork':
+ case 'dnsimple':
$this->_update();
if($this->_dnsDummyUpdateDone == true) {
// If a dummy update was needed, then sleep a while and do the update again to put the proper address back.
@@ -670,6 +673,21 @@
$port = ":" . $this->_dnsPort;
curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
break;
+ case 'dnsimple':
+ /* Uses DNSimple's REST API
+ Requires username and Account API token passed in header
+ Piggybacks on Route 53's ZoneID field for DNSimple record ID
+ Data sent as JSON */
+ $needsIP = TRUE;
+ $server = 'https://api.dnsimple.com/v1/domains/';
+ $token = $this->_dnsUser . ':' . $this->_dnsPass;
+ $jsondata = '{"record":{"content":"' . $this->_dnsIP . '","ttl":"' . $this->_dnsTTL . '"}}';
+ curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json','Content-Type: application/json','X-DNSimple-Token: ' . $token));
+ curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '/records/' . $this->_dnsZoneID);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $jsondata);
+ break;
default:
break;
}
@@ -1191,8 +1209,33 @@
$this->_debug($data);
}
break;
+ case 'dnsimple':
+ /* Responds with HTTP 200 on success.
+ Responds with HTTP 4xx on error.
+ Returns JSON data as body */
+ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $header = substr($data, 0, $header_size);
+ $body = substr($data, $header_size);
+ if (preg_match("/Status: 200\s/i", $header)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Success) IP Address Updated Successfully!";
+ $successful_update = true;
+ } else if (preg_match("/Status: 4\d\d\s/i", $header)) {
+ $arrbody = json_decode($body, true);
+ $message = $arrbody['message'] . ".";
+ if (isset($arrbody['errors']['content'])) {
+ foreach($arrbody['errors']['content'] as $key => $content) {
+ $message .= " " . $content . ".";
+ }
+ }
+ $status = "phpDynDNS ({$this->_dnsHost}): (Error) " . $message;
+ } else {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Unknown Response)";
+ log_error("phpDynDNS ({$this->_dnsHost}): PAYLOAD: {$body}");
+ $this->_debug($body);
+ }
+ break;
}
-
+
if($successful_update == true) {
/* Write WAN IP to cache file */
$wan_ip = $this->_checkIP();
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index c405ab2..1f5283a 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -38,8 +38,8 @@
pfSense_MODULE: utils
*/
-define('DYNDNS_PROVIDER_VALUES', 'citynetwork cloudflare custom custom-v6 dhs dnsexit dnsomatic dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns glesys gratisdns he-net he-net-v6 he-net-tunnelbroker loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost zoneedit');
-define('DYNDNS_PROVIDER_DESCRIPTIONS', 'City Network,CloudFlare,Custom,Custom (v6),DHS,DNSexit,DNS-O-Matic,DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,GleSYS,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,ZoneEdit');
+define('DYNDNS_PROVIDER_VALUES', 'citynetwork cloudflare custom custom-v6 dhs dnsexit dnsimple dnsomatic dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns glesys gratisdns he-net he-net-v6 he-net-tunnelbroker loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost zoneedit');
+define('DYNDNS_PROVIDER_DESCRIPTIONS', 'City Network,CloudFlare,Custom,Custom (v6),DHS,DNSexit,DNSimple,DNS-O-Matic,DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,GleSYS,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,ZoneEdit');
/* implement ipv6 route advertising daemon */
function services_radvd_configure($blacklist = array()) {
OpenPOWER on IntegriCloud