1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
part of pfSense (http://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
|
if($_POST['savetest'])
|
35
|
$save_and_test = true;
|
36
|
|
37
|
require("guiconfig.inc");
|
38
|
|
39
|
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
|
40
|
$pconfig['ldapserver'] = &$config['system']['webgui']['ldapserver'];
|
41
|
$pconfig['backend'] = &$config['system']['webgui']['backend'];
|
42
|
$pconfig['ldapbindun'] = &$config['system']['webgui']['ldapbindun'];
|
43
|
$pconfig['ldapbindpw'] = &$config['system']['webgui']['ldapbindpw'];
|
44
|
$pconfig['ldapfilter'] = &$config['system']['webgui']['ldapfilter'];
|
45
|
$pconfig['ldapsearchbase'] = &$config['system']['webgui']['ldapsearchbase'];
|
46
|
|
47
|
// Page title for main admin
|
48
|
$pgtitle = array("System","User manager settings");
|
49
|
|
50
|
if ($_POST) {
|
51
|
unset($input_errors);
|
52
|
|
53
|
/* input validation */
|
54
|
$reqdfields = explode(" ", "session_timeout");
|
55
|
$reqdfieldsn = explode(",", "Session Timeout");
|
56
|
|
57
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
58
|
|
59
|
if($_POST['session_timeout']) {
|
60
|
$timeout = intval($_POST['session_timeout']);
|
61
|
if ($timeout != "" && !is_numeric($timeout))
|
62
|
$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
|
63
|
|
64
|
if ($timeout < 1)
|
65
|
$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
|
66
|
|
67
|
if ($timeout > 999)
|
68
|
$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
|
69
|
}
|
70
|
|
71
|
if (!$input_errors) {
|
72
|
|
73
|
if($_POST['session_timeout'] && $_POST['session_timeout'] != "0")
|
74
|
$pconfig['session_timeout'] = intval($_POST['session_timeout']);
|
75
|
else
|
76
|
unset($config['system']['webgui']['session_timeout']);
|
77
|
|
78
|
if($_POST['ldapserver'])
|
79
|
$pconfig['ldapserver'] = $_POST['ldapserver'];
|
80
|
else
|
81
|
unset($pconfig['ldapserver']);
|
82
|
|
83
|
if($_POST['backend'])
|
84
|
$pconfig['backend'] = $_POST['backend'];
|
85
|
else
|
86
|
unset($pconfig['backend']);
|
87
|
|
88
|
if($_POST['ldapbindun'])
|
89
|
$pconfig['ldapbindun'] = $_POST['ldapbindun'];
|
90
|
else
|
91
|
unset($pconfig['ldapbindun']);
|
92
|
|
93
|
if($_POST['ldapbindpw'])
|
94
|
$pconfig['ldapbindpw'] = $_POST['ldapbindpw'];
|
95
|
else
|
96
|
unset($pconfig['ldapbindpw']);
|
97
|
|
98
|
if($_POST['ldapfilter'])
|
99
|
$pconfig['ldapfilter'] = $_POST['ldapfilter'];
|
100
|
else
|
101
|
unset($pconfig['ldapfilter']);
|
102
|
|
103
|
if($_POST['ldapsearchbase'])
|
104
|
$pconfig['ldapsearchbase'] = $_POST['ldapsearchbase'];
|
105
|
else
|
106
|
unset($pconfig['ldapsearchbase']);
|
107
|
|
108
|
write_config();
|
109
|
|
110
|
$retval = system_password_configure();
|
111
|
sync_webgui_passwords();
|
112
|
|
113
|
}
|
114
|
}
|
115
|
|
116
|
include("head.inc");
|
117
|
?>
|
118
|
|
119
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
120
|
<?php include("fbegin.inc");?>
|
121
|
<?php if ($input_errors) print_input_errors($input_errors);?>
|
122
|
<?php if ($savemsg) print_info_box($savemsg);?>
|
123
|
|
124
|
<?php
|
125
|
if($save_and_test) {
|
126
|
echo "<script language='javascript'>\n";
|
127
|
echo "myRef = window.open('system_usermanager_settings_test.php','mywin', ";
|
128
|
echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
|
129
|
echo "</script>\n";
|
130
|
}
|
131
|
?>
|
132
|
|
133
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
134
|
<tr>
|
135
|
<td class="tabnavtbl">
|
136
|
<?php
|
137
|
$tab_array = array();
|
138
|
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
|
139
|
$tab_array[] = array(gettext("Group"), false, "system_groupmanager.php");
|
140
|
$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
|
141
|
display_top_tabs($tab_array);
|
142
|
|
143
|
/* Default to pfsense backend type if none is defined */
|
144
|
if(!$pconfig['backend'])
|
145
|
$pconfig['backend'] = "pfsense";
|
146
|
|
147
|
?>
|
148
|
</td>
|
149
|
<tr>
|
150
|
<td>
|
151
|
<div id="mainarea">
|
152
|
<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
|
153
|
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
|
154
|
<tr>
|
155
|
<td width="22%" valign="top" class="vncell">Session Timeout</td>
|
156
|
<td width="78%" class="vtable">
|
157
|
<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
|
158
|
<br />
|
159
|
<?=gettext("Time in minutes to expire idle management sessions.");?><br />
|
160
|
</td>
|
161
|
</tr>
|
162
|
<tr>
|
163
|
<td width="22%" valign="top" class="vncell">Authentication primary backend</td>
|
164
|
<td width="78%" class="vtable">
|
165
|
<select name='backend'>
|
166
|
<option value="pfsense"<?php if ($pconfig['backend'] == "pfsense") echo " SELECTED";?>>pfSense</option>
|
167
|
<option value="ldap"<?php if ($pconfig['backend'] == "ldap") echo " SELECTED";?>>LDAP (Active Directory)</option>
|
168
|
</select>
|
169
|
<br/>NOTE: login failures or server not available issues will fall back to pfSense internal users/group authentication.
|
170
|
</td>
|
171
|
</tr>
|
172
|
<tr>
|
173
|
<td width="22%" valign="top" class="vncell">LDAP Server:port</td>
|
174
|
<td width="78%" class="vtable">
|
175
|
<input name="ldapserver" size="65" value="<?=htmlspecialchars($pconfig['ldapserver']);?>">
|
176
|
<br/>Example: ldaps://ldap.example.org:389 or ldap://ldap.example.org:389
|
177
|
</td>
|
178
|
</tr>
|
179
|
<tr>
|
180
|
<td width="22%" valign="top" class="vncell">LDAP Binding username</td>
|
181
|
<td width="78%" class="vtable">
|
182
|
<input name="ldapbindun" size="65" value="<?=htmlspecialchars($pconfig['ldapbindun']);?>">
|
183
|
<br/>This account must have read access to the user objects and be able to retrieve groups.
|
184
|
<br/>Example: For Active Directory you would want to use format DOMAIN\username
|
185
|
</td>
|
186
|
</tr>
|
187
|
<tr>
|
188
|
<td width="22%" valign="top" class="vncell">LDAP Binding password</td>
|
189
|
<td width="78%" class="vtable">
|
190
|
<input name="ldapbindpw" type="password" size="65" value="<?=htmlspecialchars($pconfig['ldapbindpw']);?>">
|
191
|
</td>
|
192
|
</tr>
|
193
|
<tr>
|
194
|
<td width="22%" valign="top" class="vncell">LDAP Filter</td>
|
195
|
<td width="78%" class="vtable">
|
196
|
<input name="ldapfilter" size="65" value="<?=htmlspecialchars($pconfig['ldapfilter']);?>">
|
197
|
<br/>Example: For Active Directory you would want to use (samaccountname=$username)
|
198
|
</td>
|
199
|
</tr>
|
200
|
<tr>
|
201
|
<td width="22%" valign="top" class="vncell">LDAP Search base</td>
|
202
|
<td width="78%" class="vtable">
|
203
|
<input name="ldapsearchbase" size="65" value="<?=htmlspecialchars($pconfig['ldapsearchbase']);?>">
|
204
|
<br/>Example: DC=pfsense,DC=com
|
205
|
</td>
|
206
|
</tr>
|
207
|
<tr>
|
208
|
<td width="22%" valign="top"> </td>
|
209
|
<td width="78%">
|
210
|
<input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
211
|
<input id="savetest" name="savetest" type="submit" class="formbtn" value="<?=gettext("Save and Test");?>" />
|
212
|
</td>
|
213
|
</tr>
|
214
|
</table>
|
215
|
</form>
|
216
|
</div>
|
217
|
</td>
|
218
|
</tr>
|
219
|
</table>
|
220
|
<?php include("fend.inc");?>
|
221
|
</body>
|
222
|
</html>
|
223
|
<script language="javascript">
|
224
|
function openwindow(url) {
|
225
|
var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
|
226
|
if (oWin==null || typeof(oWin)=="undefined") {
|
227
|
return false;
|
228
|
} else {
|
229
|
return true;
|
230
|
}
|
231
|
}
|
232
|
</script>
|