Project

General

Profile

Download (26.8 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
$act = $_GET['act'];
58
if ($_POST['act'])
59
	$act = $_POST['act'];
60

    
61
if ($act == "del") {
62

    
63
	if (!$a_server[$_GET['id']]) {
64
		pfSenseHeader("system_authservers.php");
65
		exit;
66
	}
67

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

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

    
78
	$savemsg = gettext("Authentication Server")." {$serverdeleted} ".
79
				gettext("deleted")."<br/>";
80
	write_config($savemsg);
81
}
82

    
83
if ($act == "edit") {
84
	if (isset($id) && $a_server[$id]) {
85

    
86
		$pconfig['type'] = $a_server[$id]['type'];
87
		$pconfig['name'] = $a_server[$id]['name'];
88

    
89
		if ($pconfig['type'] == "ldap") {
90
			$pconfig['ldap_host'] = $a_server[$id]['host'];
91
			$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
92
			$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
93
			$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
94
			$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
95
			$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
96
			$pconfig['ldap_authcn'] = $a_server[$id]['ldap_authcn'];
97
			$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
98
			$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
99
			$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
100
			$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
101
			$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
102

    
103
			if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw'])
104
				$pconfig['ldap_anon'] = true;
105
		}
106

    
107
		if ($pconfig['type'] == "radius") {
108
			$pconfig['radius_host'] = $a_server[$id]['host'];
109
			$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
110
			$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
111
			$pconfig['radius_secret'] = $a_server[$id]['radius_secret'];
112

    
113
			if ($pconfig['radius_auth_port'] &&
114
				$pconfig['radius_acct_port'] ) {
115
				$pconfig['radius_srvcs'] = "both";
116
			}
117

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

    
124
			if (!$pconfig['radius_auth_port'] &&
125
				 $pconfig['radius_acct_port'] ) {
126
				$pconfig['radius_srvcs'] = "acct";
127
				$pconfig['radius_auth_port'] = 1812;
128
			}
129

    
130
		}
131
	}
132
}
133

    
134
if ($act == "new") {
135
	$pconfig['ldap_protver'] = 3;
136
	$pconfig['ldap_anon'] = true;
137
	$pconfig['radius_srvcs'] = "both";
138
	$pconfig['radius_auth_port'] = "1812";
139
	$pconfig['radius_acct_port'] = "1813";
140
}
141

    
142
if ($_POST) {
143
	unset($input_errors);
144
	$pconfig = $_POST;
145

    
146
	/* input validation */
147

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

    
166
		if (!$pconfig['ldap_anon']) {
167
			$reqdfields[] = "ldap_binddn";
168
			$reqdfields[] = "ldap_bindpw";
169
			$reqdfieldsn[] = gettext("Bind user DN");
170
			$reqdfieldsn[] = gettext("Bind Password");
171
		}
172

    
173
	}
174

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

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

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

    
195
		if (!isset($id)) {
196
			$reqdfields[] = "radius_secret";
197
			$reqdfieldsn[] = gettext("Shared Secret");
198
		}
199
	}
200

    
201
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
202

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

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

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

    
215
	if (!$input_errors) {
216
		$server = array();
217
		$server['refid'] = uniqid();
218
		if (isset($id) && $a_server[$id])
219
			$server = $a_server[$id];
220

    
221
		$server['type'] = $pconfig['type'];
222
		$server['name'] = $pconfig['name'];
223

    
224
		if ($server['type'] == "ldap") {
225

    
226
			$server['host'] = $pconfig['ldap_host'];
227
			$server['ldap_port'] = $pconfig['ldap_port'];
228
			$server['ldap_urltype'] = $pconfig['ldap_urltype'];
229
			$server['ldap_protver'] = $pconfig['ldap_protver'];
230
			$server['ldap_scope'] = $pconfig['ldap_scope'];
231
			$server['ldap_basedn'] = $pconfig['ldap_basedn'];
232
			$server['ldap_authcn'] = $pconfig['ldapauthcontainers'];
233
			$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
234
			$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
235
			$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
236

    
237
			if (!$pconfig['ldap_anon']) {
238
				$server['ldap_binddn'] = $pconfig['ldap_binddn'];
239
				$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
240
			} else {
241
				unset($server['ldap_binddn']);
242
				unset($server['ldap_bindpw']);
243
			}
244
		}
245

    
246
		if ($server['type'] == "radius") {
247

    
248
			$server['host'] = $pconfig['radius_host'];
249

    
250
			if ($pconfig['radius_secret'])
251
				$server['radius_secret'] = $pconfig['radius_secret'];
252

    
253
			if ($pconfig['radius_srvcs'] == "both") {
254
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
255
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
256
			}
257

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

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

    
269
		if (isset($id) && $config['system']['authserver'][$id])
270
			$config['system']['authserver'][$id] = $server;
271
		else
272
			$config['system']['authserver'][] = $server;
273

    
274
		write_config();
275

    
276
		pfSenseHeader("system_authservers.php");
277
	}
278
}
279

    
280
include("head.inc");
281
?>
282

    
283
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
284
<?php include("fbegin.inc"); ?>
285
<script type="text/javascript">
286
<!--
287

    
288
function server_typechange(typ) {
289

    
290
	var idx = 0;
291
	if (!typ) {
292
		idx = document.getElementById("type").selectedIndex;
293
		typ = document.getElementById("type").options[idx].value;
294
	}
295

    
296
    	switch (typ) {
297
		case "ldap":
298
			document.getElementById("ldap").style.display="";
299
			document.getElementById("radius").style.display="none";
300
			break;
301
		case "radius":
302
			document.getElementById("ldap").style.display="none";
303
			document.getElementById("radius").style.display="";
304
			break;
305
	}
306
}
307

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

    
324
function ldap_bindchange() {
325

    
326
	if (document.getElementById("ldap_anon").checked)
327
		document.getElementById("ldap_bind").style.display="none";
328
    else
329
		document.getElementById("ldap_bind").style.display="";
330
}
331

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

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

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

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

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

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

    
460
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="ldap" style="display:none">
461
						<tr>
