Project

General

Profile

Download (26.2 KB) Statistics
| Branch: | Tag: | Revision:
1 fbf672cb Matthew Grooms
<?php
2
/*
3 c5d81585 Renato Botelho
 * system_authservers.php
4 ac9d8bed Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * Copyright (c) 2008 Shrew Soft Inc
8
 * All rights reserved.
9 ac9d8bed Stephen Beaver
 *
10 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
11
 * you may not use this file except in compliance with the License.
12
 * You may obtain a copy of the License at
13 ac9d8bed Stephen Beaver
 *
14 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
15 ac9d8bed Stephen Beaver
 *
16 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
17
 * distributed under the License is distributed on an "AS IS" BASIS,
18
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
 * See the License for the specific language governing permissions and
20
 * limitations under the License.
21 ac9d8bed Stephen Beaver
 */
22 fbf672cb Matthew Grooms
23
##|+PRIV
24
##|*IDENT=page-system-authservers
25
##|*NAME=System: Authentication Servers
26
##|*DESCR=Allow access to the 'System: Authentication Servers' page.
27 57188e47 Phil Davis
##|*WARN=standard-warning-root
28 fbf672cb Matthew Grooms
##|*MATCH=system_authservers.php*
29
##|-PRIV
30
31 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
32 acee624f Ermal Lu?i
require_once("auth.inc");
33 fbf672cb Matthew Grooms
34 098604d3 Stephen Beaver
// Have we been called to populate the "Select a container" modal?
35
if ($_REQUEST['ajax']) {
36
37
	$ous = array();
38
	$authcfg = array();
39
40
	$authcfg['ldap_port'] = $_REQUEST['port'];
41
	$authcfg['ldap_basedn'] = $_REQUEST['basedn'];
42
	$authcfg['host'] = $_REQUEST['host'];
43
	$authcfg['ldap_scope'] = $_REQUEST['scope'];
44
	$authcfg['ldap_binddn'] = $_REQUEST['binddn'];
45
	$authcfg['ldap_bindpw'] = $_REQUEST['bindpw'];
46
	$authcfg['ldap_urltype'] = $_REQUEST['urltype'];
47
	$authcfg['ldap_protver'] = $_REQUEST['proto'];
48
	$authcfg['ldap_authcn'] = explode(";", $_REQUEST['authcn']);
49
	$authcfg['ldap_caref'] = $_REQUEST['cert'];
50
51
	$ous = ldap_get_user_ous(true, $authcfg);
52
53
	if (empty($ous)) {
54 89140b63 NOYB
		print('<span class="text-danger">Could not connect to the LDAP server. Please check the LDAP configuration.</span>');
55 098604d3 Stephen Beaver
	} else {
56 697b1e07 Stephen Beaver
		$modal = new Modal("Select LDAP containers for authentication", "containers", true);
57 098604d3 Stephen Beaver
		$group = new Form_MultiCheckboxGroup('Containers');
58
59
		if (is_array($ous)) {
60
			$idx = 0;
61
62
			foreach ($ous as $ou) {
63
				$group->add(new Form_MultiCheckbox(
64
					'ou' . $idx,
65
					'',
66
					$ou,
67
					in_array($ou, $authcfg['ldap_authcn']),
68
					$ou
69
				));
70
71
				$idx++;
72
			}
73
		}
74
75 697b1e07 Stephen Beaver
		$modal->add($group);
76 098604d3 Stephen Beaver
77
		// Create a "Save button"
78 697b1e07 Stephen Beaver
79
		$btnsv = new Form_Button(
80 098604d3 Stephen Beaver
			'svcontbtn',
81
			'Save',
82
			null,
83
			'fa-save'
84
		);
85
86 697b1e07 Stephen Beaver
		$btnsv->removeClass("btn-default)")->addClass("btn-primary");
87 098604d3 Stephen Beaver
88 697b1e07 Stephen Beaver
		$modal->addInput(new Form_StaticText(
89 098604d3 Stephen Beaver
			'',
90 697b1e07 Stephen Beaver
			$btnsv
91 098604d3 Stephen Beaver
		));
92
93 697b1e07 Stephen Beaver
		print($modal);
94 098604d3 Stephen Beaver
	}
95
96
	exit;
97
}
98
99 4611e283 Steve Beaver
$id = $_REQUEST['id'];
100 fbf672cb Matthew Grooms
101 2ee8dea1 Phil Davis
if (!is_array($config['system']['authserver'])) {
102 fbf672cb Matthew Grooms
	$config['system']['authserver'] = array();
103 2ee8dea1 Phil Davis
}
104 fbf672cb Matthew Grooms
105 6306b5dd Ermal Lu?i
$a_servers = auth_get_authserver_list();
106 59d06739 Steve Beaver
107 2ee8dea1 Phil Davis
foreach ($a_servers as $servers) {
108 6306b5dd Ermal Lu?i
	$a_server[] = $servers;
109 2ee8dea1 Phil Davis
}
110 fbf672cb Matthew Grooms
111 2ee8dea1 Phil Davis
if (!is_array($config['ca'])) {
112 a0165602 Sjon Hortensius
	$config['ca'] = array();
113 2ee8dea1 Phil Davis
}
114 59d06739 Steve Beaver
115 fe2031ab Ermal
$a_ca =& $config['ca'];
116
117 4611e283 Steve Beaver
$act = $_REQUEST['act'];
118 fbf672cb Matthew Grooms
119 4611e283 Steve Beaver
if ($_POST['act'] == "del") {
120 fbf672cb Matthew Grooms
121 59d06739 Steve Beaver
	if (!$a_server[$_POST['id']]) {
122 fbf672cb Matthew Grooms
		pfSenseHeader("system_authservers.php");
123
		exit;
124
	}
125
126 9db6993f jim-p
	/* Remove server from main list. */
127 59d06739 Steve Beaver
	$serverdeleted = $a_server[$_POST['id']]['name'];
128 9db6993f jim-p
	foreach ($config['system']['authserver'] as $k => $as) {
129 2ee8dea1 Phil Davis
		if ($config['system']['authserver'][$k]['name'] == $serverdeleted) {
130 9db6993f jim-p
			unset($config['system']['authserver'][$k]);
131 2ee8dea1 Phil Davis
		}
132 9db6993f jim-p
	}
133
134
	/* Remove server from temp list used later on this page. */
135 59d06739 Steve Beaver
	unset($a_server[$_POST['id']]);
136 9db6993f jim-p
137 8545adde k-paulius
	$savemsg = sprintf(gettext("Authentication Server %s deleted."), htmlspecialchars($serverdeleted));
138 9db6993f jim-p
	write_config($savemsg);
139 fbf672cb Matthew Grooms
}
140
141
if ($act == "edit") {
142
	if (isset($id) && $a_server[$id]) {
143
144
		$pconfig['type'] = $a_server[$id]['type'];
145
		$pconfig['name'] = $a_server[$id]['name'];
146
147
		if ($pconfig['type'] == "ldap") {
148 fe2031ab Ermal
			$pconfig['ldap_caref'] = $a_server[$id]['ldap_caref'];
149 fbf672cb Matthew Grooms
			$pconfig['ldap_host'] = $a_server[$id]['host'];
150
			$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
151 d6b4dfe3 jim-p
			$pconfig['ldap_timeout'] = $a_server[$id]['ldap_timeout'];
152 fbf672cb Matthew Grooms
			$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
153
			$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
154
			$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
155
			$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
156 c61e4626 Ermal Lu?i
			$pconfig['ldap_authcn'] = $a_server[$id]['ldap_authcn'];
157 c7073ebf namezero111111
			$pconfig['ldap_extended_enabled'] = $a_server[$id]['ldap_extended_enabled'];
158
			$pconfig['ldap_extended_query'] = $a_server[$id]['ldap_extended_query'];
159 fbf672cb Matthew Grooms
			$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
160
			$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
161
			$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
162
			$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
163
			$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
164 149efbea jim-p
			$pconfig['ldap_attr_groupobj'] = $a_server[$id]['ldap_attr_groupobj'];
165 a5cd1c5a jim-p
			$pconfig['ldap_utf8'] = isset($a_server[$id]['ldap_utf8']);
166
			$pconfig['ldap_nostrip_at'] = isset($a_server[$id]['ldap_nostrip_at']);
167 149efbea jim-p
			$pconfig['ldap_rfc2307'] = isset($a_server[$id]['ldap_rfc2307']);
168 fbf672cb Matthew Grooms
169 2ee8dea1 Phil Davis
			if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw']) {
170 fbf672cb Matthew Grooms
				$pconfig['ldap_anon'] = true;
171 2ee8dea1 Phil Davis
			}
172 fbf672cb Matthew Grooms
		}
173
174
		if ($pconfig['type'] == "radius") {
175 9da4a575 Renato Botelho
			$pconfig['radius_protocol'] = $a_server[$id]['radius_protocol'];
176 fbf672cb Matthew Grooms
			$pconfig['radius_host'] = $a_server[$id]['host'];
177
			$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
178
			$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
179 e8a58de4 Ermal Lu?i
			$pconfig['radius_secret'] = $a_server[$id]['radius_secret'];
180 bddd2be8 jim-p
			$pconfig['radius_timeout'] = $a_server[$id]['radius_timeout'];
181 fbf672cb Matthew Grooms
182
			if ($pconfig['radius_auth_port'] &&
183 ac9d8bed Stephen Beaver
				$pconfig['radius_acct_port']) {
184 fbf672cb Matthew Grooms
				$pconfig['radius_srvcs'] = "both";
185
			}
186
187 2ee8dea1 Phil Davis
			if ($pconfig['radius_auth_port'] &&
188 ac9d8bed Stephen Beaver
				!$pconfig['radius_acct_port']) {
189 fbf672cb Matthew Grooms
				$pconfig['radius_srvcs'] = "auth";
190 acee624f Ermal Lu?i
				$pconfig['radius_acct_port'] = 1813;
191 fbf672cb Matthew Grooms
			}
192
193
			if (!$pconfig['radius_auth_port'] &&
194 ac9d8bed Stephen Beaver
				$pconfig['radius_acct_port']) {
195 fbf672cb Matthew Grooms
				$pconfig['radius_srvcs'] = "acct";
196 acee624f Ermal Lu?i
				$pconfig['radius_auth_port'] = 1812;
197 fbf672cb Matthew Grooms
			}
198
199
		}
200
	}
