Commit 531e9be8 authored by Franco Fichtner's avatar Franco Fichtner

services/dnydns: support Duck DNS (#43)

parent 02d6fcf3
<?php
/*
* PHP.updateDNS (pfSense version)
* PHP.updateDNS (OPNsense version)
*
* +====================================================+
* Services Supported:
......@@ -29,7 +30,8 @@
* - CloudFlare (www.cloudflare.com)
* - Eurodns (eurodns.com)
* - GratisDNS (gratisdns.dk)
* - City Network (citynetwork.se)
* - City Network (citynetwork.se)
* - Duck DNS (duckdns.org)
* +----------------------------------------------------+
* Requirements:
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
......@@ -71,7 +73,8 @@
* Eurodns - Last Tested: 27 June 2013
* GratisDNS - Last Tested: 15 August 2012
* OVH DynHOST - Last Tested: NEVER
* City Network - Last Tested: 13 November 2013
* City Network - Last Tested: 13 November 2013
* Duck DNS - Last Tested: 04 March 2015
* +====================================================+
*
* @author E.Kristensen
......@@ -240,7 +243,8 @@
case 'eurodns':
case 'gratisdns':
case 'ovh-dynhost':
case 'citynetwork':
case 'citynetwork':
case 'duckdns':
$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.
......@@ -674,6 +678,14 @@
$port = ":" . $this->_dnsPort;
curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
break;
case 'duckdns':
$needsIP = FALSE;
if ($this->_dnsVerboseLog)
log_error("Duck DNS ({$this->_dnsHost}): DNS update() starting.");
$server = "https://www.duckdns.org/update";
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . $this->_dnsHost . '&token=' . $this->_dnsUser);
break;
default:
break;
}
......@@ -1185,6 +1197,16 @@
$this->_debug($data);
}
break;
case 'duckdns':
if (preg_match('/OK/i', $data)) {
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
$successful_update = true;
} else {
$status = "phpDynDNS: (Unknown Response)";
log_error("phpDynDNS: PAYLOAD: {$data}");
$this->_debug($data);
}
break;
}
if($successful_update == true) {
......
......@@ -1602,6 +1602,7 @@ function services_dyndns_list()
'dhs' => 'DHS',
'dnsexit' => 'DNSexit',
'dnsomatic' => 'DNS-O-Matic',
'duckdns' => 'Duck DNS',
'dyndns' => 'DynDNS (dynamic)',
'dyndns-static' => 'DynDNS (static)',
'dyndns-custom' => 'DynDNS (custom)',
......
......@@ -82,18 +82,20 @@ if ($_POST) {
/* input validation */
$reqdfields = array();
$reqdfieldsn = array();
$reqdfields = array("type");
$reqdfieldsn = array(gettext("Service type"));
$reqdfields = array('type');
$reqdfieldsn = array(gettext('Service type'));
if ($pconfig['type'] != 'custom' && $pconfig['type'] != 'custom-v6') {
$reqdfields[] = "host";
$reqdfieldsn[] = gettext("Hostname");
$reqdfields[] = "password";
$reqdfieldsn[] = gettext("Password");
$reqdfields[] = "username";
$reqdfieldsn[] = gettext("Username");
}else{
$reqdfields[] = "updateurl";
$reqdfieldsn[] = gettext("Update URL");
$reqdfields[] = 'host';
$reqdfieldsn[] = gettext('Hostname');
$reqdfields[] = 'username';
$reqdfieldsn[] = gettext('Username');
if ($pconfig['type'] != 'duckdns') {
$reqdfields[] = 'password';
$reqdfieldsn[] = gettext('Password');
}
} else {
$reqdfields[] = 'updateurl';
$reqdfieldsn[] = gettext('Update URL');
}
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
......@@ -363,6 +365,7 @@ include("head.inc");
<input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>" />
<br /><?= gettext("Username is required for all types except Namecheap, FreeDNS and Custom Entries.");?>
<br /><?= gettext("Route 53: Enter your Access Key ID.");?>
<br /><?= gettext("Duck DNS: Enter your Token.");?>
<br /><?= gettext("For Custom Entries, Username and Password represent HTTP Authentication username and passwords.");?>
</td>
</tr>
......@@ -373,6 +376,7 @@ include("head.inc");
<br />
<?=gettext("FreeDNS (freedns.afraid.org): Enter your \"Authentication Token\" provided by FreeDNS.");?>
<br /><?= gettext("Route 53: Enter your Secret Access Key.");?>
<br /><?= gettext("Duck DNS: Leave blank.");?>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment