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