201
}
202
203
if ($act == "new") {
204
	$pconfig['ldap_protver'] = 3;
205
	$pconfig['ldap_anon'] = true;
206 9da4a575 Renato Botelho
	$pconfig['radius_protocol'] = "MSCHAPv2";
207 fbf672cb Matthew Grooms
	$pconfig['radius_srvcs'] = "both";
208 acee624f Ermal Lu?i
	$pconfig['radius_auth_port'] = "1812";
209
	$pconfig['radius_acct_port'] = "1813";
210 fbf672cb Matthew Grooms
}
211
212 59d06739 Steve Beaver
if ($_POST['save']) {
213 fbf672cb Matthew Grooms
	unset($input_errors);
214
	$pconfig = $_POST;
215
216
	/* input validation */
217
218
	if ($pconfig['type'] == "ldap") {
219 2ee8dea1 Phil Davis
		$reqdfields = explode(" ",
220
			"name type ldap_host ldap_port " .
221
			"ldap_urltype ldap_protver ldap_scope " .
222
			"ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
223 7b4b0ad3 Stephen Beaver
224 257705ca Renato Botelho
		$reqdfieldsn = array(
225
			gettext("Descriptive name"),
226
			gettext("Type"),
227
			gettext("Hostname or IP"),
228
			gettext("Port value"),
229
			gettext("Transport"),
230
			gettext("Protocol version"),
231
			gettext("Search level"),
232
			gettext("User naming Attribute"),
233
			gettext("Group naming Attribute"),
234
			gettext("Group member attribute"),
235
			gettext("Authentication container"));
236 fbf672cb Matthew Grooms
237
		if (!$pconfig['ldap_anon']) {
238
			$reqdfields[] = "ldap_binddn";
239
			$reqdfields[] = "ldap_bindpw";
240 257705ca Renato Botelho
			$reqdfieldsn[] = gettext("Bind user DN");
241
			$reqdfieldsn[] = gettext("Bind Password");
242 fbf672cb Matthew Grooms
		}
243
	}
244
245
	if ($pconfig['type'] == "radius") {
246 9da4a575 Renato Botelho
		$reqdfields = explode(" ", "name type radius_protocol radius_host radius_srvcs");
247 257705ca Renato Botelho
		$reqdfieldsn = array(
248
			gettext("Descriptive name"),
249
			gettext("Type"),
250 9da4a575 Renato Botelho
			gettext("Radius Protocol"),
251 257705ca Renato Botelho
			gettext("Hostname or IP"),
252
			gettext("Services"));
253 fbf672cb Matthew Grooms
254 0a6ab475 hamnur
		if ($pconfig['radius_srvcs'] == "both" ||
255
			$pconfig['radius_srvcs'] == "auth") {
256 fbf672cb Matthew Grooms
			$reqdfields[] = "radius_auth_port";
257 81ec3187 Chris Buechler
			$reqdfieldsn[] = gettext("Authentication port");
258 fbf672cb Matthew Grooms
		}
259
260 0a6ab475 hamnur
		if ($pconfig['radius_srvcs'] == "both" ||
261
			$pconfig['radius_srvcs'] == "acct") {
262 fbf672cb Matthew Grooms
			$reqdfields[] = "radius_acct_port";
263 81ec3187 Chris Buechler
			$reqdfieldsn[] = gettext("Accounting port");
264 fbf672cb Matthew Grooms
		}
265
266
		if (!isset($id)) {
267
			$reqdfields[] = "radius_secret";
268 257705ca Renato Botelho
			$reqdfieldsn[] = gettext("Shared Secret");
269 fbf672cb Matthew Grooms
		}
270
	}
271
272 1e9b4611 Renato Botelho
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
273 fbf672cb Matthew Grooms
274 2ee8dea1 Phil Davis
	if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host'])) {
275 fbf672cb Matthew Grooms
		$input_errors[] = gettext("The host name contains invalid characters.");
276 2ee8dea1 Phil Davis
	}
277 fbf672cb Matthew Grooms
278 2ee8dea1 Phil Davis
	if (auth_get_authserver($pconfig['name']) && !isset($id)) {
279 257705ca Renato Botelho
		$input_errors[] = gettext("An authentication server with the same name already exists.");
280 2ee8dea1 Phil Davis
	}
281 acee624f Ermal Lu?i
282 d6b4dfe3 jim-p
	if (($pconfig['type'] == "ldap") || ($pconfig['type'] == "radius")) {
283
		$to_field = "{$pconfig['type']}_timeout";
284
		if (isset($_POST[$to_field]) && !empty($_POST[$to_field]) && (!is_numeric($_POST[$to_field]) || (is_numeric($_POST[$to_field]) && ($_POST[$to_field] <= 0)))) {
285
			$input_errors[] = sprintf(gettext("%s Timeout value must be numeric and positive."), strtoupper($pconfig['type']));
286
		}
287 2ee8dea1 Phil Davis
	}
288 bddd2be8 jim-p
289 fbf672cb Matthew Grooms
	if (!$input_errors) {
290
		$server = array();
291
		$server['refid'] = uniqid();
292 2ee8dea1 Phil Davis
		if (isset($id) && $a_server[$id]) {
293 fbf672cb Matthew Grooms
			$server = $a_server[$id];
294 2ee8dea1 Phil Davis
		}
295 fbf672cb Matthew Grooms
296
		$server['type'] = $pconfig['type'];
297
		$server['name'] = $pconfig['name'];
298
299
		if ($server['type'] == "ldap") {
300
301 2ee8dea1 Phil Davis
			if (!empty($pconfig['ldap_caref'])) {
302 fe2031ab Ermal
				$server['ldap_caref'] = $pconfig['ldap_caref'];
303 2ee8dea1 Phil Davis
			}
304 fbf672cb Matthew Grooms
			$server['host'] = $pconfig['ldap_host'];
305
			$server['ldap_port'] = $pconfig['ldap_port'];
306
			$server['ldap_urltype'] = $pconfig['ldap_urltype'];
307
			$server['ldap_protver'] = $pconfig['ldap_protver'];
308
			$server['ldap_scope'] = $pconfig['ldap_scope'];
309
			$server['ldap_basedn'] = $pconfig['ldap_basedn'];
310 c61e4626 Ermal Lu?i
			$server['ldap_authcn'] = $pconfig['ldapauthcontainers'];
311 c7073ebf namezero111111
			$server['ldap_extended_enabled'] = $pconfig['ldap_extended_enabled'];
312
			$server['ldap_extended_query'] = $pconfig['ldap_extended_query'];
313 fbf672cb Matthew Grooms
			$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
314
			$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
315
			$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
316 149efbea jim-p
317
			$server['ldap_attr_groupobj'] = empty($pconfig['ldap_attr_groupobj']) ? "posixGroup" : $pconfig['ldap_attr_groupobj'];
318
319 2ee8dea1 Phil Davis
			if ($pconfig['ldap_utf8'] == "yes") {
320 a5cd1c5a jim-p
				$server['ldap_utf8'] = true;
321 2ee8dea1 Phil Davis
			} else {
322 a5cd1c5a jim-p
				unset($server['ldap_utf8']);
323 2ee8dea1 Phil Davis
			}
324
			if ($pconfig['ldap_nostrip_at'] == "yes") {
325 a5cd1c5a jim-p
				$server['ldap_nostrip_at'] = true;
326 2ee8dea1 Phil Davis
			} else {
327 a5cd1c5a jim-p
				unset($server['ldap_nostrip_at']);
328 2ee8dea1 Phil Davis
			}
329 149efbea jim-p
			if ($pconfig['ldap_rfc2307'] == "yes") {
330
				$server['ldap_rfc2307'] = true;
331
			} else {
332
				unset($server['ldap_rfc2307']);
333
			}
334 a5cd1c5a jim-p
335 fbf672cb Matthew Grooms
336
			if (!$pconfig['ldap_anon']) {
337
				$server['ldap_binddn'] = $pconfig['ldap_binddn'];
338
				$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
339
			} else {
340
				unset($server['ldap_binddn']);
341
				unset($server['ldap_bindpw']);
342
			}
343 d6b4dfe3 jim-p
344
			if ($pconfig['ldap_timeout']) {
345
				$server['ldap_timeout'] = $pconfig['ldap_timeout'];
346
			} else {
347
				$server['ldap_timeout'] = 25;
348
			}
349 fbf672cb Matthew Grooms
		}
350
351
		if ($server['type'] == "radius") {
352
353 9da4a575 Renato Botelho
			$server['radius_protocol'] = $pconfig['radius_protocol'];
354 fbf672cb Matthew Grooms
			$server['host'] = $pconfig['radius_host'];
355
356 2ee8dea1 Phil Davis
			if ($pconfig['radius_secret']) {
357 fbf672cb Matthew Grooms
				$server['radius_secret'] = $pconfig['radius_secret'];
358 2ee8dea1 Phil Davis
			}
359 fbf672cb Matthew Grooms
360 2ee8dea1 Phil Davis
			if ($pconfig['radius_timeout']) {
361 bddd2be8 jim-p
				$server['radius_timeout'] = $pconfig['radius_timeout'];
362 2ee8dea1 Phil Davis
			} else {
363 afdf29d3 jim-p
				$server['radius_timeout'] = 5;
364 2ee8dea1 Phil Davis
			}
365 bddd2be8 jim-p
366 fbf672cb Matthew Grooms
			if ($pconfig['radius_srvcs'] == "both") {
367
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
368
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
369
			}
370
371
			if ($pconfig['radius_srvcs'] == "auth") {
372
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
373
				unset($server['radius_acct_port']);
374
			}
375
376
			if ($pconfig['radius_srvcs'] == "acct") {
377
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
378
				unset($server['radius_auth_port']);
379
			}
380
		}
381
382 2ee8dea1 Phil Davis
		if (isset($id) && $config['system']['authserver'][$id]) {
383 6306b5dd Ermal Lu?i
			$config['system']['authserver'][$id] = $server;
384 2ee8dea1 Phil Davis
		} else {
385 6306b5dd Ermal Lu?i
			$config['system']['authserver'][] = $server;
386 2ee8dea1 Phil Davis
		}
387 fbf672cb Matthew Grooms
388
		write_config();
389
390
		pfSenseHeader("system_authservers.php");
391
	}
392
}
393
394 1d3259b5 Stephen Beaver
// On error, restore the form contents so the user doesn't have to re-enter too much
395 9d3e8723 Phil Davis
if ($_POST && $input_errors) {
396 504bd882 Stephen Beaver
	$pconfig = $_POST;
397
	$pconfig['ldap_authcn'] = $_POST['ldapauthcontainers'];
398 b1f0f7e1 Stephen Beaver
	$pconfig['ldap_template'] = $_POST['ldap_tmpltype'];
399 504bd882 Stephen Beaver
}
400
401 8f1ab2a4 k-paulius
$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Authentication Servers"));
402 edcd7535 Phil Davis
$pglinks = array("", "system_usermanager.php", "system_authservers.php");
403 8f1ab2a4 k-paulius
404
if ($act == "new" || $act == "edit" || $input_errors) {
405
	$pgtitle[] = gettext('Edit');
406 edcd7535 Phil Davis
	$pglinks[] = "@self";
407 8f1ab2a4 k-paulius
}
408
$shortcut_section = "authentication";
409 fbf672cb Matthew Grooms
include("head.inc");
410
411 762faef5 Phil Davis
if ($input_errors) {
412 a0165602 Sjon Hortensius
	print_input_errors($input_errors);
413 762faef5 Phil Davis
}
414 7b4b0ad3 Stephen Beaver
415 762faef5 Phil Davis
if ($savemsg) {
416 ea342b0f Stephen Beaver
	print_info_box($savemsg, 'success');
417 762faef5 Phil Davis
}
418 a0165602 Sjon Hortensius
419
$tab_array = array();
420
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
421
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
422
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
423 2d1f33d9 k-paulius
$tab_array[] = array(gettext("Authentication Servers"), true, "system_authservers.php");
424 a0165602 Sjon Hortensius
display_top_tabs($tab_array);
425
426 762faef5 Phil Davis
if (!($act == "new" || $act == "edit" || $input_errors)) {
427 060ed238 Stephen Beaver
?>
428
<div class="panel panel-default">
429 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Authentication Servers')?></h2></div>
430 060ed238 Stephen Beaver
	<div class="panel-body">
431
		<div class="table-responsive">
432 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap table-rowdblclickedit" data-sortable>
433 060ed238 Stephen Beaver
				<thead>
434
					<tr>
435
						<th><?=gettext("Server Name")?></th>
436
						<th><?=gettext("Type")?></th>
437
						<th><?=gettext("Host Name")?></th>
438
						<th><?=gettext("Actions")?></th>
439
					</tr>
440
				</thead>
441
				<tbody>
442 9d3e8723 Phil Davis
			<?php foreach ($a_server as $i => $server): ?>
443 060ed238 Stephen Beaver
					<tr>
444
						<td><?=htmlspecialchars($server['name'])?></td>
445
						<td><?=htmlspecialchars($auth_server_types[$server['type']])?></td>
446
						<td><?=htmlspecialchars($server['host'])?></td>
447
						<td>
448
						<?php if ($i < (count($a_server) - 1)): ?>
449 4611e283 Steve Beaver
							<a class="fa fa-pencil" title="<?=gettext("Edit server"); ?>" href="system_authservers.php?act=edit&amp;id=<?=$i?>"></a>
450 59d06739 Steve Beaver
							<a class="fa fa-trash"  title="<?=gettext("Delete server")?>" href="system_authservers.php?act=del&amp;id=<?=$i?>" usepost></a>
451 060ed238 Stephen Beaver
						<?php endif?>
452
						</td>
453
					</tr>
454
			<?php endforeach; ?>
455
				</tbody>
456
			</table>
457
		</div>
458 94404d94 Sander van Leeuwen
	</div>
459 060ed238 Stephen Beaver
</div>
460
461
<nav class="action-buttons">
462 4611e283 Steve Beaver
	<a href="?act=new" class="btn btn-success btn-sm">
463 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
464
		<?=gettext("Add")?>
465
	</a>
466
</nav>
467 fbf672cb Matthew Grooms
<?php
468 a0165602 Sjon Hortensius
	include("foot.inc");
469
	exit;
470 fbf672cb Matthew Grooms
}
471
472 a0165602 Sjon Hortensius
$form = new Form;
473
$form->setAction('system_authservers.php?act=edit');
474 ea342b0f Stephen Beaver
475 a0165602 Sjon Hortensius
$form->addGlobal(new Form_Input(
476
	'userid',
477
	null,
478
	'hidden',
479
	$id
480
));
481
482 5f88f964 k-paulius
$section = new Form_Section('Server Settings');
483 a0165602 Sjon Hortensius
484
$section->addInput($input = new Form_Input(
485
	'name',
486 153c3aa6 Phil Davis
	'*Descriptive name',
487 a0165602 Sjon Hortensius
	'text',
488
	$pconfig['name']
489
));
490
491
$section->addInput($input = new Form_Select(
492
	'type',
493 153c3aa6 Phil Davis
	'*Type',
494 a0165602 Sjon Hortensius
	$pconfig['type'],
495
	$auth_server_types
496 44d906ca Sjon Hortensius
))->toggles();
497 a0165602 Sjon Hortensius
498
$form->add($section);
499 6157f724 Stephen Beaver
500
// ==== LDAP settings =========================================================
501 a0165602 Sjon Hortensius
$section = new Form_Section('LDAP Server Settings');
502 44d906ca Sjon Hortensius
$section->addClass('toggle-ldap collapse');
503 a0165602 Sjon Hortensius
504
if (!isset($pconfig['type']) || $pconfig['type'] == 'ldap')
505
	$section->addClass('in');
