Project

General

Profile

Download (26 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("System", "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
	$serverdeleted = $a_server[$_GET['id']]['name'];
69
	unset($a_server[$_GET['id']]);
70
	write_config();
71
	$savemsg = gettext("Authentication Server")." {$serverdeleted} ".
72
				gettext("successfully deleted")."<br/>";
73
}
74

    
75
if ($act == "edit") {
76
	if (isset($id) && $a_server[$id]) {
77

    
78
		$pconfig['type'] = $a_server[$id]['type'];
79
		$pconfig['name'] = $a_server[$id]['name'];
80

    
81
		if ($pconfig['type'] == "ldap") {
82
			$pconfig['ldap_host'] = $a_server[$id]['host'];
83
			$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
84
			$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
85
			$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
86
			$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
87
			$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
88
			$pconfig['ldap_authcn'] = $a_server[$id]['ldap_authcn'];
89
			$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
90
			$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
91
			$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
92
			$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
93
			$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
94

    
95
			if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw'])
96
				$pconfig['ldap_anon'] = true;
97
		}
98

    
99
		if ($pconfig['type'] == "radius") {
100
			$pconfig['radius_host'] = $a_server[$id]['host'];
101
			$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
102
			$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
103
			$pconfig['radius_secret'] = $a_server[$id]['radius_secret'];
104

    
105
			if ($pconfig['radius_auth_port'] &&
106
				$pconfig['radius_acct_port'] ) {
107
				$pconfig['radius_srvcs'] = "both";
108
			}
109

    
110
			if ( $pconfig['radius_auth_port'] &&
111
				!$pconfig['radius_acct_port'] ) {
112
				$pconfig['radius_srvcs'] = "auth";
113
				$pconfig['radius_acct_port'] = 1813;
114
			}
115

    
116
			if (!$pconfig['radius_auth_port'] &&
117
				 $pconfig['radius_acct_port'] ) {
118
				$pconfig['radius_srvcs'] = "acct";
119
				$pconfig['radius_auth_port'] = 1812;
120
			}
121

    
122
		}
123
	}
124
}
125

    
126
if ($act == "new") {
127
	$pconfig['ldap_protver'] = 3;
128
	$pconfig['ldap_anon'] = true;
129
	$pconfig['radius_srvcs'] = "both";
130
	$pconfig['radius_auth_port'] = "1812";
131
	$pconfig['radius_acct_port'] = "1813";
132
}
133

    
134
if ($_POST) {
135
	unset($input_errors);
136
	$pconfig = $_POST;
137

    
138
	/* input validation */
139

    
140
	if ($pconfig['type'] == "ldap") {
141
		$reqdfields = explode(" ", "name type ldap_host ldap_port ".
142
						"ldap_urltype ldap_protver ldap_scope ldap_basedn ".
143
						"ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
144
		$reqdfieldsn = explode(",", "Descriptive name,Type,Hostname or IP,".
145
						"Port value,Transport,Protocol version,Search level,".
146
						"Search Base DN,User naming Attribute,".
147
						"Group naming Attribute,Group member attribute,Authentication container");
148

    
149
		if (!$pconfig['ldap_anon']) {
150
			$reqdfields[] = "ldap_binddn";
151
			$reqdfields[] = "ldap_bindpw";
152
			$reqdfieldsn[] = "Bind user DN";
153
			$reqdfieldsn[] = "Bind Password";
154
		}
155

    
156
	}
157

    
158
	if ($pconfig['type'] == "radius") {
159
		$reqdfields = explode(" ", "name type radius_host radius_srvcs");
160
		$reqdfieldsn = explode(",", "Descriptive name,Type,Hostname or IP,".
161
						"Services");
162

    
163
		if ($pconfig['radisu_srvcs'] == "both" ||
164
			$pconfig['radisu_srvcs'] == "auth") {
165
			$reqdfields[] = "radius_auth_port";
166
			$reqdfieldsn[] = "Authentication port value";
167
		}
168

    
169
		if ($pconfig['radisu_srvcs'] == "both" ||
170
			$pconfig['radisu_srvcs'] == "acct") {
171
			$reqdfields[] = "radius_acct_port";
172
			$reqdfieldsn[] = "Accounting port value";
173
		}
174

    
175
		if (!isset($id)) {
176
			$reqdfields[] = "radius_secret";
177
			$reqdfieldsn[] = "Shared Secret";
178
		}
179
	}
180

    
181
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
182

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

    
186
	if (auth_get_authserver($pconfig['name']) && !isset($id))
187
		$input_errors[] = "A authentication server with the same name already exists.";
188

    
189
	/* if this is an AJAX caller then handle via JSON */
190
	if (isAjax() && is_array($input_errors)) {
191
		input_errors2Ajax($input_errors);
192
		exit;
193
	}
194

    
195
	if (!$input_errors) {
196
		$server = array();
197
		$server['refid'] = uniqid();
198
		if (isset($id) && $a_server[$id])
199
			$server = $a_server[$id];
200

    
201
		$server['type'] = $pconfig['type'];
202
		$server['name'] = $pconfig['name'];
203

    
204
		if ($server['type'] == "ldap") {
205

    
206
			$server['host'] = $pconfig['ldap_host'];
207
			$server['ldap_port'] = $pconfig['ldap_port'];
208
			$server['ldap_urltype'] = $pconfig['ldap_urltype'];
209
			$server['ldap_protver'] = $pconfig['ldap_protver'];
210
			$server['ldap_scope'] = $pconfig['ldap_scope'];
211
			$server['ldap_basedn'] = $pconfig['ldap_basedn'];
212
			$server['ldap_authcn'] = $pconfig['ldapauthcontainers'];
213
			$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
214
			$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
215
			$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
216

    
217
			if (!$pconfig['ldap_anon']) {
218
				$server['ldap_binddn'] = $pconfig['ldap_binddn'];
219
				$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
220
			} else {
221
				unset($server['ldap_binddn']);
222
				unset($server['ldap_bindpw']);
223
			}
224
		}
225

    
226
		if ($server['type'] == "radius") {
227

    
228
			$server['host'] = $pconfig['radius_host'];
229

    
230
			if ($pconfig['radius_secret'])
231
				$server['radius_secret'] = $pconfig['radius_secret'];
232

    
233
			if ($pconfig['radius_srvcs'] == "both") {
234
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
235
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
236
			}
237

    
238
			if ($pconfig['radius_srvcs'] == "auth") {
239
				$server['radius_auth_port'] = $pconfig['radius_auth_port'];
240
				unset($server['radius_acct_port']);
241
			}
242

    
243
			if ($pconfig['radius_srvcs'] == "acct") {
244
				$server['radius_acct_port'] = $pconfig['radius_acct_port'];
245
				unset($server['radius_auth_port']);
246
			}
247
		}
248

    
249
		if (isset($id) && $config['system']['authserver'][$id])
250
			$config['system']['authserver'][$id] = $server;
251
		else
252
			$config['system']['authserver'][] = $server;
253

    
254
		write_config();
255

    
256
		pfSenseHeader("system_authservers.php");
257
	}
258
}
259

    
260
include("head.inc");
261
?>
262

    
263
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
264
<?php include("fbegin.inc"); ?>
265
<script type="text/javascript">
266
<!--
267

    
268
function server_typechange(typ) {
269

    
270
	var idx = 0;
271
	if (!typ) {
272
		idx = document.getElementById("type").selectedIndex;
273
		typ = document.getElementById("type").options[idx].value;
274
	}
275

    
276
    	switch (typ) {
277
		case "ldap":
278
			document.getElementById("ldap").style.display="";
279
			document.getElementById("radius").style.display="none";
280
			break;
281
		case "radius":
282
			document.getElementById("ldap").style.display="none";
283
			document.getElementById("radius").style.display="";
284
			break;
285
	}
286
}
287

    
288
function ldap_urlchange() {
289
    switch (document.getElementById("ldap_urltype").selectedIndex) {
290
<?php
291
	$index = 0;
292
	foreach ($ldap_urltypes as $urltype => $urlport):
293
?>
294
		case <?=$index;?>:
295
			document.getElementById("ldap_port").value = "<?=$urlport;?>";
296
			break;
297
<?php
298
		$index++;
299
	endforeach;
300
?>
301
	}
302
}
303

    
304
function ldap_bindchange() {
305

    
306
	if (document.getElementById("ldap_anon").checked)
307
		document.getElementById("ldap_bind").style.display="none";
308
    else
309
		document.getElementById("ldap_bind").style.display="";
310
}
311

    
312
function ldap_tmplchange(){
313
    switch (document.getElementById("ldap_tmpltype").selectedIndex) {
314
<?php
315
	$index = 0;
316
	foreach ($ldap_templates as $tmpldata):
317
?>
318
		case <?=$index;?>:
319
			document.getElementById("ldap_attr_user").value = "<?=$tmpldata['attr_user'];?>";
320
			document.getElementById("ldap_attr_group").value = "<?=$tmpldata['attr_group'];?>";
321
			document.getElementById("ldap_attr_member").value = "<?=$tmpldata['attr_member'];?>";
322
			break;
323
<?php
324
		$index++;
325
	endforeach;
326
?>
327
	}
328
}
329

    
330
function radius_srvcschange(){
331
    switch (document.getElementById("radius_srvcs").selectedIndex) {
332
		case 0: // both
333
			document.getElementById("radius_auth").style.display="";
334
			document.getElementById("radius_acct").style.display="";
335
			break;
336
		case 1: // authentication
337
			document.getElementById("radius_auth").style.display="";
338
			document.getElementById("radius_acct").style.display="none";
339
			break;
340
		case 2: // accounting
341
			document.getElementById("radius_auth").style.display="none";
342
			document.getElementById("radius_acct").style.display="";
343
			break;
344
	}
345
}
346

    
347
function select_clicked() {
348
        var url = 'system_usermanager_settings_ldapacpicker.php?';
349
        url += 'port=' + document.getElementById("ldap_port").value;
350
        url += '&host=' + document.getElementById("ldap_host").value;
351
        url += '&scope=' + document.getElementById("ldap_scope").value;
352
        url += '&basedn=' + document.getElementById("ldap_basedn").value;
353
        url += '&binddn=' + document.getElementById("ldap_binddn").value;
354
        url += '&bindpw=' + document.getElementById("ldap_bindpw").value;
355
        url += '&urltype=' + document.getElementById("ldap_urltype").value;
356
        url += '&proto=' + document.getElementById("ldap_protver").value;
357
	url += '&authcn=' + document.getElementById("ldapauthcontainers").value;
358

    
359
        var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
360
        if (oWin==null || typeof(oWin)=="undefined")
361
                alert('Popup blocker detected.  Action aborted.');
362
}
363
//-->
364
</script>
365
<?php
366
	if ($input_errors)
367
		print_input_errors($input_errors);
368
	if ($savemsg)
369
		print_info_box($savemsg);
370
?>
371
<table width="100%" border="0" cellpadding="0" cellspacing="0">
372
	<tr>
373
		<td>
374
		<?php
375
			$tab_array = array();
376
			$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
377
			$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
378
			$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
379
			$tab_array[] = array(gettext("Servers"), true, "system_authservers.php");
380
			display_top_tabs($tab_array);
381
		?>
382
		</td>
383
	</tr>
384
	<tr>
385
		<td id="mainarea">
386
			<div class="tabcont">
387

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

    
390
				<form action="system_authservers.php" method="post" name="iform" id="iform">
391
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
392
						<tr>
393
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
394
							<td width="78%" class="vtable">
395
							<?php if (!isset($id)): ?>
396
								<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"/>
397
							<?php else: ?>
398
                                                                <strong><?=$pconfig[name];?></strong>
399
                                                                <input name='name' type='hidden' id='name' value="<?=htmlspecialchars($pconfig['name']);?>"/>
400
                                                                <?php endif; ?>
401
							</td>
402
						</tr>
403
						<tr>
404
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Type");?></td>
405
							<td width="78%" class="vtable">
406
								<?php if (!isset($id)): ?>
407
								<select name='type' id='type' class="formselect" onchange='server_typechange()'>
408
								<?php
409
									foreach ($auth_server_types as $typename => $typedesc ):
410
										$selected = "";
411
										if ($pconfig['type'] == $typename)
412
											$selected = "selected";
413
								?>
414
									<option value="<?=$typename;?>" <?=$selected;?>><?=$typedesc;?></option>
415
								<?php endforeach; ?>
416
								</select>
417
								<?php else: ?>
418
								<strong><?=$auth_server_types[$pconfig['type']];?></strong>
419
								<input name='type' type='hidden' id='type' value="<?=htmlspecialchars($pconfig['type']);?>"/>
420
								<?php endif; ?>
421
							</td>
422
						</tr>
423
					</table>
424

    
425
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="ldap" style="display:none">
426
						<tr>
427
							<td colspan="2" class="list" height="12"></td>
428
						</tr>
429
						<tr>
430
							<td colspan="2" valign="top" class="listtopic">LDAP Server Settings</td>
431
						</tr>
432
						<tr>
433
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
434
							<td width="78%" class="vtable">
435
								<input name="ldap_host" type="text" class="formfld unknown" id="ldap_host" size="20" value="<?=htmlspecialchars($pconfig['ldap_host']);?>"/>
436
							</td>
437
						</tr>
438
						<tr>
439
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Port value");?></td>
440
							<td width="78%" class="vtable">
441
								<input name="ldap_port" type="text" class="formfld unknown" id="ldap_port" size="5" value="<?=htmlspecialchars($pconfig['ldap_port']);?>"/>
442
							</td>
443
						</tr>
444
						<tr>
445
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Transport");?></td>
446
							<td width="78%" class="vtable">
447
								<select name='ldap_urltype' id='ldap_urltype' class="formselect" onchange='ldap_urlchange()'>
448
								<?php
449
									foreach ($ldap_urltypes as $urltype => $urlport):
450
										$selected = "";
451
										if ($pconfig['ldap_urltype'] == $urltype)
452
											$selected = "selected";
453
								?>
454
									<option value="<?=$urltype;?>" <?=$selected;?>><?=$urltype;?></option>
455
								<?php endforeach; ?>
456
								</select>
457
							</td>
458
						</tr>
459
						<tr>
460
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol version");?></td>
461
							<td width="78%" class="vtable">
462
								<select name='ldap_protver' id='ldap_protver' class="formselect">
463
								<?php
464
									foreach ($ldap_protvers as $version):
465
										$selected = "";
466
										if ($pconfig['ldap_protver'] == $version)
467
											$selected = "selected";
468
								?>
469
									<option value="<?=$version;?>" <?=$selected;?>><?=$version;?></option>
470
								<?php endforeach; ?>
471
								</select>
472
							</td>
473
						</tr>
474
						<tr>
475
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Search scope");?></td>
476
							<td width="78%" class="vtable">
477
								<table border="0" cellspacing="0" cellpadding="2">
478
									<tr>
479
										<td>Level: &nbsp;</td>
480
										<td>
481
											<select name='ldap_scope' id='ldap_scope' class="formselect">
482
											<?php
483
												foreach ($ldap_scopes as $scopename => $scopedesc):
484
													$selected = "";
485
													if ($pconfig['ldap_scope'] == $scopename)
486
														$selected = "selected";
487
											?>
488
												<option value="<?=$scopename;?>" <?=$selected;?>><?=$scopedesc;?></option>
489
											<?php endforeach; ?>
490
											</select>
491
										</td>
492
									</tr>
493
									<tr>
494
										<td>Base DN: &nbsp;</td>
495
										<td>
496
											<input name="ldap_basedn" type="text" class="formfld unknown" id="ldap_basedn" size="40" value="<?=htmlspecialchars($pconfig['ldap_basedn']);?>"/>
497
										</td>
498
									</tr>
499
								</table>
500

    
501
							</td>
502
						</tr>
503
						<tr>
504
                                                        <td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication containers");?></td>
505
                                                        <td width="78%" class="vtable">
506
                                                                <table border="0" cellspacing="0" cellpadding="2">
507
                                                                        <tr>
508
                                                                                <td>Containers: &nbsp;</td>
509
                                                                                <td>
510
                                                                                        <input name="ldapauthcontainers" type="text" class="formfld unknown" id="ldapauthcontainers" size="40" value="<?=htmlspecialchars($pconfig['ldap_authcn']);?>"/>
511
											<input type="button" onClick="select_clicked();" value="Select">
512
											<br />NOTE: Semi-Colon separated. This will be prepended to the search base dn above or you can specify full container path.
513
											<br />EXAMPLE: CN=Users;DC=example
514
											<br />EXAMPLE: CN=Users,DC=example,DC=com;OU=OtherUsers,DC=example,DC=com 
515
                                                                                </td>
516
                                                                        </tr>
517
                                                                </table>
518

    
519
                                                        </td>
520
                                                </tr>
521
						<tr>
522
							<td width="22%" valign="top" class="vncell"><?=gettext("Bind credentials");?></td>
523
							<td width="78%" class="vtable">
524
								<table border="0" cellspacing="0" cellpadding="2">
525
									<tr>
526
										<td>
527
											<input name="ldap_anon" type="checkbox" id="ldap_anon" value="yes" <?php if ($pconfig['ldap_anon']) echo "checked"; ?> onClick="ldap_bindchange()">
528
										</td>
529
										<td>
530
											Use anonymous binds to resolve distinguished names
531
										</td>
532
									</tr>
533
								</table>
534
								<table border="0" cellspacing="0" cellpadding="2" id="ldap_bind">
535
									<tr>
536
										<td colspan="2"></td>
537
									</tr>
538
									<tr>
539
										<td>User DN: &nbsp;</td>
540
										<td>
541
											<input name="ldap_binddn" type="text" class="formfld unknown" id="ldap_binddn" size="40" value="<?=htmlspecialchars($pconfig['ldap_binddn']);?>"/><br/>
542
										</td>
543
									</tr>
544
									<tr>
545
										<td>Password: &nbsp;</td>
546
										<td>
547
											<input name="ldap_bindpw" type="password" class="formfld pwd" id="ldap_bindpw" size="20" value="<?=htmlspecialchars($pconfig['ldap_bindpw']);?>"/><br/>
548
										</td>
549
									</tr>
550
								</table>
551
							</td>
552
						</tr>
553
						<?php if (!isset($id)): ?>
554
						<tr>
555
							<td width="22%" valign="top" class="vncell"><?=gettext("Initial Template");?></td>
556
							<td width="78%" class="vtable">
557
								<select name='ldap_tmpltype' id='ldap_tmpltype' class="formselect" onchange='ldap_tmplchange()'>
558
								<?php
559
									foreach ($ldap_templates as $tmplname => $tmpldata):
560
										$selected = "";
561
										if ($pconfig['ldap_template'] == $tmplname)
562
											$selected = "selected";
563
								?>
564
									<option value="<?=$tmplname;?>" <?=$selected;?>><?=$tmpldata['desc'];?></option>
565
								<?php endforeach; ?>
566
								</select>
567
							</td>
568
						</tr>
569
						<?php endif; ?>
570
						<tr>
571
							<td width="22%" valign="top" class="vncell"><?=gettext("User naming attribute");?></td>
572
							<td width="78%" class="vtable">
573
								<input name="ldap_attr_user" type="text" class="formfld unknown" id="ldap_attr_user" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_user']);?>"/>
574
							</td>
575
						</tr>
576
						<tr>
577
							<td width="22%" valign="top" class="vncell"><?=gettext("Group naming attribute");?></td>
578
							<td width="78%" class="vtable">
579
								<input name="ldap_attr_group" type="text" class="formfld unknown" id="ldap_attr_group" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_group']);?>"/>
580
							</td>
581
						</tr>
582
						<tr>
583
							<td width="22%" valign="top" class="vncell"><?=gettext("Group member attribute");?></td>
584
							<td width="78%" class="vtable">
585
								<input name="ldap_attr_member" type="text" class="formfld unknown" id="ldap_attr_member" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_member']);?>"/>
586
							</td>
587
						</tr>
588
					</table>
589

    
590
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="radius" style="display:none">
591
						<tr>
592
							<td colspan="2" class="list" height="12"></td>
593
						</tr>
594
						<tr>
595
							<td colspan="2" valign="top" class="listtopic">Radius Server Settings</td>
596
						</tr>
597
						<tr>
598
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
599
							<td width="78%" class="vtable">
600
								<input name="radius_host" type="text" class="formfld unknown" id="radius_host" size="20" value="<?=htmlspecialchars($pconfig['radius_host']);?>"/>
601
							</td>
602
						</tr>
603
						<tr>
604
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Secret");?></td>
605
							<td width="78%" class="vtable">
606
								<input name="radius_secret" type="password" class="formfld pwd" id="radius_secret" size="20" value="<?=htmlspecialchars($pconfig['radius_secret']);?>"/>
607
							</td>
608
						</tr>
609
						<tr>
610
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Services offered");?></td>
611
							<td width="78%" class="vtable">
612
								<select name='radius_srvcs' id='radius_srvcs' class="formselect" onchange='radius_srvcschange()'>
613
								<?php
614
									foreach ($radius_srvcs as $srvcname => $srvcdesc):
615
										$selected = "";
616
										if ($pconfig['radius_srvcs'] == $srvcname)
617
											$selected = "selected";
618
								?>
619
									<option value="<?=$srvcname;?>" <?=$selected;?>><?=$srvcdesc;?></option>
620
								<?php endforeach; ?>
621
								</select>
622
							</td>
623
						</tr>
624
						<tr id="radius_auth">
625
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication port value");?></td>
626
							<td width="78%" class="vtable">
627
								<input name="radius_auth_port" type="text" class="formfld unknown" id="radius_auth_port" size="5" value="<?=htmlspecialchars($pconfig['radius_auth_port']);?>"/>
628
							</td>
629
						</tr>
630
						<tr id="radius_acct">
631
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Accounting port value");?></td>
632
							<td width="78%" class="vtable">
633
								<input name="radius_acct_port" type="text" class="formfld unknown" id="radius_acct_port" size="5" value="<?=htmlspecialchars($pconfig['radius_acct_port']);?>"/>
634
							</td>
635
						</tr>
636
					</table>
637

    
638
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
639
						<tr>
640
							<td width="22%" valign="top">&nbsp;</td>
641
							<td width="78%">
642
								<input id="submit" name="save" type="submit" class="formbtn" value="Save" />
643
								<?php if (isset($id) && $a_server[$id]): ?>
644
								<input name="id" type="hidden" value="<?=$id;?>" />
645
								<?php endif;?>
646
							</td>
647
						</tr>
648
					</table>
649
				</form>
650

    
651
				<?php else: ?>
652

    
653
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
654
					<tr>
655
						<td width="25%" class="listhdrr">Server Name</td>
656
						<td width="25%" class="listhdrr">Type</td>
657
						<td width="35%" class="listhdrr">Host Name</td>
658
						<td width="10%" class="list"></td>
659
					</tr>
660
					<?php
661
						$i = 0;
662
						foreach($a_server as $server):
663
							$name = htmlspecialchars($server['name']);
664
							$type = htmlspecialchars($auth_server_types[$server['type']]);
665
							$host = htmlspecialchars($server['host']);
666
					?>
667
					<tr <?php if ($i < (count($a_server) - 1)): ?> ondblclick="document.location='system_authservers.php?act=edit&id=<?=$i;?>'" <?php endif; ?>>
668
						<td class="listlr"><?=$name?>&nbsp;</td>
669
						<td class="listr"><?=$type;?>&nbsp;</td>
670
						<td class="listr"><?=$host;?>&nbsp;</td>
671
						<td valign="middle" nowrap class="list">
672
						<?php if ($i < (count($a_server) - 1)): ?>
673
							<a href="system_authservers.php?act=edit&id=<?=$i;?>">
674
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="edit server" alt="edit server" width="17" height="17" border="0" />
675
							</a>
676
							&nbsp;
677
							<a href="system_authservers.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Server?");?>')">
678
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="delete server" alt="delete server" width="17" height="17" border="0" />
679
							</a>
680
						<?php endif; ?>
681
						</td>
682
					</tr>
683
					<?php
684
						$i++; endforeach;
685
					?>
686
					<tr>
687
						<td class="list" colspan="3"></td>
688
						<td class="list">
689
							<a href="system_authservers.php?act=new">
690
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="add server" alt="add server" width="17" height="17" border="0" />
691
							</a>
692
						</td>
693
					</tr>
694
					<tr>
695
						<td colspan="3">
696
							<p>
697
								<?=gettext("Additional authentication servers can be added here.");?>
698
							</p>
699
						</td>
700
					</tr>
701
				</table>
702

    
703
				<?php endif; ?>
704

    
705
			</div>
706
		</td>
707
	</tr>
708
</table>
709
<?php include("fend.inc"); ?>
710
<script type="text/javascript">
711
<!--
712
server_typechange('<?=$pconfig['type'];?>');
713
<?php if (!isset($id) || $pconfig['type'] == "ldap"): ?>
714
ldap_bindchange();
715
ldap_urlchange();
716
<?php if (!isset($id)): ?>
717
ldap_tmplchange();
718
<? endif; ?>
719
<? endif; ?>
720
<?php if (!isset($id) || $pconfig['type'] == "radius"): ?>
721
radius_srvcschange();
722
<? endif; ?>
723
//-->
724
</script>
725
</body>
(176-176/218)