Project

General

Profile

Download (19.7 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-2023 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 = crl_get_max_lifetime();
38
$default_lifetime = min(730, $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

    
118
		/* input validation */
119
		$reqdfields = explode(" ", "descr id");
120
		$reqdfieldsn = array(
121
			gettext("Descriptive name"),
122
			gettext("CRL ID"));
123

    
124
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
125

    
126
		if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
127
			array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
128
		}
129
		if ($pconfig['lifetime'] > $max_lifetime) {
130
			$input_errors[] = gettext("Lifetime is longer than the maximum allowed value. Use a shorter lifetime.");
131
		}
132
		if ((strlen($pconfig['serial']) > 0) && !cert_validate_serial($pconfig['serial'])) {
133
			$input_errors[] = gettext("Please enter a valid integer serial number.");
134
		}
135

    
136
		$revoke_list = array();
137
		if (!$pconfig['crlref']) {
138
			pfSenseHeader("system_crlmanager.php");
139
			exit;
140
		}
141
		$crl =& lookup_crl($pconfig['crlref']);
142

    
143
		if (!is_array($pconfig['certref'])) {
144
			$pconfig['certref'] = array();
145
		}
146
		if (!is_crl_internal($crl)) {
147
			$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
148
		}
149
		if (!empty($pconfig['revokeserial'])) {
150
			foreach (explode(' ', $pconfig['revokeserial']) as $serial) {
151
				$vserial = cert_validate_serial($serial, true, true);
152
				if ($vserial != null) {
153
					$revoke_list[] = $vserial;
154
				} else {
155
					$input_errors[] = gettext("Invalid serial in list (Must be ASN.1 integer compatible decimal or hex string).");
156
				}
157
			}
158
		}
159
		if (empty($pconfig['save']) && empty($pconfig['certref']) && empty($revoke_list)) {
160
			$input_errors[] = gettext("Select one or more certificates or enter a serial number to revoke.");
161
		}
162
		foreach ($pconfig['certref'] as $rcert) {
163
			$cert = lookup_cert($rcert);
164
			if ($crl['caref'] == $cert['caref']) {
165
				$revoke_list[] = $cert;
166
			} else {
167
				$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
168
			}
169
		}
170

    
171
		if (!$input_errors) {
172
			$crl['descr'] = $pconfig['descr'];
173
			$crl['lifetime'] = $pconfig['lifetime'];
174
			$crl['serial'] = $pconfig['serial'];
175
			if (!empty($revoke_list)) {
176
				$savemsg = "Revoked certificate(s) in CRL {$crl['descr']}.";
177
				$reason = (empty($pconfig['crlreason'])) ? 0 : $pconfig['crlreason'];
178
				foreach ($revoke_list as $cert) {
179
					cert_revoke($cert, $crl, $reason);
180
				}
181
				// refresh IPsec and OpenVPN CRLs
182
				openvpn_refresh_crls();
183
				ipsec_configure();
184
			} else {
185
				$savemsg = "Saved CRL {$crl['descr']}.";
186
			}
187
			write_config($savemsg);
188
			pfSenseHeader("system_crlmanager.php");
189
			exit;
190
		} else {
191
			$act = 'edit';
192
		}
193
		break;
194
	case 'delcert':
195
		if (!is_array($thiscrl['cert'])) {
196
			pfSenseHeader("system_crlmanager.php");
197
			exit;
198
		}
199
		$found = false;
200
		foreach ($thiscrl['cert'] as $acert) {
201
			if ($acert['refid'] == $_REQUEST['certref']) {
202
				$found = true;
203
				$thiscert = $acert;
204
			}
205
		}
206
		if (!$found) {
207
			pfSenseHeader("system_crlmanager.php");
208
			exit;
209
		}
210
		$certname = htmlspecialchars($thiscert['descr']);
211
		$crlname = htmlspecialchars($thiscrl['descr']);
212
		if (cert_unrevoke($thiscert, $thiscrl)) {
213
			$savemsg = sprintf(gettext('Deleted Certificate %1$s from CRL %2$s.'), $certname, $crlname);
214
			$class = "success";
215
			// refresh IPsec and OpenVPN CRLs
216
			openvpn_refresh_crls();
217
			ipsec_configure();
218
			write_config($savemsg);
219
		} else {
220
			$savemsg = sprintf(gettext('Failed to delete Certificate %1$s from CRL %2$s.'), $certname, $crlname);
221
			$class = "danger";
222
		}
223
		$act="edit";
224
		break;
225
	case 'exp':
226
		/* Exporting the CRL contents*/
227
		crl_update($thiscrl);
228
		send_user_download('data', base64_decode($thiscrl['text']), "{$thiscrl['descr']}.crl");
229
		break;
230
	default:
231
		break;
232
}
233

    
234
if ($_POST['save'] && empty($input_errors)) {
235
	$input_errors = array();
236
	$pconfig = $_POST;
237

    
238
	/* input validation */
239
	if (($pconfig['method'] == "existing") || ($act == "editimported")) {
240
		$reqdfields = explode(" ", "descr crltext");
241
		$reqdfieldsn = array(
242
			gettext("Descriptive name"),
243
			gettext("Certificate Revocation List data"));
244
	}
245
	if (($pconfig['method'] == "internal") ||
246
	    ($act == "addcert")) {
247
		$reqdfields = explode(" ", "descr caref");
248
		$reqdfieldsn = array(
249
			gettext("Descriptive name"),
250
			gettext("Certificate Authority"));
251
	}
252

    
253
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
254

    
255
	if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
256
		array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
257
	}
