1 |
f98bfed2
|
Ermal Lu?i
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
c7281770
|
Chris Buechler
|
part of pfSense (https://www.pfsense.org/)
|
5 |
f98bfed2
|
Ermal Lu?i
|
|
6 |
|
|
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
|
7 |
338ded9b
|
Renato Botelho
|
Copyright (C) 2007 Bill Marquette <bill.marquette@gmail.com>
|
8 |
29aef6c4
|
Jim Thompson
|
Copyright (C) 2013-2014 Electric Sheep Fencing, LP
|
9 |
338ded9b
|
Renato Botelho
|
All rights reserved.
|
10 |
|
|
|
11 |
|
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
|
|
|
14 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
|
|
|
17 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
|
|
|
21 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
f98bfed2
|
Ermal Lu?i
|
*/
|
32 |
|
|
/*
|
33 |
|
|
pfSense_MODULE: auth
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-system-usermanager-settings
|
38 |
0ff5ea76
|
Renato Botelho
|
##|*NAME=System: User Manager: settings page
|
39 |
|
|
##|*DESCR=Allow access to the 'System: User Manager: settings' page.
|
40 |
f98bfed2
|
Ermal Lu?i
|
##|*MATCH=system_usermanager_settings.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
|
|
require("guiconfig.inc");
|
44 |
|
|
|
45 |
|
|
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
|
46 |
6306b5dd
|
Ermal Lu?i
|
$pconfig['authmode'] = &$config['system']['webgui']['authmode'];
|
47 |
f98bfed2
|
Ermal Lu?i
|
$pconfig['backend'] = &$config['system']['webgui']['backend'];
|
48 |
|
|
|
49 |
|
|
// Page title for main admin
|
50 |
e2f0ac59
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("System"),gettext("User manager settings"));
|
51 |
f98bfed2
|
Ermal Lu?i
|
|
52 |
b641a575
|
Ermal
|
$save_and_test = false;
|
53 |
f98bfed2
|
Ermal Lu?i
|
if ($_POST) {
|
54 |
|
|
unset($input_errors);
|
55 |
6306b5dd
|
Ermal Lu?i
|
$pconfig = $_POST;
|
56 |
f98bfed2
|
Ermal Lu?i
|
|
57 |
02647583
|
Ermal
|
if(isset($_POST['session_timeout'])) {
|
58 |
f98bfed2
|
Ermal Lu?i
|
$timeout = intval($_POST['session_timeout']);
|
59 |
8cd27a98
|
Ermal Lu?i
|
if ($timeout != "" && (!is_numeric($timeout) || $timeout <= 0))
|
60 |
f98bfed2
|
Ermal Lu?i
|
$input_errors[] = gettext("Session timeout must be an integer value.");
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
if (!$input_errors) {
|
64 |
20e18ef2
|
Ermal
|
if ($_POST['authmode'] != "local") {
|
65 |
|
|
$authsrv = auth_get_authserver($_POST['authmode']);
|
66 |
072bc34c
|
jim-p
|
if ($_POST['savetest'])
|
67 |
|
|
if ($authsrv['type'] == "ldap")
|
68 |
|
|
$save_and_test = true;
|
69 |
|
|
else
|
70 |
|
|
$savemsg = gettext("The test was not performed because it is supported only for ldap based backends.");
|
71 |
20e18ef2
|
Ermal
|
}
|
72 |
b641a575
|
Ermal
|
|
73 |
f98bfed2
|
Ermal Lu?i
|
|
74 |
34a2fb1b
|
Erik Fonnesbeck
|
if(isset($_POST['session_timeout']) && $_POST['session_timeout'] != "")
|
75 |
6306b5dd
|
Ermal Lu?i
|
$config['system']['webgui']['session_timeout'] = intval($_POST['session_timeout']);
|
76 |
f98bfed2
|
Ermal Lu?i
|
else
|
77 |
|
|
unset($config['system']['webgui']['session_timeout']);
|
78 |
|
|
|
79 |
6306b5dd
|
Ermal Lu?i
|
if($_POST['authmode'])
|
80 |
|
|
$config['system']['webgui']['authmode'] = $_POST['authmode'];
|
81 |
f98bfed2
|
Ermal Lu?i
|
else
|
82 |
6306b5dd
|
Ermal Lu?i
|
unset($config['system']['webgui']['authmode']);
|
83 |
f98bfed2
|
Ermal Lu?i
|
|
84 |
|
|
write_config();
|
85 |
|
|
|
86 |
|
|
}
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
include("head.inc");
|
90 |
|
|
?>
|
91 |
|
|
|
92 |
|
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
93 |
|
|
<?php include("fbegin.inc");?>
|
94 |
|
|
<?php if ($input_errors) print_input_errors($input_errors);?>
|
95 |
|
|
<?php if ($savemsg) print_info_box($savemsg);?>
|
96 |
|
|
|
97 |
|
|
<?php
|
98 |
|
|
if($save_and_test) {
|
99 |
1df3c262
|
Colin Fleming
|
echo "<script type=\"text/javascript\">\n";
|
100 |
|
|
echo "//<![CDATA[\n";
|
101 |
6306b5dd
|
Ermal Lu?i
|
echo "myRef = window.open('system_usermanager_settings_test.php?authserver={$pconfig['authmode']}','mywin', ";
|
102 |
f98bfed2
|
Ermal Lu?i
|
echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
|
103 |
e2f0ac59
|
Carlos Eduardo Ramos
|
echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected. Action aborted.") ."');\n";
|
104 |
1df3c262
|
Colin Fleming
|
echo "//]]>\n";
|
105 |
f98bfed2
|
Ermal Lu?i
|
echo "</script>\n";
|
106 |
|
|
}
|
107 |
|
|
?>
|
108 |
|
|
|
109 |
338ded9b
|
Renato Botelho
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="user manager settings">
|
110 |
|
|
<tr>
|
111 |
|
|
<td class="tabnavtbl">
|
112 |
f98bfed2
|
Ermal Lu?i
|
<?php
|
113 |
338ded9b
|
Renato Botelho
|
$tab_array = array();
|
114 |
|
|
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
|
115 |
|
|
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
|
116 |
|
|
$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
|
117 |
|
|
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
|
118 |
|
|
display_top_tabs($tab_array);
|
119 |
|
|
|
120 |
|
|
/* Default to pfsense backend type if none is defined */
|
121 |
|
|
if(!$pconfig['backend'])
|
122 |
|
|
$pconfig['backend'] = "pfsense";
|
123 |
f98bfed2
|
Ermal Lu?i
|
?>
|
124 |
6306b5dd
|
Ermal Lu?i
|
</td>
|
125 |
|
|
</tr>
|
126 |
|
|
<tr>
|
127 |
338ded9b
|
Renato Botelho
|
<td>
|
128 |
|
|
<div id="mainarea">
|
129 |
|
|
<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
|
130 |
|
|
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="main area">
|
131 |
|
|
<tr>
|
132 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Session Timeout"); ?></td>
|
133 |
|
|
<td width="78%" class="vtable">
|
134 |
|
|
<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
|
135 |
|
|
<br />
|
136 |
8cd558b6
|
ayvis
|
<?=gettext("Time in minutes to expire idle management sessions. The default is 4 hours (240 minutes).");?><br />
|
137 |
338ded9b
|
Renato Botelho
|
<?=gettext("Enter 0 to never expire sessions. NOTE: This is a security risk!");?><br />
|
138 |
|
|
</td>
|
139 |
|
|
</tr>
|
140 |
|
|
<tr>
|
141 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
|
142 |
|
|
<td width="78%" class="vtable">
|
143 |
|
|
<select name='authmode' id='authmode' class="formselect" >
|
144 |
|
|
<?php
|
145 |
|
|
$auth_servers = auth_get_authserver_list();
|
146 |
|
|
foreach ($auth_servers as $auth_server):
|
147 |
|
|
$selected = "";
|
148 |
|
|
if ($auth_server['name'] == $pconfig['authmode'])
|
149 |
|
|
$selected = "selected=\"selected\"";
|
150 |
|
|
if (!isset($pconfig['authmode']) && $auth_server['name'] == "Local Database")
|
151 |
|
|
$selected = "selected=\"selected\"";
|
152 |
|
|
?>
|
153 |
|
|
<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
|
154 |
|
|
<?php
|
155 |
|
|
endforeach;
|
156 |
|
|
?>
|
157 |
|
|
</select>
|
158 |
|
|
</td>
|
159 |
|
|
</tr>
|
160 |
|
|
<tr>
|
161 |
|
|
<td width="22%" valign="top"> </td>
|
162 |
|
|
<td width="78%">
|
163 |
|
|
<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
164 |
|
|
<input id="savetest" name="savetest" type="submit" class="formbtn" value="<?=gettext("Save and Test");?>" />
|
165 |
|
|
</td>
|
166 |
|
|
</tr>
|
167 |
|
|
</table>
|
168 |
|
|
</form>
|
169 |
|
|
</div>
|
170 |
6306b5dd
|
Ermal Lu?i
|
</td>
|
171 |
|
|
</tr>
|
172 |
338ded9b
|
Renato Botelho
|
</table>
|
173 |
f98bfed2
|
Ermal Lu?i
|
<?php include("fend.inc");?>
|
174 |
|
|
</body>
|
175 |
|
|
</html>
|