. 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. */ ##|+PRIV ##|*IDENT=page-vpn-ipsec ##|*NAME=VPN: IPsec page ##|*DESCR=Allow access to the 'VPN: IPsec' page. ##|*MATCH=vpn_ipsec.php* ##|-PRIV require("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); if (!is_array($config['ipsec']['phase1'])) $config['ipsec']['phase1'] = array(); if (!is_array($config['ipsec']['phase2'])) $config['ipsec']['phase2'] = array(); $a_phase1 = &$config['ipsec']['phase1']; $a_phase2 = &$config['ipsec']['phase2']; $pconfig['enable'] = isset($config['ipsec']['enable']); if ($_POST) { if ($_POST['apply']) { $retval = 0; $retval = vpn_ipsec_refresh_policies(); $retval = vpn_ipsec_configure(); /* reload the filter in the background */ filter_configure(); $savemsg = get_std_save_message($retval); if ($retval == 0) { if (is_subsystem_dirty('ipsec')) clear_subsystem_dirty('ipsec'); } } else if ($_POST['submit']) { $pconfig = $_POST; $config['ipsec']['enable'] = $_POST['enable'] ? true : false; write_config(); $retval = vpn_ipsec_configure(); } } if ($_GET['act'] == "delph1") { if ($a_phase1[$_GET['p1index']]) { /* remove static route if interface is not WAN */ if ($a_phase1[$_GET['p1index']]['interface'] <> "wan") mwexec("/sbin/route delete -host {$a_phase1[$_GET['p1index']]['remote-gateway']}"); /* remove all phase2 entries that match the ikeid */ $ikeid = $a_phase1[$_GET['p1index']]['ikeid']; foreach ($a_phase2 as $p2index => $ph2tmp) if ($ph2tmp['ikeid'] == $ikeid) unset($a_phase2[$p2index]); /* remove the phase1 entry */ unset($a_phase1[$_GET['p1index']]); vpn_ipsec_refresh_policies(); vpn_ipsec_configure(); write_config(); filter_configure(); header("Location: vpn_ipsec.php"); exit; } } if ($_GET['act'] == "delph2") { if ($a_phase2[$_GET['p2index']]) { /* remove the phase2 entry */ unset($a_phase2[$_GET['p2index']]); vpn_ipsec_refresh_policies(); vpn_ipsec_configure(); filter_configure(); write_config(); header("Location: vpn_ipsec.php"); exit; } } $pgtitle = array(gettext("VPN"),gettext("IPsec")); $statusurl = "diag_ipsec.php"; $logurl = "diag_logs_ipsec.php"; include("head.inc"); ?>
" . gettext("You must apply the changes in order for them to take effect.")); ?>
>
">
"; $spane = ""; } else $spans = $spane = ""; show_ipsec_header($ph1ent); $counter++; // used to determine if we need to output header manually (no records exist) ?>
$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).")"; $grouplist = return_gateway_groups_array(); foreach ($grouplist as $name => $group) { if($group[0]['vip'] <> "") $vipif = $group[0]['vip']; else $vipif = $group[0]['int']; $iflabels[$name] = "GW Group {$name}"; } $if = htmlspecialchars($iflabels[$ph1ent['interface']]); } else $if = "WAN"; if (!isset($ph1ent['mobile'])) echo $if."
".$ph1ent['remote-gateway']; else echo $if."
" . gettext("Mobile Client") . ""; ?>
 
" width="17" height="17" border="0"> ')"> " width="17" height="17" border="0">
" width="17" height="17" border="0">
-
"; $spane = ""; } else $spans = $spane = ""; ?> "tunnel") and ($ph2ent['mode'] <> "tunnel6")) { echo ""; } ?>
 
" width="17" height="17" border="0">

:
.
.
.