Project

General

Profile

Download (6.4 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 f1bede03 Ermal
		$userkeys[] = array('ident' => $user['name'], 'pre-shared-key' => $user['ipsecpsk'], 'id' => $id);;
53 66a72c9f jim-p
	}
54
}
55
56
57 958420c5 jim-p
if ($_GET['act'] == "del") {
58
	if ($a_secret[$_GET['id']]) {
59
		unset($a_secret[$_GET['id']]);
60 171b0468 Rafael Lucas
		write_config(gettext("Deleted IPsec Pre-Shared Key"));
61 958420c5 jim-p
		mark_subsystem_dirty('ipsec');
62
		header("Location: vpn_ipsec_keys.php");
63
		exit;
64
	}
65
}
66
67 76b89c84 Carlos Eduardo Ramos
$pgtitle = gettext("VPN: IPsec: Keys");
68 b32dd0a6 jim-p
$shortcut_section = "ipsec";
69 6deedfde jim-p
70 958420c5 jim-p
include("head.inc");
71
72
?>
73
74
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
75
<?php include("fbegin.inc"); ?>
76
<?php 
77
if ($savemsg)
78
	print_info_box($savemsg);
79
if (is_subsystem_dirty('ipsec'))
80 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."));
81 958420c5 jim-p
82
?>
83 4d07ca6a Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec keys">
84 958420c5 jim-p
  <tr><td class="tabnavtbl">
85
<?php
86
	$tab_array = array();
87 76b89c84 Carlos Eduardo Ramos
	$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
88
	$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
89 2a2b247b jim-p
	$tab_array[2] = array(gettext("Pre-Shared Keys"), true, "vpn_ipsec_keys.php");
90 71172088 jim-p
	$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
91 958420c5 jim-p
	display_top_tabs($tab_array);
92
?>
93
  </td></tr>
94
  <tr> 
95
    <td>
96
	<div id="mainarea">
97 4d07ca6a Colin Fleming
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
98 958420c5 jim-p
                <tr> 
99 76b89c84 Carlos Eduardo Ramos
                  <td class="listhdrr"><?=gettext("Identifier"); ?></td>
100 2a2b247b jim-p
                  <td class="listhdr"><?=gettext("Pre-Shared Key"); ?></td>
101 958420c5 jim-p
                  <td class="list">
102 4d07ca6a Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
103 958420c5 jim-p
			    <tr>
104 4d07ca6a Colin Fleming
			        <td width="20" height="17"></td>
105
				<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>
106 958420c5 jim-p
			    </tr>
107
			</table>
108
		  </td>
109
		</tr>
110 66a72c9f jim-p
			  <?php $i = 0; foreach ($userkeys as $secretent): ?>
111
		<tr>
112
		<td class="listlr gray">
113 f1bede03 Ermal
			<?php
114
				if ($secretent['ident'] == 'allusers')
115
					echo gettext("ANY USER");
116
				else
117
					echo htmlspecialchars($secretent['ident']);
118
			?>
119 66a72c9f jim-p
		</td>
120
		<td class="listr gray">
121
			<?=htmlspecialchars($secretent['pre-shared-key']);?>
122
		</td>
123 1a6769a6 Renato Botelho
		<td class="list nowrap">
124
			<form action="system_usermanager.php" method="post" name="form_edit_key">
125
				<input type="hidden" name="act" value="edit" />
126
				<input type="hidden" name="userid" value="<?=$secretent['id'];?>" />
127
				<input type="image" name="edituser[]" width="17" height="17" border="0"
128
					src="/themes/<?=$g['theme'];?>/images/icons/icon_e.gif"
129
					title="<?=gettext("edit");?>" />
130
			</form>
131 66a72c9f jim-p
		&nbsp;</td>
132
				</tr>
133
			  <?php $i++; endforeach; ?>
134
135 958420c5 jim-p
			  <?php $i = 0; foreach ($a_secret as $secretent): ?>
136
                <tr> 
137
                  <td class="listlr">
138
                    <?=htmlspecialchars($secretent['ident']);?>
139
                  </td>
140
                  <td class="listr">
141
                    <?=htmlspecialchars($secretent['pre-shared-key']);?>
142
                  </td>
143 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>
144
                     &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>
145 958420c5 jim-p
				</tr>
146
			  <?php $i++; endforeach; ?>
147
                <tr> 
148
                  <td class="list" colspan="2"></td>
149
                  <td class="list">
150 4d07ca6a Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
151 958420c5 jim-p
			    <tr>
152 4d07ca6a Colin Fleming
			        <td width="20" height="17"></td>
153
				<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>
154 958420c5 jim-p
			    </tr>
155
			</table>
156
		  </td>
157
		</tr>
158
              </table>
159
	</div>
160
      </td>
161
    </tr>
162 f1bede03 Ermal
	<tr>
163
		<td colspan="4">
164
			<p>
165
			<span class="vexpl">
166
			<span class="red">
167
				<strong><?=gettext("Note"); ?>:<br /></strong>
168
			</span>
169
			<?=gettext("PSK for any user can be set by using an identifier of any/ANY");?>
170
			</span>
171
			</p>
172
		</td>
173
	</tr>
174 958420c5 jim-p
</table>
175
<?php include("fend.inc"); ?>
176
</body>
177
</html>