diff --git a/plist b/plist index 4cd0a4bb0..1d0036d4e 100644 --- a/plist +++ b/plist @@ -1831,7 +1831,6 @@ /usr/local/www/system_usermanager_import_ldap.php /usr/local/www/system_usermanager_passwordmg.php /usr/local/www/system_usermanager_settings_ldapacpicker.php -/usr/local/www/vpn_ipsec.php /usr/local/www/vpn_ipsec_keys.php /usr/local/www/vpn_ipsec_keys_edit.php /usr/local/www/vpn_ipsec_mobile.php diff --git a/src/etc/inc/filter.lib.inc b/src/etc/inc/filter.lib.inc index 76985d8fc..720b3e030 100644 --- a/src/etc/inc/filter.lib.inc +++ b/src/etc/inc/filter.lib.inc @@ -541,7 +541,7 @@ function filter_core_rules_system($fw, $defaults) $fw->registerFilterRule( 5, array('direction' => 'out', 'statetype' => 'keep', 'quick' => false, 'interface' => 'enc0', - '#ref' => 'vpn_ipsec.php#enable', + '#ref' => '/ui/ipsec/tunnels', 'descr' => 'IPsec internal host to host'), $defaults['pass'] ); diff --git a/src/opnsense/mvc/app/models/OPNsense/IPsec/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/IPsec/ACL/ACL.xml index 47ab4a7ae..25a80caa7 100644 --- a/src/opnsense/mvc/app/models/OPNsense/IPsec/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/IPsec/ACL/ACL.xml @@ -9,14 +9,16 @@ api/ipsec/legacy-subsystem/* - - VPN: IPsec - vpn_ipsec.php* + ui/ipsec/tunnels + api/ipsec/tunnel/* + api/ipsec/legacy-subsystem/* + + VPN: IPsec: Edit Phase 1 diff --git a/src/opnsense/mvc/app/models/OPNsense/IPsec/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/IPsec/Menu/Menu.xml index 7137d722a..4776cd3e4 100644 --- a/src/opnsense/mvc/app/models/OPNsense/IPsec/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/IPsec/Menu/Menu.xml @@ -1,7 +1,7 @@ - + diff --git a/src/opnsense/mvc/app/views/OPNsense/IPsec/tunnels.volt b/src/opnsense/mvc/app/views/OPNsense/IPsec/tunnels.volt index 275f783e4..85e26b605 100644 --- a/src/opnsense/mvc/app/views/OPNsense/IPsec/tunnels.volt +++ b/src/opnsense/mvc/app/views/OPNsense/IPsec/tunnels.volt @@ -3,7 +3,7 @@ $(function () { function attach_legacy_actions() { $(".legacy_action").unbind('click').click(function(e){ - e.preventDefault(); + e.stopPropagation(); if ($(this).data('scope') === 'phase1') { if ($(this).hasClass('command-add')) { window.location = '/vpn_ipsec_phase1.php'; @@ -80,8 +80,10 @@ data_tags = 'data-row-id="' + row.id + '" data-scope="phase2" data-row-uniqid="' + row.uniqid + '"'; } btns = btns + ' ' + - '' + - ''; + ''; + + // delete buttons use standard mvc functionality, id should map to the unique id used by the delete endpoint + btns = btns +''; return btns; }, "gateway": function (column, row) { @@ -210,9 +212,10 @@ + {# multi select isn't supported on master/detail views + #} diff --git a/src/www/vpn_ipsec.php b/src/www/vpn_ipsec.php deleted file mode 100644 index 6b15c982c..000000000 --- a/src/www/vpn_ipsec.php +++ /dev/null @@ -1,625 +0,0 @@ - - * Copyright (C) 2008 Shrew Soft Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("guiconfig.inc"); -require_once("system.inc"); -require_once("filter.inc"); -require_once("interfaces.inc"); -require_once("plugins.inc.d/ipsec.inc"); - -/* - * Return phase2 idinfo in text format - */ -function ipsec_idinfo_to_text(& $idinfo) { - global $config; - - switch ($idinfo['type']) { - case "address": - return $idinfo['address']; - break; /* NOTREACHED */ - case "network": - return $idinfo['address']."/".$idinfo['netbits']; - break; /* NOTREACHED */ - case "mobile": - return gettext("Mobile Client"); - break; /* NOTREACHED */ - case "none": - return gettext("None"); - break; /* NOTREACHED */ - default: - if (!empty($config['interfaces'][$idinfo['type']])) { - return convert_friendly_interface_to_friendly_descr($idinfo['type']); - } else { - return strtoupper($idinfo['type']); - } - break; /* NOTREACHED */ - } -} - -$a_phase1 = &config_read_array('ipsec', 'phase1'); -$a_phase2 = &config_read_array('ipsec', 'phase2'); -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (isset($_POST['apply'])) { - ipsec_configure_do(); - filter_configure(); - $savemsg = get_std_save_message(); - clear_subsystem_dirty('ipsec'); - } elseif (isset($_POST['save'])) { - if (!empty($_POST['enable'])) { - $config['ipsec']['enable'] = true; - } elseif (isset($config['ipsec']['enable'])) { - unset($config['ipsec']['enable']); - } - write_config(); - ipsec_configure_do(); - filter_configure(); - clear_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "delphase1" ) { - $del_items = array(); - if (isset($_POST['id']) && isset($config['ipsec']['phase1'][$_POST['id']])){ - $del_items[] = $_POST['id']; - } elseif (empty($_POST['id']) && isset($_POST['p1entry']) && count($_POST['p1entry'])) { - $del_items = $_POST['p1entry']; - } - - foreach ($del_items as $p1entrydel) { - /* remove static route if interface is not WAN */ - if ($a_phase1[$p1entrydel]['interface'] != 'wan') { - /* XXX does this even apply? only use of system.inc at the top! */ - system_host_route($a_phase1[$p1entrydel]['remote-gateway'], $a_phase1[$p1entrydel]['remote-gateway'], true, false); - } - /* remove all phase2 entries that match the ikeid */ - $ikeid = $a_phase1[$p1entrydel]['ikeid']; - foreach ($a_phase2 as $p2index => $ph2tmp) { - if ($ph2tmp['ikeid'] == $ikeid) { - unset($a_phase2[$p2index]); - } - } - unset($config['ipsec']['phase1'][$p1entrydel]); - } - - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "delselected" ) { - if (empty($_POST['id']) && isset($_POST['p2entry']) && count($_POST['p2entry'])) { - foreach ($_POST['p2entry'] as $p2entrydel) { - unset($config['ipsec']['phase2'][$p2entrydel]); - } - } - if (empty($_POST['id']) && isset($_POST['p1entry']) && count($_POST['p1entry'])) { - foreach ($_POST['p1entry'] as $p1entrydel) { - $ikeid = $a_phase1[$p1entrydel]['ikeid']; - foreach ($a_phase2 as $p2index => $ph2tmp) { - if ($ph2tmp['ikeid'] == $ikeid) { - unset($a_phase2[$p2index]); - } - } - unset($config['ipsec']['phase1'][$p1entrydel]); - } - } - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "delphase2" ) { - if (isset($_POST['id']) && isset($config['ipsec']['phase2'][$_POST['id']])){ - unset($config['ipsec']['phase2'][$_POST['id']]); - } - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "move" ) { - // move phase 2 records - if (isset($_POST['p2entry']) && count($_POST['p2entry']) > 0) { - // if rule not set/found, move to end - if (!isset($_POST['id']) || !isset($a_phase2[$_POST['id']])) { - $id = count($a_phase2); - } else { - $id = $_POST['id']; - } - $a_phase2 = legacy_move_config_list_items($a_phase2, $id, $_POST['p2entry']); - } - // move phase 1 records - if (isset($_POST['p1entry']) && count($_POST['p1entry']) > 0) { - // if rule not set/found, move to end - if (!isset($_POST['id']) || !isset($a_phase1[$_POST['id']])) { - $id = count($a_phase1); - } else { - $id = $_POST['id']; - } - $a_phase1 = legacy_move_config_list_items($a_phase1, $id, $_POST['p1entry']); - } - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "togglep1" && isset($a_phase1[$_POST['id']]) ) { - // toggle phase 1 record - if (isset($a_phase1[$_POST['id']]['disabled'])) { - unset($a_phase1[$_POST['id']]['disabled']); - } else { - $a_phase1[$_POST['id']]['disabled'] = true; - } - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } elseif (!empty($_POST['act']) && $_POST['act'] == "togglep2" && isset($a_phase2[$_POST['id']]) ) { - // toggle phase 2 record - if (isset($a_phase2[$_POST['id']]['disabled'])) { - unset($a_phase2[$_POST['id']]['disabled']); - } else { - $a_phase2[$_POST['id']]['disabled'] = true; - } - write_config(); - mark_subsystem_dirty('ipsec'); - header(url_safe('Location: /vpn_ipsec.php')); - exit; - } -} - -// form data -legacy_html_escape_form_data($a_phase1); -legacy_html_escape_form_data($a_phase2); - -$service_hook = 'strongswan'; - -include("head.inc"); - -$dhgroups = array( - 0 => gettext('off'), - 1 => '1 (768 bits)', - 2 => '2 (1024 bits)', - 5 => '5 (1536 bits)', - 14 => '14 (2048 bits)', - 15 => '15 (3072 bits)', - 16 => '16 (4096 bits)', - 17 => '17 (6144 bits)', - 18 => '18 (8192 bits)', - 19 => '19 (NIST EC 256 bits)', - 20 => '20 (NIST EC 384 bits)', - 21 => '21 (NIST EC 521 bits)', - 22 => '22 (1024(sub 160) bits)', - 23 => '23 (2048(sub 224) bits)', - 24 => '24 (2048(sub 256) bits)', - 28 => '28 (Brainpool EC 256 bits)', - 29 => '29 (Brainpool EC 384 bits)', - 30 => '30 (Brainpool EC 512 bits)', - 31 => '31 (Elliptic Curve 25519)', -); - -$p2_protos = array( - 'esp' => 'ESP', - 'ah' => 'AH' -); - -$p1_ealgos = ipsec_p1_ealgos(); -$p2_ealgos = ipsec_p2_ealgos(); -$p1_authentication_methods = ipsec_p1_authentication_methods(); -$p2_halgos = ipsec_p2_halgos(); - -?> - - - - - -
-
-
-" . gettext("You must apply the changes in order for them to take effect.")); - }?> -
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $ph2ent) : - if ($ph2ent['ikeid'] != $ph1ent['ikeid']) { - continue; - }?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ">
  
- - - - - $carpip) { - $iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")"; - } - - $aliaslist = get_configured_ip_aliases_list(); - foreach ($aliaslist as $aliasip => $aliasif) { - $iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")"; - } - $if = $iflabels[$ph1ent['interface']]; - } else { - $if = "WAN"; - }?> - - " . gettext("Mobile Client") . ""; - ?> - - - - " class="btn btn-primary btn-xs" - title="" data-toggle="tooltip"> - - - - - - - - - - - - -
- - - - - - - -    - - - - - - - - -
- " data-toggle="tooltip" - class="btn btn-primary btn-xs"> - - - - -
- /> - -
- -
-
-
-
-
-
-
-
-