diff options
author | NOYB <Al_Stu@Frontier.com> | 2016-07-02 02:13:04 -0700 |
---|---|---|
committer | NOYB <Al_Stu@Frontier.com> | 2016-07-02 02:13:04 -0700 |
commit | 39d2f39d57e4eefbfd0630758464fab7568b6877 (patch) | |
tree | fa704038d6fb81a653a7bfd6582f700381b40a64 /src/etc/inc/services.inc | |
parent | 9c40391966dbd9c69d2bfbfbf042d3277adb145d (diff) | |
download | pfsense-39d2f39d57e4eefbfd0630758464fab7568b6877.zip pfsense-39d2f39d57e4eefbfd0630758464fab7568b6877.tar.gz |
Check IP Services
Configurable check IP services.
Used by Dynamic DNS services to check IP addresses.
Configure as many check IP services as desired. The first (highest in the list) that is enabled will be used as the default.
A future possibility could be to add an option to the Dynamic DNS entires to use a specific check IP service.
Addresses bug #6493 by allowing additional check IP service to be added and selected as the default.
Diffstat (limited to 'src/etc/inc/services.inc')
-rw-r--r-- | src/etc/inc/services.inc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 6ee7a07..b0d79e4 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -1963,7 +1963,7 @@ function services_dyndns_configure($int = "") { } function dyndnsCheckIP($int) { - global $config; + global $config, $factory_default_checkipservice; $ip_address = get_interface_ip($int); if (is_private_ip($ip_address)) { $gateways_status = return_gateways_status(true); @@ -1972,14 +1972,35 @@ function dyndnsCheckIP($int) { if (stristr($gateways_status[$config['interfaces'][$int]['gateway']]['status'], "down")) { return "down"; } - $hosttocheck = "http://checkip.dyndns.org"; + + // Append the factory default check IP service to the list (if not disabled). + if (!isset($config['checkipservices']['disable_factory_default'])) { + $config['checkipservices']['checkipservice'][] = $factory_default_checkipservice; + } + + // Use the first enabled check IP service as the default. + if (is_array($config['checkipservices']['checkipservice'])) { + foreach ($config['checkipservices']['checkipservice'] as $i => $checkipservice) { + if (isset($checkipservice['enable'])) { + $url = $checkipservice['url']; + $username = $checkipservice['username']; + $password = $checkipservice['password']; + $verifysslpeer = isset($checkipservice['verifysslpeer']); + break; + } + } + } + + $hosttocheck = $url; $ip_ch = curl_init($hosttocheck); curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, $verifysslpeer); curl_setopt($ip_ch, CURLOPT_INTERFACE, 'host!' . $ip_address); curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, '30'); curl_setopt($ip_ch, CURLOPT_TIMEOUT, 120); curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_setopt($ip_ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($ip_ch, CURLOPT_USERPWD, "{$username}:{$password}"); $ip_result_page = curl_exec($ip_ch); curl_close($ip_ch); $ip_result_decoded = urldecode($ip_result_page); |