1 |
22f81828
|
Ermal Lu?i
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_l2tp_users.php
|
4 |
|
|
part of pfSense
|
5 |
|
|
|
6 |
|
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
7 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
8 |
22f81828
|
Ermal Lu?i
|
All rights reserved.
|
9 |
|
|
|
10 |
|
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
|
|
|
13 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
|
|
|
16 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
|
|
|
20 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
047cb829
|
Ermal Lu?i
|
##|+PRIV
|
33 |
|
|
##|*IDENT=page-vpn-vpnl2tp-users
|
34 |
|
|
##|*NAME=VPN: VPN L2TP : Users page
|
35 |
|
|
##|*DESCR=Allow access to the 'VPN: VPN L2TP : Users' page.
|
36 |
|
|
##|*MATCH=vpn_l2tp_users.php*
|
37 |
|
|
##|-PRIV
|
38 |
|
|
|
39 |
22f81828
|
Ermal Lu?i
|
$pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("Users"));
|
40 |
b32dd0a6
|
jim-p
|
$shortcut_section = "l2tps";
|
41 |
22f81828
|
Ermal Lu?i
|
|
42 |
|
|
require("guiconfig.inc");
|
43 |
483e6de8
|
Scott Ullrich
|
require_once("vpn.inc");
|
44 |
22f81828
|
Ermal Lu?i
|
|
45 |
|
|
if (!is_array($config['l2tp']['user'])) {
|
46 |
|
|
$config['l2tp']['user'] = array();
|
47 |
|
|
}
|
48 |
|
|
$a_secret = &$config['l2tp']['user'];
|
49 |
|
|
|
50 |
|
|
if ($_POST) {
|
51 |
|
|
|
52 |
|
|
$pconfig = $_POST;
|
53 |
|
|
|
54 |
|
|
if ($_POST['apply']) {
|
55 |
|
|
$retval = 0;
|
56 |
a368a026
|
Ermal Lu?i
|
if (!is_subsystem_dirty('rebootreq')) {
|
57 |
22f81828
|
Ermal Lu?i
|
$retval = vpn_l2tp_configure();
|
58 |
|
|
}
|
59 |
|
|
$savemsg = get_std_save_message($retval);
|
60 |
|
|
if ($retval == 0) {
|
61 |
9cc0dd73
|
Ermal
|
if (is_subsystem_dirty('l2tpusers'))
|
62 |
|
|
clear_subsystem_dirty('l2tpusers');
|
63 |
22f81828
|
Ermal Lu?i
|
}
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
if ($_GET['act'] == "del") {
|
68 |
|
|
if ($a_secret[$_GET['id']]) {
|
69 |
|
|
unset($a_secret[$_GET['id']]);
|
70 |
|
|
write_config();
|
71 |
9cc0dd73
|
Ermal
|
mark_subsystem_dirty('l2tpusers');
|
72 |
22f81828
|
Ermal Lu?i
|
pfSenseHeader("vpn_l2tp_users.php");
|
73 |
|
|
exit;
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
include("head.inc");
|
78 |
|
|
?>
|
79 |
|
|
|
80 |
|
|
<form action="vpn_l2tp_users.php" method="post">
|
81 |
c4a7740d
|
Sander van Leeuwen
|
<?php if ($savemsg) print_info_box($savemsg)?>
|
82 |
22f81828
|
Ermal Lu?i
|
<?php if (isset($config['l2tp']['radius']['enable']))
|
83 |
c4a7740d
|
Sander van Leeuwen
|
print_info_box(gettext("Warning: RADIUS is enabled. The local user database will not be used."))?>
|
84 |
|
|
<?php if (is_subsystem_dirty('l2tpusers')):?><br/>
|
85 |
|
|
<?php print_info_box_np(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>")?><br />
|
86 |
|
|
<?php endif?>
|
87 |
|
|
|
88 |
22f81828
|
Ermal Lu?i
|
<?php
|
89 |
|
|
$tab_array = array();
|
90 |
|
|
$tab_array[0] = array(gettext("Configuration"), false, "vpn_l2tp.php");
|
91 |
|
|
$tab_array[1] = array(gettext("Users"), true, "vpn_l2tp_users.php");
|
92 |
c4a7740d
|
Sander van Leeuwen
|
display_top_tabs($tab_array, false, 'pills');
|
93 |
|
|
?>
|
94 |
|
|
<div class="table-responsive">
|
95 |
|
|
<table class="table table-striped table-hover">
|
96 |
|
|
<thead>
|
97 |
|
|
<tr>
|
98 |
|
|
<th><?=gettext("Username")?></th>
|
99 |
|
|
<th><?=gettext("IP address")?></th>
|
100 |
|
|
<th></th>
|
101 |
22f81828
|
Ermal Lu?i
|
</tr>
|
102 |
c4a7740d
|
Sander van Leeuwen
|
</thead>
|
103 |
|
|
<tbody>
|
104 |
|
|
<?php $i = 0; foreach ($a_secret as $secretent):?>
|
105 |
|
|
<tr>
|
106 |
|
|
<td>
|
107 |
|
|
<?=htmlspecialchars($secretent['name'])?>
|
108 |
|
|
</td>
|
109 |
|
|
<td>
|
110 |
|
|
<?php if($secretent['ip'] == "") $secretent['ip'] = "Dynamic"?>
|
111 |
|
|
<?=htmlspecialchars($secretent['ip'])?>
|
112 |
|
|
</td>
|
113 |
|
|
<td>
|
114 |
|
|
<a class="btn btn-xs btn-primary" href="vpn_l2tp_users_edit.php?id=<?=$i?>"><?= gettext('edit') ?></a>
|
115 |
|
|
<a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?")?>')"><?=gettext("delete")?></a>
|
116 |
|
|
</td>
|
117 |
22f81828
|
Ermal Lu?i
|
</tr>
|
118 |
c4a7740d
|
Sander van Leeuwen
|
<?php $i++; endforeach?>
|
119 |
|
|
</tbody>
|
120 |
|
|
</table>
|
121 |
|
|
</div>
|
122 |
|
|
|
123 |
|
|
<a class="btn btn-success" href="vpn_l2tp_users_edit.php"><?=gettext("add user")?></a>
|
124 |
22f81828
|
Ermal Lu?i
|
</form>
|
125 |
|
|
|
126 |
c4a7740d
|
Sander van Leeuwen
|
<?php include("foot.inc")?>
|