Projet

Général

Profil

Télécharger (6,4 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / vpn_ipsec_keys.php @ 1a6769a6

1
<?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
$userkeys = array();
50
foreach ($config['system']['user'] as $id => $user) {
51
	if (!empty($user['ipsecpsk'])) {
52
		$userkeys[] = array('ident' => $user['name'], 'pre-shared-key' => $user['ipsecpsk'], 'id' => $id);;
53
	}
54
}
55

    
56

    
57
if ($_GET['act'] == "del") {
58
	if ($a_secret[$_GET['id']]) {
59
		unset($a_secret[$_GET['id']]);
60
		write_config(gettext("Deleted IPsec Pre-Shared Key"));
61
		mark_subsystem_dirty('ipsec');
62
		header("Location: vpn_ipsec_keys.php");
63
		exit;
64
	}
65
}
66

    
67
$pgtitle = gettext("VPN: IPsec: Keys");
68
$shortcut_section = "ipsec";
69

    
70
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
	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

    
82
?>
83
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec keys">
84
  <tr><td class="tabnavtbl">
85
<?php
86
	$tab_array = array();
87
	$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
88
	$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
89
	$tab_array[2] = array(gettext("Pre-Shared Keys"), true, "vpn_ipsec_keys.php");
90
	$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
91
	display_top_tabs($tab_array);
92
?>
93
  </td></tr>
94
  <tr> 
95
    <td>
96
	<div id="mainarea">
97
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
98
                <tr> 
99
                  <td class="listhdrr"><?=gettext("Identifier"); ?></td>
100
                  <td class="listhdr"><?=gettext("Pre-Shared Key"); ?></td>
101
                  <td class="list">
102
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
103
			    <tr>
104
			        <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
			    </tr>
107
			</table>
108
		  </td>
109
		</tr>
110
			  <?php $i = 0; foreach ($userkeys as $secretent): ?>
111
		<tr>
112
		<td class="listlr gray">
113
			<?php
114
				if ($secretent['ident'] == 'allusers')
115
					echo gettext("ANY USER");
116
				else
117
					echo htmlspecialchars($secretent['ident']);
118
			?>
119
		</td>
120
		<td class="listr gray">
121
			<?=htmlspecialchars($secretent['pre-shared-key']);?>
122
		</td>
123
		<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
		&nbsp;</td>
132
				</tr>
133
			  <?php $i++; endforeach; ?>
134

    
135
			  <?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
                  <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
				</tr>
146
			  <?php $i++; endforeach; ?>
147
                <tr> 
148
                  <td class="list" colspan="2"></td>
149
                  <td class="list">
150
			<table border="0" cellspacing="0" cellpadding="1" summary="add key">
151
			    <tr>
152
			        <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
			    </tr>
155
			</table>
156
		  </td>
157
		</tr>
158
              </table>
159
	</div>
160
      </td>
161
    </tr>
162
	<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
</table>
175
<?php include("fend.inc"); ?>
176
</body>
177
</html>
(238-238/256)