Project

General

Profile

Download (5.73 KB) Statistics
| Branch: | Tag: | Revision:
1 958420c5 jim-p
<?php
2
/*
3
	vpn_ipsec_keys.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5
	
6
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
7
	All rights reserved.
8
	
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
	
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
	
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
	
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
##|+PRIV
32
##|*IDENT=page-vpn-ipsec-listkeys
33
##|*NAME=VPN: IPsec: Pre-Shared Keys List
34
##|*DESCR=Allow access to the 'VPN: IPsec: Pre-Shared Keys List' page.
35
##|*MATCH=vpn_ipsec_keys.php*
36
##|-PRIV
37
38
require("functions.inc");
39
require("guiconfig.inc");
40
require_once("ipsec.inc");
41
require_once("vpn.inc");
42
43
if (!is_array($config['ipsec']['mobilekey'])) {
44
	$config['ipsec']['mobilekey'] = array();
45
}
46
ipsec_mobilekey_sort();
47
$a_secret = &$config['ipsec']['mobilekey'];
48
49 66a72c9f jim-p
$userkeys = array();
50
foreach ($config['system']['user'] as $id => $user) {
51 b039f099 jim-p
	if (!empty($user['ipsecpsk'])) {
52 66a72c9f jim-p
		$k = array();
53
		$k["ident"] = $user['name'];
54
		$k["pre-shared-key"] = $user['ipsecpsk'];
55
		$k["id"] = $id;
56
		$userkeys[] = $k;
57
	}
58
}
59
60
61 958420c5 jim-p
if ($_GET['act'] == "del") {
62
	if ($a_secret[$_GET['id']]) {
63
		unset($a_secret[$_GET['id']]);
64 171b0468 Rafael Lucas
		write_config(gettext("Deleted IPsec Pre-Shared Key"));
65 958420c5 jim-p
		mark_subsystem_dirty('ipsec');
66
		header("Location: vpn_ipsec_keys.php");
67
		exit;
68
	}
69
}
70
71 76b89c84 Carlos Eduardo Ramos
$pgtitle = gettext("VPN: IPsec: Keys");
72 b32dd0a6 jim-p
$shortcut_section = "ipsec";
73 6deedfde jim-p
74 958420c5 jim-p
include("head.inc");
75
76
?>
77
78
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
79
<?php include("fbegin.inc"); ?>
80
<form action="vpn_ipsec.php" method="post">
81
<?php 
82
if ($savemsg)
83
	print_info_box($savemsg);
84
if (is_subsystem_dirty('ipsec'))
85 76b89c84 Carlos Eduardo Ramos
	print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br>" . gettext("You must apply the changes in order for them to take effect."));
86 958420c5 jim-p
87
?>
88
<table width="100%" border="0" cellpadding="0" cellspacing="0">
89
  <tr><td class="tabnavtbl">
90
<?php
91
	$tab_array = array();
92 76b89c84 Carlos Eduardo Ramos
	$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
93
	$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
94 2a2b247b jim-p
	$tab_array[2] = array(gettext("Pre-Shared Keys"), true, "vpn_ipsec_keys.php");
95 958420c5 jim-p
	display_top_tabs($tab_array);
96
?>
97
  </td></tr>
98
  <tr> 
99
    <td>
100
	<div id="mainarea">
101
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
102
                <tr> 
103 76b89c84 Carlos Eduardo Ramos
                  <td class="listhdrr"><?=gettext("Identifier"); ?></td>
104 2a2b247b jim-p
                  <td class="listhdr"><?=gettext("Pre-Shared Key"); ?></td>
105 958420c5 jim-p
                  <td class="list">
106
			<table border="0" cellspacing="0" cellpadding="1">
107
			    <tr>
108
			        <td width="20" heigth="17"></td>
109 76b89c84 Carlos Eduardo Ramos
				<td><a href="vpn_ipsec_keys_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add key"); ?>" width="17" height="17" border="0"></a></td>
110 958420c5 jim-p
			    </tr>
111
			</table>
112
		  </td>
113
		</tr>
114 66a72c9f jim-p
			  <?php $i = 0; foreach ($userkeys as $secretent): ?>
115
		<tr>
116
		<td class="listlr gray">
117
			<?=htmlspecialchars($secretent['ident']);?>
118
		</td>
119
		<td class="listr gray">
120
			<?=htmlspecialchars($secretent['pre-shared-key']);?>
121
		</td>
122 76b89c84 Carlos Eduardo Ramos
		<td class="list" nowrap><a href="system_usermanager.php?act=edit&id=<?=$secretent['id'];?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit key"); ?>" width="17" height="17" border="0"></a>
123 66a72c9f jim-p
		&nbsp;</td>
124
				</tr>
125
			  <?php $i++; endforeach; ?>
126
127 958420c5 jim-p
			  <?php $i = 0; foreach ($a_secret as $secretent): ?>
128
                <tr> 
129
                  <td class="listlr">
130
                    <?=htmlspecialchars($secretent['ident']);?>
131
                  </td>
132
                  <td class="listr">
133
                    <?=htmlspecialchars($secretent['pre-shared-key']);?>
134
                  </td>
135 76b89c84 Carlos Eduardo Ramos
                  <td class="list" nowrap> <a href="vpn_ipsec_keys_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit key"); ?>" width="17" height="17" border="0"></a>
136 2a2b247b jim-p
                     &nbsp;<a href="vpn_ipsec_keys.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Pre-Shared Key?"); ?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete key"); ?>" width="17" height="17" border="0"></a></td>
137 958420c5 jim-p
				</tr>
138
			  <?php $i++; endforeach; ?>
139
                <tr> 
140
                  <td class="list" colspan="2"></td>
141
                  <td class="list">
142
			<table border="0" cellspacing="0" cellpadding="1">
143
			    <tr>
144
			        <td width="20" heigth="17"></td>
145 76b89c84 Carlos Eduardo Ramos
				<td><a href="vpn_ipsec_keys_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add key"); ?>" width="17" height="17" border="0"></a></td>
146 958420c5 jim-p
			    </tr>
147
			</table>
148
		  </td>
149
		</tr>
150
              </table>
151
	</div>
152
      </td>
153
    </tr>
154
</table>
155
</form>
156
<?php include("fend.inc"); ?>
157
</body>
158
</html>