1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
vpn_ipsec_keys.php
|
6
|
part of m0n0wall (http://m0n0.ch/wall)
|
7
|
|
8
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9
|
All rights reserved.
|
10
|
|
11
|
Redistribution and use in source and binary forms, with or without
|
12
|
modification, are permitted provided that the following conditions are met:
|
13
|
|
14
|
1. Redistributions of source code must retain the above copyright notice,
|
15
|
this list of conditions and the following disclaimer.
|
16
|
|
17
|
2. Redistributions in binary form must reproduce the above copyright
|
18
|
notice, this list of conditions and the following disclaimer in the
|
19
|
documentation and/or other materials provided with the distribution.
|
20
|
|
21
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
POSSIBILITY OF SUCH DAMAGE.
|
31
|
*/
|
32
|
|
33
|
require("guiconfig.inc");
|
34
|
|
35
|
if (!is_array($config['ipsec']['mobilekey'])) {
|
36
|
$config['ipsec']['mobilekey'] = array();
|
37
|
}
|
38
|
ipsec_mobilekey_sort();
|
39
|
$a_secret = &$config['ipsec']['mobilekey'];
|
40
|
|
41
|
if ($_GET['act'] == "del") {
|
42
|
if ($a_secret[$_GET['id']]) {
|
43
|
unset($a_secret[$_GET['id']]);
|
44
|
write_config();
|
45
|
touch($d_ipsecconfdirty_path);
|
46
|
header("Location: vpn_ipsec_keys.php");
|
47
|
exit;
|
48
|
}
|
49
|
}
|
50
|
|
51
|
?>
|
52
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
53
|
<html>
|
54
|
<head>
|
55
|
<title><?=gentitle("VPN: IPsec");?></title>
|
56
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
57
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
58
|
</head>
|
59
|
|
60
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
61
|
<?php include("fbegin.inc"); ?>
|
62
|
<p class="pgtitle">VPN: IPsec</p>
|
63
|
<form action="vpn_ipsec.php" method="post">
|
64
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
65
|
<?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
|
66
|
<?php print_info_box_np("The IPsec tunnel configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
67
|
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
|
68
|
<?php endif; ?>
|
69
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
70
|
<tr><td>
|
71
|
<ul id="tabnav">
|
72
|
<li class="tabinact"><a href="vpn_ipsec.php">Tunnels</a></li>
|
73
|
<li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
|
74
|
<li class="tabact">Pre-shared keys</li>
|
75
|
</ul>
|
76
|
</td></tr>
|
77
|
<tr>
|
78
|
<td class="tabcont">
|
79
|
<table width="80%" border="0" cellpadding="0" cellspacing="0">
|
80
|
<tr>
|
81
|
<td class="listhdrr">Identifier</td>
|
82
|
<td class="listhdr">Pre-shared key</td>
|
83
|
<td class="list"></td>
|
84
|
</tr>
|
85
|
<?php $i = 0; foreach ($a_secret as $secretent): ?>
|
86
|
<tr>
|
87
|
<td class="listlr">
|
88
|
<?=htmlspecialchars($secretent['ident']);?>
|
89
|
</td>
|
90
|
<td class="listr">
|
91
|
<?=htmlspecialchars($secretent['pre-shared-key']);?>
|
92
|
</td>
|
93
|
<td class="list" nowrap> <a href="vpn_ipsec_keys_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
|
94
|
<a href="vpn_ipsec_keys.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pre-shared key?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
|
95
|
</tr>
|
96
|
<?php $i++; endforeach; ?>
|
97
|
<tr>
|
98
|
<td class="list" colspan="2"></td>
|
99
|
<td class="list"> <a href="vpn_ipsec_keys_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
|
100
|
</tr>
|
101
|
</table>
|
102
|
</td>
|
103
|
</tr>
|
104
|
</table>
|
105
|
</form>
|
106
|
<?php include("fend.inc"); ?>
|
107
|
</body>
|
108
|
</html>
|