506
507
$section->addInput(new Form_Input(
508
	'ldap_host',
509 153c3aa6 Phil Davis
	'*Hostname or IP address',
510 a0165602 Sjon Hortensius
	'text',
511
	$pconfig['ldap_host']
512 d672403c derelict-pf
))->setHelp('NOTE: When using SSL or STARTTLS, this hostname MUST match the Common Name '.
513 5585e65d Chris Buechler
	'(CN) of the LDAP server\'s SSL Certificate.');
514 a0165602 Sjon Hortensius
515
$section->addInput(new Form_Input(
516
	'ldap_port',
517 153c3aa6 Phil Davis
	'*Port value',
518 a0165602 Sjon Hortensius
	'number',
519
	$pconfig['ldap_port']
520
));
521
522
$section->addInput(new Form_Select(
523
	'ldap_urltype',
524 153c3aa6 Phil Davis
	'*Transport',
525 a0165602 Sjon Hortensius
	$pconfig['ldap_urltype'],
526
	array_combine(array_keys($ldap_urltypes), array_keys($ldap_urltypes))
527
));
528
529
if (empty($a_ca))
530
{
531
	$section->addInput(new Form_StaticText(
532
		'Peer Certificate Authority',
533 d4a744b2 k-paulius
		'No Certificate Authorities defined.<br/>Create one under <a href="system_camanager.php">System &gt; Cert. Manager</a>.'
534 a0165602 Sjon Hortensius
	));
535 fbf672cb Matthew Grooms
}
536 a0165602 Sjon Hortensius
else
537
{
538
	$ldapCaRef = [];
539
	foreach ($a_ca as $ca)
540
		$ldapCaRef[ $ca['refid'] ] = $ca['descr'];
541
542
	$section->addInput(new Form_Select(
543
		'ldap_caref',
544
		'Peer Certificate Authority',
545
		$pconfig['ldap_caref'],
546
		$ldapCaRef
547 d672403c derelict-pf
	))->setHelp('This option is used if \'SSL Encrypted\' '.
548
		'or \'TCP - STARTTLS\' options are chosen. '.
549 a0165602 Sjon Hortensius
		'It must match with the CA in the AD otherwise problems will arise.');
550 fbf672cb Matthew Grooms
}
551
552 a0165602 Sjon Hortensius
$section->addInput(new Form_Select(
553
	'ldap_protver',
554 153c3aa6 Phil Davis
	'*Protocol version',
555 a0165602 Sjon Hortensius
	$pconfig['ldap_protver'],
556
	array_combine($ldap_protvers, $ldap_protvers)
557
));
558
559 d6b4dfe3 jim-p
$section->addInput(new Form_Input(
560
	'ldap_timeout',
561
	'Server Timeout',
562
	'number',
563
	$pconfig['ldap_timeout'],
564
	['placeholder' => 25]
565
))->setHelp('Timeout for LDAP operations (seconds)');
566
567 905f6119 Stephen Beaver
$group = new Form_Group('Search scope');
568
569 c84db5bb Stephen Beaver
$SSF = new Form_Select(
570 a0165602 Sjon Hortensius
	'ldap_scope',
571 153c3aa6 Phil Davis
	'*Level',
572 a0165602 Sjon Hortensius
	$pconfig['ldap_scope'],
573
	$ldap_scopes
574 c84db5bb Stephen Beaver
);
575 df8fca9d Stephen Beaver
576 c84db5bb Stephen Beaver
$SSB = new Form_Input(
577 a0165602 Sjon Hortensius
	'ldap_basedn',
578
	'Base DN',
579
	'text',
580
	$pconfig['ldap_basedn']
581 c84db5bb Stephen Beaver
);
582 905f6119 Stephen Beaver
583 c84db5bb Stephen Beaver
584
$section->addInput(new Form_StaticText(
585
	'Search scope',
586
	'Level ' . $SSF . '<br />' . 'Base DN' . $SSB
587
));
588 a0165602 Sjon Hortensius
589
$group = new Form_Group('Authentication containers');
590
$group->add(new Form_Input(
591
	'ldapauthcontainers',
592 153c3aa6 Phil Davis
	'*Containers',
593 a0165602 Sjon Hortensius
	'text',
594
	$pconfig['ldap_authcn']
595
))->setHelp('Note: Semi-Colon separated. This will be prepended to the search '.
596 89140b63 NOYB
	'base dn above or the full container path can be specified containing a dc= '.
597 781d9ce4 Phil Davis
	'component.%1$sExample: CN=Users;DC=example,DC=com or OU=Staff;OU=Freelancers', '<br/>');
