mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge pull request #664 from chrostek/master
Added CURL options to custom DynDNS
This commit is contained in:
commit
33682de2e2
@ -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}");
|
||||
}
|
||||
|
||||
@ -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 = "") {
|
||||
|
||||
@ -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">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user