462
							<td colspan="2" class="list" height="12"></td>
463
						</tr>
464
						<tr>
465
							<td colspan="2" valign="top" class="listtopic"><?=gettext("LDAP Server Settings");?></td>
466
						</tr>
467
						<tr>
468
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
469
							<td width="78%" class="vtable">
470
								<input name="ldap_host" type="text" class="formfld unknown" id="ldap_host" size="20" value="<?=htmlspecialchars($pconfig['ldap_host']);?>"/>
471
							</td>
472
						</tr>
473
						<tr>
474
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Port value");?></td>
475
							<td width="78%" class="vtable">
476
								<input name="ldap_port" type="text" class="formfld unknown" id="ldap_port" size="5" value="<?=htmlspecialchars($pconfig['ldap_port']);?>"/>
477
							</td>
478
						</tr>
479
						<tr>
480
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Transport");?></td>
481
							<td width="78%" class="vtable">
482
								<select name='ldap_urltype' id='ldap_urltype' class="formselect" onchange='ldap_urlchange()'>
483
								<?php
484
									foreach ($ldap_urltypes as $urltype => $urlport):
485
										$selected = "";
486
										if ($pconfig['ldap_urltype'] == $urltype)
487
											$selected = "selected";
488
								?>
489
									<option value="<?=$urltype;?>" <?=$selected;?>><?=$urltype;?></option>
490
								<?php endforeach; ?>
491
								</select>
492
							</td>
493
						</tr>
494
						<tr>
495
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol version");?></td>
496
							<td width="78%" class="vtable">
497
								<select name='ldap_protver' id='ldap_protver' class="formselect">
498
								<?php
499
									foreach ($ldap_protvers as $version):
500
										$selected = "";
501
										if ($pconfig['ldap_protver'] == $version)
502
											$selected = "selected";
503
								?>
504
									<option value="<?=$version;?>" <?=$selected;?>><?=$version;?></option>
505
								<?php endforeach; ?>
506
								</select>
507
							</td>
508
						</tr>
509
						<tr>
510
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Search scope");?></td>
511
							<td width="78%" class="vtable">
512
								<table border="0" cellspacing="0" cellpadding="2">
513
									<tr>
514
										<td><?=gettext("Level");?>: &nbsp;</td>
515
										<td>
516
											<select name='ldap_scope' id='ldap_scope' class="formselect">
517
											<?php
518
												foreach ($ldap_scopes as $scopename => $scopedesc):
519
													$selected = "";
520
													if ($pconfig['ldap_scope'] == $scopename)
521
														$selected = "selected";
522
											?>
523
												<option value="<?=$scopename;?>" <?=$selected;?>><?=$scopedesc;?></option>
524
											<?php endforeach; ?>
525
											</select>
526
										</td>
527
									</tr>
528
									<tr>
529
										<td><?=gettext("Base DN");?>: &nbsp;</td>
530
										<td>
531
											<input name="ldap_basedn" type="text" class="formfld unknown" id="ldap_basedn" size="40" value="<?=htmlspecialchars($pconfig['ldap_basedn']);?>"/>
532
										</td>
533
									</tr>
534
								</table>
535

    
536
							</td>
537
						</tr>
538
						<tr>
539
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication containers");?></td>
540
							<td width="78%" class="vtable">
541
								<table border="0" cellspacing="0" cellpadding="2">
542
									<tr>
543
										<td><?=gettext("Containers");?>: &nbsp;</td>
544
										<td>
