Project

General

Profile

Download (7.87 KB) Statistics
| Branch: | Tag: | Revision:
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 fab7ff44 Bill Marquette
require("guiconfig.inc");
35 e6c18b27 Scott Ullrich
36 fab7ff44 Bill Marquette
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
37 36d42c1a Scott Ullrich
$pconfig['ldapserver'] = &$config['system']['webgui']['ldapserver'];
38
$pconfig['backend'] = &$config['system']['webgui']['backend'];
39 8c7f51fb Scott Ullrich
$pconfig['ldapbindun'] = &$config['system']['webgui']['ldapbindun'];
40
$pconfig['ldapbindpw'] = &$config['system']['webgui']['ldapbindpw'];
41 e6c18b27 Scott Ullrich
$pconfig['ldapfilter'] = &$config['system']['webgui']['ldapfilter'];
42 8c7f51fb Scott Ullrich
$pconfig['ldapsearchbase'] = &$config['system']['webgui']['ldapsearchbase'];
43
44 fab7ff44 Bill Marquette
// Page title for main admin
45 d88c6a9f Scott Ullrich
$pgtitle = array("System","User manager settings");
46 fab7ff44 Bill Marquette
47
if ($_POST) {
48
	unset($input_errors);
49
50
	/* input validation */
51
	$reqdfields = explode(" ", "session_timeout");
52
	$reqdfieldsn = explode(",", "Session Timeout");
53
54
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
55
56 ac09997e Scott Ullrich
	$timeout = intval($_POST['session_timeout']);
57
	if ($timeout != "" && !is_numeric($timeout))
58
		$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
59
60
	if ($timeout < 1) 
61
		$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
62
	
63
	if ($timeout > 999) 
64
		$input_errors[] = gettext("Session timeout must be an integer with value 1 or greater.");
65 fab7ff44 Bill Marquette
66
	/* if this is an AJAX caller then handle via JSON */
67
	if (isAjax() && is_array($input_errors)) {
68
		input_errors2Ajax($input_errors);
69
		exit;
70
	}
71
72
73
	if (!$input_errors) {
74
75 44c31706 Scott Ullrich
		if($_POST['session_timeout'] && $_POST['session_timeout'] != "0") 
76
			$pconfig['session_timeout'] = intval($_POST['session_timeout']);
77
		else 
78
			unset($config['system']['webgui']['session_timeout']);
79 36d42c1a Scott Ullrich
		
80
		if($_POST['ldapserver'])
81
			$pconfig['ldapserver'] = $_POST['ldapserver'];
82
		else
83
			unset($pconfig['ldapserver']);
84 44c31706 Scott Ullrich
			
85 36d42c1a Scott Ullrich
		if($_POST['backend'])
86
			$pconfig['backend'] = $_POST['backend'];
87
		else
88
			unset($pconfig['backend']);
89 8c7f51fb Scott Ullrich
90
		if($_POST['ldapbindun'])
91
			$pconfig['ldapbindun'] = $_POST['ldapbindun'];
92
		else
93
			unset($pconfig['ldapbindun']);
94
95
		if($_POST['ldapbindpw'])
96
			$pconfig['ldapbindpw'] = $_POST['ldapbindpw'];
97
		else
98
			unset($pconfig['ldapbindpw']);
99
100
		if($_POST['ldapfilter'])
101
			$pconfig['ldapfilter'] = $_POST['ldapfilter'];
102
		else
103
			unset($pconfig['ldapfilter']);
104
105
		if($_POST['ldapsearchbase'])
106
			$pconfig['ldapsearchbase'] = $_POST['ldapsearchbase'];
107
		else
108
			unset($pconfig['ldapsearchbase']);
109
110 fab7ff44 Bill Marquette
		write_config();
111
112 a18a8bc6 Scott Ullrich
		$retval = system_password_configure();
113
		sync_webgui_passwords();
114
115 fab7ff44 Bill Marquette
		pfSenseHeader("system_usermanager_settings.php");
116
	}
117
}
118
119
include("head.inc");
120
?>
121
122
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
123
<?php include("fbegin.inc");?>
124
<?php if ($input_errors) print_input_errors($input_errors);?>
125
<?php if ($savemsg) print_info_box($savemsg);?>
126
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
127
    <tr>
128
      <td class="tabnavtbl">
129
<?php
130
    $tab_array = array();
131
    $tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
132
    $tab_array[] = array(gettext("Group"), false, "system_groupmanager.php");
