1 |
fab7ff44
|
Bill Marquette
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
part of pfSense (http://www.pfsense.org/)
|
5 |
|
|
|
6 |
e6c18b27
|
Scott Ullrich
|
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
|
7 |
|
|
All rights reserved.
|
8 |
|
|
|
9 |
fab7ff44
|
Bill Marquette
|
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 |
e6c18b27
|
Scott Ullrich
|
|
34 |
4848bc75
|
Scott Ullrich
|
if($_POST['savetest'])
|
35 |
|
|
$save_and_test = true;
|
36 |
|
|
|
37 |
fab7ff44
|
Bill Marquette
|
require("guiconfig.inc");
|
38 |
e6c18b27
|
Scott Ullrich
|
|
39 |
fab7ff44
|
Bill Marquette
|
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
|
40 |
36d42c1a
|
Scott Ullrich
|
$pconfig['ldapserver'] = &$config['system']['webgui']['ldapserver'];
|
41 |
|
|
$pconfig['backend'] = &$config['system']['webgui']['backend'];
|
42 |
8c7f51fb
|
Scott Ullrich
|
$pconfig['ldapbindun'] = &$config['system']['webgui']['ldapbindun'];
|
43 |
|
|
$pconfig['ldapbindpw'] = &$config['system']['webgui']['ldapbindpw'];
|
44 |
e6c18b27
|
Scott Ullrich
|
$pconfig['ldapfilter'] = &$config['system']['webgui']['ldapfilter'];
|
45 |
8c7f51fb
|
Scott Ullrich
|
$pconfig['ldapsearchbase'] = &$config['system']['webgui']['ldapsearchbase'];
|
46 |
|
|
|
47 |
fab7ff44
|
Bill Marquette
|
// Page title for main admin
|
48 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("System","User manager settings");
|
49 |
fab7ff44
|
Bill Marquette
|
|
50 |
|
|
if ($_POST) {
|
51 |
|
|
unset($input_errors);
|
52 |
4848bc75
|
Scott Ullrich
|
|
53 |
fab7ff44
|
Bill Marquette
|
/* input validation */
|
54 |
|
|
$reqdfields = explode(" ", "session_timeout");
|
55 |
|
|
$reqdfieldsn = explode(",", "Session Timeout");
|
56 |
|
|
|
57 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
58 |
|
|
|
59 |
5ed85831
|
Scott Ullrich
|
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 |
ac09997e
|
Scott Ullrich
|
|
64 |
5ed85831
|
Scott Ullrich
|
if ($timeout < 1)
|
65 |
|
|
$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
|
66 |
ac09997e
|
Scott Ullrich
|
|
67 |
5ed85831
|
Scott Ullrich
|
if ($timeout > 999)
|
68 |
|
|
$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
|
69 |
|
|
}
|
70 |
fab7ff44
|
Bill Marquette
|
|
71 |
|
|
if (!$input_errors) {
|
72 |
|
|
|
73 |
44c31706
|
Scott Ullrich
|
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 |
36d42c1a
|
Scott Ullrich
|
|
78 |
|
|
if($_POST['ldapserver'])
|
79 |
|
|
$pconfig['ldapserver'] = $_POST['ldapserver'];
|
80 |
|
|
else
|
81 |
|
|
unset($pconfig['ldapserver']);
|
82 |
44c31706
|
Scott Ullrich
|
|
83 |
36d42c1a
|
Scott Ullrich
|
if($_POST['backend'])
|
84 |
|
|
$pconfig['backend'] = $_POST['backend'];
|
85 |
|
|
else
|
86 |
|
|
unset($pconfig['backend']);
|
87 |
8c7f51fb
|
Scott Ullrich
|
|
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 |
fab7ff44
|
Bill Marquette
|
write_config();
|
109 |
|
|
|
110 |
a18a8bc6
|
Scott Ullrich
|
$retval = system_password_configure();
|
111 |
|
|
sync_webgui_passwords();
|
112 |
|
|
|
113 |
fab7ff44
|
Bill Marquette
|
}
|
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 |
4848bc75
|
Scott Ullrich
|
|
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 |
b0fff0d7
|
Scott Ullrich
|
echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
|
129 |
4848bc75
|
Scott Ullrich
|
echo "</script>\n";
|
130 |
|
|
}
|
131 |
|
|
?>
|
132 |
|
|
|
133 |
fab7ff44
|
Bill Marquette
|
<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 |
36d42c1a
|
Scott Ullrich
|
|
143 |
|
|
/* Default to pfsense backend type if none is defined */
|
144 |
|
|
if(!$pconfig['backend'])
|
145 |
|
|
$pconfig['backend'] = "pfsense";
|
146 |
|
|
|
147 |
fab7ff44
|
Bill Marquette
|
?>
|
148 |
|
|
</td>
|
149 |
|
|
<tr>
|
150 |
|
|
<td>
|
151 |
|
|
<div id="mainarea">
|
152 |
|
|
<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
|
153 |
36d42c1a
|
Scott Ullrich
|
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
|
154 |
|
|
<tr>
|
155 |
fab7ff44
|
Bill Marquette
|
<td width="22%" valign="top" class="vncell">Session Timeout</td>
|
156 |
36d42c1a
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
157 |
5ed85831
|
Scott Ullrich
|
<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
|
158 |
fab7ff44
|
Bill Marquette
|
<br />
|
159 |
|
|
<?=gettext("Time in minutes to expire idle management sessions.");?><br />
|
160 |
36d42c1a
|
Scott Ullrich
|
</td>
|
161 |
fab7ff44
|
Bill Marquette
|
</tr>
|
162 |
36d42c1a
|
Scott Ullrich
|
<tr>
|
163 |
9d265058
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">Authentication primary backend</td>
|
164 |
36d42c1a
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
165 |
|
|
<select name='backend'>
|
166 |
9d265058
|
Scott Ullrich
|
<option value="pfsense"<?php if ($pconfig['backend'] == "pfsense") echo " SELECTED";?>>pfSense</option>
|
167 |
f3f60e61
|
Scott Ullrich
|
<option value="ldap"<?php if ($pconfig['backend'] == "ldap") echo " SELECTED";?>>LDAP (Active Directory)</option>
|
168 |
36d42c1a
|
Scott Ullrich
|
</select>
|
169 |
68f9c987
|
Scott Ullrich
|
<br/>NOTE: login failures or server not available issues will fall back to pfSense internal users/group authentication.
|
170 |
36d42c1a
|
Scott Ullrich
|
</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 |
68f9c987
|
Scott Ullrich
|
<br/>Example: ldaps://ldap.example.org:389 or ldap://ldap.example.org:389
|
177 |
36d42c1a
|
Scott Ullrich
|
</td>
|
178 |
|
|
</tr>
|
179 |
8c7f51fb
|
Scott Ullrich
|
<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 |
68f9c987
|
Scott Ullrich
|
<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 |
8c7f51fb
|
Scott Ullrich
|
</td>
|
186 |
|
|
</tr>
|
187 |
|
|
<tr>
|
188 |
|
|
<td width="22%" valign="top" class="vncell">LDAP Binding password</td>
|
189 |
|
|
<td width="78%" class="vtable">
|
190 |
5ed85831
|
Scott Ullrich
|
<input name="ldapbindpw" type="password" size="65" value="<?=htmlspecialchars($pconfig['ldapbindpw']);?>">
|
191 |
8c7f51fb
|
Scott Ullrich
|
</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 |
e6c18b27
|
Scott Ullrich
|
<br/>Example: For Active Directory you would want to use (samaccountname=$username)
|
198 |
8c7f51fb
|
Scott Ullrich
|
</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 |
e6c18b27
|
Scott Ullrich
|
<br/>Example: DC=pfsense,DC=com
|
205 |
8c7f51fb
|
Scott Ullrich
|
</td>
|
206 |
e6c18b27
|
Scott Ullrich
|
</tr>
|
207 |
36d42c1a
|
Scott Ullrich
|
<tr>
|
208 |
|
|
<td width="22%" valign="top"> </td>
|
209 |
4848bc75
|
Scott Ullrich
|
<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 |
36d42c1a
|
Scott Ullrich
|
</td>
|
213 |
|
|
</tr>
|
214 |
fab7ff44
|
Bill Marquette
|
</table>
|
215 |
|
|
</form>
|
216 |
|
|
</div>
|
217 |
|
|
</td>
|
218 |
|
|
</tr>
|
219 |
|
|
</table>
|
220 |
|
|
<?php include("fend.inc");?>
|
221 |
|
|
</body>
|
222 |
|
|
</html>
|
223 |
073115bc
|
Scott Ullrich
|
<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>
|