1
|
<?php
|
2
|
/*
|
3
|
system_crlmanager.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
*
|
8
|
* Redistribution and use in source and binary forms, with or without modification,
|
9
|
* 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
|
16
|
* the documentation and/or other materials provided with the
|
17
|
* distribution.
|
18
|
*
|
19
|
* 3. All advertising materials mentioning features or use of this software
|
20
|
* must display the following acknowledgment:
|
21
|
* "This product includes software developed by the pfSense Project
|
22
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
23
|
*
|
24
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
25
|
* endorse or promote products derived from this software without
|
26
|
* prior written permission. For written permission, please contact
|
27
|
* coreteam@pfsense.org.
|
28
|
*
|
29
|
* 5. Products derived from this software may not be called "pfSense"
|
30
|
* nor may "pfSense" appear in their names without prior written
|
31
|
* permission of the Electric Sheep Fencing, LLC.
|
32
|
*
|
33
|
* 6. Redistributions of any form whatsoever must retain the following
|
34
|
* acknowledgment:
|
35
|
*
|
36
|
* "This product includes software developed by the pfSense Project
|
37
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
38
|
*
|
39
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
40
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
41
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
43
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
44
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
45
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
46
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
48
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
49
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
50
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
51
|
*
|
52
|
* ====================================================================
|
53
|
*
|
54
|
*/
|
55
|
|
56
|
##|+PRIV
|
57
|
##|*IDENT=page-system-crlmanager
|
58
|
##|*NAME=System: CRL Manager
|
59
|
##|*DESCR=Allow access to the 'System: CRL Manager' page.
|
60
|
##|*MATCH=system_crlmanager.php*
|
61
|
##|-PRIV
|
62
|
|
63
|
require("guiconfig.inc");
|
64
|
require_once("certs.inc");
|
65
|
require_once("openvpn.inc");
|
66
|
require_once("vpn.inc");
|
67
|
|
68
|
global $openssl_crl_status;
|
69
|
|
70
|
$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("Certificate Revocation Lists"));
|
71
|
|
72
|
$crl_methods = array(
|
73
|
"internal" => gettext("Create an internal Certificate Revocation List"),
|
74
|
"existing" => gettext("Import an existing Certificate Revocation List"));
|
75
|
|
76
|
if (ctype_alnum($_GET['id'])) {
|
77
|
$id = $_GET['id'];
|
78
|
}
|
79
|
if (isset($_POST['id']) && ctype_alnum($_POST['id'])) {
|
80
|
$id = $_POST['id'];
|
81
|
}
|
82
|
|
83
|
if (!is_array($config['ca'])) {
|
84
|
$config['ca'] = array();
|
85
|
}
|
86
|
|
87
|
$a_ca =& $config['ca'];
|
88
|
|
89
|
if (!is_array($config['cert'])) {
|
90
|
$config['cert'] = array();
|
91
|
}
|
92
|
|
93
|
$a_cert =& $config['cert'];
|
94
|
|
95
|
if (!is_array($config['crl'])) {
|
96
|
$config['crl'] = array();
|
97
|
}
|
98
|
|
99
|
$a_crl =& $config['crl'];
|
100
|
|
101
|
foreach ($a_crl as $cid => $acrl) {
|
102
|
if (!isset($acrl['refid'])) {
|
103
|
unset ($a_crl[$cid]);
|
104
|
}
|
105
|
}
|
106
|
|
107
|
$act = $_GET['act'];
|
108
|
if ($_POST['act']) {
|
109
|
$act = $_POST['act'];
|
110
|
}
|
111
|
|
112
|
if (!empty($id)) {
|
113
|
$thiscrl =& lookup_crl($id);
|
114
|
}
|
115
|
|
116
|
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
|
117
|
if (!$thiscrl && (($act != "") && ($act != "new"))) {
|
118
|
pfSenseHeader("system_crlmanager.php");
|
119
|
$act="";
|
120
|
$savemsg = gettext("Invalid CRL reference.");
|
121
|
}
|
122
|
|
123
|
if ($act == "del") {
|
124
|
$name = htmlspecialchars($thiscrl['descr']);
|
125
|
if (crl_in_use($id)) {
|
126
|
$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name) . "<br />";
|
127
|
} else {
|
128
|
foreach ($a_crl as $cid => $acrl) {
|
129
|
if ($acrl['refid'] == $thiscrl['refid']) {
|
130
|
unset($a_crl[$cid]);
|
131
|
}
|
132
|
}
|
133
|
write_config("Deleted CRL {$name}.");
|
134
|
$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name) . "<br />";
|
135
|
}
|
136
|
}
|
137
|
|
138
|
if ($act == "new") {
|
139
|
$pconfig['method'] = $_GET['method'];
|
140
|
$pconfig['caref'] = $_GET['caref'];
|
141
|
$pconfig['lifetime'] = "9999";
|
142
|
$pconfig['serial'] = "0";
|
143
|
}
|
144
|
|
145
|
if ($act == "exp") {
|
146
|
crl_update($thiscrl);
|
147
|
$exp_name = urlencode("{$thiscrl['descr']}.crl");
|
148
|
$exp_data = base64_decode($thiscrl['text']);
|
149
|
$exp_size = strlen($exp_data);
|
150
|
|
151
|
header("Content-Type: application/octet-stream");
|
152
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
153
|
header("Content-Length: $exp_size");
|
154
|
echo $exp_data;
|
155
|
exit;
|
156
|
}
|
157
|
|
158
|
if ($act == "addcert") {
|
159
|
if ($_POST) {
|
160
|
unset($input_errors);
|
161
|
$pconfig = $_POST;
|
162
|
|
163
|
if (!$pconfig['crlref'] || !$pconfig['certref']) {
|
164
|
pfSenseHeader("system_crlmanager.php");
|
165
|
exit;
|
166
|
}
|
167
|
|
168
|
// certref, crlref
|
169
|
$crl =& lookup_crl($pconfig['crlref']);
|
170
|
$cert = lookup_cert($pconfig['certref']);
|
171
|
|
172
|
if (!$crl['caref'] || !$cert['caref']) {
|
173
|
$input_errors[] = gettext("Both the Certificate and CRL must be specified.");
|
174
|
}
|
175
|
|
176
|
if ($crl['caref'] != $cert['caref']) {
|
177
|
$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
|
178
|
}
|
179
|
if (!is_crl_internal($crl)) {
|
180
|
$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
|
181
|
}
|
182
|
|
183
|
if (!$input_errors) {
|
184
|
$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
|
185
|
cert_revoke($cert, $crl, $reason);
|
186
|
// refresh IPsec and OpenVPN CRLs
|
187
|
openvpn_refresh_crls();
|
188
|
vpn_ipsec_configure();
|
189
|
write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
|
190
|
pfSenseHeader("system_crlmanager.php");
|
191
|
exit;
|
192
|
}
|
193
|
}
|
194
|
}
|
195
|
|
196
|
if ($act == "delcert") {
|
197
|
if (!is_array($thiscrl['cert'])) {
|
198
|
pfSenseHeader("system_crlmanager.php");
|
199
|
exit;
|
200
|
}
|
201
|
$found = false;
|
202
|
foreach ($thiscrl['cert'] as $acert) {
|
203
|
if ($acert['refid'] == $_GET['certref']) {
|
204
|
$found = true;
|
205
|
$thiscert = $acert;
|
206
|
}
|
207
|
}
|
208
|
if (!$found) {
|
209
|
pfSenseHeader("system_crlmanager.php");
|
210
|
exit;
|
211
|
}
|
212
|
$certname = htmlspecialchars($thiscert['descr']);
|
213
|
$crlname = htmlspecialchars($thiscrl['descr']);
|
214
|
if (cert_unrevoke($thiscert, $thiscrl)) {
|
215
|
$savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname) . "<br />";
|
216
|
// refresh IPsec and OpenVPN CRLs
|
217
|
openvpn_refresh_crls();
|
218
|
vpn_ipsec_configure();
|
219
|
write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname));
|
220
|
} else {
|
221
|
$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $certname, $crlname) . "<br />";
|
222
|
}
|
223
|
$act="edit";
|
224
|
}
|
225
|
|
226
|
if ($_POST) {
|
227
|
$input_errors = array();
|
228
|
$pconfig = $_POST;
|
229
|
|
230
|
/* input validation */
|
231
|
if (($pconfig['method'] == "existing") || ($act == "editimported")) {
|
232
|
$reqdfields = explode(" ", "descr crltext");
|
233
|
$reqdfieldsn = array(
|
234
|
gettext("Descriptive name"),
|
235
|
gettext("Certificate Revocation List data"));
|
236
|
}
|
237
|
if ($pconfig['method'] == "internal") {
|
238
|
$reqdfields = explode(" ", "descr caref");
|
239
|
$reqdfieldsn = array(
|
240
|
gettext("Descriptive name"),
|
241
|
gettext("Certificate Authority"));
|
242
|
}
|
243
|
|
244
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
245
|
|
246
|
if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
|
247
|
array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
|
248
|
}
|
249
|
|
250
|
/* if this is an AJAX caller then handle via JSON */
|
251
|
if (isAjax() && is_array($input_errors)) {
|
252
|
input_errors2Ajax($input_errors);
|
253
|
exit;
|
254
|
}
|
255
|
|
256
|
/* save modifications */
|
257
|
if (!$input_errors) {
|
258
|
$result = false;
|
259
|
|
260
|
if ($thiscrl) {
|
261
|
$crl =& $thiscrl;
|
262
|
} else {
|
263
|
$crl = array();
|
264
|
$crl['refid'] = uniqid();
|
265
|
}
|
266
|
|
267
|
$crl['descr'] = $pconfig['descr'];
|
268
|
if ($act != "editimported") {
|
269
|
$crl['caref'] = $pconfig['caref'];
|
270
|
$crl['method'] = $pconfig['method'];
|
271
|
}
|
272
|
|
273
|
if (($pconfig['method'] == "existing") || ($act == "editimported")) {
|
274
|
$crl['text'] = base64_encode($pconfig['crltext']);
|
275
|
}
|
276
|
|
277
|
if ($pconfig['method'] == "internal") {
|
278
|
$crl['serial'] = empty($pconfig['serial']) ? 9999 : $pconfig['serial'];
|
279
|
$crl['lifetime'] = empty($pconfig['lifetime']) ? 9999 : $pconfig['lifetime'];
|
280
|
$crl['cert'] = array();
|
281
|
}
|
282
|
|
283
|
if (!$thiscrl) {
|
284
|
$a_crl[] = $crl;
|
285
|
}
|
286
|
|
287
|
write_config("Saved CRL {$crl['descr']}");
|
288
|
// refresh IPsec and OpenVPN CRLs
|
289
|
openvpn_refresh_crls();
|
290
|
vpn_ipsec_configure();
|
291
|
pfSenseHeader("system_crlmanager.php");
|
292
|
}
|
293
|
}
|
294
|
|
295
|
include("head.inc");
|
296
|
?>
|
297
|
|
298
|
<script type="text/javascript">
|
299
|
//<![CDATA[
|
300
|
|
301
|
function method_change() {
|
302
|
|
303
|
method = document.iform.method.value;
|
304
|
|
305
|
switch (method) {
|
306
|
case "internal":
|
307
|
document.getElementById("existing").style.display="none";
|
308
|
document.getElementById("internal").style.display="";
|
309
|
break;
|
310
|
case "existing":
|
311
|
document.getElementById("existing").style.display="";
|
312
|
document.getElementById("internal").style.display="none";
|
313
|
break;
|
314
|
}
|
315
|
}
|
316
|
|
317
|
//]]>
|
318
|
</script>
|
319
|
|
320
|
<?php
|
321
|
|
322
|
function build_method_list() {
|
323
|
global $_GET, $crl_methods;
|
324
|
|
325
|
$list = array();
|
326
|
|
327
|
foreach ($crl_methods as $method => $desc) {
|
328
|
if (($_GET['importonly'] == "yes") && ($method != "existing")) {
|
329
|
continue;
|
330
|
}
|
331
|
|
332
|
$list[$method] = $desc;
|
333
|
}
|
334
|
|
335
|
return($list);
|
336
|
}
|
337
|
|
338
|
function build_ca_list() {
|
339
|
global $a_ca;
|
340
|
|
341
|
$list = array();
|
342
|
|
343
|
foreach ($a_ca as $ca) {
|
344
|
$list[$ca['refid']] = $ca['descr'];
|
345
|
}
|
346
|
|
347
|
return($list);
|
348
|
}
|
349
|
|
350
|
function build_cacert_list() {
|
351
|
global $ca_certs;
|
352
|
|
353
|
$list = array();
|
354
|
|
355
|
foreach($ca_certs as $cert) {
|
356
|
$list[$cert['refid']] = $cert['descr'];
|
357
|
}
|
358
|
|
359
|
return($list);
|
360
|
}
|
361
|
|
362
|
if ($input_errors) {
|
363
|
print_input_errors($input_errors);
|
364
|
}
|
365
|
|
366
|
if ($savemsg) {
|
367
|
print_info_box($savemsg, 'success');
|
368
|
}
|
369
|
|
370
|
$tab_array = array();
|
371
|
$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
|
372
|
$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
|
373
|
$tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php");
|
374
|
display_top_tabs($tab_array);
|
375
|
|
376
|
if ($act == "new" || $act == gettext("Save") || $input_errors) {
|
377
|
if (!isset($id)) {
|
378
|
$form = new Form();
|
379
|
|
380
|
$section = new Form_Section('Create new revocation list');
|
381
|
|
382
|
$section->addInput(new Form_Select(
|
383
|
'method',
|
384
|
'Method',
|
385
|
$pconfig['method'],
|
386
|
build_method_list()
|
387
|
));
|
388
|
|
389
|
}
|
390
|
|
391
|
$section->addInput(new Form_Input(
|
392
|
'descr',
|
393
|
'Descriptive name',
|
394
|
'text',
|
395
|
$pconfig['descr']
|
396
|
));
|
397
|
|
398
|
$section->addInput(new Form_Select(
|
399
|
'caref',
|
400
|
'Certificate Authority',
|
401
|
$pconfig['caref'],
|
402
|
build_ca_list()
|
403
|
));
|
404
|
|
405
|
$form->add($section);
|
406
|
|
407
|
$section = new Form_Section('Existing Certificate Revocation List');
|
408
|
$section->addClass('existing');
|
409
|
|
410
|
$section->addInput(new Form_Textarea(
|
411
|
'crltext',
|
412
|
'CRL data',
|
413
|
$pconfig['crltext']
|
414
|
))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
|
415
|
|
416
|
$form->add($section);
|
417
|
|
418
|
$section = new Form_Section('Internal Certificate Revocation List');
|
419
|
$section->addClass('internal');
|
420
|
|
421
|
$section->addInput(new Form_Input(
|
422
|
'lifetime',
|
423
|
'Lifetime (Days)',
|
424
|
'number',
|
425
|
$pconfig['lifetime'],
|
426
|
[max => '9999']
|
427
|
));
|
428
|
|
429
|
$section->addInput(new Form_Input(
|
430
|
'serial',
|
431
|
'Serial',
|
432
|
'number',
|
433
|
$pconfig['serial'],
|
434
|
[min => '0', max => '9999']
|
435
|
));
|
436
|
|
437
|
$form->add($section);
|
438
|
|
439
|
if (isset($id) && $thiscrl) {
|
440
|
$section->addInput(new Form_Input(
|
441
|
'id',
|
442
|
null,
|
443
|
'hidden',
|
444
|
$id
|
445
|
));
|
446
|
}
|
447
|
|
448
|
print($form);
|
449
|
|
450
|
} elseif ($act == "editimported") {
|
451
|
|
452
|
$form = new Form();
|
453
|
|
454
|
$section = new Form_Section('Edit Imported Certificate Revocation List');
|
455
|
|
456
|
$section->addInput(new Form_Input(
|
457
|
'descr',
|
458
|
'Descriptive name',
|
459
|
'text',
|
460
|
$pconfig['descr']
|
461
|
));
|
462
|
|
463
|
$section->addInput(new Form_Textarea(
|
464
|
'crltext',
|
465
|
'CRL data',
|
466
|
$pconfig['crltext']
|
467
|
))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
|
468
|
|
469
|
$section->addInput(new Form_Input(
|
470
|
'id',
|
471
|
null,
|
472
|
'hidden',
|
473
|
$id
|
474
|
));
|
475
|
|
476
|
$section->addInput(new Form_Input(
|
477
|
'act',
|
478
|
null,
|
479
|
'hidden',
|
480
|
'editimported'
|
481
|
));
|
482
|
|
483
|
$form->add($section);
|
484
|
|
485
|
print($form);
|
486
|
|
487
|
} elseif ($act == "edit") {
|
488
|
$crl = $thiscrl;
|
489
|
|
490
|
$form = new Form(false);
|
491
|
?>
|
492
|
|
493
|
<div class="panel panel-default">
|
494
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Currently Revoked Certificates for CRL") . ': ' . $crl['descr']?></h2></div>
|
495
|
<div class="panel-body table-responsive">
|
496
|
<?php
|
497
|
if (!is_array($crl['cert']) || (count($crl['cert']) == 0)) {
|
498
|
print_info_box(gettext("No Certificates Found for this CRL."), 'danger');
|
499
|
} else {
|
500
|
?>
|
501
|
<table class="table table-striped table-hover table-condensed">
|
502
|
<thead>
|
503
|
<tr>
|
504
|
<th><?=gettext("Certificate Name")?></th>
|
505
|
<th><?=gettext("Revocation Reason")?></th>
|
506
|
<th><?=gettext("Revoked At")?></th>
|
507
|
<th></th>
|
508
|
</tr>
|
509
|
</thead>
|
510
|
<tbody>
|
511
|
<?php
|
512
|
foreach ($crl['cert'] as $i => $cert):
|
513
|
$name = htmlspecialchars($cert['descr']);
|
514
|
?>
|
515
|
<tr>
|
516
|
<td class="listlr">
|
517
|
<?=$name; ?>
|
518
|
</td>
|
519
|
<td class="listlr">
|
520
|
<?=$openssl_crl_status[$cert["reason"]]; ?>
|
521
|
</td>
|
522
|
<td class="listlr">
|
523
|
<?=date("D M j G:i:s T Y", $cert["revoke_time"]); ?>
|
524
|
</td>
|
525
|
<td class="list">
|
526
|
<a href="system_crlmanager.php?act=delcert&id=<?=$crl['refid']; ?>&certref=<?=$cert['refid']; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate from the CRL?")?>')">
|
527
|
<i class="fa fa-times-circle" title="<?=gettext("Delete this certificate from the CRL ")?>" alt="<?=gettext("Delete this certificate from the CRL ")?>"></i>
|
528
|
</a>
|
529
|
</td>
|
530
|
</tr>
|
531
|
<?php
|
532
|
endforeach;
|
533
|
?>
|
534
|
</tbody>
|
535
|
</table>
|
536
|
<?php
|
537
|
}
|
538
|
?>
|
539
|
</div>
|
540
|
</div>
|
541
|
<?php
|
542
|
|
543
|
$ca_certs = array();
|
544
|
foreach ($a_cert as $cert) {
|
545
|
if ($cert['caref'] == $crl['caref']) {
|
546
|
$ca_certs[] = $cert;
|
547
|
}
|
548
|
}
|
549
|
|
550
|
if (count($ca_certs) == 0) {
|
551
|
print_info_box(gettext("No Certificates Found for this CA."), 'danger');
|
552
|
} else {
|
553
|
$section = new Form_Section('Choose a certificate to revoke');
|
554
|
$group = new Form_Group(null);
|
555
|
|
556
|
$group->add(new Form_Select(
|
557
|
'certref',
|
558
|
null,
|
559
|
$pconfig['certref'],
|
560
|
build_cacert_list()
|
561
|
))->setWidth(4)->setHelp('Certificate');
|
562
|
|
563
|
$group->add(new Form_Select(
|
564
|
'crlreason',
|
565
|
null,
|
566
|
-1,
|
567
|
$openssl_crl_status
|
568
|
))->setHelp('Reason');
|
569
|
|
570
|
$group->add(new Form_Button(
|
571
|
'submit',
|
572
|
'Add'
|
573
|
))->removeClass('btn-primary')->addClass('btn-success btn-sm');
|
574
|
|
575
|
$section->add($group);
|
576
|
|
577
|
$section->addInput(new Form_Input(
|
578
|
'id',
|
579
|
null,
|
580
|
'hidden',
|
581
|
$crl['refid']
|
582
|
));
|
583
|
|
584
|
$section->addInput(new Form_Input(
|
585
|
'act',
|
586
|
null,
|
587
|
'hidden',
|
588
|
'addcert'
|
589
|
));
|
590
|
|
591
|
$section->addInput(new Form_Input(
|
592
|
'crlref',
|
593
|
null,
|
594
|
'hidden',
|
595
|
$crl['refid']
|
596
|
));
|
597
|
|
598
|
$form->add($section);
|
599
|
}
|
600
|
|
601
|
print($form);
|
602
|
} else {
|
603
|
?>
|
604
|
|
605
|
<div class="panel panel-default">
|
606
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Additional Certificate Revocation Lists")?></h2></div>
|
607
|
<div class="panel-body table-responsive">
|
608
|
<table class="table table-striped table-hover table-condensed">
|
609
|
<thead>
|
610
|
<tr>
|
611
|
<th><?=gettext("Name")?></th>
|
612
|
<th><?=gettext("Internal")?></th>
|
613
|
<th><?=gettext("Certificates")?></th>
|
614
|
<th><?=gettext("In Use")?></th>
|
615
|
<th></th>
|
616
|
</tr>
|
617
|
</thead>
|
618
|
<tbody>
|
619
|
<?php
|
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
|
$name = htmlspecialchars($ca['descr']);
|
629
|
|
630
|
if ($ca['prv']) {
|
631
|
$cainternal = "YES";
|
632
|
} else {
|
633
|
$cainternal = "NO";
|
634
|
}
|
635
|
?>
|
636
|
<tr>
|
637
|
<td colspan="4">
|
638
|
<?=$name?>
|
639
|
</td>
|
640
|
<td>
|
641
|
<?php
|
642
|
if ($cainternal == "YES"):
|
643
|
?>
|
644
|
<a href="system_crlmanager.php?act=new&caref=<?=$ca['refid']; ?>" class="btn btn-xs btn-success">
|
645
|
<?=gettext("Add or Import CRL")?>
|
646
|
</a>
|
647
|
<?php
|
648
|
else:
|
649
|
?>
|
650
|
<a href="system_crlmanager.php?act=new&caref=<?=$ca['refid']; ?>&importonly=yes" class="btn btn-xs btn-success">
|
651
|
<?=gettext("Add or Import CRL")?>
|
652
|
</a>
|
653
|
<?php
|
654
|
endif;
|
655
|
?>
|
656
|
</td>
|
657
|
</tr>
|
658
|
<?php
|
659
|
if (is_array($ca_crl_map[$ca['refid']])):
|
660
|
foreach ($ca_crl_map[$ca['refid']] as $crl):
|
661
|
$tmpcrl = lookup_crl($crl);
|
662
|
$internal = is_crl_internal($tmpcrl);
|
663
|
$inuse = crl_in_use($tmpcrl['refid']);
|
664
|
?>
|
665
|
<tr>
|
666
|
<td><?=$tmpcrl['descr']; ?></td>
|
667
|
<td><?=($internal) ? "YES" : "NO"; ?></td>
|
668
|
<td><?=($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
|
669
|
<td><?=($inuse) ? "YES" : "NO"; ?></td>
|
670
|
<td>
|
671
|
<a href="system_crlmanager.php?act=exp&id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-success">
|
672
|
<?=gettext("Export CRL")?>
|
673
|
</a>
|
674
|
<?php
|
675
|
if ($internal): ?>
|
676
|
<a href="system_crlmanager.php?act=edit&id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-info">
|
677
|
<?=gettext("Edit CRL")?>
|
678
|
</a>
|
679
|
<?php
|
680
|
else:
|
681
|
?>
|
682
|
<a href="system_crlmanager.php?act=editimported&id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-info">
|
683
|
<?=gettext("Edit CRL")?>
|
684
|
</a>
|
685
|
<?php endif;
|
686
|
if (!$inuse):
|
687
|
?>
|
688
|
<a href="system_crlmanager.php?act=del&id=<?=$tmpcrl['refid']?>" class="btn btn-xs btn-danger">
|
689
|
<?=gettext("Delete CRL")?>
|
690
|
</a>
|
691
|
<?php
|
692
|
endif;
|
693
|
?>
|
694
|
</td>
|
695
|
</tr>
|
696
|
<?php
|
697
|
$i++;
|
698
|
endforeach;
|
699
|
endif;
|
700
|
$i++;
|
701
|
endforeach;
|
702
|
?>
|
703
|
</tbody>
|
704
|
</table>
|
705
|
</div>
|
706
|
</div>
|
707
|
|
708
|
|
709
|
<?php
|
710
|
}
|
711
|
?>
|
712
|
|
713
|
<script>
|
714
|
//<![CDATA[
|
715
|
events.push(function() {
|
716
|
|
717
|
// Hides all elements of the specified class. This will usually be a section or group
|
718
|
function hideClass(s_class, hide) {
|
719
|
if (hide) {
|
720
|
$('.' + s_class).hide();
|
721
|
} else {
|
722
|
$('.' + s_class).show();
|
723
|
}
|
724
|
}
|
725
|
|
726
|
// When the 'method" selector is changed, we show/hide certain sections
|
727
|
$('#method').on('change', function() {
|
728
|
hideClass('internal', ($('#method').val() == 'existing'));
|
729
|
hideClass('existing', ($('#method').val() == 'internal'));
|
730
|
});
|
731
|
|
732
|
hideClass('internal', ($('#method').val() == 'existing'));
|
733
|
hideClass('existing', ($('#method').val() == 'internal'));
|
734
|
});
|
735
|
//]]>
|
736
|
</script>
|
737
|
|
738
|
<?php include("foot.inc");
|
739
|
|