258
	if ($pconfig['lifetime'] > $max_lifetime) {
259
		$input_errors[] = gettext("Lifetime is longer than the maximum allowed value. Use a shorter lifetime.");
260
	}
261

    
262
	if ((strlen($pconfig['serial']) > 0) && !cert_validate_serial($pconfig['serial'])) {
263
		$input_errors[] = gettext("Please enter a valid integer serial number.");
264
	}
265

    
266
	/* save modifications */
267
	if (!$input_errors) {
268
		$result = false;
269

    
270
		if ($thiscrl) {
271
			$crl =& $thiscrl;
272
		} else {
273
			$crl = array();
274
			$crl['refid'] = uniqid();
275
		}
276

    
277
		$crl['descr'] = $pconfig['descr'];
278
		if ($act != "editimported") {
279
			$crl['caref'] = $pconfig['caref'];
280
			$crl['method'] = $pconfig['method'];
281
		}
282

    
283
		if (($pconfig['method'] == "existing") || ($act == "editimported")) {
284
			$crl['text'] = base64_encode($pconfig['crltext']);
285
		}
286

    
287
		if ($pconfig['method'] == "internal") {
288
			$crl['serial'] = empty($pconfig['serial']) ? '0' : $pconfig['serial'];
289
			$crl['lifetime'] = empty($pconfig['lifetime']) ? $default_lifetime : $pconfig['lifetime'];
290
			$crl['cert'] = array();
291
		}
292

    
293
		if (!$thiscrl) {
294
			$a_crl[] = $crl;
295
		}
296

    
297
		write_config("Saved CRL {$crl['descr']}");
298
		// refresh IPsec and OpenVPN CRLs
299
		openvpn_refresh_crls();
300
		ipsec_configure();
301
		pfSenseHeader("system_crlmanager.php");
302
	}