598 504bd882 Stephen Beaver
599 a0165602 Sjon Hortensius
$group->add(new Form_Button(
600
	'Select',
601 faab522f Renato Botelho
	'Select a container',
602 2e7fa7ca jim-p
	null,
603
	'fa-search'
604 347c0214 Phil Davis
))->setAttribute('type','button')->addClass('btn-info');
605 501efbd2 Stephen Beaver
606 a0165602 Sjon Hortensius
$section->add($group);
607
608 2e101d89 Sander van Leeuwen
$section->addInput(new Form_Checkbox(
609 a0165602 Sjon Hortensius
	'ldap_extended_enabled',
610 2e101d89 Sander van Leeuwen
	'Extended query',
611
	'Enable extended query',
612 a0165602 Sjon Hortensius
	$pconfig['ldap_extended_enabled']
613 e39a41e9 Stephen Beaver
));
614 a0165602 Sjon Hortensius
615 2e101d89 Sander van Leeuwen
$group = new Form_Group('Query');
616 e39a41e9 Stephen Beaver
$group->addClass('extended');
617
618 a0165602 Sjon Hortensius
$group->add(new Form_Input(
619
	'ldap_extended_query',
620 2e101d89 Sander van Leeuwen
	'Query',
621 a0165602 Sjon Hortensius
	'text',
622
	$pconfig['ldap_extended_query']
623 2e101d89 Sander van Leeuwen
))->setHelp('Example: &amp;(objectClass=inetOrgPerson)(mail=*@example.com)');
624
625 a0165602 Sjon Hortensius
$section->add($group);
626
627
$section->addInput(new Form_Checkbox(
628
	'ldap_anon',
629
	'Bind anonymous',
630
	'Use anonymous binds to resolve distinguished names',
631
	$pconfig['ldap_anon']
632 b0909f2e Stephen Beaver
));
633 a0165602 Sjon Hortensius
634 153c3aa6 Phil Davis
$group = new Form_Group('*Bind credentials');
635 b0909f2e Stephen Beaver
$group->addClass('ldapanon');
636
637 a0165602 Sjon Hortensius
$group->add(new Form_Input(
638
	'ldap_binddn',
639
	'User DN:',
640
	'text',
641
	$pconfig['ldap_binddn']
642
));
643 b0909f2e Stephen Beaver
644 a0165602 Sjon Hortensius
$group->add(new Form_Input(
645
	'ldap_bindpw',
646
	'Password',
647 1c1f08f9 Stephen Beaver
	'password',
648 a0165602 Sjon Hortensius
	$pconfig['ldap_bindpw']
649
));
650
$section->add($group);
651
652 ac9d8bed Stephen Beaver
if (!isset($id)) {
653
	$template_list = array();
654
655 9d3e8723 Phil Davis
	foreach ($ldap_templates as $option => $template) {
656 ac9d8bed Stephen Beaver
		$template_list[$option] = $template['desc'];
657
	}
658 a0165602 Sjon Hortensius
659
	$section->addInput(new Form_Select(
660
		'ldap_tmpltype',
661
		'Initial Template',
662
		$pconfig['ldap_template'],
663 ac9d8bed Stephen Beaver
		$template_list
664 a0165602 Sjon Hortensius
	));
665 fbf672cb Matthew Grooms
}
666
667 a0165602 Sjon Hortensius
$section->addInput(new Form_Input(
668
	'ldap_attr_user',
669 153c3aa6 Phil Davis
	'*User naming attribute',
670 a0165602 Sjon Hortensius
	'text',
671
	$pconfig['ldap_attr_user']
672
));
673
674
$section->addInput(new Form_Input(
675
	'ldap_attr_group',
676 153c3aa6 Phil Davis
	'*Group naming attribute',
677 a0165602 Sjon Hortensius
	'text',
678
	$pconfig['ldap_attr_group']
679
));
680
681
$section->addInput(new Form_Input(
682
	'ldap_attr_member',
683 153c3aa6 Phil Davis
	'*Group member attribute',
684 a0165602 Sjon Hortensius
	'text',
685
	$pconfig['ldap_attr_member']
686
));
687
688 149efbea jim-p
$section->addInput(new Form_Checkbox(
689
	'ldap_rfc2307',
690
	'RFC 2307 Groups',
691
	'LDAP Server uses RFC 2307 style group membership',
692
	$pconfig['ldap_rfc2307']
693
))->setHelp('RFC 2307 style group membership has members listed on the group '.
694
	'object rather than using groups listed on user object. Leave unchecked '.
695
	'for Active Directory style group membership (RFC 2307bis).');
