Project

General

Profile

Download (28.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
    system_authservers.php
4

    
5
    Copyright (C) 2010 Ermal Lu?i
6
    Copyright (C) 2008 Shrew Soft Inc.
7
    All rights reserved.
8

    
9
    Redistribution and use in source and binary forms, with or without
10
    modification, are permitted provided that the following conditions are met:
11

    
12
    1. Redistributions of source code must retain the above copyright notice,
13
       this list of conditions and the following disclaimer.
14

    
15
    2. Redistributions in binary form must reproduce the above copyright
16
       notice, this list of conditions and the following disclaimer in the
17
       documentation and/or other materials provided with the distribution.
18

    
19
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
    POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/*
31
	pfSense_MODULE:	auth
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-system-authservers
36
##|*NAME=System: Authentication Servers
37
##|*DESCR=Allow access to the 'System: Authentication Servers' page.
38
##|*MATCH=system_authservers.php*
39
##|-PRIV
40

    
41
require("guiconfig.inc");
42
require_once("auth.inc");
43

    
44
$pgtitle = array(gettext("System"), gettext("Authentication Servers"));
45

    
46
$id = $_GET['id'];
47
if (isset($_POST['id']))
48
	$id = $_POST['id'];
49

    
50
if (!is_array($config['system']['authserver']))
51
	$config['system']['authserver'] = array();
52

    
53
$a_servers = auth_get_authserver_list();
54
foreach ($a_servers as $servers)
55
	$a_server[] = $servers;
56

    
57
if (!is_array($config['ca']))
58
        $config['ca'] = array();
59
$a_ca =& $config['ca'];
60

    
61
$act = $_GET['act'];
62
if ($_POST['act'])
63
	$act = $_POST['act'];
64

    
65
if ($act == "del") {
66

    
67
	if (!$a_server[$_GET['id']]) {
68
		pfSenseHeader("system_authservers.php");
69
		exit;
70
	}
71

    
72
	/* Remove server from main list. */
73
	$serverdeleted = $a_server[$_GET['id']]['name'];
74
	foreach ($config['system']['authserver'] as $k => $as) {
75
		if ($config['system']['authserver'][$k]['name'] == $serverdeleted)
76
			unset($config['system']['authserver'][$k]);
77
	}
78

    
79
	/* Remove server from temp list used later on this page. */
80
	unset($a_server[$_GET['id']]);
81

    
82
	$savemsg = gettext("Authentication Server")." {$serverdeleted} ".
83
				gettext("deleted")."<br/>";
84
	write_config($savemsg);
85
}
86

    
87
if ($act == "edit") {
88
	if (isset($id) && $a_server[$id]) {
89

    
90
		$pconfig['type'] = $a_server[$id]['type'];
91
		$pconfig['name'] = $a_server[$id]['name'];
92

    
93
		if ($pconfig['type'] == "ldap") {
94
			$pconfig['ldap_caref'] = $a_server[$id]['ldap_caref'];
95
			$pconfig['ldap_host'] = $a_server[$id]['host'];
96
			$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
97
			$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
98
			$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
99
			$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
100
			$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
101
			$pconfig['ldap_authcn'] = $a_server[$id]['ldap_authcn'];
102
			$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
103
			$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
104
			$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
105
			$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
106
			$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
107

    
108
			if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw'])
109
				$pconfig['ldap_anon'] = true;
110
		}
111

    
112
		if ($pconfig['type'] == "radius") {
113
			$pconfig['radius_host'] = $a_server[$id]['host'];
114
			$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
115
			$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
116
			$pconfig['radius_secret'] = $a_server[$id]['radius_secret'];
117

    
118
			if ($pconfig['radius_auth_port'] &&
119
				$pconfig['radius_acct_port'] ) {
120
				$pconfig['radius_srvcs'] = "both";
121
			}
122

    
123
			if ( $pconfig['radius_auth_port'] &&
124
				!$pconfig['radius_acct_port'] ) {
125
				$pconfig['radius_srvcs'] = "auth";
126
				$pconfig['radius_acct_port'] = 1813;
127
			}
128

    
129
			if (!$pconfig['radius_auth_port'] &&
130
				 $pconfig['radius_acct_port'] ) {
131
				$pconfig['radius_srvcs'] = "acct";
132
				$pconfig['radius_auth_port'] = 1812;
133
			}
134

    
135
		}
136
	}
137
}
138

    
139
if ($act == "new") {
140
	$pconfig['ldap_protver'] = 3;
141
	$pconfig['ldap_anon'] = true;
142
	$pconfig['radius_srvcs'] = "both";
143
	$pconfig['radius_auth_port'] = "1812";
144
	$pconfig['radius_acct_port'] = "1813";
145
}
146

    
147
if ($_POST) {
148
	unset($input_errors);
149
	$pconfig = $_POST;
150

    
151
	/* input validation */
152

    
153
	if ($pconfig['type'] == "ldap") {
154
		$reqdfields = explode(" ", "name type ldap_host ldap_port ".
155
						"ldap_urltype ldap_protver ldap_scope ".
156
						"ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
157
		$reqdfieldsn = array(
158
			gettext("Descriptive name"),
159
			gettext("Type"),
160
			gettext("Hostname or IP"),
161
			gettext("Port value"),
162
			gettext("Transport"),
163
			gettext("Protocol version"),
164
			gettext("Search level"),
165
			gettext("User naming Attribute"),
166
			gettext("Group naming Attribute"),
167
			gettext("Group member attribute"),
168
			gettext("Authentication container"));
169

    
170
		if (!$pconfig['ldap_anon']) {
171
			$reqdfields[] = "ldap_binddn";
172
			$reqdfields[] = "ldap_bindpw";
173
			$reqdfieldsn[] = gettext("Bind user DN");
174
			$reqdfieldsn[] = gettext("Bind Password");
175
		}
176
	}
177

    
178
	if ($pconfig['type'] == "radius") {
179
		$reqdfields = explode(" ", "name type radius_host radius_srvcs");
180
		$reqdfieldsn = array(
181
			gettext("Descriptive name"),
182
			gettext("Type"),
183
			gettext("Hostname or IP"),
184
			gettext("Services"));
185

    
186
		if ($pconfig['radisu_srvcs'] == "both" ||
187
			$pconfig['radisu_srvcs'] == "auth") {
188
			$reqdfields[] = "radius_auth_port";
189
			$reqdfieldsn[] = gettext("Authentication port value");
190
		}
191

    
192
		if ($pconfig['radisu_srvcs'] == "both" ||
193
			$pconfig['radisu_srvcs'] == "acct") {
194
			$reqdfields[] = "radius_acct_port";
195
			$reqdfieldsn[] = gettext("Accounting port value");
196
		}
197

    
198
		if (!isset($id)) {
199
			$reqdfields[] = "radius_secret";
200
			$reqdfieldsn[] = gettext("Shared Secret");
201
		}
202
	}
203

    
204
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
205

    
206
	if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host']))
207
		$input_errors[] = gettext("The host name contains invalid characters.");
208

    
209
	if (auth_get_authserver($pconfig['name']) && !isset($id))
210
		$input_errors[] = gettext("An authentication server with the same name already exists.");
211

    
212
	/* if this is an AJAX caller then handle via JSON */
213
	if (isAjax() && is_array($input_errors)) {
214
		input_errors2Ajax($input_errors);
215
		exit;
216
	}
217

    
218
	if (!$input_errors) {
219
		$server = array();
220
		$server['refid'] = uniqid();
221
		if (isset($id) && $a_server[$id])
222
			$server = $a_server[$id];
223

    
224
		$server['type'] = $pconfig['type'];
225
		$server['name'] = $pconfig['name'];
226

    
227
		if ($server['type'] == "ldap") {
228

    
229
			if (!empty($pconfig['ldap_caref']))
230
				$server['ldap_caref'] = $pconfig['ldap_caref'];
231
			$server['host'] = $pconfig['ldap_host'];
232
			$server['ldap_port'] = $pconfig['ldap_port'];
233
			$server['ldap_urltype'] = $pconfig['ldap_urltype'];
234
			$server['ldap_protver'] = $pconfig['ldap_protver'];
235
			$server['ldap_scope'] = $pconfig['ldap_scope'];
236
			$server['ldap_basedn'] = $pconfig['ldap_basedn'];
237
			$server['ldap_authcn'] = $pconfig['ldapauthcontainers'];
238
			$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
239
			$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
240
			$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
241

    
242
			if (!$pconfig['ldap_anon']) {
243
				$server['ldap_binddn'] = $pconfig['ldap_binddn'];
244
				$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
245
			} else {
246
				unset($server['ldap_binddn']);
247
				unset($server['ldap_bindpw']);
248
			}
249
		}
250

    
251
		if ($server['type'] == "radius") {
252

    
253
			$server['host'] = $pconfig['radius_host'];
254

    
255
			if ($pconfig['radius_secret'])
256
				$server['radius_secret'] = $pconfig['radius_secret'];
257

    
258
			if ($pconfig['radius_srvcs'] == "both") {
259
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
260
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
261
			}
262

    
263
			if ($pconfig['radius_srvcs'] == "auth") {
264
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
265
				unset($server['radius_acct_port']);
266
			}
267

    
268
			if ($pconfig['radius_srvcs'] == "acct") {
269
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
270
				unset($server['radius_auth_port']);
271
			}
272
		}
273

    
274
		if (isset($id) && $config['system']['authserver'][$id])
275
			$config['system']['authserver'][$id] = $server;
276
		else
277
			$config['system']['authserver'][] = $server;
278

    
279
		write_config();
280

    
281
		pfSenseHeader("system_authservers.php");
282
	}
283
}
284

    
285
include("head.inc");
286
?>
287

    
288
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
289
<?php include("fbegin.inc"); ?>
290
<script type="text/javascript">
291
<!--
292

    
293
function server_typechange(typ) {
294

    
295
	var idx = 0;
296
	if (!typ) {
297
		idx = document.getElementById("type").selectedIndex;
298
		typ = document.getElementById("type").options[idx].value;
299
	}
300

    
301
    	switch (typ) {
302
		case "ldap":
303
			document.getElementById("ldap").style.display="";
304
			document.getElementById("radius").style.display="none";
305
			break;
306
		case "radius":
307
			document.getElementById("ldap").style.display="none";
308
			document.getElementById("radius").style.display="";
309
			break;
310
	}
311
}
312

    
313
function ldap_urlchange() {
314
    switch (document.getElementById("ldap_urltype").selectedIndex) {
315
<?php
316
	$index = 0;
317
	foreach ($ldap_urltypes as $urltype => $urlport):
318
?>
319
		case <?=$index;?>:
320
			document.getElementById("ldap_port").value = "<?=$urlport;?>";
321
			break;
322
<?php
323
		$index++;
324
	endforeach;
325
?>
326
	}
327
}
328

    
329
function ldap_bindchange() {
330

    
331
	if (document.getElementById("ldap_anon").checked)
332
		document.getElementById("ldap_bind").style.display="none";
333
    else
334
		document.getElementById("ldap_bind").style.display="";
335
}
336

    
337
function ldap_tmplchange(){
338
    switch (document.getElementById("ldap_tmpltype").selectedIndex) {
339
<?php
340
	$index = 0;
341
	foreach ($ldap_templates as $tmpldata):
342
?>
343
		case <?=$index;?>:
344
			document.getElementById("ldap_attr_user").value = "<?=$tmpldata['attr_user'];?>";
345
			document.getElementById("ldap_attr_group").value = "<?=$tmpldata['attr_group'];?>";
346
			document.getElementById("ldap_attr_member").value = "<?=$tmpldata['attr_member'];?>";
347
			break;
348
<?php
349
		$index++;
350
	endforeach;
351
?>
352
	}
353
}
354

    
355
function radius_srvcschange(){
356
    switch (document.getElementById("radius_srvcs").selectedIndex) {
357
		case 0: // both
358
			document.getElementById("radius_auth").style.display="";
359
			document.getElementById("radius_acct").style.display="";
360
			break;
361
		case 1: // authentication
362
			document.getElementById("radius_auth").style.display="";
363
			document.getElementById("radius_acct").style.display="none";
364
			break;
365
		case 2: // accounting
366
			document.getElementById("radius_auth").style.display="none";
367
			document.getElementById("radius_acct").style.display="";
368
			break;
369
	}
370
}
371

    
372
function select_clicked() {
373
	if (document.getElementById("ldap_port").value == '' ||
374
	    document.getElementById("ldap_host").value == '' ||
375
	    document.getElementById("ldap_scope").value == '' ||
376
	    document.getElementById("ldap_basedn").value == '' ||
377
	    document.getElementById("ldapauthcontainers").value == '') {
378
		alert("<?=gettext("Please fill the required values.");?>");
379
		return;
380
	}
381
	if (!document.getElementById("ldap_anon").checked) {
382
		if (document.getElementById("ldap_binddn").value == '' ||
383
		    document.getElementById("ldap_bindpw").value == '') {
384
				alert("<?=gettext("Please fill the bind username/password.");?>");
385
			return;
386
		}
387
	}
388
        var url = 'system_usermanager_settings_ldapacpicker.php?';
389
        url += 'port=' + document.getElementById("ldap_port").value;
390
        url += '&host=' + document.getElementById("ldap_host").value;
391
        url += '&scope=' + document.getElementById("ldap_scope").value;
392
        url += '&basedn=' + document.getElementById("ldap_basedn").value;
393
        url += '&binddn=' + document.getElementById("ldap_binddn").value;
394
        url += '&bindpw=' + document.getElementById("ldap_bindpw").value;
395
        url += '&urltype=' + document.getElementById("ldap_urltype").value;
396
        url += '&proto=' + document.getElementById("ldap_protver").value;
397
	url += '&authcn=' + document.getElementById("ldapauthcontainers").value;
398
	url += '&cert=' + document.getElementById("ldap_caref").value;
399

    
400
        var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
401
        if (oWin==null || typeof(oWin)=="undefined")
402
			alert("<?=gettext('Popup blocker detected.  Action aborted.');?>");
403
}
404
//-->
405
</script>
406
<?php
407
	if ($input_errors)
408
		print_input_errors($input_errors);
409
	if ($savemsg)
410
		print_info_box($savemsg);
411
?>
412
<table width="100%" border="0" cellpadding="0" cellspacing="0">
413
	<tr>
414
		<td>
415
		<?php
416
			$tab_array = array();
417
			$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
418
			$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
419
			$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
420
			$tab_array[] = array(gettext("Servers"), true, "system_authservers.php");
421
			display_top_tabs($tab_array);
422
		?>
423
		</td>
424
	</tr>
425
	<tr>
426
		<td id="mainarea">
427
			<div class="tabcont">
428

    
429
				<?php if ($act == "new" || $act == "edit" || $input_errors): ?>
430

    
431
				<form action="system_authservers.php" method="post" name="iform" id="iform">
432
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
433
						<tr>
434
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
435
							<td width="78%" class="vtable">
436
							<?php if (!isset($id)): ?>
437
								<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"/>
438
							<?php else: ?>
439
                                                                <strong><?=htmlspecialchars($pconfig['name']);?></strong>
440
                                                                <input name='name' type='hidden' id='name' value="<?=htmlspecialchars($pconfig['name']);?>"/>
441
                                                                <?php endif; ?>
442
							</td>
443
						</tr>
444
						<tr>
445
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Type");?></td>
446
							<td width="78%" class="vtable">
447
								<?php if (!isset($id)): ?>
448
								<select name='type' id='type' class="formselect" onchange='server_typechange()'>
449
								<?php
450
									foreach ($auth_server_types as $typename => $typedesc ):
451
										$selected = "";
452
										if ($pconfig['type'] == $typename)
453
											$selected = "selected";
454
								?>
455
									<option value="<?=$typename;?>" <?=$selected;?>><?=$typedesc;?></option>
456
								<?php endforeach; ?>
457
								</select>
458
								<?php else: ?>
459
								<strong><?=$auth_server_types[$pconfig['type']];?></strong>
460
								<input name='type' type='hidden' id='type' value="<?=htmlspecialchars($pconfig['type']);?>"/>
461
								<?php endif; ?>
462
							</td>
463
						</tr>
464
					</table>
465

    
466
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="ldap" style="display:none">
467
						<tr>
468
							<td colspan="2" class="list" height="12"></td>
469
						</tr>
470
						<tr>
471
							<td colspan="2" valign="top" class="listtopic"><?=gettext("LDAP Server Settings");?></td>
472
						</tr>
473
						<tr>
474
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
475
							<td width="78%" class="vtable">
476
								<input name="ldap_host" type="text" class="formfld unknown" id="ldap_host" size="20" value="<?=htmlspecialchars($pconfig['ldap_host']);?>"/>
477
							</td>
478
						</tr>
479
						<tr>
480
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Port value");?></td>
481
							<td width="78%" class="vtable">
482
								<input name="ldap_port" type="text" class="formfld unknown" id="ldap_port" size="5" value="<?=htmlspecialchars($pconfig['ldap_port']);?>"/>
483
							</td>
484
						</tr>
485
						<tr>
486
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Transport");?></td>
487
							<td width="78%" class="vtable">
488
								<select name='ldap_urltype' id='ldap_urltype' class="formselect" onchange='ldap_urlchange()'>
489
								<?php
490
									foreach ($ldap_urltypes as $urltype => $urlport):
491
										$selected = "";
492
										if ($pconfig['ldap_urltype'] == $urltype)
493
											$selected = "selected";
494
								?>
495
									<option value="<?=$urltype;?>" <?=$selected;?>><?=$urltype;?></option>
496
								<?php endforeach; ?>
497
								</select>
498
							</td>
499
						</tr>
500
						<tr id="tls_ca">
501
							<td width="22%" valign="top" class="vncell"><?=gettext("Peer Certificate Authority"); ?></td>
502
                                                        <td width="78%" class="vtable">
503
                                                        <?php if (count($a_ca)): ?>
504
								<select name='ldap_caref' class="formselect">
505
                                                        <?php
506
                                                                foreach ($a_ca as $ca):
507
                                                                        $selected = "";
508
                                                                        if ($pconfig['ldap_caref'] == $ca['refid'])
509
                                                                                $selected = "selected";
510
                                                        ?>
511
									<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
512
                                                        <?php	endforeach; ?>
513
								</select>
514
								<br/><span><?=gettext("This option is used if 'SSL Encrypted' option is choosen.");?> <br/>
515
								<?=gettext("It must match with the CA in the AD otherwise problems will arise.");?></span>
516
                                                        <?php else: ?>
517
                                                                <b>No Certificate Authorities defined.</b> <br/>Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
518
                                                        <?php endif; ?>
519
                                                        </td>
520
						</tr>
521
						<tr>
522
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol version");?></td>
523
							<td width="78%" class="vtable">
524
								<select name='ldap_protver' id='ldap_protver' class="formselect">
525
								<?php
526
									foreach ($ldap_protvers as $version):
527
										$selected = "";
528
										if ($pconfig['ldap_protver'] == $version)
529
											$selected = "selected";
530
								?>
531
									<option value="<?=$version;?>" <?=$selected;?>><?=$version;?></option>
532
								<?php endforeach; ?>
533
								</select>
534
							</td>
535
						</tr>
536
						<tr>
537
							<td width="22%" valign="top" class="vncell"><?=gettext("Search scope");?></td>
538
							<td width="78%" class="vtable">
539
								<table border="0" cellspacing="0" cellpadding="2">
540
									<tr>
541
										<td><?=gettext("Level:");?> &nbsp;</td>
542
										<td>
543
											<select name='ldap_scope' id='ldap_scope' class="formselect">
544
											<?php
545
												foreach ($ldap_scopes as $scopename => $scopedesc):
546
													$selected = "";
547
													if ($pconfig['ldap_scope'] == $scopename)
548
														$selected = "selected";
549
											?>
550
												<option value="<?=$scopename;?>" <?=$selected;?>><?=$scopedesc;?></option>
551
											<?php endforeach; ?>
552
											</select>
553
										</td>
554
									</tr>
555
									<tr>
556
										<td><?=gettext("Base DN:");?> &nbsp;</td>
557
										<td>
558
											<input name="ldap_basedn" type="text" class="formfld unknown" id="ldap_basedn" size="40" value="<?=htmlspecialchars($pconfig['ldap_basedn']);?>"/>
559
										</td>
560
									</tr>
561
								</table>
562

    
563
							</td>
564
						</tr>
565
						<tr>
566
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication containers");?></td>
567
							<td width="78%" class="vtable">
568
								<table border="0" cellspacing="0" cellpadding="2">
569
									<tr>
570
										<td><?=gettext("Containers:");?> &nbsp;</td>
571
										<td>
572
											<input name="ldapauthcontainers" type="text" class="formfld unknown" id="ldapauthcontainers" size="40" value="<?=htmlspecialchars($pconfig['ldap_authcn']);?>"/>
573
											<input type="button" onClick="select_clicked();" value="<?=gettext("Select");?>">
574
											<br /><?=gettext("Note: Semi-Colon separated. This will be prepended to the search base dn above or you can specify full container path.");?>
575
											<br /><?=gettext("Example: CN=Users;DC=example");?>
576
											<br /><?=gettext("Example: CN=Users,DC=example,DC=com;OU=OtherUsers,DC=example,DC=com ");?>
577
										</td>
578
									</tr>
579
								</table>
580
							</td>
581
						</tr>
582
						<tr>
583
							<td width="22%" valign="top" class="vncell"><?=gettext("Bind credentials");?></td>
584
							<td width="78%" class="vtable">
585
								<table border="0" cellspacing="0" cellpadding="2">
586
									<tr>
587
										<td>
588
											<input name="ldap_anon" type="checkbox" id="ldap_anon" value="yes" <?php if ($pconfig['ldap_anon']) echo "checked"; ?> onClick="ldap_bindchange()">
589
										</td>
590
										<td>
591
											<?=gettext("Use anonymous binds to resolve distinguished names");?>
592
										</td>
593
									</tr>
594
								</table>
595
								<table border="0" cellspacing="0" cellpadding="2" id="ldap_bind">
596
									<tr>
597
										<td colspan="2"></td>
598
									</tr>
599
									<tr>
600
										<td><?=gettext("User DN:");?> &nbsp;</td>
601
										<td>
602
											<input name="ldap_binddn" type="text" class="formfld unknown" id="ldap_binddn" size="40" value="<?=htmlspecialchars($pconfig['ldap_binddn']);?>"/><br/>
603
										</td>
604
									</tr>
605
									<tr>
606
										<td><?=gettext("Password:");?> &nbsp;</td>
607
										<td>
608
											<input name="ldap_bindpw" type="password" class="formfld pwd" id="ldap_bindpw" size="20" value="<?=htmlspecialchars($pconfig['ldap_bindpw']);?>"/><br/>
609
										</td>
610
									</tr>
611
								</table>
612
							</td>
613
						</tr>
614
						<?php if (!isset($id)): ?>
615
						<tr>
616
							<td width="22%" valign="top" class="vncell"><?=gettext("Initial Template");?></td>
617
							<td width="78%" class="vtable">
618
								<select name='ldap_tmpltype' id='ldap_tmpltype' class="formselect" onchange='ldap_tmplchange()'>
619
								<?php
620
									foreach ($ldap_templates as $tmplname => $tmpldata):
621
										$selected = "";
622
										if ($pconfig['ldap_template'] == $tmplname)
623
											$selected = "selected";
624
								?>
625
									<option value="<?=$tmplname;?>" <?=$selected;?>><?=$tmpldata['desc'];?></option>
626
								<?php endforeach; ?>
627
								</select>
628
							</td>
629
						</tr>
630
						<?php endif; ?>
631
						<tr>
632
							<td width="22%" valign="top" class="vncell"><?=gettext("User naming attribute");?></td>
633
							<td width="78%" class="vtable">
634
								<input name="ldap_attr_user" type="text" class="formfld unknown" id="ldap_attr_user" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_user']);?>"/>
635
							</td>
636
						</tr>
637
						<tr>
638
							<td width="22%" valign="top" class="vncell"><?=gettext("Group naming attribute");?></td>
639
							<td width="78%" class="vtable">
640
								<input name="ldap_attr_group" type="text" class="formfld unknown" id="ldap_attr_group" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_group']);?>"/>
641
							</td>
642
						</tr>
643
						<tr>
644
							<td width="22%" valign="top" class="vncell"><?=gettext("Group member attribute");?></td>
645
							<td width="78%" class="vtable">
646
								<input name="ldap_attr_member" type="text" class="formfld unknown" id="ldap_attr_member" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_member']);?>"/>
647
							</td>
648
						</tr>
649
					</table>
650

    
651
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="radius" style="display:none">
652
						<tr>
653
							<td colspan="2" class="list" height="12"></td>
654
						</tr>
655
						<tr>
656
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Radius Server Settings");?></td>
657
						</tr>
658
						<tr>
659
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
660
							<td width="78%" class="vtable">
661
								<input name="radius_host" type="text" class="formfld unknown" id="radius_host" size="20" value="<?=htmlspecialchars($pconfig['radius_host']);?>"/>
662
							</td>
663
						</tr>
664
						<tr>
665
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Secret");?></td>
666
							<td width="78%" class="vtable">
667
								<input name="radius_secret" type="password" class="formfld pwd" id="radius_secret" size="20" value="<?=htmlspecialchars($pconfig['radius_secret']);?>"/>
668
							</td>
669
						</tr>
670
						<tr>
671
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Services offered");?></td>
672
							<td width="78%" class="vtable">
673
								<select name='radius_srvcs' id='radius_srvcs' class="formselect" onchange='radius_srvcschange()'>
674
								<?php
675
									foreach ($radius_srvcs as $srvcname => $srvcdesc):
676
										$selected = "";
677
										if ($pconfig['radius_srvcs'] == $srvcname)
678
											$selected = "selected";
679
								?>
680
									<option value="<?=$srvcname;?>" <?=$selected;?>><?=$srvcdesc;?></option>
681
								<?php endforeach; ?>
682
								</select>
683
							</td>
684
						</tr>
685
						<tr id="radius_auth">
686
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication port value");?></td>
687
							<td width="78%" class="vtable">
688
								<input name="radius_auth_port" type="text" class="formfld unknown" id="radius_auth_port" size="5" value="<?=htmlspecialchars($pconfig['radius_auth_port']);?>"/>
689
							</td>
690
						</tr>
691
						<tr id="radius_acct">
692
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Accounting port value");?></td>
693
							<td width="78%" class="vtable">
694
								<input name="radius_acct_port" type="text" class="formfld unknown" id="radius_acct_port" size="5" value="<?=htmlspecialchars($pconfig['radius_acct_port']);?>"/>
695
							</td>
696
						</tr>
697
					</table>
698

    
699
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
700
						<tr>
701
							<td width="22%" valign="top">&nbsp;</td>
702
							<td width="78%">
703
								<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
704
								<?php if (isset($id) && $a_server[$id]): ?>
705
								<input name="id" type="hidden" value="<?=$id;?>" />
706
								<?php endif;?>
707
							</td>
708
						</tr>
709
					</table>
710
				</form>
711

    
712
				<?php else: ?>
713

    
714
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
715
					<tr>
716
						<td width="25%" class="listhdrr"><?=gettext("Server Name");?></td>
717
						<td width="25%" class="listhdrr"><?=gettext("Type");?></td>
718
						<td width="35%" class="listhdrr"><?=gettext("Host Name");?></td>
719
						<td width="10%" class="list"></td>
720
					</tr>
721
					<?php
722
						$i = 0;
723
						foreach($a_server as $server):
724
							$name = htmlspecialchars($server['name']);
725
							$type = htmlspecialchars($auth_server_types[$server['type']]);
726
							$host = htmlspecialchars($server['host']);
727
					?>
728
					<tr <?php if ($i < (count($a_server) - 1)): ?> ondblclick="document.location='system_authservers.php?act=edit&id=<?=$i;?>'" <?php endif; ?>>
729
						<td class="listlr"><?=$name?>&nbsp;</td>
730
						<td class="listr"><?=$type;?>&nbsp;</td>
731
						<td class="listr"><?=$host;?>&nbsp;</td>
732
						<td valign="middle" nowrap class="list">
733
						<?php if ($i < (count($a_server) - 1)): ?>
734
							<a href="system_authservers.php?act=edit&id=<?=$i;?>">
735
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit server");?>" alt="<?=gettext("edit server");?>" width="17" height="17" border="0" />
736
							</a>
737
							&nbsp;
738
							<a href="system_authservers.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Server?");?>')">
