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