303
}
304

    
305
$pgtitle = array(gettext('System'), gettext('Certificates'), gettext('Revocation'));
306
$pglinks = array("", "system_camanager.php", "system_crlmanager.php");
307

    
308
if ($act == "new" || $act == gettext("Save") || $input_errors || $act == "edit") {
309
	$pgtitle[] = gettext('Edit');
310
	$pglinks[] = "@self";
311
}
312
include("head.inc");
313
?>
314

    
315
<script type="text/javascript">
316
//<![CDATA[
317

    
318
function method_change() {
319

    
320
	method = document.iform.method.value;
321

    
322
	switch (method) {
323
		case "internal":
324
			document.getElementById("existing").style.display="none";
325
			document.getElementById("internal").style.display="";
326
			break;
327
		case "existing":
328
			document.getElementById("existing").style.display="";
329
			document.getElementById("internal").style.display="none";
330
			break;
331
	}
332
}
333

    
334
//]]>
335
</script>
336

    
337
<?php
338

    
339
function build_method_list($importonly = false) {
340
	global $_POST, $crl_methods;
341

    
342
	$list = array();
343

    
344
	foreach ($crl_methods as $method => $desc) {
345
		if ($importonly && ($method != "existing")) {
346
			continue;
347
		}
348

    
349
		$list[$method] = $desc;
350
	}
351

    
352
	return($list);
353
}
354

    
355
function build_ca_list() {
356
	global $a_ca;
357

    
358
	$list = array();
359

    
360
	foreach ($a_ca as $ca) {
361
		$list[$ca['refid']] = $ca['descr'];
362
	}
363

    
364
	return($list);
365
}
366

    
367
function build_cacert_list() {
368
	global $a_cert, $crl, $id;
369

    
370
	$list = array();
371
	foreach ($a_cert as $cert) {
372
		if ((isset($cert['caref']) && !empty($cert['caref'])) &&
373
		    ($cert['caref'] == $crl['caref']) &&
374
		    !is_cert_revoked($cert, $id)) {
375
			$list[$cert['refid']] = $cert['descr'];
376
		}
377
	}
378

    
379
	return($list);
380
}
381

    
382
if ($input_errors) {
383
	print_input_errors($input_errors);
384
}
385

    
386
if ($savemsg) {
387
	print_info_box($savemsg, $class);
388
}
389

    
390
$tab_array = array();
391
$tab_array[] = array(gettext('Authorities'), false, 'system_camanager.php');
392
$tab_array[] = array(gettext('Certificates'), false, 'system_certmanager.php');
393
$tab_array[] = array(gettext('Revocation'), true, 'system_crlmanager.php');
394
display_top_tabs($tab_array);
395

    
396
if ($act == "new" || $act == gettext("Save")) {
397
	$form = new Form();
398

    
399
	$section = new Form_Section('Create new Revocation List');
400

    
401
	$section->addInput(new Form_StaticText(
402
		'Certificate Authority',
403
		$crlca['descr']
404
	));
405

    
406
	if (!isset($id)) {
407
		$section->addInput(new Form_Select(
408
			'method',
409
			'*Method',
410
			$pconfig['method'],
411
			build_method_list((!isset($crlca['prv']) || empty($crlca['prv'])))
412
		));
413
	}
414

    
415
	$section->addInput(new Form_Input(
416
		'descr',
417
		'*Descriptive name',
418
		'text',
419
		$pconfig['descr']
420
	));
421

    
422
	$form->addGlobal(new Form_Input(
423
		'caref',
424
		null,
425
		'hidden',
426
		$pconfig['caref']
427
	));
428

    
429
	$form->add($section);
430

    
431
	$section = new Form_Section('Existing Certificate Revocation List');
432
	$section->addClass('existing');
433

    
434
	$section->addInput(new Form_Textarea(
435
		'crltext',
436
		'*CRL data',
437
		$pconfig['crltext']
438
		))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
439

    
440
	$form->add($section);
441

    
442
	$section = new Form_Section('Internal Certificate Revocation List');
443
	$section->addClass('internal');
444

    
445
	$section->addInput(new Form_Input(
446
		'lifetime',
447
		'Lifetime (Days)',
448
		'number',
449
		$pconfig['lifetime'],
450
		['max' => $max_lifetime]
451
	));
452

    
453
	$section->addInput(new Form_Input(
454
		'serial',
455
		'Serial',
456
		'number',
457
		$pconfig['serial'],
458
		['min' => '0']
459
	));
460

    
461
	$form->add($section);
462

    
463
	if (isset($id) && $thiscrl) {
464
		$form->addGlobal(new Form_Input(
465
			'id',
466
			null,
467
			'hidden',
468
			$id
469
		));
470
	}
471

    
472
	print($form);
473

    
474
} elseif ($act == "editimported") {
475

    
476
	$form = new Form();
477

    
478
	$section = new Form_Section('Edit Imported Certificate Revocation List');
479

    
480
	$section->addInput(new Form_Input(
481
		'descr',
482
		'*Descriptive name',
483
		'text',
484
		$thiscrl['descr']
485
	));
486

    
487
	$section->addInput(new Form_Textarea(
488
		'crltext',
489
		'*CRL data',
490
		!empty($thiscrl['text']) ? base64_decode($thiscrl['text']) : ''
491
	))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
492

    
493
	$form->addGlobal(new Form_Input(
494
		'id',
495
		null,
496
		'hidden',
497
		$id
498
	));
499

    
500
	$form->addGlobal(new Form_Input(
501
		'act',
502
		null,
503
		'hidden',
504
		'editimported'
505
	));
506

    
507
	$form->add($section);
508

    
509
	print($form);
510

    
511
} elseif ($act == "edit") {
512
	$crl = $thiscrl;
513

    
514
	$form = new Form();
515

    
516
	$section = new Form_Section('Edit Internal Certificate Revocation List');
517

    
518
	$section->addInput(new Form_Input(
519
		'descr',
520
		'*Descriptive name',
521
		'text',
522
		$crl['descr']
523
	));
524

    
525
	$section->addInput(new Form_Input(
526
		'lifetime',
527
		'CRL Lifetime (Days)',
528
		'number',
529
		$crl['lifetime'],
530
		['max' => $max_lifetime]
531
	));
532

    
533
	$section->addInput(new Form_Input(
534
		'serial',
535
		'CRL Serial',
536
		'number',
537
		$crl['serial'],
538
		['min' => '0']
539
	));
540

    
541
	$form->add($section);
542
?>
543

    
544
	<div class="panel panel-default">
545
		<div class="panel-heading"><h2 class="panel-title"><?=gettext("Revoked Certificates in CRL") . ': ' . $crl['descr']?></h2></div>
546
		<div class="panel-body table-responsive">
547
<?php
548
	if (!is_array($crl['cert']) || (count($crl['cert']) == 0)) {
549
		print_info_box(gettext("No certificates found for this CRL."), 'danger');
550
	} else {
551
?>
552
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
553
				<thead>
554
					<tr>
555
						<th><?=gettext("Serial")?></th>
556
						<th><?=gettext("Certificate Name")?></th>
557
						<th><?=gettext("Revocation Reason")?></th>
558
						<th><?=gettext("Revoked At")?></th>
559
						<th></th>
560
					</tr>
561
				</thead>
562
				<tbody>
563
<?php
564
		foreach ($crl['cert'] as $cert):
565
			$name = empty($cert['descr']) ? gettext('Revoked by Serial') : htmlspecialchars($cert['descr']);
566
			$serial = crl_get_entry_serial($cert);
567
			if (strlen($serial) == 0) {
568
				$serial = gettext("Invalid");
569
			} ?>
570
					<tr>
571
						<td><?=htmlspecialchars($serial);?></td>
572
						<td><?=$name; ?></td>
573
						<td><?=$openssl_crl_status[$cert['reason']]; ?></td>
574
						<td><?=date("D M j G:i:s T Y", $cert['revoke_time']); ?></td>
575
						<td class="list">
576
							<a href="system_crlmanager.php?act=delcert&amp;id=<?=$crl['refid']; ?>&amp;certref=<?=$cert['refid']; ?>" usepost>
577
								<i class="fa fa-trash" title="<?=gettext("Delete this certificate from the CRL")?>" alt="<?=gettext("Delete this certificate from the CRL")?>"></i>
578
							</a>
579
						</td>
580
					</tr>
581
<?php
582
		endforeach;
583
?>
584
				</tbody>
585
			</table>
586
<?php
587
	}
588
?>
589
		</div>
590
	</div>
591
<?php
592

    
593
	$section = new Form_Section('Revoke Certificates');
594

    
595
	$section->addInput(new Form_Select(
596
		'crlreason',
597
		'Reason',
598
		-1,
599
		$openssl_crl_status
600
		))->setHelp('Select the reason for which the certificates are being revoked.');
601

    
602
	$cacert_list = build_cacert_list();
603
	if (count($cacert_list) == 0) {
604
		print_info_box(gettext("No certificates found for this CA."), 'danger');
605
	} else {
606
		$section->addInput(new Form_Select(
607
			'certref',
608
			'Revoke Certificates',
609
			$pconfig['certref'],
610
			$cacert_list,
611
			true
612
			))->addClass('multiselect')
613
			->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.');
614
	}
615

    
616
	$section->addInput(new Form_Input(
617
		'revokeserial',
618
		'Revoke by Serial',
619
		'text',
620
		$pconfig['revokeserial']
621
	))->setHelp('List of certificate serial numbers to revoke (separated by spaces)');
622

    
623
	$form->addGlobal(new Form_Button(
624
		'submit',
625
		'Add',
626
		null,
627
		'fa-plus'
628
		))->addClass('btn-success btn-sm');
629

    
630
	$form->addGlobal(new Form_Input(
631
		'id',
632
		null,
633
		'hidden',
634
		$crl['refid']
635
	));
636

    
637
	$form->addGlobal(new Form_Input(
638
		'act',
639
		null,
640
		'hidden',
641
		'addcert'
642
	));
643

    
644
	$form->addGlobal(new Form_Input(
645
		'crlref',
646
		null,
647
		'hidden',
648
		$crl['refid']
649
	));
650

    
651
	$form->add($section);
652

    
653
	print($form);
654
} else {
655
?>
656

    
657
	<div class="panel panel-default">
658
		<div class="panel-heading"><h2 class="panel-title"><?=gettext("Certificate Revocation Lists")?></h2></div>
659
		<div class="panel-body table-responsive">
660
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
661
				<thead>
662
					<tr>
663
						<th><?=gettext("CA")?></th>
664
						<th><?=gettext("Name")?></th>
665
						<th><?=gettext("Internal")?></th>
666
						<th><?=gettext("Certificates")?></th>
667
						<th><?=gettext("In Use")?></th>
668
						<th><?=gettext("Actions")?></th>
669
					</tr>
670
				</thead>
671
				<tbody>
672
<?php
673
	$pluginparams = array();
674
	$pluginparams['type'] = 'certificates';
675
	$pluginparams['event'] = 'used_crl';
676
	$certificates_used_by_packages = pkg_call_plugins('plugin_certificates', $pluginparams);
677
	// Map CRLs to CAs in one pass
678
	$ca_crl_map = array();
679
	foreach ($a_crl as $crl) {
680
		$ca_crl_map[$crl['caref']][] = $crl['refid'];
681
	}
682

    
683
	$i = 0;
684
	foreach ($a_ca as $ca):
685
		$caname = htmlspecialchars($ca['descr']);
686
		if (is_array($ca_crl_map[$ca['refid']])):
687
			foreach ($ca_crl_map[$ca['refid']] as $crl):
688
				$tmpcrl = lookup_crl($crl);
689
				$internal = is_crl_internal($tmpcrl);
690
				if ($internal && (!isset($tmpcrl['cert']) || empty($tmpcrl['cert'])) ) {
691
					$tmpcrl['cert'] = array();
692
				}
693
				$inuse = crl_in_use($tmpcrl['refid']);
694
?>
695
					<tr>
696
						<td><?=$caname?></td>
697
						<td><?=$tmpcrl['descr']; ?></td>
698
						<td><i class="fa fa-<?=($internal) ? "check" : "times"; ?>"></i></td>
699
						<td><?=($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
700
						<td>
701
						<?php if (is_openvpn_server_crl($tmpcrl['refid'])): ?>
702
							<?=gettext("OpenVPN Server")?>
703
						<?php endif?>
704
						<?php echo cert_usedby_description($tmpcrl['refid'], $certificates_used_by_packages); ?>
705
						</td>
706
						<td>
707
							<a href="system_crlmanager.php?act=exp&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-download" title="<?=gettext("Export CRL")?>" ></a>
708
<?php
709
				if ($internal): ?>
710
							<a href="system_crlmanager.php?act=edit&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
711
<?php
712
				else:
713
?>
714
							<a href="system_crlmanager.php?act=editimported&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
715
<?php			endif;
716
				if (!$inuse):
717
?>
718
							<a href="system_crlmanager.php?act=del&amp;id=<?=$tmpcrl['refid']?>" class="fa fa-trash" title="<?=gettext("Delete CRL")?>" usepost></a>
719
<?php
720
				endif;
721
?>
722
						</td>
723
					</tr>
724
<?php
725
				$i++;
726
				endforeach;
727
			endif;
728
			$i++;
729
		endforeach;
730
?>
731
				</tbody>
732
			</table>
733
		</div>
734
	</div>
735

    
736
<?php
737
	$form = new Form(false);
738
	$section = new Form_Section('Create or Import a New Certificate Revocation List');
739
	$group = new Form_Group(null);
740
	$group->add(new Form_Select(
741
		'caref',
742
		'Certificate Authority',
743
		null,
744
		build_ca_list()
745
		))->setHelp('Select a Certificate Authority for the new CRL');
746
	$group->add(new Form_Button(
747
		'submit',
748
		'Add',
749
		null,
750
		'fa-plus'
751
		))->addClass('btn-success btn-sm');
752
	$section->add($group);
753
	$form->addGlobal(new Form_Input(
754
		'act',
755
		null,
756
		'hidden',
757
		'new'
758
	));
759
	$form->add($section);
760
	print($form);
761
}
762

    
763
?>
764

    
765
<script type="text/javascript">
766
//<![CDATA[
767
events.push(function() {
768

    
769
	// Hides all elements of the specified class. This will usually be a section or group
770
	function hideClass(s_class, hide) {
771
		if (hide) {
772
			$('.' + s_class).hide();
773
		} else {
774
			$('.' + s_class).show();
775
		}
776
	}
777

    
778
	// When the 'method" selector is changed, we show/hide certain sections
779
	$('#method').on('change', function() {
780
		hideClass('internal', ($('#method').val() == 'existing'));
781
		hideClass('existing', ($('#method').val() == 'internal'));
782
	});
783

    
784
	hideClass('internal', ($('#method').val() == 'existing'));
785
	hideClass('existing', ($('#method').val() == 'internal'));
786
	$('.multiselect').attr("size","<?= max(3, min(15, count($cacert_list))) ?>");
787
});
788
//]]>
789
</script>
790

    
791
<?php include("foot.inc");
(195-195/228)