739
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete server");?>" alt="<?=gettext("delete server");?>" width="17" height="17" border="0" />
740
							</a>
741
						<?php endif; ?>
742
						</td>
743
					</tr>
744
					<?php
745
						$i++; endforeach;
746
					?>
747
					<tr>
748
						<td class="list" colspan="3"></td>
749
						<td class="list">
750
							<a href="system_authservers.php?act=new">
751
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add server");?>" alt="<?=gettext("add server");?>" width="17" height="17" border="0" />
752
							</a>
753
						</td>
754
					</tr>
755
					<tr>
756
						<td colspan="3">
757
							<p>
758
								<?=gettext("Additional authentication servers can be added here.");?>
759
							</p>
760
						</td>
761
					</tr>
762
				</table>
763

    
764
				<?php endif; ?>
765

    
766
			</div>
767
		</td>
768
	</tr>
769
</table>
770
<?php include("fend.inc"); ?>
771
<script type="text/javascript">
772
<!--
773
server_typechange('<?=htmlspecialchars($pconfig['type']);?>');
774
<?php if (!isset($id) || $pconfig['type'] == "ldap"): ?>
775
ldap_bindchange();
776
ldap_urlchange();
777
<?php if (!isset($id)): ?>
778
ldap_tmplchange();
779
<?php endif; ?>
780
<?php endif; ?>
781
<?php if (!isset($id) || $pconfig['type'] == "radius"): ?>
782
radius_srvcschange();
783
<?php endif; ?>
784
//-->
785
</script>
786
</body>
(189-189/232)