From f5fa5adca534be29fc9f208bbe4c618ab558a42b Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 5 Mar 2018 07:11:51 +0100 Subject: [PATCH] services: revert previous --- plist | 4 - src/etc/inc/services.inc | 24 +- .../app/models/OPNsense/CheckIP/ACL/ACL.xml | 10 - .../app/models/OPNsense/CheckIP/Menu/Menu.xml | 7 - src/www/services_checkip.php | 202 ----------------- src/www/services_checkip_edit.php | 208 ------------------ 6 files changed, 1 insertion(+), 454 deletions(-) delete mode 100644 src/opnsense/mvc/app/models/OPNsense/CheckIP/ACL/ACL.xml delete mode 100644 src/opnsense/mvc/app/models/OPNsense/CheckIP/Menu/Menu.xml delete mode 100644 src/www/services_checkip.php delete mode 100644 src/www/services_checkip_edit.php diff --git a/plist b/plist index 8deb37f52..12311c941 100644 --- a/plist +++ b/plist @@ -461,8 +461,6 @@ /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/CaptivePortal.xml /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/Menu/Menu.xml /usr/local/opnsense/mvc/app/models/OPNsense/CaptivePortal/Migrations/M1_0_0.php -/usr/local/opnsense/mvc/app/models/OPNsense/CheckIP/ACL/ACL.xml -/usr/local/opnsense/mvc/app/models/OPNsense/CheckIP/Menu/Menu.xml /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL.php /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.php /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml @@ -1056,8 +1054,6 @@ /usr/local/www/license.php /usr/local/www/reboot.php /usr/local/www/reporting_settings.php -/usr/local/www/services_checkip.php -/usr/local/www/services_checkip_edit.php /usr/local/www/services_dhcp.php /usr/local/www/services_dhcp_edit.php /usr/local/www/services_dhcp_relay.php diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 834f46921..4b6811600 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -1592,36 +1592,14 @@ function get_dyndns_ip($int, $ipver = 4) } if ($ipver == 4 && is_private_ip($ip_address)) { + /* Chinese alternative is http://ip.3322.net/ */ $hosttocheck = 'http://checkip.dyndns.org'; - $verifysslpeer = false; - $username = null; - $password = null; - - /* Use the first enabled check IP service as the default. */ - if (isset($config['checkipservices']['service'])) { - foreach ($config['checkipservices']['service'] as $i => $checkipservice) { - if (isset($checkipservice['enable'])) { - $verifysslpeer = isset($checkipservice['verifysslpeer']); - $username = $checkipservice['username']; - $password = $checkipservice['password']; - $hosttocheck = $checkipservice['url']; - break; - } - } - } - $ip_ch = curl_init($hosttocheck); curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, $verifysslpeer); curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address); curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ip_ch, CURLOPT_TIMEOUT, 30); curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - if (!empty($username) && !empty($password)) { - curl_setopt($ip_ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - curl_setopt($ip_ch, CURLOPT_USERPWD, "{$username}:{$password}"); - } - $ip_result = curl_exec($ip_ch); if ($ip_result !== false) { preg_match('=Current IP Address: (.*)=siU', $ip_result, $matches); diff --git a/src/opnsense/mvc/app/models/OPNsense/CheckIP/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/CheckIP/ACL/ACL.xml deleted file mode 100644 index 07d58888e..000000000 --- a/src/opnsense/mvc/app/models/OPNsense/CheckIP/ACL/ACL.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Services: Check IP - Allow access to the Check IP service module - - services_checkip.php* - services_checkip_edit.php* - - - diff --git a/src/opnsense/mvc/app/models/OPNsense/CheckIP/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/CheckIP/Menu/Menu.xml deleted file mode 100644 index 7794d341f..000000000 --- a/src/opnsense/mvc/app/models/OPNsense/CheckIP/Menu/Menu.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/www/services_checkip.php b/src/www/services_checkip.php deleted file mode 100644 index c17aaee19..000000000 --- a/src/www/services_checkip.php +++ /dev/null @@ -1,202 +0,0 @@ - true, - "name" => 'Default', - "url" => 'http://checkip.dyndns.org', - #"url" => 'http://ip.3322.net/', /* Chinese alternative */ - #"username" => '', - #"password" => '', - #"verifysslpeer" => true, - "descr" => 'Factory Default Check IP Service' -); -$factory_default = count($a_checkipservices) - 1; - -// Is the factory default check IP service disabled? -if (isset($config['checkipservices']['disable_factory_default'])) { - unset($a_checkipservices[$factory_default]['enable']); -} - -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $name = $a_checkipservices[$_POST['id']]['name']; - if (isset($_POST['act']) && $_POST['act'] == "del" && isset($_POST['id'])) { - unset($a_checkipservices[$_POST['id']]); - $wc_msg = gettext("Deleted a check IP service: %s"); - } elseif (isset($_POST['act']) && $_POST['act'] == "toggle" && isset($_POST['id'])) { - if ($a_checkipservices[$_POST['id']]) { - if (isset($a_checkipservices[$_POST['id']]['enable'])) { - unset($a_checkipservices[$_POST['id']]['enable']); - $wc_msg = gettext("Disabled a check IP service: %s"); - } else { - $a_checkipservices[$_POST['id']]['enable'] = true; - $wc_msg = gettext("Enabled a check IP service: %s"); - } - if ($_POST['id'] == $factory_default) { - if (isset($config['checkipservices']['disable_factory_default'])) { - unset($config['checkipservices']['disable_factory_default']); - } else { - $config['checkipservices']['disable_factory_default'] = true; - } - } - } - } - unset($a_checkipservices[$factory_default]); - write_config(sprintf($wc_msg, htmlspecialchars($name))); - - header(url_safe('Location: /services_checkip.php')); - exit; -} - -include("head.inc"); - -legacy_html_escape_form_data($a_checkipservices); - -$main_buttons = array( - array('label' => gettext('Add'), 'href' => 'services_checkip_edit.php'), -); - -?> - - - - -

-
-
-

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- "> - "> - - - - - - - > - - - - - - - - - -
-

- Current IP Address: {IP_Address}"')); ?>
- Current IP CheckCurrent IP Address: ')); ?> -
-
-
-
-
-
-
-
- diff --git a/src/www/services_checkip_edit.php b/src/www/services_checkip_edit.php deleted file mode 100644 index 0266af8ce..000000000 --- a/src/www/services_checkip_edit.php +++ /dev/null @@ -1,208 +0,0 @@ - - - -

Check IP Service Add/Edit

-
-
- 0) print_input_errors($input_errors); ?> -

Input Form

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- -
- - -
- - -
- - -
- - -
- -
- - -
  - - - - - -
-
-
-
-
-
-
-
-