summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2013-06-03 00:03:27 -0700
committerErmal Luçi <eri@pfsense.org>2013-06-03 00:03:27 -0700
commit33682de2e2f59ecefc171fc42820d77ede4efde6 (patch)
treeba2be0a2ae660243575a43cf5e2ad19af39851b7
parent91523382a317784eeef6da2739cd0e12ec35a64f (diff)
parentaa79f3518283d82e03a745702ff51ba04c200acb (diff)
downloadpfsense-33682de2e2f59ecefc171fc42820d77ede4efde6.zip
pfsense-33682de2e2f59ecefc171fc42820d77ede4efde6.tar.gz
Merge pull request #664 from chrostek/master
Added CURL options to custom DynDNS
-rw-r--r--etc/inc/dyndns.class12
-rw-r--r--etc/inc/services.inc4
-rw-r--r--usr/local/www/services_dyndns_edit.php16
3 files changed, 30 insertions, 2 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index ff72bd8..014721d 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -99,6 +99,8 @@
var $_dnsRequestIf;
var $_dnsRequestIfIP;
var $_dnsVerboseLog;
+ var $_curlIpresolveV4;
+ var $_curlSslVerifypeer;
var $_dnsMaxCacheAgeDays;
var $_dnsDummyUpdateDone;
var $_forceUpdateNeeded;
@@ -116,13 +118,15 @@
$dnsWildcard = 'OFF', $dnsMX = '', $dnsIf = '', $dnsBackMX = '',
$dnsServer = '', $dnsPort = '', $dnsUpdateURL = '', $forceUpdate = false,
$dnsZoneID ='', $dnsTTL='', $dnsResultMatch = '', $dnsRequestIf = '',
- $dnsID = '', $dnsVerboseLog = false) {
+ $dnsID = '', $dnsVerboseLog = false, $curlIpresolveV4 = false, $curlSslVerifypeer = true) {
global $config, $g;
$this->_cacheFile = "{$g['conf_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.cache";
$this->_debugFile = "{$g['varetc_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.debug";
+ $this->_curlIpresolveV4 = $curlIpresolveV4;
+ $this->_curlSslVerifypeer = $curlSslVerifypeer;
$this->_dnsVerboseLog = $dnsVerboseLog;
if ($this->_dnsVerboseLog)
log_error("DynDns: updatedns() starting");
@@ -569,6 +573,12 @@
log_error("Custom DDNS ({$this->_dnsHost}): DNS update() starting.");
if (strstr($this->dnsUpdateURL, "%IP%")) {$needsIP = TRUE;} else {$needsIP = FALSE;}
if ($this->_dnsUser != '') {
+ if ($this->_curlIpresolveV4)
+ curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
+ if ($this->_curlSslVerifypeer)
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
+ else
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "{$this->_dnsUser}:{$this->_dnsPass}");
}
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index dbffe39..95e9264 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1549,7 +1549,9 @@ function services_dyndns_configure_client($conf) {
$dnsResultMatch = "{$conf['resultmatch']}",
$dnsRequestIf = "{$conf['requestif']}",
$dnsID = "{$conf['id']}",
- $dnsVerboseLog = $conf['verboselog']);
+ $dnsVerboseLog = $conf['verboselog'],
+ $curlIpresolveV4 = $conf['curl_ipresolve_v4'],
+ $curlSslVerifypeer = $conf['curl_ssl_verifypeer']);
}
function services_dyndns_configure($int = "") {
diff --git a/usr/local/www/services_dyndns_edit.php b/usr/local/www/services_dyndns_edit.php
index 75dde35..f48cb90 100644
--- a/usr/local/www/services_dyndns_edit.php
+++ b/usr/local/www/services_dyndns_edit.php
@@ -70,6 +70,8 @@ if (isset($id) && isset($a_dyndns[$id])) {
$pconfig['interface'] = $a_dyndns[$id]['interface'];
$pconfig['wildcard'] = isset($a_dyndns[$id]['wildcard']);
$pconfig['verboselog'] = isset($a_dyndns[$id]['verboselog']);
+ $pconfig['curl_ipresolve_v4'] = isset($a_dyndns[$id]['curl_ipresolve_v4']);
+ $pconfig['curl_ssl_verifypeer'] = isset($a_dyndns[$id]['curl_ssl_verifypeer']);
$pconfig['zoneid'] = $a_dyndns[$id]['zoneid'];
$pconfig['ttl'] = isset($a_dyndns[$id]['ttl']);
$pconfig['updateurl'] = $a_dyndns[$id]['updateurl'];
@@ -119,6 +121,8 @@ if ($_POST) {
$dyndns['mx'] = $_POST['mx'];
$dyndns['wildcard'] = $_POST['wildcard'] ? true : false;
$dyndns['verboselog'] = $_POST['verboselog'] ? true : false;
+ $dyndns['curl_ipresolve_v4'] = $_POST['curl_ipresolve_v4'] ? true : false;
+ $dyndns['curl_ssl_verifypeer'] = $_POST['curl_ssl_verifypeer'] ? true : false;
/* In this place enable means disabled */
if ($_POST['enable'])
unset($dyndns['enable']);
@@ -175,6 +179,7 @@ function _onTypeChange(type){
document.getElementById("_resulttr").style.display = '';
document.getElementById("_urltr").style.display = '';
document.getElementById("_requestiftr").style.display = '';
+ document.getElementById("_curloptions").style.display = '';
document.getElementById("_hostnametr").style.display = 'none';
document.getElementById("_mxtr").style.display = 'none';
document.getElementById("_wildcardtr").style.display = 'none';
@@ -185,6 +190,7 @@ function _onTypeChange(type){
document.getElementById("_resulttr").style.display = 'none';
document.getElementById("_urltr").style.display = 'none';
document.getElementById("_requestiftr").style.display = 'none';
+ document.getElementById("_curloptions").style.display = 'none';
document.getElementById("_hostnametr").style.display = '';
document.getElementById("_mxtr").style.display = '';
document.getElementById("_wildcardtr").style.display = '';
@@ -195,6 +201,7 @@ function _onTypeChange(type){
document.getElementById("_resulttr").style.display = 'none';
document.getElementById("_urltr").style.display = 'none';
document.getElementById("_requestiftr").style.display = 'none';
+ document.getElementById("_curloptions").style.display = 'none';
document.getElementById("_hostnametr").style.display = '';
document.getElementById("_mxtr").style.display = '';
document.getElementById("_wildcardtr").style.display = '';
@@ -304,6 +311,15 @@ function _onTypeChange(type){
<input name="verboselog" type="checkbox" id="verboselog" value="yes" <?php if ($pconfig['verboselog']) echo "checked"; ?>>
<?=gettext("Enable ");?><?=gettext("verbose logging"); ?></td>
</tr>
+ <tr id="_curloptions">
+ <td width="22%" valign="top" class="vncell"><?=gettext("CURL options"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="curl_ipresolve_v4" type="checkbox" id="curl_ipresolve_v4" value="yes" <?php if ($pconfig['curl_ipresolve_v4']) echo "checked"; ?>>
+ <?=gettext("Force IPv4 resolving"); ?><br/>
+ <input name="curl_ssl_verifypeer" type="checkbox" id="curl_ssl_verifypeer" value="yes" <?php if ($pconfig['curl_ssl_verifypeer']) echo "checked"; ?>>
+ <?=gettext("Verify SSL peer"); ?>
+ </td>
+ </tr>
<tr id="_usernametr">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Username");?></td>
<td width="78%" class="vtable">
OpenPOWER on IntegriCloud