1
|
<?php
|
2
|
/*
|
3
|
system_authservers.php
|
4
|
|
5
|
Copyright (C) 2008 Shrew Soft Inc.
|
6
|
All rights reserved.
|
7
|
|
8
|
Redistribution and use in source and binary forms, with or without
|
9
|
modification, are permitted provided that the following conditions are met:
|
10
|
|
11
|
1. Redistributions of source code must retain the above copyright notice,
|
12
|
this list of conditions and the following disclaimer.
|
13
|
|
14
|
2. Redistributions in binary form must reproduce the above copyright
|
15
|
notice, this list of conditions and the following disclaimer in the
|
16
|
documentation and/or other materials provided with the distribution.
|
17
|
|
18
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
POSSIBILITY OF SUCH DAMAGE.
|
28
|
*/
|
29
|
|
30
|
##|+PRIV
|
31
|
##|*IDENT=page-system-authservers
|
32
|
##|*NAME=System: Authentication Servers
|
33
|
##|*DESCR=Allow access to the 'System: Authentication Servers' page.
|
34
|
##|*MATCH=system_authservers.php*
|
35
|
##|-PRIV
|
36
|
|
37
|
require("guiconfig.inc");
|
38
|
|
39
|
$pgtitle = array("System", "Authentication Servers");
|
40
|
|
41
|
$id = $_GET['id'];
|
42
|
if (isset($_POST['id']))
|
43
|
$id = $_POST['id'];
|
44
|
|
45
|
if (!is_array($config['system']['authserver']))
|
46
|
$config['system']['authserver'] = array();
|
47
|
|
48
|
$a_server =& $config['system']['authserver'];
|
49
|
|
50
|
$act = $_GET['act'];
|
51
|
if ($_POST['act'])
|
52
|
$act = $_POST['act'];
|
53
|
|
54
|
if ($act == "del") {
|
55
|
|
56
|
if (!$a_server[$_GET['id']]) {
|
57
|
pfSenseHeader("system_authservers.php");
|
58
|
exit;
|
59
|
}
|
60
|
|
61
|
$serverdeleted = $a_server[$_GET['id']]['name'];
|
62
|
unset($a_server[$_GET['id']]);
|
63
|
write_config();
|
64
|
$savemsg = gettext("Authentication Server")." {$serverdeleted} ".
|
65
|
gettext("successfully deleted")."<br/>";
|
66
|
}
|
67
|
|
68
|
if ($act == "edit") {
|
69
|
if (isset($id) && $a_server[$id]) {
|
70
|
|
71
|
$pconfig['type'] = $a_server[$id]['type'];
|
72
|
$pconfig['name'] = $a_server[$id]['name'];
|
73
|
|
74
|
if ($pconfig['type'] == "ldap") {
|
75
|
$pconfig['ldap_host'] = $a_server[$id]['host'];
|
76
|
$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
|
77
|
$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
|
78
|
$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
|
79
|
$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
|
80
|
$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
|
81
|
$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
|
82
|
$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
|
83
|
$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
|
84
|
$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
|
85
|
$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
|
86
|
|
87
|
if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw'])
|
88
|
$pconfig['ldap_anon'] = true;
|
89
|
}
|
90
|
|
91
|
if ($pconfig['type'] == "radius") {
|
92
|
$pconfig['radius_host'] = $a_server[$id]['host'];
|
93
|
$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
|
94
|
$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
|
95
|
|
96
|
if ($pconfig['radius_auth_port'] &&
|
97
|
$pconfig['radius_acct_port'] ) {
|
98
|
$pconfig['radius_srvcs'] = "both";
|
99
|
}
|
100
|
|
101
|
if ( $pconfig['radius_auth_port'] &&
|
102
|
!$pconfig['radius_acct_port'] ) {
|
103
|
$pconfig['radius_srvcs'] = "auth";
|
104
|
$pconfig['radius_acct_port'] = 813;
|
105
|
}
|
106
|
|
107
|
if (!$pconfig['radius_auth_port'] &&
|
108
|
$pconfig['radius_acct_port'] ) {
|
109
|
$pconfig['radius_srvcs'] = "acct";
|
110
|
$pconfig['radius_auth_port'] = 812;
|
111
|
}
|
112
|
|
113
|
}
|
114
|
}
|
115
|
}
|
116
|
|
117
|
if ($act == "new") {
|
118
|
$pconfig['ldap_protver'] = 3;
|
119
|
$pconfig['ldap_anon'] = true;
|
120
|
$pconfig['radius_srvcs'] = "both";
|
121
|
$pconfig['radius_auth_port'] = "812";
|
122
|
$pconfig['radius_acct_port'] = "813";
|
123
|
}
|
124
|
|
125
|
if ($_POST) {
|
126
|
unset($input_errors);
|
127
|
$pconfig = $_POST;
|
128
|
|
129
|
/* input validation */
|
130
|
|
131
|
if ($pconfig['type'] == "ldap") {
|
132
|
$reqdfields = explode(" ", "name type ldap_host ldap_port ".
|
133
|
"ldap_urltype ldap_protver ldap_scope ldap_basedn ".
|
134
|
"ldap_attr_user ldap_attr_group ldap_attr_member");
|
135
|
$reqdfieldsn = explode(",", "Descriptive name,Type,Hostname or IP,".
|
136
|
"Port value,Transport,Protocol version,Search level,".
|
137
|
"Search Base DN,User naming Attribute,".
|
138
|
"Group naming Attribute,Group member attribute");
|
139
|
|
140
|
if (!$pconfig['ldap_anon']) {
|
141
|
$reqdfields[] = "ldap_binddn";
|
142
|
$reqdfields[] = "ldap_bindpw";
|
143
|
$reqdfieldsn[] = "Bind user DN";
|
144
|
$reqdfieldsn[] = "Bind Password";
|
145
|
}
|
146
|
}
|
147
|
|
148
|
if ($pconfig['type'] == "radius") {
|
149
|
$reqdfields = explode(" ", "name type radius_host radius_srvcs");
|
150
|
$reqdfieldsn = explode(",", "Descriptive name,Type,Hostname or IP,".
|
151
|
"Services");
|
152
|
|
153
|
if ($pconfig['radisu_srvcs'] == "both" ||
|
154
|
$pconfig['radisu_srvcs'] == "auth") {
|
155
|
$reqdfields[] = "radius_auth_port";
|
156
|
$reqdfieldsn[] = "Authentication port value";
|
157
|
}
|
158
|
|
159
|
if ($pconfig['radisu_srvcs'] == "both" ||
|
160
|
$pconfig['radisu_srvcs'] == "acct") {
|
161
|
$reqdfields[] = "radius_acct_port";
|
162
|
$reqdfieldsn[] = "Accounting port value";
|
163
|
}
|
164
|
|
165
|
if (!isset($id)) {
|
166
|
$reqdfields[] = "radius_secret";
|
167
|
$reqdfieldsn[] = "Shared Secret";
|
168
|
}
|
169
|
}
|
170
|
|
171
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
172
|
|
173
|
if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host']))
|
174
|
$input_errors[] = gettext("The host name contains invalid characters.");
|
175
|
|
176
|
/* if this is an AJAX caller then handle via JSON */
|
177
|
if (isAjax() && is_array($input_errors)) {
|
178
|
input_errors2Ajax($input_errors);
|
179
|
exit;
|
180
|
}
|
181
|
|
182
|
if (!$input_errors) {
|
183
|
$server = array();
|
184
|
$server['refid'] = uniqid();
|
185
|
if (isset($id) && $a_server[$id])
|
186
|
$server = $a_server[$id];
|
187
|
|
188
|
$server['type'] = $pconfig['type'];
|
189
|
$server['name'] = $pconfig['name'];
|
190
|
|
191
|
if ($server['type'] == "ldap") {
|
192
|
|
193
|
$server['host'] = $pconfig['ldap_host'];
|
194
|
$server['ldap_port'] = $pconfig['ldap_port'];
|
195
|
$server['ldap_urltype'] = $pconfig['ldap_urltype'];
|
196
|
$server['ldap_protver'] = $pconfig['ldap_protver'];
|
197
|
$server['ldap_scope'] = $pconfig['ldap_scope'];
|
198
|
$server['ldap_basedn'] = $pconfig['ldap_basedn'];
|
199
|
$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
|
200
|
$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
|
201
|
$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
|
202
|
|
203
|
if (!$pconfig['ldap_anon']) {
|
204
|
$server['ldap_binddn'] = $pconfig['ldap_binddn'];
|
205
|
$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
|
206
|
} else {
|
207
|
unset($server['ldap_binddn']);
|
208
|
unset($server['ldap_bindpw']);
|
209
|
}
|
210
|
}
|
211
|
|
212
|
if ($server['type'] == "radius") {
|
213
|
|
214
|
$server['host'] = $pconfig['radius_host'];
|
215
|
|
216
|
if ($pconfig['radius_secret'])
|
217
|
$server['radius_secret'] = $pconfig['radius_secret'];
|
218
|
|
219
|
if ($pconfig['radius_srvcs'] == "both") {
|
220
|
$server['radius_auth_port'] = $pconfig['radius_auth_port'];
|
221
|
$server['radius_acct_port'] = $pconfig['radius_acct_port'];
|
222
|
}
|
223
|
|
224
|
if ($pconfig['radius_srvcs'] == "auth") {
|
225
|
$server['radius_auth_port'] = $pconfig['radius_auth_port'];
|
226
|
unset($server['radius_acct_port']);
|
227
|
}
|
228
|
|
229
|
if ($pconfig['radius_srvcs'] == "acct") {
|
230
|
$server['radius_acct_port'] = $pconfig['radius_acct_port'];
|
231
|
unset($server['radius_auth_port']);
|
232
|
}
|
233
|
}
|
234
|
|
235
|
if (isset($id) && $a_server[$id])
|
236
|
$a_server[$id] = $server;
|
237
|
else
|
238
|
$a_server[] = $server;
|
239
|
|
240
|
write_config();
|
241
|
|
242
|
pfSenseHeader("system_authservers.php");
|
243
|
}
|
244
|
}
|
245
|
|
246
|
include("head.inc");
|
247
|
?>
|
248
|
|
249
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
250
|
<?php include("fbegin.inc"); ?>
|
251
|
<script type="text/javascript">
|
252
|
<!--
|
253
|
|
254
|
function server_typechange(type) {
|
255
|
|
256
|
if (!type) {
|
257
|
index = document.iform.type.selectedIndex;
|
258
|
type = document.iform.type.options[index].value;
|
259
|
}
|
260
|
|
261
|
switch (type) {
|
262
|
case "ldap":
|
263
|
document.getElementById("ldap").style.display="";
|
264
|
document.getElementById("radius").style.display="none";
|
265
|
break;
|
266
|
case "radius":
|
267
|
document.getElementById("ldap").style.display="none";
|
268
|
document.getElementById("radius").style.display="";
|
269
|
break;
|
270
|
}
|
271
|
}
|
272
|
|
273
|
function ldap_urlchange() {
|
274
|
switch (document.iform.ldap_urltype.selectedIndex) {
|
275
|
<?php
|
276
|
$index = 0;
|
277
|
foreach ($ldap_urltypes as $urltype => $urlport):
|
278
|
?>
|
279
|
case <?=$index;?>:
|
280
|
document.iform.ldap_port.value = "<?=$urlport;?>";
|
281
|
break;
|
282
|
<?php
|
283
|
$index++;
|
284
|
endforeach;
|
285
|
?>
|
286
|
}
|
287
|
}
|
288
|
|
289
|
function ldap_bindchange() {
|
290
|
|
291
|
if (document.iform.ldap_anon.checked)
|
292
|
document.getElementById("ldap_bind").style.display="none";
|
293
|
else
|
294
|
document.getElementById("ldap_bind").style.display="";
|
295
|
}
|
296
|
|
297
|
function ldap_tmplchange(){
|
298
|
switch (document.iform.ldap_tmpltype.selectedIndex) {
|
299
|
<?php
|
300
|
$index = 0;
|
301
|
foreach ($ldap_templates as $tmpldata):
|
302
|
?>
|
303
|
case <?=$index;?>:
|
304
|
document.iform.ldap_attr_user.value = "<?=$tmpldata['attr_user'];?>";
|
305
|
document.iform.ldap_attr_group.value = "<?=$tmpldata['attr_group'];?>";
|
306
|
document.iform.ldap_attr_member.value = "<?=$tmpldata['attr_member'];?>";
|
307
|
break;
|
308
|
<?php
|
309
|
$index++;
|
310
|
endforeach;
|
311
|
?>
|
312
|
}
|
313
|
}
|
314
|
|
315
|
function radius_srvcschange(){
|
316
|
switch (document.iform.radius_srvcs.selectedIndex) {
|
317
|
case 0: // both
|
318
|
document.getElementById("radius_auth").style.display="";
|
319
|
document.getElementById("radius_acct").style.display="";
|
320
|
break;
|
321
|
case 1: // authentication
|
322
|
document.getElementById("radius_auth").style.display="";
|
323
|
document.getElementById("radius_acct").style.display="none";
|
324
|
break;
|
325
|
case 2: // accounting
|
326
|
document.getElementById("radius_auth").style.display="none";
|
327
|
document.getElementById("radius_acct").style.display="";
|
328
|
break;
|
329
|
}
|
330
|
}
|
331
|
|
332
|
//-->
|
333
|
</script>
|
334
|
<?php
|
335
|
if ($input_errors)
|
336
|
print_input_errors($input_errors);
|
337
|
if ($savemsg)
|
338
|
print_info_box($savemsg);
|
339
|
?>
|
340
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
341
|
<tr>
|
342
|
<td>
|
343
|
<?php
|
344
|
$tab_array = array();
|
345
|
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
|
346
|
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
|
347
|
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
|
348
|
$tab_array[] = array(gettext("Servers"), true, "system_authservers.php");
|
349
|
display_top_tabs($tab_array);
|
350
|
?>
|
351
|
</td>
|
352
|
</tr>
|
353
|
<tr>
|
354
|
<td id="mainarea">
|
355
|
<div class="tabcont">
|
356
|
|
357
|
<?php if ($act == "new" || $act == "edit" || $input_errors): ?>
|
358
|
|
359
|
<form action="system_authservers.php" method="post" name="iform" id="iform">
|
360
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
361
|
<tr>
|
362
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
|
363
|
<td width="78%" class="vtable">
|
364
|
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"/>
|
365
|
</td>
|
366
|
</tr>
|
367
|
<tr>
|
368
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Type");?></td>
|
369
|
<td width="78%" class="vtable">
|
370
|
<?php if (!isset($id)): ?>
|
371
|
<select name='type' id='type' class="formselect" onchange='server_typechange()'>
|
372
|
<?php
|
373
|
foreach ($auth_server_types as $typename => $typedesc ):
|
374
|
$selected = "";
|
375
|
if ($pconfig['type'] == $typename)
|
376
|
$selected = "selected";
|
377
|
?>
|
378
|
<option value="<?=$typename;?>" <?=$selected;?>><?=$typedesc;?></option>
|
379
|
<?php endforeach; ?>
|
380
|
</select>
|
381
|
<?php else: ?>
|
382
|
<strong><?=$auth_server_types[$pconfig['type']];?></strong>
|
383
|
<input name='type' type='hidden' id='type' value="<?=htmlspecialchars($pconfig['type']);?>"/>
|
384
|
<?php endif; ?>
|
385
|
</td>
|
386
|
</tr>
|
387
|
</table>
|
388
|
|
389
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="ldap">
|
390
|
<tr>
|
391
|
<td colspan="2" class="list" height="12"></td>
|
392
|
</tr>
|
393
|
<tr>
|
394
|
<td colspan="2" valign="top" class="listtopic">LDAP Server Settings</td>
|
395
|
</tr>
|
396
|
<tr>
|
397
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
|
398
|
<td width="78%" class="vtable">
|
399
|
<input name="ldap_host" type="text" class="formfld unknown" id="ldap_host" size="20" value="<?=htmlspecialchars($pconfig['ldap_host']);?>"/>
|
400
|
</td>
|
401
|
</tr>
|
402
|
<tr>
|
403
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Port value");?></td>
|
404
|
<td width="78%" class="vtable">
|
405
|
<input name="ldap_port" type="text" class="formfld unknown" id="ldap_port" size="5" value="<?=htmlspecialchars($pconfig['ldap_port']);?>"/>
|
406
|
</td>
|
407
|
</tr>
|
408
|
<tr>
|
409
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Transport");?></td>
|
410
|
<td width="78%" class="vtable">
|
411
|
<select name='ldap_urltype' id='ldap_urltype' class="formselect" onchange='ldap_urlchange()'>
|
412
|
<?php
|
413
|
foreach ($ldap_urltypes as $urltype => $urlport):
|
414
|
$selected = "";
|
415
|
if ($pconfig['ldap_urltype'] == $urltype)
|
416
|
$selected = "selected";
|
417
|
?>
|
418
|
<option value="<?=$urltype;?>" <?=$selected;?>><?=$urltype;?></option>
|
419
|
<?php endforeach; ?>
|
420
|
</select>
|
421
|
</td>
|
422
|
</tr>
|
423
|
<tr>
|
424
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol version");?></td>
|
425
|
<td width="78%" class="vtable">
|
426
|
<select name='ldap_protver' id='ldap_protver' class="formselect">
|
427
|
<?php
|
428
|
foreach ($ldap_protvers as $version):
|
429
|
$selected = "";
|
430
|
if ($pconfig['ldap_protver'] == $version)
|
431
|
$selected = "selected";
|
432
|
?>
|
433
|
<option value="<?=$version;?>" <?=$selected;?>><?=$version;?></option>
|
434
|
<?php endforeach; ?>
|
435
|
</select>
|
436
|
</td>
|
437
|
</tr>
|
438
|
<tr>
|
439
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Search scope");?></td>
|
440
|
<td width="78%" class="vtable">
|
441
|
<table border="0" cellspacing="0" cellpadding="2">
|
442
|
<tr>
|
443
|
<td>Level: </td>
|
444
|
<td>
|
445
|
<select name='ldap_scope' id='ldap_scope' class="formselect">
|
446
|
<?php
|
447
|
foreach ($ldap_scopes as $scopename => $scopedesc):
|
448
|
$selected = "";
|
449
|
if ($pconfig['ldap_scope'] == $scopename)
|
450
|
$selected = "selected";
|
451
|
?>
|
452
|
<option value="<?=$scopename;?>" <?=$selected;?>><?=$scopedesc;?></option>
|
453
|
<?php endforeach; ?>
|
454
|
</select>
|
455
|
</td>
|
456
|
</tr>
|
457
|
<tr>
|
458
|
<td>Base DN: </td>
|
459
|
<td>
|
460
|
<input name="ldap_basedn" type="text" class="formfld unknown" id="ldap_basedn" size="40" value="<?=htmlspecialchars($pconfig['ldap_basedn']);?>"/>
|
461
|
</td>
|
462
|
</tr>
|
463
|
</table>
|
464
|
|
465
|
</td>
|
466
|
</tr>
|
467
|
<tr>
|
468
|
<td width="22%" valign="top" class="vncell"><?=gettext("Bind credentials");?></td>
|
469
|
<td width="78%" class="vtable">
|
470
|
<table border="0" cellspacing="0" cellpadding="2">
|
471
|
<tr>
|
472
|
<td>
|
473
|
<input name="ldap_anon" type="checkbox" id="ldap_anon" value="yes" <?php if ($pconfig['ldap_anon']) echo "checked"; ?> onClick="ldap_bindchange()">
|
474
|
</td>
|
475
|
<td>
|
476
|
Use anonymous binds to resolve distinguished names
|
477
|
</td>
|
478
|
</tr>
|
479
|
</table>
|
480
|
<table border="0" cellspacing="0" cellpadding="2" id="ldap_bind">
|
481
|
<tr>
|
482
|
<td colspan="2"></td>
|
483
|
</tr>
|
484
|
<tr>
|
485
|
<td>User DN: </td>
|
486
|
<td>
|
487
|
<input name="ldap_binddn" type="text" class="formfld unknown" id="ldap_binddn" size="40" value="<?=htmlspecialchars($pconfig['ldap_binddn']);?>"/><br/>
|
488
|
</td>
|
489
|
</tr>
|
490
|
<tr>
|
491
|
<td>Password: </td>
|
492
|
<td>
|
493
|
<input name="ldap_bindpw" type="password" class="formfld pwd" id="ldap_bindpw" size="20" value="<?=htmlspecialchars($pconfig['ldap_bindpw']);?>"/><br/>
|
494
|
</td>
|
495
|
</tr>
|
496
|
</table>
|
497
|
</td>
|
498
|
</tr>
|
499
|
<?php if (!isset($id)): ?>
|
500
|
<tr>
|
501
|
<td width="22%" valign="top" class="vncell"><?=gettext("Initial Template");?></td>
|
502
|
<td width="78%" class="vtable">
|
503
|
<select name='ldap_tmpltype' id='ldap_tmpltype' class="formselect" onchange='ldap_tmplchange()'>
|
504
|
<?php
|
505
|
foreach ($ldap_templates as $tmplname => $tmpldata):
|
506
|
$selected = "";
|
507
|
if ($pconfig['ldap_template'] == $tmplname)
|
508
|
$selected = "selected";
|
509
|
?>
|
510
|
<option value="<?=$tmplname;?>" <?=$selected;?>><?=$tmpldata['desc'];?></option>
|
511
|
<?php endforeach; ?>
|
512
|
</select>
|
513
|
</td>
|
514
|
</tr>
|
515
|
<?php endif; ?>
|
516
|
<tr>
|
517
|
<td width="22%" valign="top" class="vncell"><?=gettext("User naming attribute");?></td>
|
518
|
<td width="78%" class="vtable">
|
519
|
<input name="ldap_attr_user" type="text" class="formfld unknown" id="ldap_attr_user" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_user']);?>"/>
|
520
|
</td>
|
521
|
</tr>
|
522
|
<tr>
|
523
|
<td width="22%" valign="top" class="vncell"><?=gettext("Group naming attribute");?></td>
|
524
|
<td width="78%" class="vtable">
|
525
|
<input name="ldap_attr_group" type="text" class="formfld unknown" id="ldap_attr_group" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_group']);?>"/>
|
526
|
</td>
|
527
|
</tr>
|
528
|
<tr>
|
529
|
<td width="22%" valign="top" class="vncell"><?=gettext("Group member attribute");?></td>
|
530
|
<td width="78%" class="vtable">
|
531
|
<input name="ldap_attr_member" type="text" class="formfld unknown" id="ldap_attr_member" size="20" value="<?=htmlspecialchars($pconfig['ldap_attr_member']);?>"/>
|
532
|
</td>
|
533
|
</tr>
|
534
|
</table>
|
535
|
|
536
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="radius">
|
537
|
<tr>
|
538
|
<td colspan="2" class="list" height="12"></td>
|
539
|
</tr>
|
540
|
<tr>
|
541
|
<td colspan="2" valign="top" class="listtopic">Radius Server Settings</td>
|
542
|
</tr>
|
543
|
<tr>
|
544
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP address");?></td>
|
545
|
<td width="78%" class="vtable">
|
546
|
<input name="radius_host" type="text" class="formfld unknown" id="radius_host" size="20" value="<?=htmlspecialchars($pconfig['radius_host']);?>"/>
|
547
|
</td>
|
548
|
</tr>
|
549
|
<tr>
|
550
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Secret");?></td>
|
551
|
<td width="78%" class="vtable">
|
552
|
<input name="radius_secret" type="password" class="formfld pwd" id="radius_secret" size="20" value="<?=htmlspecialchars($pconfig['radius_secret']);?>"/>
|
553
|
</td>
|
554
|
</tr>
|
555
|
<tr>
|
556
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Services offered");?></td>
|
557
|
<td width="78%" class="vtable">
|
558
|
<select name='radius_srvcs' id='radius_srvcs' class="formselect" onchange='radius_srvcschange()'>
|
559
|
<?php
|
560
|
foreach ($radius_srvcs as $srvcname => $srvcdesc):
|
561
|
$selected = "";
|
562
|
if ($pconfig['radius_srvcs'] == $srvcname)
|
563
|
$selected = "selected";
|
564
|
?>
|
565
|
<option value="<?=$srvcname;?>" <?=$selected;?>><?=$srvcdesc;?></option>
|
566
|
<?php endforeach; ?>
|
567
|
</select>
|
568
|
</td>
|
569
|
</tr>
|
570
|
<tr id="radius_auth">
|
571
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication port value");?></td>
|
572
|
<td width="78%" class="vtable">
|
573
|
<input name="radius_auth_port" type="text" class="formfld unknown" id="radius_auth_port" size="5" value="<?=htmlspecialchars($pconfig['radius_auth_port']);?>"/>
|
574
|
</td>
|
575
|
</tr>
|
576
|
<tr id="radius_acct">
|
577
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Accounting port value");?></td>
|
578
|
<td width="78%" class="vtable">
|
579
|
<input name="radius_acct_port" type="text" class="formfld unknown" id="radius_acct_port" size="5" value="<?=htmlspecialchars($pconfig['radius_acct_port']);?>"/>
|
580
|
</td>
|
581
|
</tr>
|
582
|
</table>
|
583
|
|
584
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
585
|
<tr>
|
586
|
<td width="22%" valign="top"> </td>
|
587
|
<td width="78%">
|
588
|
<input id="submit" name="save" type="submit" class="formbtn" value="Save" />
|
589
|
<?php if (isset($id) && $a_server[$id]): ?>
|
590
|
<input name="id" type="hidden" value="<?=$id;?>" />
|
591
|
<?php endif;?>
|
592
|
</td>
|
593
|
</tr>
|
594
|
</table>
|
595
|
</form>
|
596
|
|
597
|
<?php else: ?>
|
598
|
|
599
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
600
|
<tr>
|
601
|
<td width="25%" class="listhdrr">Server Name</td>
|
602
|
<td width="25%" class="listhdrr">Type</td>
|
603
|
<td width="35%" class="listhdrr">Host Name</td>
|
604
|
<td width="10%" class="list"></td>
|
605
|
</tr>
|
606
|
<?php
|
607
|
$i = 0;
|
608
|
foreach($a_server as $server):
|
609
|
$name = htmlspecialchars($server['name']);
|
610
|
$type = htmlspecialchars($auth_server_types[$server['type']]);
|
611
|
$host = htmlspecialchars($server['host']);
|
612
|
?>
|
613
|
<tr ondblclick="document.location='system_authservers.php?act=edit&id=<?=$i;?>'">
|
614
|
<td class="listlr"><?=$name?> </td>
|
615
|
<td class="listr"><?=$type;?> </td>
|
616
|
<td class="listr"><?=$host;?> </td>
|
617
|
<td valign="middle" nowrap class="list">
|
618
|
<a href="system_authservers.php?act=edit&id=<?=$i;?>">
|
619
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="edit server" alt="edit server" width="17" height="17" border="0" />
|
620
|
</a>
|
621
|
|
622
|
<a href="system_authservers.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Server?");?>')">
|
623
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="delete server" alt="delete server" width="17" height="17" border="0" />
|
624
|
</a>
|
625
|
</td>
|
626
|
</tr>
|
627
|
<?php
|
628
|
$i++;
|
629
|
endforeach;
|
630
|
?>
|
631
|
<tr>
|
632
|
<td class="list" colspan="3"></td>
|
633
|
<td class="list">
|
634
|
<a href="system_authservers.php?act=new">
|
635
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="add server" alt="add server" width="17" height="17" border="0" />
|
636
|
</a>
|
637
|
</td>
|
638
|
</tr>
|
639
|
<tr>
|
640
|
<td colspan="3">
|
641
|
<p>
|
642
|
<?=gettext("Additional authentication servers can be added here.");?>
|
643
|
</p>
|
644
|
</td>
|
645
|
</tr>
|
646
|
</table>
|
647
|
|
648
|
<?php endif; ?>
|
649
|
|
650
|
</div>
|
651
|
</td>
|
652
|
</tr>
|
653
|
</table>
|
654
|
<?php include("fend.inc");?>
|
655
|
<script type="text/javascript">
|
656
|
<!--
|
657
|
server_typechange('<?=$pconfig['type'];?>');
|
658
|
<?php if (!isset($id) || $pconfig['type'] == "ldap"): ?>
|
659
|
ldap_bindchange();
|
660
|
ldap_urlchange();
|
661
|
ldap_tmplchange();
|
662
|
<? endif; ?>
|
663
|
<?php if (!isset($id) || $pconfig['type'] == "radius"): ?>
|
664
|
radius_srvcschange();
|
665
|
<? endif; ?>
|
666
|
//-->
|
667
|
</script>
|
668
|
|
669
|
</body>
|