summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Dale <sdale@pfsense.org>2007-12-10 02:43:18 +0000
committerScott Dale <sdale@pfsense.org>2007-12-10 02:43:18 +0000
commit52e6fdfdaebeb754c5a6029c5a801756a7f9c835 (patch)
tree108cfc18a801442d002e89fe5027ca3ea35491cc
parentb875f3061a6591de849d8c01240cefaf359d13ac (diff)
downloadpfsense-52e6fdfdaebeb754c5a6029c5a801756a7f9c835.zip
pfsense-52e6fdfdaebeb754c5a6029c5a801756a7f9c835.tar.gz
Support DNS-O-Matic
-rw-r--r--etc/inc/dyndns.class63
-rwxr-xr-xusr/local/www/services_dyndns.php22
2 files changed, 65 insertions, 20 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index 1e08032..2041c33 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -118,7 +118,8 @@
if ($this->_detectChange() == FALSE) {
$this->_error(10);
} else {
- if ($this->_dnsService == 'dyndns' ||
+ if ($this->_dnsService == 'dnsomatic' ||
+ $this->_dnsService == 'dyndns' ||
$this->_dnsService == 'dyndns-static' ||
$this->_dnsService == 'dyndns-custom' ||
$this->_dnsService == 'dhs' ||
@@ -374,14 +375,36 @@
curl_close($ch);
$this->_checkStatus($data);
break;
- case 'staticcling':
- $needsIP = FALSE;
- curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
- $data = curl_exec($ch);
- if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch));
- curl_close($ch);
- $this->_checkStatus($data);
- break;
+ case 'staticcling':
+ $needsIP = FALSE;
+ curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
+ $data = curl_exec($ch);
+ if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch));
+ curl_close($ch);
+ $this->_checkStatus($data);
+ break;
+ case 'dnsomatic':
+
+ /* Example syntax
+ https://username:password@updates.dnsomatic.com/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
+ */
+
+ $needsIP = FALSE;
+ log_error("DNS-O-Matic: DNS update() starting.");
+ if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
+ $server = "https://" . $this->_dnsUser . ":" . $this->_dnsPass . "@updates.dnsomatic.com/nic/update?hostname=";
+ if($this->_dnsServer)
+ $server = $this->_dnsServer;
+ if($this->_dnsPort)
+ $port = ":" . $this->_dnsPort;
+ curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG');
+ $data = curl_exec($ch);
+ if (@curl_error($ch)) log_error("Request completed. DNS-O-Matic reported: " . curl_error($ch));
+ curl_close($ch);
+ $this->_checkStatus($data);
+ break;
default:
break;
}
@@ -396,6 +419,28 @@
log_error("DynDns: Current Service: {$this->_dnsService}");
$successful_update = false;
switch ($this->_dnsService) {
+ case 'dnsomatic':
+ if (preg_match('/badauth/i', $data)) {
+ $status = "DNS-O-Matic: The DNS-O-Matic username or password specified are incorrect. No updates will be distributed to services until this is resolved.";
+ } else if (preg_match('/notfqdn /i', $data)) {
+ $status = "DNS-O-Matic: The hostname specified is not a fully-qualified domain name. If no hostnames included, notfqdn will be returned once.";
+ } else if (preg_match('/nohost/i', $data)) {
+ $status = "DNS-O-Matic: The hostname passed could not be matched to any services configured. The service field will be blank in the return code.";
+ } else if (preg_match('/numhost/i', $data)) {
+ $status = "DNS-O-Matic: You may update up to 20 hosts. numhost is returned if you try to update more than 20 or update a round-robin.";
+ } else if (preg_match('/abuse/i', $data)) {
+ $status = "DNS-O-Matic: The hostname is blocked for update abuse.";
+ } else if (preg_match('/good/i', $data)) {
+ $status = "DNS-O-Matic: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
+ $successful_update = true;
+ } else if (preg_match('/dnserr/i', $data)) {
+ $status = "DNS-O-Matic: DNS error encountered. Stop updating for 30 minutes.";
+ } else {
+ $status = "DNS-O-Matic: (Unknown Response)";
+ log_error("DNS-O-Matic: PAYLOAD: {$data}");
+ $this->_debug($data);
+ }
+ break;
case 'dyndns':
if (preg_match('/notfqdn/i', $data)) {
$status = "phpDynDNS: (Error) Not A FQDN!";
diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php
index 856a378..b877358 100755
--- a/usr/local/www/services_dyndns.php
+++ b/usr/local/www/services_dyndns.php
@@ -178,8 +178,8 @@ function enable_change(enable_change) {
<td width="78%" class="vtable">
<select name="type" class="formselect" id="type">
<?php
- $types = explode(",", "DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit");
- $vals = explode(" ", "dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit");
+ $types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit");
+ $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit");
$j = 0; for ($j = 0; $j < count($vals); $j++): ?>
<option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['type']) echo "selected";?>>
<?=htmlspecialchars($types[$j]);?>
@@ -188,17 +188,17 @@ function enable_change(enable_change) {
</select></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq">Hostname</td>
+ <td width="22%" valign="top" class="vncellreq">Hostname/Interface</td>
<td width="78%" class="vtable">
<input name="host" type="text" class="formfld unknown" id="host" size="30" value="<?=htmlspecialchars($pconfig['host']);?>">
- <br>
- <span class="vexpl">
- <span class="red"><strong>Note:<br></strong>
- </span>
- Enter the complete host/domain name. example: myhost.dyndns.org
- </span>
- </td>
- </tr>
+ <br>
+ <span class="vexpl">
+ <span class="red"><strong>Note:<br></strong>
+ </span>
+ Enter the complete host/domain name. example: myhost.dyndns.org
+ </span>
+ </td>
+ </tr>
<tr>
<td width="22%" valign="top" class="vncell">MX</td>
<td width="78%" class="vtable">
OpenPOWER on IntegriCloud