696
697
$section->addInput(new Form_Input(
698
	'ldap_attr_groupobj',
699
	'Group Object Class',
700
	'text',
701
	$pconfig['ldap_attr_groupobj'],
702
	['placeholder' => 'posixGroup']
703
))->setHelp('Object class used for groups in RFC2307 mode. '.
704
	'Typically "posixGroup" or "group".');
705
706 a0165602 Sjon Hortensius
$section->addInput(new Form_Checkbox(
707
	'ldap_utf8',
708
	'UTF8 Encode',
709
	'UTF8 encode LDAP parameters before sending them to the server.',
710
	$pconfig['ldap_utf8']
711
))->setHelp('Required to support international characters, but may not be '.
712
	'supported by every LDAP server.');
713
714
$section->addInput(new Form_Checkbox(
715
	'ldap_nostrip_at',
716
	'Username Alterations',
717
	'Do not strip away parts of the username after the @ symbol',
718
	$pconfig['ldap_nostrip_at']
719
))->setHelp('e.g. user@host becomes user when unchecked.');
720
721
$form->add($section);
722 6157f724 Stephen Beaver
723
// ==== RADIUS section ========================================================
724 7aaf60a8 k-paulius
$section = new Form_Section('RADIUS Server Settings');
725 44d906ca Sjon Hortensius
$section->addClass('toggle-radius collapse');
726 a0165602 Sjon Hortensius
727 9da4a575 Renato Botelho
$section->addInput(new Form_Select(
728
	'radius_protocol',
729 153c3aa6 Phil Davis
	'*Protocol',
730 9da4a575 Renato Botelho
	$pconfig['radius_protocol'],
731
	$radius_protocol
732
));
733
734 a0165602 Sjon Hortensius
$section->addInput(new Form_Input(
735
	'radius_host',
736 153c3aa6 Phil Davis
	'*Hostname or IP address',
737 a0165602 Sjon Hortensius
	'text',
738
	$pconfig['radius_host']
739
));
740
741
$section->addInput(new Form_Input(
742
	'radius_secret',
743 153c3aa6 Phil Davis
	'*Shared Secret',
744 406a904b jim-p
	'password',
745 a0165602 Sjon Hortensius
	$pconfig['radius_secret']
746
));
747
748
$section->addInput(new Form_Select(
749
	'radius_srvcs',
750 153c3aa6 Phil Davis
	'*Services offered',
751 a0165602 Sjon Hortensius
	$pconfig['radius_srvcs'],
752
	$radius_srvcs
753
));
754
755
$section->addInput(new Form_Input(
756
	'radius_auth_port',
757 81ec3187 Chris Buechler
	'Authentication port',
758 a0165602 Sjon Hortensius
	'number',
759 df5d8616 Stephen Beaver
	$pconfig['radius_auth_port']
760 a0165602 Sjon Hortensius
));
761
762
$section->addInput(new Form_Input(
763
	'radius_acct_port',
764 df5d8616 Stephen Beaver
	'Accounting port',
765 a0165602 Sjon Hortensius
	'number',
766
	$pconfig['radius_acct_port']
767
));
768
769
$section->addInput(new Form_Input(
770
	'radius_timeout',
771
	'Authentication Timeout',
772
	'number',
773
	$pconfig['radius_timeout']
774
))->setHelp('This value controls how long, in seconds, that the RADIUS '.
775
	'server may take to respond to an authentication request. If left blank, the '.
776 89140b63 NOYB
	'default value is 5 seconds. NOTE: If using an interactive two-factor '.
777 a0165602 Sjon Hortensius
	'authentication system, increase this timeout to account for how long it will '.
778
	'take the user to receive and enter a token.');
