Project

General

Profile

Download (5.97 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 8cd558b6 ayvis
	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 4d07ca6a Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec keys">
89 958420c5 jim-p
  <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 71172088 jim-p
	$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
96 958420c5 jim-p
	display_top_tabs($tab_array);
97
?>
98
  </td></tr>
99
  <tr> 
100
    <td>
101
	<div id="mainarea">
102 4d07ca6a Colin Fleming
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
103 958420c5 jim-p
                <tr> 
104 76b89c84 Carlos Eduardo Ramos
                  <td class="listhdrr"><?=gettext("Identifier"); ?></td>
105 2a2b247b jim-p
                  <td class="listhdr"><?=gettext("Pre-Shared Key"); ?></td>
106 958420c5 jim-p
                  <td class="list">
107 4d07ca6a Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
108 958420c5 jim-p
			    <tr>
109 4d07ca6a Colin Fleming
			        <td width="20" height="17"></td>
110
				<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" alt="add" /></a></td>
111 958420c5 jim-p
			    </tr>
112
			</table>
113
		  </td>
114
		</tr>
115 66a72c9f jim-p
			  <?php $i = 0; foreach ($userkeys as $secretent): ?>
116
		<tr>
117
		<td class="listlr gray">
118
			<?=htmlspecialchars($secretent['ident']);?>
119
		</td>
120
		<td class="listr gray">
121
			<?=htmlspecialchars($secretent['pre-shared-key']);?>
122
		</td>
123 4d07ca6a Colin Fleming
		<td class="list nowrap"><a href="system_usermanager.php?act=edit&amp;id=<?=$secretent['id'];?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit key"); ?>" width="17" height="17" border="0" alt="edit" /></a>
124 66a72c9f jim-p
		&nbsp;</td>
125
				</tr>
126
			  <?php $i++; endforeach; ?>
127
128 958420c5 jim-p
			  <?php $i = 0; foreach ($a_secret as $secretent): ?>
129
                <tr> 
130
                  <td class="listlr">
131
                    <?=htmlspecialchars($secretent['ident']);?>
132
                  </td>
133
                  <td class="listr">
134
                    <?=htmlspecialchars($secretent['pre-shared-key']);?>
135
                  </td>
136 4d07ca6a Colin Fleming
                  <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" alt="edit" /></a>
137
                     &nbsp;<a href="vpn_ipsec_keys.php?act=del&amp;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" alt="delete" /></a></td>
138 958420c5 jim-p
				</tr>
139
			  <?php $i++; endforeach; ?>
140
                <tr> 
141
                  <td class="list" colspan="2"></td>
142
                  <td class="list">
143 4d07ca6a Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
144 958420c5 jim-p
			    <tr>
145 4d07ca6a Colin Fleming
			        <td width="20" height="17"></td>
146
				<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" alt="add" /></a></td>
147 958420c5 jim-p
			    </tr>
148
			</table>
149
		  </td>
150
		</tr>
151
              </table>
152
	</div>
153
      </td>
154
    </tr>
155
</table>
156
</form>
157
<?php include("fend.inc"); ?>
158
</body>
159
</html>