545
											<input name="ldapauthcontainers" type="text" class="formfld unknown" id="ldapauthcontainers" size="40" value="<?=htmlspecialchars($pconfig['ldap_authcn']);?>"/>
546
											<input type="button" onClick="select_clicked();" value="<?=gettext("Select");?>">
547
											<br /><?=gettext("NOTE: Semi-Colon separated. This will be prepended to the search base dn above or you can specify full container path.");?>
548
											<br /><?=gettext("EXAMPLE: CN=Users;DC=example");?>
549
											<br /><?=gettext("EXAMPLE: CN=Users,DC=example,DC=com;OU=OtherUsers,DC=example,DC=com ");?>
550
										</td>
551
									</tr>
552
								</table>
553
							</td>
554
						</tr>
555
						<tr>
556
							<td width="22%" valign="top" class="vncell"><?=gettext("Bind credentials");?></td>
557
							<td width="78%" class="vtable">
558
								<table border="0" cellspacing="0" cellpadding="2">
559
									<tr>
560
										<td>
561
											<input name="ldap_anon" type="checkbox" id="ldap_anon" value="yes" <?php if ($pconfig['ldap_anon']) echo "checked"; ?> onClick="ldap_bindchange()">
562
										</td>
563
										<td>
564
											<?=gettext("Use anonymous binds to resolve distinguished names");?>
565
										</td>
566
									</tr>
567
								</table>
568
								<table border="0" cellspacing="0" cellpadding="2" id="ldap_bind">
569
									<tr>
570
										<td colspan="2"></td>
571
									</tr>
572
									<tr>
573
										<td><?=gettext("User DN");?>: &nbsp;</td>
574
										<td>
575
											<input name="ldap_binddn" type="text" class="formfld unknown" id="ldap_binddn" size="40" value="<?=htmlspecialchars($pconfig['ldap_binddn']);?>"/><br/>
576
										</td>
577
									</tr>
578
									<tr>
579
										<td><?=gettext("Password");?>: &nbsp;</td>
580
										<td>
581
											<input name="ldap_bindpw" type="password" class="formfld pwd" id="ldap_bindpw" size="20" value="<?=htmlspecialchars($pconfig['ldap_bindpw']);?>"/><br/>
582
										</td>
583
									</tr>
584
								</table>
585
							</td>
586
						</tr>
587
						<?php if (!isset($id)): ?>
588
						<tr>
589
							<td width="22%" valign="top" class="vncell"><?=gettext("Initial Template");?></td>
590
							<td width="78%" class="vtable">
591
								<select name='ldap_tmpltype' id='ldap_tmpltype' class="formselect" onchange='ldap_tmplchange()'>
592
								<?php
593
									foreach ($ldap_templates as $tmplname => $tmpldata):
594
										$selected = "";
595
										if ($pconfig['ldap_template'] == $tmplname)
596
											$selected = "selected";
597
								?>
598
									<option value="<?=$tmplname;?>" <?=$selected;?>><?=$tmpldata['desc'];?></option>
599
								<?php endforeach; ?>
600
								</select>
601
							</td>
602
						</tr>
603
						<?php endif; ?>
604
						<tr>
605
							<td width="22%" valign="top" class="vncell"><?=gettext("User naming attribute");?></td>
606
							<td width="78%" class="vtable">
607
								<input name="ldap_attr_user" type="text" class="formfld unknown" id="ldap_attr_user" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_user']);?>"/>
608
							</td>
609
						</tr>
610
						<tr>
611
							<td width="22%" valign="top" class="vncell"><?=gettext("Group naming attribute");?></td>
612
							<td width="78%" class="vtable">
613
								<input name="ldap_attr_group" type="text" class="formfld unknown" id="ldap_attr_group" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_group']);?>"/>
614
							</td>
615
						</tr>
616
						<tr>
617
							<td width="22%" valign="top" class="vncell"><?=gettext("Group member attribute");?></td>
618
							<td width="78%" class="vtable">
619
								<input name="ldap_attr_member" type="text" class="formfld unknown" id="ldap_attr_member" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_member']);?>"/>
620
							</td>
621
						</tr>
622
					</table>
623

    
624
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="radius" style="display:none">
625
						<tr>
626
							<td colspan="2" class="list" height="12"></td>
627
						</tr>
628
						<tr>
629
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Radius Server Settings");?></td>
630
						</tr>
631
						<tr>
632
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
633
							<td width="78%" class="vtable">
634
								<input name="radius_host" type="text" class="formfld unknown" id="radius_host" size="20" value="<?=htmlspecialchars($pconfig['radius_host']);?>"/>
635
							</td>
636
						</tr>
637
						<tr>
638
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Secret");?></td>
639
							<td width="78%" class="vtable">
640
								<input name="radius_secret" type="password" class="formfld pwd" id="radius_secret" size="20" value="<?=htmlspecialchars($pconfig['radius_secret']);?>"/>