779
780
if (isset($id) && $a_server[$id])
781
{
782
	$section->addInput(new Form_Input(
783
		'id',
784
		null,
785
		'hidden',
786
		$id
787
	));
788 6306b5dd Ermal Lu?i
}
789 a0165602 Sjon Hortensius
790
$form->add($section);
791 098604d3 Stephen Beaver
792
// Create a largely empty modal to show the available containers. We will populate it via AJAX later
793
$modal = new Modal("LDAP containers", "containers", true);
794
795
$form->add($modal);
796
797 a0165602 Sjon Hortensius
print $form;
798 ac9d8bed Stephen Beaver
?>
799 8fd9052f Colin Fleming
<script type="text/javascript">
800 ac9d8bed Stephen Beaver
//<![CDATA[
801 098604d3 Stephen Beaver
events.push(function() {
802
803
	// Create an AJAX request (to this page) to get the container list and controls
804 501efbd2 Stephen Beaver
	function select_clicked() {
805
		if (document.getElementById("ldap_port").value == '' ||
806 7b4b0ad3 Stephen Beaver
			document.getElementById("ldap_host").value == '' ||
807
			document.getElementById("ldap_scope").value == '' ||
808
			document.getElementById("ldap_basedn").value == '' ||
809
			document.getElementById("ldapauthcontainers").value == '') {
810 501efbd2 Stephen Beaver
			alert("<?=gettext("Please fill the required values.");?>");
811
			return;
812
		}
813 7b4b0ad3 Stephen Beaver
814 501efbd2 Stephen Beaver
		if (!document.getElementById("ldap_anon").checked) {
815
			if (document.getElementById("ldap_binddn").value == '' ||
816 7b4b0ad3 Stephen Beaver
				document.getElementById("ldap_bindpw").value == '') {
817 501efbd2 Stephen Beaver
				alert("<?=gettext("Please fill the bind username/password.");?>");
818
				return;
819
			}
820
		}
821 098604d3 Stephen Beaver
822
		var ajaxRequest;
823
		var authserver = $('#authmode').val();
824
		var cert;
825
826
<?php if (count($a_ca) > 0): ?>
827
			cert = $('#ldap_caref').val();
828
<?php else: ?>
829
			cert = '';
830
<?php endif; ?>
831 697b1e07 Stephen Beaver
/*
832 098604d3 Stephen Beaver
		$('#containers').modal('show');
833 79df3d68 Stephen Beaver
		$('#serverlist').parent('div').prev('label').remove();
834
		$('#serverlist').parent('div').removeClass("col-sm-10");
835
		$('#serverlist').parent('div').addClass("col-sm-12");
836 697b1e07 Stephen Beaver
*/
837 098604d3 Stephen Beaver
		ajaxRequest = $.ajax(
838
			{
839
				url: "/system_authservers.php",
840
				type: "post",
841
				data: {
842
					ajax: 	"ajax",
843
					port: 	$('#ldap_port').val(),
844
					host: 	$('#ldap_host').val(),
845
					scope: 	$('#ldap_scope').val(),
846
					basedn: $('#ldap_basedn').val(),
847
					binddn: $('#ldap_binddn').val(),
848
					bindpw: $('#ldap_bindpw').val(),
849
					urltype:$('#ldap_urltype').val(),
850
					proto:  $('#ldap_protver').val(),
851
					authcn: $('#ldapauthcontainers').val(),
852
					cert:   cert
853
				}
854
			}
855
		);
856
857
		// Deal with the results of the above ajax call
858
		ajaxRequest.done(function (response, textStatus, jqXHR) {
859 697b1e07 Stephen Beaver
			$('#containers').replaceWith(response);
860
861
			$('#containers').modal('show');
862 098604d3 Stephen Beaver
863
			// The button handler needs to be here because until the modal has been populated
864
			// the controls we need to attach handlers to do not exist
865
			$('#svcontbtn').prop("type", "button");
866
			$('#svcontbtn').removeAttr("href");
867
868
			$('#svcontbtn').click(function () {
869
				var ous = $('[id^=ou]').length;
870
				var i;
871
872
				$('#ldapauthcontainers').val("");
873
874
				for (i = 0; i < ous; i++) {
875
					if ($('#ou' + i).prop("checked")) {
876
						if ($('#ldapauthcontainers').val() != "") {
877
							$('#ldapauthcontainers').val($('#ldapauthcontainers').val() +";");
878
						}
879
880
						$('#ldapauthcontainers').val($('#ldapauthcontainers').val() + $('#ou' + i).val());
881
					}
882
				}
883
884
				$('#containers').modal('hide');
885
			});
886
		});
887
888 501efbd2 Stephen Beaver
	}
889 7b4b0ad3 Stephen Beaver
890 f3a43095 Stephen Beaver
	function set_ldap_port() {
891 d672403c derelict-pf
		if ($('#ldap_urltype').find(":selected").index() == 2)
892 7b4b0ad3 Stephen Beaver
			$('#ldap_port').val('636');
893 d672403c derelict-pf
		else
894
			$('#ldap_port').val('389');
895 7b4b0ad3 Stephen Beaver
	}
896
897 153c3aa6 Phil Davis
	function set_required_port_fields() {
898
		if (document.getElementById("radius_srvcs").value == 'auth') {
899
			setRequired('radius_auth_port', true);
900
			setRequired('radius_acct_port', false);
901
		} else if (document.getElementById("radius_srvcs").value == 'acct') {
902
			setRequired('radius_auth_port', false);
903
			setRequired('radius_acct_port', true);
904
		} else { // both
905
			setRequired('radius_auth_port', true);
906
			setRequired('radius_acct_port', true);
907
		}
908
	}
909
910 7b4b0ad3 Stephen Beaver
	// Hides all elements of the specified class. This will usually be a section
911
	function hideClass(s_class, hide) {
912 9d3e8723 Phil Davis
		if (hide)
913 7b4b0ad3 Stephen Beaver
			$('.' + s_class).hide();
914
		else
915
			$('.' + s_class).show();
916 f3a43095 Stephen Beaver
	}
917 7b4b0ad3 Stephen Beaver
918 ac9d8bed Stephen Beaver
	function ldap_tmplchange() {
919
		switch ($('#ldap_tmpltype').find(":selected").index()) {
920
<?php
921
		$index = 0;
922
		foreach ($ldap_templates as $tmpldata):
923
?>
924
			case <?=$index;?>:
925
				$('#ldap_attr_user').val("<?=$tmpldata['attr_user'];?>");
926
				$('#ldap_attr_group').val("<?=$tmpldata['attr_group'];?>");
927
				$('#ldap_attr_member').val("<?=$tmpldata['attr_member'];?>");
928
				break;
929
<?php
930
			$index++;
931
		endforeach;
932
?>
933
		}
934
	}
935 a0165602 Sjon Hortensius
936 eef93144 Jared Dillard
	// ---------- On initial page load ------------------------------------------------------------
937 782922c2 Stephen Beaver
938 c4302457 Stephen Beaver
<?php if ($act != 'edit') : ?>
939 ac9d8bed Stephen Beaver
	ldap_tmplchange();
940 c4302457 Stephen Beaver
<?php endif; ?>
941
942 b0909f2e Stephen Beaver
	hideClass('ldapanon', $('#ldap_anon').prop('checked'));
943 e39a41e9 Stephen Beaver
	hideClass('extended', !$('#ldap_extended_enabled').prop('checked'));
944 153c3aa6 Phil Davis
	set_required_port_fields();
945 7b4b0ad3 Stephen Beaver
946 9d3e8723 Phil Davis
	if ($('#ldap_port').val() == "")
947 f3a43095 Stephen Beaver
		set_ldap_port();
948 ac9d8bed Stephen Beaver
949 ea342b0f Stephen Beaver
<?php
950 9d3e8723 Phil Davis
	if ($act == 'edit') {
951 ea342b0f Stephen Beaver
?>
952 6157f724 Stephen Beaver
		$('#type option:not(:selected)').each(function(){
953 7b4b0ad3 Stephen Beaver
			$(this).attr('disabled', 'disabled');
954 6157f724 Stephen Beaver
		});
955 7b4b0ad3 Stephen Beaver
956 2138c41b Stephen Beaver
<?php
957 9d3e8723 Phil Davis
		if (!$input_errors) {
958 7b4b0ad3 Stephen Beaver
?>
959 6157f724 Stephen Beaver
		$('#name').prop("readonly", true);
960 ea342b0f Stephen Beaver
<?php
961 2138c41b Stephen Beaver
		}
962 ea342b0f Stephen Beaver
	}
963
?>
964 eef93144 Jared Dillard
	// ---------- Click checkbox handlers ---------------------------------------------------------
965 782922c2 Stephen Beaver
966 ac9d8bed Stephen Beaver
	$('#ldap_tmpltype').on('change', function() {
967
		ldap_tmplchange();
968
	});
969 b0909f2e Stephen Beaver
970 7b4b0ad3 Stephen Beaver
	$('#ldap_anon').click(function () {
971
		hideClass('ldapanon', this.checked);
972
	});
973
974 f3a43095 Stephen Beaver
	$('#ldap_urltype').on('change', function() {
975
		set_ldap_port();
976 7b4b0ad3 Stephen Beaver
	});
977
978
	$('#Select').click(function () {
979
		select_clicked();
980
	});
981 504bd882 Stephen Beaver
982 e39a41e9 Stephen Beaver
	$('#ldap_extended_enabled').click(function () {
983
		hideClass('extended', !this.checked);
984
	});
985 504bd882 Stephen Beaver
986 153c3aa6 Phil Davis
	$('#radius_srvcs').on('change', function() {
987
		set_required_port_fields();
988
	});
989
990 ac9d8bed Stephen Beaver
});
991
//]]>
992
</script>
993
<?php
994 81ec3187 Chris Buechler
include("foot.inc");