133
    $tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
134
    display_top_tabs($tab_array);
135 36d42c1a Scott Ullrich
136
/* Default to pfsense backend type if none is defined */
137
if(!$pconfig['backend'])
138
	$pconfig['backend'] = "pfsense";
139
140 fab7ff44 Bill Marquette
?>
141
      </td>
142
    <tr>
143
       <td>
144
            <div id="mainarea">
145
            <form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
146 36d42c1a Scott Ullrich
              <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
147
					<tr>
148 fab7ff44 Bill Marquette
                        <td width="22%" valign="top" class="vncell">Session Timeout</td>
149 36d42c1a Scott Ullrich
                        <td width="78%" class="vtable"> 
150
							<input name="session_timeout" id="session_timeout" type="text"size="8" class="formfld unknown" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
151 fab7ff44 Bill Marquette
                          <br />
152
                          <?=gettext("Time in minutes to expire idle management sessions.");?><br />
153 36d42c1a Scott Ullrich
						</td>
154 fab7ff44 Bill Marquette
                      </tr>
155 36d42c1a Scott Ullrich
					<tr>
156 9d265058 Scott Ullrich
                        <td width="22%" valign="top" class="vncell">Authentication primary backend</td>
157 36d42c1a Scott Ullrich
                        <td width="78%" class="vtable"> 
158
							<select name='backend'>
159 9d265058 Scott Ullrich
								<option value="pfsense"<?php if ($pconfig['backend'] == "pfsense") echo " SELECTED";?>>pfSense</option>
160
								<option value="ldap"<?php if ($pconfig['backend'] == "ldap") echo " SELECTED";?>>LDAP</option>
161 36d42c1a Scott Ullrich
							</select>
162
						</td>
163
					</tr>
164
					<tr>
165
                        <td width="22%" valign="top" class="vncell">LDAP Server:port</td>
166
                        <td width="78%" class="vtable">
167
							<input name="ldapserver" size="65" value="<?=htmlspecialchars($pconfig['ldapserver']);?>">
168 e6c18b27 Scott Ullrich
							<br/>Example: ldap.example.org:389
169 36d42c1a Scott Ullrich
						</td>
170
					</tr>
171 8c7f51fb Scott Ullrich
					<tr>
172
                        <td width="22%" valign="top" class="vncell">LDAP Binding username</td>
173
                        <td width="78%" class="vtable">
174
							<input name="ldapbindun" size="65" value="<?=htmlspecialchars($pconfig['ldapbindun']);?>">
175 e6c18b27 Scott Ullrich
							Example: For Active Directory you would want to use format DOMAIN\username
176 8c7f51fb Scott Ullrich
						</td>
177
					</tr>					
178
					<tr>
179
                        <td width="22%" valign="top" class="vncell">LDAP Binding password</td>
180
                        <td width="78%" class="vtable">
181
							<input name="ldapbindpw" size="65" value="<?=htmlspecialchars($pconfig['ldapbindpw']);?>">
182
						</td>
183
					</tr>
184
					<tr>
185
                        <td width="22%" valign="top" class="vncell">LDAP Filter</td>
186
                        <td width="78%" class="vtable">
187
							<input name="ldapfilter" size="65" value="<?=htmlspecialchars($pconfig['ldapfilter']);?>">
188 e6c18b27 Scott Ullrich
							<br/>Example: For Active Directory you would want to use (samaccountname=$username)
189 8c7f51fb Scott Ullrich
						</td>
190
					</tr>
191
					<tr>
192
                        <td width="22%" valign="top" class="vncell">LDAP Search base</td>
193
                        <td width="78%" class="vtable">
194
							<input name="ldapsearchbase" size="65" value="<?=htmlspecialchars($pconfig['ldapsearchbase']);?>">
195 e6c18b27 Scott Ullrich
							<br/>Example: DC=pfsense,DC=com
196 8c7f51fb Scott Ullrich
						</td>
197 e6c18b27 Scott Ullrich
					</tr>
198 36d42c1a Scott Ullrich
                	<tr>
199
                  		<td width="22%" valign="top">&nbsp;</td>
200
                  		<td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />          						
201
						</td>
202
                	</tr>
203 fab7ff44 Bill Marquette
              </table>
204
            </form>
205
            </div>
206
      </td>
207
    </tr>
208
  </table>
209
210
<?php include("fend.inc");?>
211
</body>
212
</html>