Project

General

Profile

Download (18.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * system_crlmanager.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23

    
24
##|+PRIV
25
##|*IDENT=page-system-crlmanager
26
##|*NAME=System: CRL Manager
27
##|*DESCR=Allow access to the 'System: CRL Manager' page.
28
##|*MATCH=system_crlmanager.php*
29
##|-PRIV
30

    
31
require_once("guiconfig.inc");
32
require_once("certs.inc");
33
require_once("openvpn.inc");
34
require_once("pfsense-utils.inc");
35
require_once("vpn.inc");
36

    
37
$max_lifetime = cert_get_max_lifetime();
38
$default_lifetime = min(9999, $max_lifetime);
39

    
40
global $openssl_crl_status;
41

    
42
$crl_methods = array(
43
	"internal" => gettext("Create an internal Certificate Revocation List"),
44
	"existing" => gettext("Import an existing Certificate Revocation List"));
45

    
46
if (isset($_REQUEST['id']) && ctype_alnum($_REQUEST['id'])) {
47
	$id = $_REQUEST['id'];
48
}
49

    
50
init_config_arr(array('ca'));
51
$a_ca = &$config['ca'];
52

    
53
init_config_arr(array('cert'));
54
$a_cert = &$config['cert'];
55

    
56
init_config_arr(array('crl'));
57
$a_crl = &$config['crl'];
58

    
59
/* Clean up blank entries missing a reference ID */
60
foreach ($a_crl as $cid => $acrl) {
61
	if (!isset($acrl['refid'])) {
62
		unset ($a_crl[$cid]);
63
	}
64
}
65

    
66
$act = $_REQUEST['act'];
67

    
68
$cacert_list = array();
69

    
70
if (!empty($id)) {
71
	$thiscrl =& lookup_crl($id);
72
}
73

    
74
/* Actions other than 'new' require a CRL to act upon.
75
 * 'del' action must be submitted via POST. */
76
if ((!empty($act) &&
77
    ($act != 'new') &&
78
    !$thiscrl) ||
79
    (($act == 'del') && empty($_POST))) {
80
	pfSenseHeader("system_camanager.php");
81
	$act="";
82
	$savemsg = gettext("Invalid CRL reference.");
83
	$class = "danger";
84
}
85

    
86
switch ($act) {
87
	case 'del':
88
		$name = htmlspecialchars($thiscrl['descr']);
89
		if (crl_in_use($id)) {
90
			$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted."), $name);
91
			$class = "danger";
92
		} else {
93
			foreach ($a_crl as $cid => $acrl) {
94
				if ($acrl['refid'] == $thiscrl['refid']) {
95
					unset($a_crl[$cid]);
96
				}
97
			}
98
			write_config("Deleted CRL {$name}.");
99
			$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted."), $name);
100
			$class = "success";
101
		}
102
		break;
103
	case 'new':
104
		$pconfig['method'] = $_REQUEST['method'];
105
		$pconfig['caref'] = $_REQUEST['caref'];
106
		$pconfig['lifetime'] = $default_lifetime;
107
		$pconfig['serial'] = "0";
108
		$crlca =& lookup_ca($pconfig['caref']);
109
		if (!$crlca) {
110
			$input_errors[] = gettext('Invalid CA');
111
			unset($act);
112
		}
113
		break;
114
	case 'addcert':
115
		unset($input_errors);
116
		$pconfig = $_REQUEST;
117
		$revoke_list = array();
118
		if (!$pconfig['crlref'] || (!$pconfig['certref'] && (strlen($pconfig['revokeserial']) == 0))) {
119
			pfSenseHeader("system_crlmanager.php");
120
			exit;
121
		}
122
		$crl =& lookup_crl($pconfig['crlref']);
123
		if (!is_array($pconfig['certref'])) {
124
			$pconfig['certref'] = array();
125
		}
126
		if (!is_crl_internal($crl)) {
127
			$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
128
		}
129
		if (!empty($pconfig['revokeserial'])) {
130
			foreach (explode(' ', $pconfig['revokeserial']) as $serial) {
131
				$vserial = cert_validate_serial($serial, true, true);
132
				if ($vserial != null) {
133
					$revoke_list[] = $vserial;
134
				} else {
135
					$input_errors[] = gettext("Invalid serial in list (Must be ASN.1 integer compatible decimal or hex string).");
136
				}
137
			}
138
		}
139
		if (empty($pconfig['certref']) && empty($revoke_list)) {
140
			$input_errors[] = gettext("Select one or more certificates or enter a serial number to revoke.");
141
		}
142
		foreach ($pconfig['certref'] as $rcert) {
143
			$cert = lookup_cert($rcert);
144
			if ($crl['caref'] == $cert['caref']) {
145
				$revoke_list[] = $cert;
146
			} else {
147
				$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
148
			}
149
		}
150
		if (!$input_errors) {
151
			$reason = (empty($pconfig['crlreason'])) ? 0 : $pconfig['crlreason'];
152
			foreach ($revoke_list as $cert) {
153
				cert_revoke($cert, $crl, $reason);
154
			}
155
			// refresh IPsec and OpenVPN CRLs
156
			openvpn_refresh_crls();
157
			ipsec_configure();
158
			write_config("Revoked certificate(s) in CRL {$crl['descr']}.");
159
			pfSenseHeader("system_crlmanager.php");
160
			exit;
161
		} else {
162
			$act = 'edit';
163
		}
164
		break;
165
	case 'delcert':
166
		if (!is_array($thiscrl['cert'])) {
167
			pfSenseHeader("system_crlmanager.php");
168
			exit;
169
		}
170
		$found = false;
171
		foreach ($thiscrl['cert'] as $acert) {
172
			if ($acert['refid'] == $_REQUEST['certref']) {
173
				$found = true;
174
				$thiscert = $acert;
175
			}
176
		}
177
		if (!$found) {
178
			pfSenseHeader("system_crlmanager.php");
179
			exit;
180
		}
181
		$certname = htmlspecialchars($thiscert['descr']);
182
		$crlname = htmlspecialchars($thiscrl['descr']);
183
		if (cert_unrevoke($thiscert, $thiscrl)) {
184
			$savemsg = sprintf(gettext('Deleted Certificate %1$s from CRL %2$s.'), $certname, $crlname);
185
			$class = "success";
186
			// refresh IPsec and OpenVPN CRLs
187
			openvpn_refresh_crls();
188
			ipsec_configure();
189
			write_config($savemsg);
190
		} else {
191
			$savemsg = sprintf(gettext('Failed to delete Certificate %1$s from CRL %2$s.'), $certname, $crlname);
192
			$class = "danger";
193
		}
194
		$act="edit";
195
		break;
196
	case 'exp':
197
		/* Exporting the CRL contents*/
198
		crl_update($thiscrl);
199
		send_user_download('data', base64_decode($thiscrl['text']), "{$thiscrl['descr']}.crl");
200
		break;
201
	default:
202
		break;
203
}
204

    
205
if ($_POST['save']) {
206
	$input_errors = array();
207
	$pconfig = $_POST;
208

    
209
	/* input validation */
210
	if (($pconfig['method'] == "existing") || ($act == "editimported")) {
211
		$reqdfields = explode(" ", "descr crltext");
212
		$reqdfieldsn = array(
213
			gettext("Descriptive name"),
214
			gettext("Certificate Revocation List data"));
215
	}
216
	if ($pconfig['method'] == "internal") {
217
		$reqdfields = explode(" ", "descr caref");
218
		$reqdfieldsn = array(
219
			gettext("Descriptive name"),
220
			gettext("Certificate Authority"));
221
	}
222

    
223
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
224

    
225
	if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
226
		array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
227
	}
228
	if ($pconfig['lifetime'] > $max_lifetime) {
229
		$input_errors[] = gettext("Lifetime is longer than the maximum allowed value. Use a shorter lifetime.");
230
	}
231

    
232
	if ((strlen($pconfig['serial']) > 0) && !cert_validate_serial($pconfig['serial'])) {
233
		$input_errors[] = gettext("Please enter a valid integer serial number.");
234
	}
235

    
236
	/* save modifications */
237
	if (!$input_errors) {
238
		$result = false;
239

    
240
		if ($thiscrl) {
241
			$crl =& $thiscrl;
242
		} else {
243
			$crl = array();
244
			$crl['refid'] = uniqid();
245
		}
246

    
247
		$crl['descr'] = $pconfig['descr'];
248
		if ($act != "editimported") {
249
			$crl['caref'] = $pconfig['caref'];
250
			$crl['method'] = $pconfig['method'];
251
		}
252

    
253
		if (($pconfig['method'] == "existing") || ($act == "editimported")) {
254
			$crl['text'] = base64_encode($pconfig['crltext']);
255
		}
256

    
257
		if ($pconfig['method'] == "internal") {
258
			$crl['serial'] = empty($pconfig['serial']) ? 9999 : $pconfig['serial'];
259
			$crl['lifetime'] = empty($pconfig['lifetime']) ? $default_lifetime : $pconfig['lifetime'];
260
			$crl['cert'] = array();
261
		}
262

    
263
		if (!$thiscrl) {
264
			$a_crl[] = $crl;
265
		}
266

    
267
		write_config("Saved CRL {$crl['descr']}");
268
		// refresh IPsec and OpenVPN CRLs
269
		openvpn_refresh_crls();
270
		ipsec_configure();
271
		pfSenseHeader("system_crlmanager.php");
272
	}
273
}
274

    
275
$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("Certificate Revocation"));
276
$pglinks = array("", "system_camanager.php", "system_crlmanager.php");
277

    
278
if ($act == "new" || $act == gettext("Save") || $input_errors || $act == "edit") {
279
	$pgtitle[] = gettext('Edit');
280
	$pglinks[] = "@self";
281
}
282
include("head.inc");
283
?>
284

    
285
<script type="text/javascript">
286
//<![CDATA[
287

    
288
function method_change() {
289

    
290
	method = document.iform.method.value;
291

    
292
	switch (method) {
293
		case "internal":
294
			document.getElementById("existing").style.display="none";
295
			document.getElementById("internal").style.display="";
296
			break;
297
		case "existing":
298
			document.getElementById("existing").style.display="";
299
			document.getElementById("internal").style.display="none";
300
			break;
301
	}
302
}
303

    
304
//]]>
305
</script>
306

    
307
<?php
308

    
309
function build_method_list($importonly = false) {
310
	global $_POST, $crl_methods;
311

    
312
	$list = array();
313

    
314
	foreach ($crl_methods as $method => $desc) {
315
		if ($importonly && ($method != "existing")) {
316
			continue;
317
		}
318

    
319
		$list[$method] = $desc;
320
	}
321

    
322
	return($list);
323
}
324

    
325
function build_ca_list() {
326
	global $a_ca;
327

    
328
	$list = array();
329

    
330
	foreach ($a_ca as $ca) {
331
		$list[$ca['refid']] = $ca['descr'];
332
	}
333

    
334
	return($list);
335
}
336

    
337
function build_cacert_list() {
338
	global $a_cert, $crl, $id;
339

    
340
	$list = array();
341
	foreach ($a_cert as $cert) {
342
		if ((isset($cert['caref']) && !empty($cert['caref'])) &&
343
		    ($cert['caref'] == $crl['caref']) &&
344
		    !is_cert_revoked($cert, $id)) {
345
			$list[$cert['refid']] = $cert['descr'];
346
		}
347
	}
348

    
349
	return($list);
350
}
351

    
352
if ($input_errors) {
353
	print_input_errors($input_errors);
354
}
355

    
356
if ($savemsg) {
357
	print_info_box($savemsg, $class);
358
}
359

    
360
$tab_array = array();
361
$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
362
$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
363
$tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php");
364
display_top_tabs($tab_array);
365

    
366
if ($act == "new" || $act == gettext("Save")) {
367
	$form = new Form();
368

    
369
	$section = new Form_Section('Create new Revocation List');
370

    
371
	$section->addInput(new Form_StaticText(
372
		'Certificate Authority',
373
		$crlca['descr']
374
	));
375

    
376
	if (!isset($id)) {
377
		$section->addInput(new Form_Select(
378
			'method',
379
			'*Method',
380
			$pconfig['method'],
381
			build_method_list((!isset($crlca['prv']) || empty($crlca['prv'])))
382
		));
383
	}
384

    
385
	$section->addInput(new Form_Input(
386
		'descr',
387
		'*Descriptive name',
388
		'text',
389
		$pconfig['descr']
390
	));
391

    
392
	$form->addGlobal(new Form_Input(
393
		'caref',
394
		null,
395
		'hidden',
396
		$pconfig['caref']
397
	));
398

    
399
	$form->add($section);
400

    
401
	$section = new Form_Section('Existing Certificate Revocation List');
402
	$section->addClass('existing');
403

    
404
	$section->addInput(new Form_Textarea(
405
		'crltext',
406
		'*CRL data',
407
		$pconfig['crltext']
408
		))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
409

    
410
	$form->add($section);
411

    
412
	$section = new Form_Section('Internal Certificate Revocation List');
413
	$section->addClass('internal');
414

    
415
	$section->addInput(new Form_Input(
416
		'lifetime',
417
		'Lifetime (Days)',
418
		'number',
419
		$pconfig['lifetime'],
420
		['max' => $max_lifetime]
421
	));
422

    
423
	$section->addInput(new Form_Input(
424
		'serial',
425
		'Serial',
426
		'number',
427
		$pconfig['serial'],
428
		['min' => '0']
429
	));
430

    
431
	$form->add($section);
432

    
433
	if (isset($id) && $thiscrl) {
434
		$form->addGlobal(new Form_Input(
435
			'id',
436
			null,
437
			'hidden',
438
			$id
439
		));
440
	}
441

    
442
	print($form);
443

    
444
} elseif ($act == "editimported") {
445

    
446
	$form = new Form();
447

    
448
	$section = new Form_Section('Edit Imported Certificate Revocation List');
449

    
450
	$section->addInput(new Form_Input(
451
		'descr',
452
		'*Descriptive name',
453
		'text',
454
		$pconfig['descr']
455
	));
456

    
457
	$section->addInput(new Form_Textarea(
458
		'crltext',
459
		'*CRL data',
460
		$pconfig['crltext']
461
	))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
462

    
463
	$form->addGlobal(new Form_Input(
464
		'id',
465
		null,
466
		'hidden',
467
		$id
468
	));
469

    
470
	$form->addGlobal(new Form_Input(
471
		'act',
472
		null,
473
		'hidden',
474
		'editimported'
475
	));
476

    
477
	$form->add($section);
478

    
479
	print($form);
480

    
481
} elseif ($act == "edit") {
482
	$crl = $thiscrl;
483

    
484
	$form = new Form(false);
485
?>
486

    
487
	<div class="panel panel-default">
488
		<div class="panel-heading"><h2 class="panel-title"><?=gettext("Revoked Certificates in CRL") . ': ' . $crl['descr']?></h2></div>
489
		<div class="panel-body table-responsive">
490
<?php
491
	if (!is_array($crl['cert']) || (count($crl['cert']) == 0)) {
492
		print_info_box(gettext("No certificates found for this CRL."), 'danger');
493
	} else {
494
?>
495
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
496
				<thead>
497
					<tr>
498
						<th><?=gettext("Serial")?></th>
499
						<th><?=gettext("Certificate Name")?></th>
500
						<th><?=gettext("Revocation Reason")?></th>
501
						<th><?=gettext("Revoked At")?></th>
502
						<th></th>
503
					</tr>
504
				</thead>
505
				<tbody>
506
<?php
507
		foreach ($crl['cert'] as $i => $cert):
508
			$name = empty($cert['descr']) ? gettext('Revoked by Serial') : htmlspecialchars($cert['descr']);
509
			$serial = crl_get_entry_serial($cert);
510
			if (strlen($serial) == 0) {
511
				$serial = gettext("Invalid");
512
			} ?>
513
					<tr>
514
						<td><?=htmlspecialchars($serial);?></td>
515
						<td><?=$name; ?></td>
516
						<td><?=$openssl_crl_status[$cert['reason']]; ?></td>
517
						<td><?=date("D M j G:i:s T Y", $cert['revoke_time']); ?></td>
518
						<td class="list">
519
							<a href="system_crlmanager.php?act=delcert&amp;id=<?=$crl['refid']; ?>&amp;certref=<?=$cert['refid']; ?>" usepost>
520
								<i class="fa fa-trash" title="<?=gettext("Delete this certificate from the CRL")?>" alt="<?=gettext("Delete this certificate from the CRL")?>"></i>
521
							</a>
522
						</td>
523
					</tr>
524
<?php
525
		endforeach;
526
?>
527
				</tbody>
528
			</table>
529
<?php
530
	}
531
?>
532
		</div>
533
	</div>
534
<?php
535

    
536
	$section = new Form_Section('Revoke Certificates');
537

    
538
	$section->addInput(new Form_Select(
539
		'crlreason',
540
		'Reason',
541
		-1,
542
		$openssl_crl_status
543
		))->setHelp('Select the reason for which the certificates are being revoked.');
544

    
545
	$cacert_list = build_cacert_list();
546
	if (count($cacert_list) == 0) {
547
		print_info_box(gettext("No certificates found for this CA."), 'danger');
548
	} else {
549
		$section->addInput(new Form_Select(
550
			'certref',
551
			'Revoke Certificates',
552
			$pconfig['certref'],
553
			$cacert_list,
554
			true
555
			))->addClass('multiselect')
556
			->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.');
557
	}
558

    
559
	$section->addInput(new Form_Input(
560
		'revokeserial',
561
		'Revoke by Serial',
562
		'text',
563
		$pconfig['revokeserial']
564
	))->setHelp('List of certificate serial numbers to revoke (separated by spaces)');
565

    
566
	$form->addGlobal(new Form_Button(
567
		'submit',
568
		'Add',
569
		null,
570
		'fa-plus'
571
		))->addClass('btn-success btn-sm');
572

    
573
	$form->addGlobal(new Form_Input(
574
		'id',
575
		null,
576
		'hidden',
577
		$crl['refid']
578
	));
579

    
580
	$form->addGlobal(new Form_Input(
581
		'act',
582
		null,
583
		'hidden',
584
		'addcert'
585
	));
586

    
587
	$form->addGlobal(new Form_Input(
588
		'crlref',
589
		null,
590
		'hidden',
591
		$crl['refid']
592
	));
593

    
594
	$form->add($section);
595

    
596
	print($form);
597
} else {
598
?>
599

    
600
	<div class="panel panel-default">
601
		<div class="panel-heading"><h2 class="panel-title"><?=gettext("Certificate Revocation Lists")?></h2></div>
602
		<div class="panel-body table-responsive">
603
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
604
				<thead>
605
					<tr>
606
						<th><?=gettext("CA")?></th>
607
						<th><?=gettext("Name")?></th>
608
						<th><?=gettext("Internal")?></th>
609
						<th><?=gettext("Certificates")?></th>
610
						<th><?=gettext("In Use")?></th>
611
						<th><?=gettext("Actions")?></th>
612
					</tr>
613
				</thead>
614
				<tbody>
615
<?php
616
	$pluginparams = array();
617
	$pluginparams['type'] = 'certificates';
618
	$pluginparams['event'] = 'used_crl';
619
	$certificates_used_by_packages = pkg_call_plugins('plugin_certificates', $pluginparams);
620
	// Map CRLs to CAs in one pass
621
	$ca_crl_map = array();
622
	foreach ($a_crl as $crl) {
623
		$ca_crl_map[$crl['caref']][] = $crl['refid'];
624
	}
625

    
626
	$i = 0;
627
	foreach ($a_ca as $ca):
628
		$caname = htmlspecialchars($ca['descr']);
629
		if (is_array($ca_crl_map[$ca['refid']])):
630
			foreach ($ca_crl_map[$ca['refid']] as $crl):
631
				$tmpcrl = lookup_crl($crl);
632
				$internal = is_crl_internal($tmpcrl);
633
				if ($internal && (!isset($tmpcrl['cert']) || empty($tmpcrl['cert'])) ) {
634
					$tmpcrl['cert'] = array();
635
				}
636
				$inuse = crl_in_use($tmpcrl['refid']);
637
?>
638
					<tr>
639
						<td><?=$caname?></td>
640
						<td><?=$tmpcrl['descr']; ?></td>
641
						<td><i class="fa fa-<?=($internal) ? "check" : "times"; ?>"></i></td>
642
						<td><?=($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
643
						<td><i class="fa fa-<?=($inuse) ? "check" : "times"; ?>"></i>
644
						<?php echo cert_usedby_description($tmpcrl['refid'], $certificates_used_by_packages); ?>
645
						</td>
646
						<td>
647
							<a href="system_crlmanager.php?act=exp&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-download" title="<?=gettext("Export CRL")?>" ></a>
648
<?php
649
				if ($internal): ?>
650
							<a href="system_crlmanager.php?act=edit&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
651
<?php
652
				else:
653
?>
654
							<a href="system_crlmanager.php?act=editimported&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
655
<?php			endif;
656
				if (!$inuse):
657
?>
658
							<a href="system_crlmanager.php?act=del&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-trash" title="<?=gettext("Delete CRL")?>" usepost></a>
659
<?php
660
				endif;
661
?>
662
						</td>
663
					</tr>
664
<?php
665
				$i++;
666
				endforeach;
667
			endif;
668
			$i++;
669
		endforeach;
670
?>
671
				</tbody>
672
			</table>
673
		</div>
674
	</div>
675

    
676
<?php
677
	$form = new Form(false);
678
	$section = new Form_Section('Create or Import a New Certificate Revocation List');
679
	$group = new Form_Group(null);
680
	$group->add(new Form_Select(
681
		'caref',
682
		'Certificate Authority',
683
		null,
684
		build_ca_list()
685
		))->setHelp('Select a Certificate Authority for the new CRL');
686
	$group->add(new Form_Button(
687
		'submit',
688
		'Add',
689
		null,
690
		'fa-plus'
691
		))->addClass('btn-success btn-sm');
692
	$section->add($group);
693
	$form->addGlobal(new Form_Input(
694
		'act',
695
		null,
696
		'hidden',
697
		'new'
698
	));
699
	$form->add($section);
700
	print($form);
701
}
702

    
703
?>
704

    
705
<script type="text/javascript">
706
//<![CDATA[
707
events.push(function() {
708

    
709
	// Hides all elements of the specified class. This will usually be a section or group
710
	function hideClass(s_class, hide) {
711
		if (hide) {
712
			$('.' + s_class).hide();
713
		} else {
714
			$('.' + s_class).show();
715
		}
716
	}
717

    
718
	// When the 'method" selector is changed, we show/hide certain sections
719
	$('#method').on('change', function() {
720
		hideClass('internal', ($('#method').val() == 'existing'));
721
		hideClass('existing', ($('#method').val() == 'internal'));
722
	});
723

    
724
	hideClass('internal', ($('#method').val() == 'existing'));
725
	hideClass('existing', ($('#method').val() == 'internal'));
726
	$('.multiselect').attr("size","<?= max(3, min(15, count($cacert_list))) ?>");
727
});
728
//]]>
729
</script>
730

    
731
<?php include("foot.inc");
(197-197/229)