1
|
<?php
|
2
|
/*
|
3
|
system_authservers.php
|
4
|
|
5
|
Copyright (C) 2008 Shrew Soft Inc.
|
6
|
Copyright (C) 2010 Ermal Luçi
|
7
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
8
|
All rights reserved.
|
9
|
|
10
|
Redistribution and use in source and binary forms, with or without
|
11
|
modification, are permitted provided that the following conditions are met:
|
12
|
|
13
|
1. Redistributions of source code must retain the above copyright notice,
|
14
|
this list of conditions and the following disclaimer.
|
15
|
|
16
|
2. Redistributions in binary form must reproduce the above copyright
|
17
|
notice, this list of conditions and the following disclaimer in the
|
18
|
documentation and/or other materials provided with the distribution.
|
19
|
|
20
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
POSSIBILITY OF SUCH DAMAGE.
|
30
|
*/
|
31
|
/*
|
32
|
pfSense_MODULE: auth
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-system-authservers
|
37
|
##|*NAME=System: Authentication Servers
|
38
|
##|*DESCR=Allow access to the 'System: Authentication Servers' page.
|
39
|
##|*MATCH=system_authservers.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
require_once("auth.inc");
|
44
|
|
45
|
$pgtitle = array(gettext("System"), gettext("Authentication Servers"));
|
46
|
$shortcut_section = "authentication";
|
47
|
|
48
|
if (is_numericint($_GET['id'])) {
|
49
|
$id = $_GET['id'];
|
50
|
}
|
51
|
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
|
52
|
$id = $_POST['id'];
|
53
|
}
|
54
|
|
55
|
if (!is_array($config['system']['authserver'])) {
|
56
|
$config['system']['authserver'] = array();
|
57
|
}
|
58
|
|
59
|
$a_servers = auth_get_authserver_list();
|
60
|
foreach ($a_servers as $servers) {
|
61
|
$a_server[] = $servers;
|
62
|
}
|
63
|
|
64
|
if (!is_array($config['ca'])) {
|
65
|
$config['ca'] = array();
|
66
|
}
|
67
|
$a_ca =& $config['ca'];
|
68
|
|
69
|
$act = $_GET['act'];
|
70
|
if ($_POST['act']) {
|
71
|
$act = $_POST['act'];
|
72
|
}
|
73
|
|
74
|
if ($act == "del") {
|
75
|
|
76
|
if (!$a_server[$_GET['id']]) {
|
77
|
pfSenseHeader("system_authservers.php");
|
78
|
exit;
|
79
|
}
|
80
|
|
81
|
/* Remove server from main list. */
|
82
|
$serverdeleted = $a_server[$_GET['id']]['name'];
|
83
|
foreach ($config['system']['authserver'] as $k => $as) {
|
84
|
if ($config['system']['authserver'][$k]['name'] == $serverdeleted) {
|
85
|
unset($config['system']['authserver'][$k]);
|
86
|
}
|
87
|
}
|
88
|
|
89
|
/* Remove server from temp list used later on this page. */
|
90
|
unset($a_server[$_GET['id']]);
|
91
|
|
92
|
$savemsg = gettext("Authentication Server") . " " . htmlspecialchars($serverdeleted) . " " . gettext("deleted") . "<br />";
|
93
|
write_config($savemsg);
|
94
|
}
|
95
|
|
96
|
if ($act == "edit") {
|
97
|
if (isset($id) && $a_server[$id]) {
|
98
|
|
99
|
$pconfig['type'] = $a_server[$id]['type'];
|
100
|
$pconfig['name'] = $a_server[$id]['name'];
|
101
|
|
102
|
if ($pconfig['type'] == "ldap") {
|
103
|
$pconfig['ldap_caref'] = $a_server[$id]['ldap_caref'];
|
104
|
$pconfig['ldap_host'] = $a_server[$id]['host'];
|
105
|
$pconfig['ldap_port'] = $a_server[$id]['ldap_port'];
|
106
|
$pconfig['ldap_urltype'] = $a_server[$id]['ldap_urltype'];
|
107
|
$pconfig['ldap_protver'] = $a_server[$id]['ldap_protver'];
|
108
|
$pconfig['ldap_scope'] = $a_server[$id]['ldap_scope'];
|
109
|
$pconfig['ldap_basedn'] = $a_server[$id]['ldap_basedn'];
|
110
|
$pconfig['ldap_authcn'] = $a_server[$id]['ldap_authcn'];
|
111
|
$pconfig['ldap_extended_enabled'] = $a_server[$id]['ldap_extended_enabled'];
|
112
|
$pconfig['ldap_extended_query'] = $a_server[$id]['ldap_extended_query'];
|
113
|
$pconfig['ldap_binddn'] = $a_server[$id]['ldap_binddn'];
|
114
|
$pconfig['ldap_bindpw'] = $a_server[$id]['ldap_bindpw'];
|
115
|
$pconfig['ldap_attr_user'] = $a_server[$id]['ldap_attr_user'];
|
116
|
$pconfig['ldap_attr_group'] = $a_server[$id]['ldap_attr_group'];
|
117
|
$pconfig['ldap_attr_member'] = $a_server[$id]['ldap_attr_member'];
|
118
|
$pconfig['ldap_utf8'] = isset($a_server[$id]['ldap_utf8']);
|
119
|
$pconfig['ldap_nostrip_at'] = isset($a_server[$id]['ldap_nostrip_at']);
|
120
|
|
121
|
if (!$pconfig['ldap_binddn'] || !$pconfig['ldap_bindpw']) {
|
122
|
$pconfig['ldap_anon'] = true;
|
123
|
}
|
124
|
}
|
125
|
|
126
|
if ($pconfig['type'] == "radius") {
|
127
|
$pconfig['radius_host'] = $a_server[$id]['host'];
|
128
|
$pconfig['radius_auth_port'] = $a_server[$id]['radius_auth_port'];
|
129
|
$pconfig['radius_acct_port'] = $a_server[$id]['radius_acct_port'];
|
130
|
$pconfig['radius_secret'] = $a_server[$id]['radius_secret'];
|
131
|
$pconfig['radius_timeout'] = $a_server[$id]['radius_timeout'];
|
132
|
|
133
|
if ($pconfig['radius_auth_port'] &&
|
134
|
$pconfig['radius_acct_port']) {
|
135
|
$pconfig['radius_srvcs'] = "both";
|
136
|
}
|
137
|
|
138
|
if ($pconfig['radius_auth_port'] &&
|
139
|
!$pconfig['radius_acct_port']) {
|
140
|
$pconfig['radius_srvcs'] = "auth";
|
141
|
$pconfig['radius_acct_port'] = 1813;
|
142
|
}
|
143
|
|
144
|
if (!$pconfig['radius_auth_port'] &&
|
145
|
$pconfig['radius_acct_port']) {
|
146
|
$pconfig['radius_srvcs'] = "acct";
|
147
|
$pconfig['radius_auth_port'] = 1812;
|
148
|
}
|
149
|
|
150
|
}
|
151
|
}
|
152
|
}
|
153
|
|
154
|
if ($act == "new") {
|
155
|
$pconfig['ldap_protver'] = 3;
|
156
|
$pconfig['ldap_anon'] = true;
|
157
|
$pconfig['radius_srvcs'] = "both";
|
158
|
$pconfig['radius_auth_port'] = "1812";
|
159
|
$pconfig['radius_acct_port'] = "1813";
|
160
|
}
|
161
|
|
162
|
if ($_POST) {
|
163
|
unset($input_errors);
|
164
|
$pconfig = $_POST;
|
165
|
|
166
|
/* input validation */
|
167
|
|
168
|
if ($pconfig['type'] == "ldap") {
|
169
|
$reqdfields = explode(" ",
|
170
|
"name type ldap_host ldap_port " .
|
171
|
"ldap_urltype ldap_protver ldap_scope " .
|
172
|
"ldap_attr_user ldap_attr_group ldap_attr_member ldapauthcontainers");
|
173
|
$reqdfieldsn = array(
|
174
|
gettext("Descriptive name"),
|
175
|
gettext("Type"),
|
176
|
gettext("Hostname or IP"),
|
177
|
gettext("Port value"),
|
178
|
gettext("Transport"),
|
179
|
gettext("Protocol version"),
|
180
|
gettext("Search level"),
|
181
|
gettext("User naming Attribute"),
|
182
|
gettext("Group naming Attribute"),
|
183
|
gettext("Group member attribute"),
|
184
|
gettext("Authentication container"));
|
185
|
|
186
|
if (!$pconfig['ldap_anon']) {
|
187
|
$reqdfields[] = "ldap_binddn";
|
188
|
$reqdfields[] = "ldap_bindpw";
|
189
|
$reqdfieldsn[] = gettext("Bind user DN");
|
190
|
$reqdfieldsn[] = gettext("Bind Password");
|
191
|
}
|
192
|
}
|
193
|
|
194
|
if ($pconfig['type'] == "radius") {
|
195
|
$reqdfields = explode(" ", "name type radius_host radius_srvcs");
|
196
|
$reqdfieldsn = array(
|
197
|
gettext("Descriptive name"),
|
198
|
gettext("Type"),
|
199
|
gettext("Hostname or IP"),
|
200
|
gettext("Services"));
|
201
|
|
202
|
if ($pconfig['radisu_srvcs'] == "both" ||
|
203
|
$pconfig['radisu_srvcs'] == "auth") {
|
204
|
$reqdfields[] = "radius_auth_port";
|
205
|
$reqdfieldsn[] = gettext("Authentication port value");
|
206
|
}
|
207
|
|
208
|
if ($pconfig['radisu_srvcs'] == "both" ||
|
209
|
$pconfig['radisu_srvcs'] == "acct") {
|
210
|
$reqdfields[] = "radius_acct_port";
|
211
|
$reqdfieldsn[] = gettext("Accounting port value");
|
212
|
}
|
213
|
|
214
|
if (!isset($id)) {
|
215
|
$reqdfields[] = "radius_secret";
|
216
|
$reqdfieldsn[] = gettext("Shared Secret");
|
217
|
}
|
218
|
}
|
219
|
|
220
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
221
|
|
222
|
if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['host'])) {
|
223
|
$input_errors[] = gettext("The host name contains invalid characters.");
|
224
|
}
|
225
|
|
226
|
if (auth_get_authserver($pconfig['name']) && !isset($id)) {
|
227
|
$input_errors[] = gettext("An authentication server with the same name already exists.");
|
228
|
}
|
229
|
|
230
|
if (($pconfig['type'] == "radius") && isset($_POST['radius_timeout']) && !empty($_POST['radius_timeout']) && (!is_numeric($_POST['radius_timeout']) || (is_numeric($_POST['radius_timeout']) && ($_POST['radius_timeout'] <= 0)))) {
|
231
|
$input_errors[] = gettext("RADIUS Timeout value must be numeric and positive.");
|
232
|
}
|
233
|
|
234
|
/* if this is an AJAX caller then handle via JSON */
|
235
|
if (isAjax() && is_array($input_errors)) {
|
236
|
input_errors2Ajax($input_errors);
|
237
|
exit;
|
238
|
}
|
239
|
|
240
|
if (!$input_errors) {
|
241
|
$server = array();
|
242
|
$server['refid'] = uniqid();
|
243
|
if (isset($id) && $a_server[$id]) {
|
244
|
$server = $a_server[$id];
|
245
|
}
|
246
|
|
247
|
$server['type'] = $pconfig['type'];
|
248
|
$server['name'] = $pconfig['name'];
|
249
|
|
250
|
if ($server['type'] == "ldap") {
|
251
|
|
252
|
if (!empty($pconfig['ldap_caref'])) {
|
253
|
$server['ldap_caref'] = $pconfig['ldap_caref'];
|
254
|
}
|
255
|
$server['host'] = $pconfig['ldap_host'];
|
256
|
$server['ldap_port'] = $pconfig['ldap_port'];
|
257
|
$server['ldap_urltype'] = $pconfig['ldap_urltype'];
|
258
|
$server['ldap_protver'] = $pconfig['ldap_protver'];
|
259
|
$server['ldap_scope'] = $pconfig['ldap_scope'];
|
260
|
$server['ldap_basedn'] = $pconfig['ldap_basedn'];
|
261
|
$server['ldap_authcn'] = $pconfig['ldapauthcontainers'];
|
262
|
$server['ldap_extended_enabled'] = $pconfig['ldap_extended_enabled'];
|
263
|
$server['ldap_extended_query'] = $pconfig['ldap_extended_query'];
|
264
|
$server['ldap_attr_user'] = $pconfig['ldap_attr_user'];
|
265
|
$server['ldap_attr_group'] = $pconfig['ldap_attr_group'];
|
266
|
$server['ldap_attr_member'] = $pconfig['ldap_attr_member'];
|
267
|
if ($pconfig['ldap_utf8'] == "yes") {
|
268
|
$server['ldap_utf8'] = true;
|
269
|
} else {
|
270
|
unset($server['ldap_utf8']);
|
271
|
}
|
272
|
if ($pconfig['ldap_nostrip_at'] == "yes") {
|
273
|
$server['ldap_nostrip_at'] = true;
|
274
|
} else {
|
275
|
unset($server['ldap_nostrip_at']);
|
276
|
}
|
277
|
|
278
|
|
279
|
if (!$pconfig['ldap_anon']) {
|
280
|
$server['ldap_binddn'] = $pconfig['ldap_binddn'];
|
281
|
$server['ldap_bindpw'] = $pconfig['ldap_bindpw'];
|
282
|
} else {
|
283
|
unset($server['ldap_binddn']);
|
284
|
unset($server['ldap_bindpw']);
|
285
|
}
|
286
|
}
|
287
|
|
288
|
if ($server['type'] == "radius") {
|
289
|
|
290
|
$server['host'] = $pconfig['radius_host'];
|
291
|
|
292
|
if ($pconfig['radius_secret']) {
|
293
|
$server['radius_secret'] = $pconfig['radius_secret'];
|
294
|
}
|
295
|
|
296
|
if ($pconfig['radius_timeout']) {
|
297
|
$server['radius_timeout'] = $pconfig['radius_timeout'];
|
298
|
} else {
|
299
|
$server['radius_timeout'] = 5;
|
300
|
}
|
301
|
|
302
|
if ($pconfig['radius_srvcs'] == "both") {
|
303
|
$server['radius_auth_port'] = $pconfig['radius_auth_port'];
|
304
|
$server['radius_acct_port'] = $pconfig['radius_acct_port'];
|
305
|
}
|
306
|
|
307
|
if ($pconfig['radius_srvcs'] == "auth") {
|
308
|
$server['radius_auth_port'] = $pconfig['radius_auth_port'];
|
309
|
unset($server['radius_acct_port']);
|
310
|
}
|
311
|
|
312
|
if ($pconfig['radius_srvcs'] == "acct") {
|
313
|
$server['radius_acct_port'] = $pconfig['radius_acct_port'];
|
314
|
unset($server['radius_auth_port']);
|
315
|
}
|
316
|
}
|
317
|
|
318
|
if (isset($id) && $config['system']['authserver'][$id]) {
|
319
|
$config['system']['authserver'][$id] = $server;
|
320
|
} else {
|
321
|
$config['system']['authserver'][] = $server;
|
322
|
}
|
323
|
|
324
|
write_config();
|
325
|
|
326
|
pfSenseHeader("system_authservers.php");
|
327
|
}
|
328
|
}
|
329
|
|
330
|
include("head.inc");
|
331
|
|
332
|
if ($input_errors)
|
333
|
print_input_errors($input_errors);
|
334
|
if ($savemsg)
|
335
|
print_info_box($savemsg);
|
336
|
|
337
|
$tab_array = array();
|
338
|
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
|
339
|
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
|
340
|
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
|
341
|
$tab_array[] = array(gettext("Servers"), true, "system_authservers.php");
|
342
|
display_top_tabs($tab_array);
|
343
|
|
344
|
if (!($act == "new" || $act == "edit" || $input_errors))
|
345
|
{
|
346
|
?>
|
347
|
<div class="table-responsive">
|
348
|
<table class="table table-striped table-hover">
|
349
|
<thead>
|
350
|
<tr>
|
351
|
<th><?=gettext("Server Name")?></th>
|
352
|
<th><?=gettext("Type")?></th>
|
353
|
<th><?=gettext("Host Name")?></th>
|
354
|
<th></th>
|
355
|
</tr>
|
356
|
</thead>
|
357
|
<tbody>
|
358
|
<?php foreach($a_server as $i => $server): ?>
|
359
|
<tr>
|
360
|
<td><?=htmlspecialchars($server['name'])?></td>
|
361
|
<td><?=htmlspecialchars($auth_server_types[$server['type']])?></td>
|
362
|
<td><?=htmlspecialchars($server['host'])?></td>
|
363
|
<td>
|
364
|
<?php if ($i < (count($a_server) - 1)): ?>
|
365
|
<a href="system_authservers.php?act=edit&id=<?=$i?>" class="btn btn-xs btn-primary">edit</a>
|
366
|
<a href="system_authservers.php?act=del&id=<?=$i?>" class="btn btn-xs btn-danger">delete</a>
|
367
|
<?php endif?>
|
368
|
</td>
|
369
|
</tr>
|
370
|
<?php endforeach; ?>
|
371
|
</tbody>
|
372
|
</table>
|
373
|
</div>
|
374
|
|
375
|
<nav class="action-buttons">
|
376
|
<a href="?act=new" class="btn btn-success">add new</a>
|
377
|
</nav>
|
378
|
<?php
|
379
|
include("foot.inc");
|
380
|
exit;
|
381
|
}
|
382
|
|
383
|
require('classes/Form.class.php');
|
384
|
$form = new Form;
|
385
|
$form->setAction('system_authservers.php?act=edit');
|
386
|
$form->addGlobal(new Form_Input(
|
387
|
'userid',
|
388
|
null,
|
389
|
'hidden',
|
390
|
$id
|
391
|
));
|
392
|
|
393
|
$section = new Form_Section('Server settings');
|
394
|
|
395
|
$section->addInput($input = new Form_Input(
|
396
|
'name',
|
397
|
'Descriptive name',
|
398
|
'text',
|
399
|
$pconfig['name']
|
400
|
));
|
401
|
|
402
|
if ($act == 'edit')
|
403
|
$input->setReadonly();
|
404
|
|
405
|
$section->addInput($input = new Form_Select(
|
406
|
'type',
|
407
|
'Type',
|
408
|
$pconfig['type'],
|
409
|
$auth_server_types
|
410
|
))->toggles();
|
411
|
|
412
|
if ($act == 'edit')
|
413
|
$input->setDisabled();
|
414
|
|
415
|
$form->add($section);
|
416
|
$section = new Form_Section('LDAP Server Settings');
|
417
|
$section->addClass('toggle-ldap collapse');
|
418
|
|
419
|
if (!isset($pconfig['type']) || $pconfig['type'] == 'ldap')
|
420
|
$section->addClass('in');
|
421
|
|
422
|
$section->addInput(new Form_Input(
|
423
|
'ldap_host',
|
424
|
'Hostname or IP address',
|
425
|
'text',
|
426
|
$pconfig['ldap_host']
|
427
|
))->setHelp('NOTE: When using SSL, this hostname MUST match the Common Name '.
|
428
|
'(CN) of the LDAP server"s SSL Certificate.');
|
429
|
|
430
|
$section->addInput(new Form_Input(
|
431
|
'ldap_port',
|
432
|
'Port value',
|
433
|
'number',
|
434
|
$pconfig['ldap_port']
|
435
|
));
|
436
|
|
437
|
$section->addInput(new Form_Select(
|
438
|
'ldap_urltype',
|
439
|
'Transport',
|
440
|
$pconfig['ldap_urltype'],
|
441
|
array_combine(array_keys($ldap_urltypes), array_keys($ldap_urltypes))
|
442
|
));
|
443
|
|
444
|
if (empty($a_ca))
|
445
|
{
|
446
|
$section->addInput(new Form_StaticText(
|
447
|
'Peer Certificate Authority',
|
448
|
'No Certificate Authorities defined.<br/>Create one under <a href="system_camanager.php">System > Cert Manager</a>.'
|
449
|
));
|
450
|
}
|
451
|
else
|
452
|
{
|
453
|
$ldapCaRef = [];
|
454
|
foreach ($a_ca as $ca)
|
455
|
$ldapCaRef[ $ca['refid'] ] = $ca['descr'];
|
456
|
|
457
|
$section->addInput(new Form_Select(
|
458
|
'ldap_caref',
|
459
|
'Peer Certificate Authority',
|
460
|
$pconfig['ldap_caref'],
|
461
|
$ldapCaRef
|
462
|
))->setHelp('This option is used if \'SSL Encrypted\' option is choosen. '.
|
463
|
'It must match with the CA in the AD otherwise problems will arise.');
|
464
|
}
|
465
|
|
466
|
$section->addInput(new Form_Select(
|
467
|
'ldap_protver',
|
468
|
'Protocol version',
|
469
|
$pconfig['ldap_protver'],
|
470
|
array_combine($ldap_protvers, $ldap_protvers)
|
471
|
));
|
472
|
|
473
|
$group = new Form_Group('Search scope');
|
474
|
$group->add(new Form_Select(
|
475
|
'ldap_scope',
|
476
|
'Level',
|
477
|
$pconfig['ldap_scope'],
|
478
|
$ldap_scopes
|
479
|
));
|
480
|
$group->add(new Form_Input(
|
481
|
'ldap_basedn',
|
482
|
'Base DN',
|
483
|
'text',
|
484
|
$pconfig['ldap_basedn']
|
485
|
));
|
486
|
$section->add($group);
|
487
|
|
488
|
$group = new Form_Group('Authentication containers');
|
489
|
$group->add(new Form_Input(
|
490
|
'ldapauthcontainers',
|
491
|
'Containers',
|
492
|
'text',
|
493
|
$pconfig['ldap_authcn']
|
494
|
))->setHelp('Note: Semi-Colon separated. This will be prepended to the search '.
|
495
|
'base dn above or you can specify full container path containing a dc= '.
|
496
|
'component.<br/>Example: CN=Users;DC=example,DC=com or OU=Staff;OU=Freelancers');
|
497
|
#FIXME
|
498
|
$group->add(new Form_Button(
|
499
|
'Select',
|
500
|
'Select a container',
|
501
|
'/system_usermanager_settings_ldapacpicker.php?port=389&host=192.168.1.1&scope=one&basedn=CN=pfsense&binddn=&bindpw=&urltype=TCP%20-%20Standard&proto=3&authcn=OU=Staff&cert='
|
502
|
));
|
503
|
$section->add($group);
|
504
|
|
505
|
$section->addInput(new Form_Checkbox(
|
506
|
'ldap_extended_enabled',
|
507
|
'Extended query',
|
508
|
'Enable extended query',
|
509
|
$pconfig['ldap_extended_enabled']
|
510
|
))->toggles('.toggle-extended');
|
511
|
|
512
|
$group = new Form_Group('Query');
|
513
|
$group->addClass('toggle-extended collapse');
|
514
|
$group->add(new Form_Input(
|
515
|
'ldap_extended_query',
|
516
|
'Query',
|
517
|
'text',
|
518
|
$pconfig['ldap_extended_query']
|
519
|
))->setHelp('Example: &(objectClass=inetOrgPerson)(mail=*@example.com)');
|
520
|
|
521
|
$section->add($group);
|
522
|
|
523
|
$section->addInput(new Form_Checkbox(
|
524
|
'ldap_anon',
|
525
|
'Bind anonymous',
|
526
|
'Use anonymous binds to resolve distinguished names',
|
527
|
$pconfig['ldap_anon']
|
528
|
))->toggles('.toggle-anon');
|
529
|
|
530
|
$group = new Form_Group('Bind credentials');
|
531
|
$group->addClass('toggle-anon collapse');
|
532
|
$group->add(new Form_Input(
|
533
|
'ldap_binddn',
|
534
|
'User DN:',
|
535
|
'text',
|
536
|
$pconfig['ldap_binddn']
|
537
|
));
|
538
|
$group->add(new Form_Input(
|
539
|
'ldap_bindpw',
|
540
|
'Password',
|
541
|
'text',
|
542
|
$pconfig['ldap_bindpw']
|
543
|
));
|
544
|
$section->add($group);
|
545
|
|
546
|
if ($act == 'add')
|
547
|
{
|
548
|
$ldap_templates = array_map($ldap_templates, function($t){ return $t['desc']; });
|
549
|
|
550
|
$section->addInput(new Form_Select(
|
551
|
'ldap_tmpltype',
|
552
|
'Initial Template',
|
553
|
$pconfig['ldap_template'],
|
554
|
$ldap_templates
|
555
|
));
|
556
|
}
|
557
|
|
558
|
$section->addInput(new Form_Input(
|
559
|
'ldap_attr_user',
|
560
|
'User naming attribute',
|
561
|
'text',
|
562
|
$pconfig['ldap_attr_user']
|
563
|
));
|
564
|
|
565
|
$section->addInput(new Form_Input(
|
566
|
'ldap_attr_group',
|
567
|
'Group naming attribute',
|
568
|
'text',
|
569
|
$pconfig['ldap_attr_group']
|
570
|
));
|
571
|
|
572
|
$section->addInput(new Form_Input(
|
573
|
'ldap_attr_member',
|
574
|
'Group member attribute',
|
575
|
'text',
|
576
|
$pconfig['ldap_attr_member']
|
577
|
));
|
578
|
|
579
|
$section->addInput(new Form_Checkbox(
|
580
|
'ldap_utf8',
|
581
|
'UTF8 Encode',
|
582
|
'UTF8 encode LDAP parameters before sending them to the server.',
|
583
|
$pconfig['ldap_utf8']
|
584
|
))->setHelp('Required to support international characters, but may not be '.
|
585
|
'supported by every LDAP server.');
|
586
|
|
587
|
$section->addInput(new Form_Checkbox(
|
588
|
'ldap_nostrip_at',
|
589
|
'Username Alterations',
|
590
|
'Do not strip away parts of the username after the @ symbol',
|
591
|
$pconfig['ldap_nostrip_at']
|
592
|
))->setHelp('e.g. user@host becomes user when unchecked.');
|
593
|
|
594
|
$form->add($section);
|
595
|
$section = new Form_Section('Radius Server Settings');
|
596
|
$section->addClass('toggle-radius collapse');
|
597
|
|
598
|
$section->addInput(new Form_Input(
|
599
|
'radius_host',
|
600
|
'Hostname or IP address',
|
601
|
'text',
|
602
|
$pconfig['radius_host']
|
603
|
));
|
604
|
|
605
|
$section->addInput(new Form_Input(
|
606
|
'radius_secret',
|
607
|
'Shared Secret',
|
608
|
'text',
|
609
|
$pconfig['radius_secret']
|
610
|
));
|
611
|
|
612
|
$section->addInput(new Form_Select(
|
613
|
'radius_srvcs',
|
614
|
'Services offered',
|
615
|
$pconfig['radius_srvcs'],
|
616
|
$radius_srvcs
|
617
|
));
|
618
|
|
619
|
$section->addInput(new Form_Input(
|
620
|
'radius_auth_port',
|
621
|
'Authentication port value',
|
622
|
'number',
|
623
|
$pconfig['radius_secret']
|
624
|
));
|
625
|
|
626
|
$section->addInput(new Form_Input(
|
627
|
'radius_acct_port',
|
628
|
'Authentication Timeout',
|
629
|
'number',
|
630
|
$pconfig['radius_acct_port']
|
631
|
));
|
632
|
|
633
|
$section->addInput(new Form_Input(
|
634
|
'radius_timeout',
|
635
|
'Authentication Timeout',
|
636
|
'number',
|
637
|
$pconfig['radius_timeout']
|
638
|
))->setHelp('This value controls how long, in seconds, that the RADIUS '.
|
639
|
'server may take to respond to an authentication request. If left blank, the '.
|
640
|
'default value is 5 seconds. NOTE: If you are using an interactive two-factor '.
|
641
|
'authentication system, increase this timeout to account for how long it will '.
|
642
|
'take the user to receive and enter a token.');
|
643
|
|
644
|
if (isset($id) && $a_server[$id])
|
645
|
{
|
646
|
$section->addInput(new Form_Input(
|
647
|
'id',
|
648
|
null,
|
649
|
'hidden',
|
650
|
$id
|
651
|
));
|
652
|
}
|
653
|
|
654
|
$form->add($section);
|
655
|
print $form;
|
656
|
|
657
|
include("foot.inc");
|