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
|
$crl_methods = array(
|
71
|
"internal" => gettext("Create an internal Certificate Revocation List"),
|
72
|
"existing" => gettext("Import an existing Certificate Revocation List"));
|
73
|
|
74
|
if (ctype_alnum($_GET['id'])) {
|
75
|
$id = $_GET['id'];
|
76
|
}
|
77
|
if (isset($_POST['id']) && ctype_alnum($_POST['id'])) {
|
78
|
$id = $_POST['id'];
|
79
|
}
|
80
|
|
81
|
if (!is_array($config['ca'])) {
|
82
|
$config['ca'] = array();
|
83
|
}
|
84
|
|
85
|
$a_ca =& $config['ca'];
|
86
|
|
87
|
if (!is_array($config['cert'])) {
|
88
|
$config['cert'] = array();
|
89
|
}
|
90
|
|
91
|
$a_cert =& $config['cert'];
|
92
|
|
93
|
if (!is_array($config['crl'])) {
|
94
|
$config['crl'] = array();
|
95
|
}
|
96
|
|
97
|
$a_crl =& $config['crl'];
|
98
|
|
99
|
foreach ($a_crl as $cid => $acrl) {
|
100
|
if (!isset($acrl['refid'])) {
|
101
|
unset ($a_crl[$cid]);
|
102
|
}
|
103
|
}
|
104
|
|
105
|
$act = $_GET['act'];
|
106
|
if ($_POST['act']) {
|
107
|
$act = $_POST['act'];
|
108
|
}
|
109
|
|
110
|
if (!empty($id)) {
|
111
|
$thiscrl =& lookup_crl($id);
|
112
|
}
|
113
|
|
114
|
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
|
115
|
if (!$thiscrl && (($act != "") && ($act != "new"))) {
|
116
|
pfSenseHeader("system_crlmanager.php");
|
117
|
$act="";
|
118
|
$savemsg = gettext("Invalid CRL reference.");
|
119
|
}
|
120
|
|
121
|
if ($act == "del") {
|
122
|
$name = htmlspecialchars($thiscrl['descr']);
|
123
|
if (crl_in_use($id)) {
|
124
|
$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted."), $name);
|
125
|
} else {
|
126
|
foreach ($a_crl as $cid => $acrl) {
|
127
|
if ($acrl['refid'] == $thiscrl['refid']) {
|
128
|
unset($a_crl[$cid]);
|
129
|
}
|
130
|
}
|
131
|
write_config("Deleted CRL {$name}.");
|
132
|
$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted."), $name);
|
133
|
}
|
134
|
}
|
135
|
|
136
|
if ($act == "new") {
|
137
|
$pconfig['method'] = $_GET['method'];
|
138
|
$pconfig['caref'] = $_GET['caref'];
|
139
|
$pconfig['lifetime'] = "9999";
|
140
|
$pconfig['serial'] = "0";
|
141
|
}
|
142
|
|
143
|
if ($act == "exp") {
|
144
|
crl_update($thiscrl);
|
145
|
$exp_name = urlencode("{$thiscrl['descr']}.crl");
|
146
|
$exp_data = base64_decode($thiscrl['text']);
|
147
|
$exp_size = strlen($exp_data);
|
148
|
|
149
|
header("Content-Type: application/octet-stream");
|
150
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
151
|
header("Content-Length: $exp_size");
|
152
|
echo $exp_data;
|
153
|
exit;
|
154
|
}
|
155
|
|
156
|
if ($act == "addcert") {
|
157
|
if ($_POST) {
|
158
|
unset($input_errors);
|
159
|
$pconfig = $_POST;
|
160
|
|
161
|
if (!$pconfig['crlref'] || !$pconfig['certref']) {
|
162
|
pfSenseHeader("system_crlmanager.php");
|
163
|
exit;
|
164
|
}
|
165
|
|
166
|
// certref, crlref
|
167
|
$crl =& lookup_crl($pconfig['crlref']);
|
168
|
$cert = lookup_cert($pconfig['certref']);
|
169
|
|
170
|
if (!$crl['caref'] || !$cert['caref']) {
|
171
|
$input_errors[] = gettext("Both the Certificate and CRL must be specified.");
|
172
|
}
|
173
|
|
174
|
if ($crl['caref'] != $cert['caref']) {
|
175
|
$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
|
176
|
}
|
177
|
if (!is_crl_internal($crl)) {
|
178
|
$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
|
179
|
}
|
180
|
|
181
|
if (!$input_errors) {
|
182
|
$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
|
183
|
cert_revoke($cert, $crl, $reason);
|
184
|
// refresh IPsec and OpenVPN CRLs
|
185
|
openvpn_refresh_crls();
|
186
|
vpn_ipsec_configure();
|
187
|
write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
|
188
|
pfSenseHeader("system_crlmanager.php");
|
189
|
exit;
|
190
|
}
|
191
|
}
|
192
|
}
|
193
|
|
194
|
if ($act == "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'] == $_GET['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 %s from CRL %s."), $certname, $crlname);
|
214
|
// refresh IPsec and OpenVPN CRLs
|
215
|
openvpn_refresh_crls();
|
216
|
vpn_ipsec_configure();
|
217
|
write_config($savemsg);
|
218
|
} else {
|
219
|
$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s."), $certname, $crlname);
|
220
|
}
|
221
|
$act="edit";
|
222
|
}
|
223
|
|
224
|
if ($_POST) {
|
225
|
$input_errors = array();
|
226
|
$pconfig = $_POST;
|
227
|
|
228
|
/* input validation */
|
229
|
if (($pconfig['method'] == "existing") || ($act == "editimported")) {
|
230
|
$reqdfields = explode(" ", "descr crltext");
|
231
|
$reqdfieldsn = array(
|
232
|
gettext("Descriptive name"),
|
233
|
gettext("Certificate Revocation List data"));
|
234
|
}
|
235
|
if ($pconfig['method'] == "internal") {
|
236
|
$reqdfields = explode(" ", "descr caref");
|
237
|
$reqdfieldsn = array(
|
238
|
gettext("Descriptive name"),
|
239
|
gettext("Certificate Authority"));
|
240
|
}
|
241
|
|
242
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
243
|
|
244
|
if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
|
245
|
array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
|
246
|
}
|
247
|
|
248
|
/* if this is an AJAX caller then handle via JSON */
|
249
|
if (isAjax() && is_array($input_errors)) {
|
250
|
input_errors2Ajax($input_errors);
|
251
|
exit;
|
252
|
}
|
253
|
|
254
|
/* save modifications */
|
255
|
if (!$input_errors) {
|
256
|
$result = false;
|
257
|
|
258
|
if ($thiscrl) {
|
259
|
$crl =& $thiscrl;
|
260
|
} else {
|
261
|
$crl = array();
|
262
|
$crl['refid'] = uniqid();
|
263
|
}
|
264
|
|
265
|
$crl['descr'] = $pconfig['descr'];
|
266
|
if ($act != "editimported") {
|
267
|
$crl['caref'] = $pconfig['caref'];
|
268
|
$crl['method'] = $pconfig['method'];
|
269
|
}
|
270
|
|
271
|
if (($pconfig['method'] == "existing") || ($act == "editimported")) {
|
272
|
$crl['text'] = base64_encode($pconfig['crltext']);
|
273
|
}
|
274
|
|
275
|
if ($pconfig['method'] == "internal") {
|
276
|
$crl['serial'] = empty($pconfig['serial']) ? 9999 : $pconfig['serial'];
|
277
|
$crl['lifetime'] = empty($pconfig['lifetime']) ? 9999 : $pconfig['lifetime'];
|
278
|
$crl['cert'] = array();
|
279
|
}
|
280
|
|
281
|
if (!$thiscrl) {
|
282
|
$a_crl[] = $crl;
|
283
|
}
|
284
|
|
285
|
write_config("Saved CRL {$crl['descr']}");
|
286
|
// refresh IPsec and OpenVPN CRLs
|
287
|
openvpn_refresh_crls();
|
288
|
vpn_ipsec_configure();
|
289
|
pfSenseHeader("system_crlmanager.php");
|
290
|
}
|
291
|
}
|
292
|
|
293
|
$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("Certificate Revocation"));
|
294
|
|
295
|
if ($act == "new" || $act == gettext("Save") || $input_errors || $act == "edit") {
|
296
|
$pgtitle[] = gettext('Edit');
|
297
|
}
|
298
|
include("head.inc");
|
299
|
?>
|
300
|
|
301
|
<script type="text/javascript">
|
302
|
//<![CDATA[
|
303
|
|
304
|
function method_change() {
|
305
|
|
306
|
method = document.iform.method.value;
|
307
|
|
308
|
switch (method) {
|
309
|
case "internal":
|
310
|
document.getElementById("existing").style.display="none";
|
311
|
document.getElementById("internal").style.display="";
|
312
|
break;
|
313
|
case "existing":
|
314
|
document.getElementById("existing").style.display="";
|
315
|
document.getElementById("internal").style.display="none";
|
316
|
break;
|
317
|
}
|
318
|
}
|
319
|
|
320
|
//]]>
|
321
|
</script>
|
322
|
|
323
|
<?php
|
324
|
|
325
|
function build_method_list() {
|
326
|
global $_GET, $crl_methods;
|
327
|
|
328
|
$list = array();
|
329
|
|
330
|
foreach ($crl_methods as $method => $desc) {
|
331
|
if (($_GET['importonly'] == "yes") && ($method != "existing")) {
|
332
|
continue;
|
333
|
}
|
334
|
|
335
|
$list[$method] = $desc;
|
336
|
}
|
337
|
|
338
|
return($list);
|
339
|
}
|
340
|
|
341
|
function build_ca_list() {
|
342
|
global $a_ca;
|
343
|
|
344
|
$list = array();
|
345
|
|
346
|
foreach ($a_ca as $ca) {
|
347
|
$list[$ca['refid']] = $ca['descr'];
|
348
|
}
|
349
|
|
350
|
return($list);
|
351
|
}
|
352
|
|
353
|
function build_cacert_list() {
|
354
|
global $ca_certs;
|
355
|
|
356
|
$list = array();
|
357
|
|
358
|
foreach($ca_certs as $cert) {
|
359
|
$list[$cert['refid']] = $cert['descr'];
|
360
|
}
|
361
|
|
362
|
return($list);
|
363
|
}
|
364
|
|
365
|
if ($input_errors) {
|
366
|
print_input_errors($input_errors);
|
367
|
}
|
368
|
|
369
|
if ($savemsg) {
|
370
|
print_info_box($savemsg, 'success');
|
371
|
}
|
372
|
|
373
|
$tab_array = array();
|
374
|
$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
|
375
|
$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
|
376
|
$tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php");
|
377
|
display_top_tabs($tab_array);
|
378
|
|
379
|
if ($act == "new" || $act == gettext("Save") || $input_errors) {
|
380
|
if (!isset($id)) {
|
381
|
$form = new Form();
|
382
|
|
383
|
$section = new Form_Section('Create new Revocation List');
|
384
|
|
385
|
$section->addInput(new Form_Select(
|
386
|
'method',
|
387
|
'Method',
|
388
|
$pconfig['method'],
|
389
|
build_method_list()
|
390
|
));
|
391
|
|
392
|
}
|
393
|
|
394
|
$section->addInput(new Form_Input(
|
395
|
'descr',
|
396
|
'Descriptive name',
|
397
|
'text',
|
398
|
$pconfig['descr']
|
399
|
));
|
400
|
|
401
|
$section->addInput(new Form_Select(
|
402
|
'caref',
|
403
|
'Certificate Authority',
|
404
|
$pconfig['caref'],
|
405
|
build_ca_list()
|
406
|
));
|
407
|
|
408
|
$form->add($section);
|
409
|
|
410
|
$section = new Form_Section('Existing Certificate Revocation List');
|
411
|
$section->addClass('existing');
|
412
|
|
413
|
$section->addInput(new Form_Textarea(
|
414
|
'crltext',
|
415
|
'CRL data',
|
416
|
$pconfig['crltext']
|
417
|
))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
|
418
|
|
419
|
$form->add($section);
|
420
|
|
421
|
$section = new Form_Section('Internal Certificate Revocation List');
|
422
|
$section->addClass('internal');
|
423
|
|
424
|
$section->addInput(new Form_Input(
|
425
|
'lifetime',
|
426
|
'Lifetime (Days)',
|
427
|
'number',
|
428
|
$pconfig['lifetime'],
|
429
|
[max => '9999']
|
430
|
));
|
431
|
|
432
|
$section->addInput(new Form_Input(
|
433
|
'serial',
|
434
|
'Serial',
|
435
|
'number',
|
436
|
$pconfig['serial'],
|
437
|
[min => '0', max => '9999']
|
438
|
));
|
439
|
|
440
|
$form->add($section);
|
441
|
|
442
|
if (isset($id) && $thiscrl) {
|
443
|
$section->addInput(new Form_Input(
|
444
|
'id',
|
445
|
null,
|
446
|
'hidden',
|
447
|
$id
|
448
|
));
|
449
|
}
|
450
|
|
451
|
print($form);
|
452
|
|
453
|
} elseif ($act == "editimported") {
|
454
|
|
455
|
$form = new Form();
|
456
|
|
457
|
$section = new Form_Section('Edit Imported Certificate Revocation List');
|
458
|
|
459
|
$section->addInput(new Form_Input(
|
460
|
'descr',
|
461
|
'Descriptive name',
|
462
|
'text',
|
463
|
$pconfig['descr']
|
464
|
));
|
465
|
|
466
|
$section->addInput(new Form_Textarea(
|
467
|
'crltext',
|
468
|
'CRL data',
|
469
|
$pconfig['crltext']
|
470
|
))->setHelp('Paste a Certificate Revocation List in X.509 CRL format here.');
|
471
|
|
472
|
$section->addInput(new Form_Input(
|
473
|
'id',
|
474
|
null,
|
475
|
'hidden',
|
476
|
$id
|
477
|
));
|
478
|
|
479
|
$section->addInput(new Form_Input(
|
480
|
'act',
|
481
|
null,
|
482
|
'hidden',
|
483
|
'editimported'
|
484
|
));
|
485
|
|
486
|
$form->add($section);
|
487
|
|
488
|
print($form);
|
489
|
|
490
|
} elseif ($act == "edit") {
|
491
|
$crl = $thiscrl;
|
492
|
|
493
|
$form = new Form(false);
|
494
|
?>
|
495
|
|
496
|
<div class="panel panel-default">
|
497
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Currently Revoked Certificates for CRL") . ': ' . $crl['descr']?></h2></div>
|
498
|
<div class="panel-body table-responsive">
|
499
|
<?php
|
500
|
if (!is_array($crl['cert']) || (count($crl['cert']) == 0)) {
|
501
|
print_info_box(gettext("No certificates found for this CRL."), 'danger');
|
502
|
} else {
|
503
|
?>
|
504
|
<table class="table table-striped table-hover table-condensed">
|
505
|
<thead>
|
506
|
<tr>
|
507
|
<th><?=gettext("Certificate Name")?></th>
|
508
|
<th><?=gettext("Revocation Reason")?></th>
|
509
|
<th><?=gettext("Revoked At")?></th>
|
510
|
<th></th>
|
511
|
</tr>
|
512
|
</thead>
|
513
|
<tbody>
|
514
|
<?php
|
515
|
foreach ($crl['cert'] as $i => $cert):
|
516
|
$name = htmlspecialchars($cert['descr']);
|
517
|
?>
|
518
|
<tr>
|
519
|
<td class="listlr">
|
520
|
<?=$name; ?>
|
521
|
</td>
|
522
|
<td class="listlr">
|
523
|
<?=$openssl_crl_status[$cert["reason"]]; ?>
|
524
|
</td>
|
525
|
<td class="listlr">
|
526
|
<?=date("D M j G:i:s T Y", $cert["revoke_time"]); ?>
|
527
|
</td>
|
528
|
<td class="list">
|
529
|
<a href="system_crlmanager.php?act=delcert&id=<?=$crl['refid']; ?>&certref=<?=$cert['refid']; ?>">
|
530
|
<i class="fa fa-trash" title="<?=gettext("Delete this certificate from the CRL")?>" alt="<?=gettext("Delete this certificate from the CRL")?>"></i>
|
531
|
</a>
|
532
|
</td>
|
533
|
</tr>
|
534
|
<?php
|
535
|
endforeach;
|
536
|
?>
|
537
|
</tbody>
|
538
|
</table>
|
539
|
<?php
|
540
|
}
|
541
|
?>
|
542
|
</div>
|
543
|
</div>
|
544
|
<?php
|
545
|
|
546
|
$ca_certs = array();
|
547
|
foreach ($a_cert as $cert) {
|
548
|
if ($cert['caref'] == $crl['caref']) {
|
549
|
$ca_certs[] = $cert;
|
550
|
}
|
551
|
}
|
552
|
|
553
|
if (count($ca_certs) == 0) {
|
554
|
print_info_box(gettext("No certificates found for this CA."), 'danger');
|
555
|
} else {
|
556
|
$section = new Form_Section('Choose a Certificate to Revoke');
|
557
|
$group = new Form_Group(null);
|
558
|
|
559
|
$group->add(new Form_Select(
|
560
|
'certref',
|
561
|
null,
|
562
|
$pconfig['certref'],
|
563
|
build_cacert_list()
|
564
|
))->setWidth(4)->setHelp('Certificate');
|
565
|
|
566
|
$group->add(new Form_Select(
|
567
|
'crlreason',
|
568
|
null,
|
569
|
-1,
|
570
|
$openssl_crl_status
|
571
|
))->setHelp('Reason');
|
572
|
|
573
|
$group->add(new Form_Button(
|
574
|
'submit',
|
575
|
'Add',
|
576
|
null,
|
577
|
'fa-plus'
|
578
|
))->addClass('btn-success btn-sm');
|
579
|
|
580
|
$section->add($group);
|
581
|
|
582
|
$section->addInput(new Form_Input(
|
583
|
'id',
|
584
|
null,
|
585
|
'hidden',
|
586
|
$crl['refid']
|
587
|
));
|
588
|
|
589
|
$section->addInput(new Form_Input(
|
590
|
'act',
|
591
|
null,
|
592
|
'hidden',
|
593
|
'addcert'
|
594
|
));
|
595
|
|
596
|
$section->addInput(new Form_Input(
|
597
|
'crlref',
|
598
|
null,
|
599
|
'hidden',
|
600
|
$crl['refid']
|
601
|
));
|
602
|
|
603
|
$form->add($section);
|
604
|
}
|
605
|
|
606
|
print($form);
|
607
|
} else {
|
608
|
?>
|
609
|
|
610
|
<div class="panel panel-default">
|
611
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Additional Certificate Revocation Lists")?></h2></div>
|
612
|
<div class="panel-body table-responsive">
|
613
|
<table class="table table-striped table-hover table-condensed">
|
614
|
<thead>
|
615
|
<tr>
|
616
|
<th><?=gettext("Name")?></th>
|
617
|
<th><?=gettext("Internal")?></th>
|
618
|
<th><?=gettext("Certificates")?></th>
|
619
|
<th><?=gettext("In Use")?></th>
|
620
|
<th><?=gettext("Actions")?></th>
|
621
|
</tr>
|
622
|
</thead>
|
623
|
<tbody>
|
624
|
<?php
|
625
|
// Map CRLs to CAs in one pass
|
626
|
$ca_crl_map = array();
|
627
|
foreach ($a_crl as $crl) {
|
628
|
$ca_crl_map[$crl['caref']][] = $crl['refid'];
|
629
|
}
|
630
|
|
631
|
$i = 0;
|
632
|
foreach ($a_ca as $ca):
|
633
|
$name = htmlspecialchars($ca['descr']);
|
634
|
|
635
|
if ($ca['prv']) {
|
636
|
$cainternal = "YES";
|
637
|
} else {
|
638
|
$cainternal = "NO";
|
639
|
}
|
640
|
?>
|
641
|
<tr>
|
642
|
<td colspan="4">
|
643
|
<?=$name?>
|
644
|
</td>
|
645
|
<td>
|
646
|
<?php
|
647
|
if ($cainternal == "YES"):
|
648
|
?>
|
649
|
<a href="system_crlmanager.php?act=new&caref=<?=$ca['refid']; ?>" class="btn btn-xs btn-success">
|
650
|
<i class="fa fa-plus icon-embed-btn"></i>
|
651
|
<?=gettext("Add or Import CRL")?>
|
652
|
</a>
|
653
|
<?php
|
654
|
else:
|
655
|
?>
|
656
|
<a href="system_crlmanager.php?act=new&caref=<?=$ca['refid']; ?>&importonly=yes" class="btn btn-xs btn-success">
|
657
|
<i class="fa fa-plus icon-embed-btn"></i>
|
658
|
<?=gettext("Add or Import CRL")?>
|
659
|
</a>
|
660
|
<?php
|
661
|
endif;
|
662
|
?>
|
663
|
</td>
|
664
|
</tr>
|
665
|
<?php
|
666
|
if (is_array($ca_crl_map[$ca['refid']])):
|
667
|
foreach ($ca_crl_map[$ca['refid']] as $crl):
|
668
|
$tmpcrl = lookup_crl($crl);
|
669
|
$internal = is_crl_internal($tmpcrl);
|
670
|
$inuse = crl_in_use($tmpcrl['refid']);
|
671
|
?>
|
672
|
<tr>
|
673
|
<td><?=$tmpcrl['descr']; ?></td>
|
674
|
<td><i class="fa fa-<?=($internal) ? "check" : "times"; ?>"></i></td>
|
675
|
<td><?=($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
|
676
|
<td><i class="fa fa-<?=($inuse) ? "check" : "times"; ?>"></i></td>
|
677
|
<td>
|
678
|
<a href="system_crlmanager.php?act=exp&id=<?=$tmpcrl['refid']?>" class="fa fa-download" title="<?=gettext("Export CRL")?>"></a>
|
679
|
<?php
|
680
|
if ($internal): ?>
|
681
|
<a href="system_crlmanager.php?act=edit&id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
|
682
|
<?php
|
683
|
else:
|
684
|
?>
|
685
|
<a href="system_crlmanager.php?act=editimported&id=<?=$tmpcrl['refid']?>" class="fa fa-pencil" title="<?=gettext("Edit CRL")?>"></a>
|
686
|
<?php endif;
|
687
|
if (!$inuse):
|
688
|
?>
|
689
|
<a href="system_crlmanager.php?act=del&id=<?=$tmpcrl['refid']?>" class="fa fa-trash" title="<?=gettext("Delete CRL")?>"></a>
|
690
|
<?php
|
691
|
endif;
|
692
|
?>
|
693
|
</td>
|
694
|
</tr>
|
695
|
<?php
|
696
|
$i++;
|
697
|
endforeach;
|
698
|
endif;
|
699
|
$i++;
|
700
|
endforeach;
|
701
|
?>
|
702
|
</tbody>
|
703
|
</table>
|
704
|
</div>
|
705
|
</div>
|
706
|
|
707
|
|
708
|
<?php
|
709
|
}
|
710
|
?>
|
711
|
|
712
|
<script>
|
713
|
//<![CDATA[
|
714
|
events.push(function() {
|
715
|
|
716
|
// Hides all elements of the specified class. This will usually be a section or group
|
717
|
function hideClass(s_class, hide) {
|
718
|
if (hide) {
|
719
|
$('.' + s_class).hide();
|
720
|
} else {
|
721
|
$('.' + s_class).show();
|
722
|
}
|
723
|
}
|
724
|
|
725
|
// When the 'method" selector is changed, we show/hide certain sections
|
726
|
$('#method').on('change', function() {
|
727
|
hideClass('internal', ($('#method').val() == 'existing'));
|
728
|
hideClass('existing', ($('#method').val() == 'internal'));
|
729
|
});
|
730
|
|
731
|
hideClass('internal', ($('#method').val() == 'existing'));
|
732
|
hideClass('existing', ($('#method').val() == 'internal'));
|
733
|
});
|
734
|
//]]>
|
735
|
</script>
|
736
|
|
737
|
<?php include("foot.inc");
|
738
|
|