641
							</td>
642
						</tr>
643
						<tr>
644
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Services offered");?></td>
645
							<td width="78%" class="vtable">
646
								<select name='radius_srvcs' id='radius_srvcs' class="formselect" onchange='radius_srvcschange()'>
647
								<?php
648
									foreach ($radius_srvcs as $srvcname => $srvcdesc):
649
										$selected = "";
650
										if ($pconfig['radius_srvcs'] == $srvcname)
651
											$selected = "selected";
652
								?>
653
									<option value="<?=$srvcname;?>" <?=$selected;?>><?=$srvcdesc;?></option>
654
								<?php endforeach; ?>
655
								</select>
656
							</td>
657
						</tr>
658
						<tr id="radius_auth">
659
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication port value");?></td>
660
							<td width="78%" class="vtable">
661
								<input name="radius_auth_port" type="text" class="formfld unknown" id="radius_auth_port" size="5" value="<?=htmlspecialchars($pconfig['radius_auth_port']);?>"/>
662
							</td>
663
						</tr>
664
						<tr id="radius_acct">
665
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Accounting port value");?></td>
666
							<td width="78%" class="vtable">
667
								<input name="radius_acct_port" type="text" class="formfld unknown" id="radius_acct_port" size="5" value="<?=htmlspecialchars($pconfig['radius_acct_port']);?>"/>
668
							</td>
669
						</tr>
670
					</table>
671

    
672
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
673
						<tr>
674
							<td width="22%" valign="top">&nbsp;</td>
675
							<td width="78%">
676
								<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
677
								<?php if (isset($id) && $a_server[$id]): ?>
678
								<input name="id" type="hidden" value="<?=$id;?>" />
679
								<?php endif;?>
680
							</td>
681
						</tr>
682
					</table>
683
				</form>
684

    
685
				<?php else: ?>
686

    
687
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
688
					<tr>
689
						<td width="25%" class="listhdrr"><?=gettext("Server Name");?></td>
690
						<td width="25%" class="listhdrr"><?=gettext("Type");?></td>
691
						<td width="35%" class="listhdrr"><?=gettext("Host Name");?></td>
692
						<td width="10%" class="list"></td>
693
					</tr>
694
					<?php
695
						$i = 0;
696
						foreach($a_server as $server):
697
							$name = htmlspecialchars($server['name']);
698
							$type = htmlspecialchars($auth_server_types[$server['type']]);
699
							$host = htmlspecialchars($server['host']);
700
					?>
701
					<tr <?php if ($i < (count($a_server) - 1)): ?> ondblclick="document.location='system_authservers.php?act=edit&id=<?=$i;?>'" <?php endif; ?>>
702
						<td class="listlr"><?=$name?>&nbsp;</td>
703
						<td class="listr"><?=$type;?>&nbsp;</td>
704
						<td class="listr"><?=$host;?>&nbsp;</td>
705
						<td valign="middle" nowrap class="list">
706
						<?php if ($i < (count($a_server) - 1)): ?>
707
							<a href="system_authservers.php?act=edit&id=<?=$i;?>">
708
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit server");?>" alt="<?=gettext("edit server");?>" width="17" height="17" border="0" />
709
							</a>
710
							&nbsp;
711
							<a href="system_authservers.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Server?");?>')">
712
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete server");?>" alt="<?=gettext("delete server");?>" width="17" height="17" border="0" />
713
							</a>
714
						<?php endif; ?>
715
						</td>
716
					</tr>
717
					<?php
718
						$i++; endforeach;
719
					?>
720
					<tr>
721
						<td class="list" colspan="3"></td>
722
						<td class="list">
723
							<a href="system_authservers.php?act=new">
724
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add server");?>" alt="<?=gettext("add server");?>" width="17" height="17" border="0" />
725
							</a>
726
						</td>
727
					</tr>
728
					<tr>
729
						<td colspan="3">
730
							<p>
731
								<?=gettext("Additional authentication servers can be added here.");?>
732
							</p>
733
						</td>
734
					</tr>
735
				</table>
736

    
737
				<?php endif; ?>
738

    
739
			</div>
740
		</td>
741
	</tr>
742
</table>
743
<?php include("fend.inc"); ?>
744
<script type="text/javascript">
745
<!--
746
server_typechange('<?=$pconfig['type'];?>');
747
<?php if (!isset($id) || $pconfig['type'] == "ldap"): ?>
748
ldap_bindchange();
749
ldap_urlchange();
750
<?php if (!isset($id)): ?>
751
ldap_tmplchange();
752
<? endif; ?>
753
<? endif; ?>
754
<?php if (!isset($id) || $pconfig['type'] == "radius"): ?>
755
radius_srvcschange();
756
<? endif; ?>
757
//-->
758
</script>
759
</body>
(178-178/221)