Project

General

Profile

Download (22.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	system_crlmanager.php
4

    
5
	Copyright (C) 2010 Jim Pingle
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	All rights reserved.
8

    
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11

    
12
	1. Redistributions of source code must retain the above copyright notice,
13
	this list of conditions and the following disclaimer.
14

    
15
	2. Redistributions in binary form must reproduce the above copyright
16
	notice, this list of conditions and the following disclaimer in the
17
	documentation and/or other materials provided with the distribution.
18

    
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/*
31
	pfSense_MODULE:	certificate_manager
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-system-crlmanager
36
##|*NAME=System: CRL Manager
37
##|*DESCR=Allow access to the 'System: CRL Manager' page.
38
##|*MATCH=system_crlmanager.php*
39
##|-PRIV
40

    
41
require("guiconfig.inc");
42
require_once("certs.inc");
43
require_once('openvpn.inc');
44

    
45
global $openssl_crl_status;
46

    
47
$pgtitle = array(gettext("System"), gettext("Certificate Revocation List Manager"));
48

    
49
$crl_methods = array(
50
	"internal" => gettext("Create an internal Certificate Revocation List"),
51
	"existing" => gettext("Import an existing Certificate Revocation List"));
52

    
53
if (ctype_alnum($_GET['id'])) {
54
	$id = $_GET['id'];
55
}
56
if (isset($_POST['id']) && ctype_alnum($_POST['id'])) {
57
	$id = $_POST['id'];
58
}
59

    
60
if (!is_array($config['ca'])) {
61
	$config['ca'] = array();
62
}
63

    
64
$a_ca =& $config['ca'];
65

    
66
if (!is_array($config['cert'])) {
67
	$config['cert'] = array();
68
}
69

    
70
$a_cert =& $config['cert'];
71

    
72
if (!is_array($config['crl'])) {
73
	$config['crl'] = array();
74
}
75

    
76
$a_crl =& $config['crl'];
77

    
78
foreach ($a_crl as $cid => $acrl) {
79
	if (!isset($acrl['refid'])) {
80
		unset ($a_crl[$cid]);
81
	}
82
}
83

    
84
$act = $_GET['act'];
85
if ($_POST['act']) {
86
	$act = $_POST['act'];
87
}
88

    
89
if (!empty($id)) {
90
	$thiscrl =& lookup_crl($id);
91
}
92

    
93
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
94
if (!$thiscrl && (($act != "") && ($act != "new"))) {
95
	pfSenseHeader("system_crlmanager.php");
96
	$act="";
97
	$savemsg = gettext("Invalid CRL reference.");
98
}
99

    
100
if ($act == "del") {
101
	$name = $thiscrl['descr'];
102
	if (crl_in_use($id)) {
103
		$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name) . "<br />";
104
	} else {
105
		foreach ($a_crl as $cid => $acrl) {
106
			if ($acrl['refid'] == $thiscrl['refid']) {
107
				unset($a_crl[$cid]);
108
			}
109
		}
110
		write_config("Deleted CRL {$name}.");
111
		$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name) . "<br />";
112
	}
113
}
114

    
115
if ($act == "new") {
116
	$pconfig['method'] = $_GET['method'];
117
	$pconfig['caref'] = $_GET['caref'];
118
	$pconfig['lifetime'] = "9999";
119
	$pconfig['serial'] = "0";
120
}
121

    
122
if ($act == "exp") {
123
	crl_update($thiscrl);
124
	$exp_name = urlencode("{$thiscrl['descr']}.crl");
125
	$exp_data = base64_decode($thiscrl['text']);
126
	$exp_size = strlen($exp_data);
127

    
128
	header("Content-Type: application/octet-stream");
129
	header("Content-Disposition: attachment; filename={$exp_name}");
130
	header("Content-Length: $exp_size");
131
	echo $exp_data;
132
	exit;
133
}
134

    
135
if ($act == "addcert") {
136
	if ($_POST) {
137
		unset($input_errors);
138
		$pconfig = $_POST;
139

    
140
		if (!$pconfig['crlref'] || !$pconfig['certref']) {
141
			pfSenseHeader("system_crlmanager.php");
142
			exit;
143
		}
144

    
145
		// certref, crlref
146
		$crl =& lookup_crl($pconfig['crlref']);
147
		$cert = lookup_cert($pconfig['certref']);
148

    
149
		if (!$crl['caref'] || !$cert['caref']) {
150
			$input_errors[] = gettext("Both the Certificate and CRL must be specified.");
151
		}
152

    
153
		if ($crl['caref'] != $cert['caref']) {
154
			$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
155
		}
156
		if (!is_crl_internal($crl)) {
157
			$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
158
		}
159

    
160
		if (!$input_errors) {
161
			$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
162
			cert_revoke($cert, $crl, $reason);
163
			openvpn_refresh_crls();
164
			write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
165
			pfSenseHeader("system_crlmanager.php");
166
			exit;
167
		}
168
	}
169
}
170

    
171
if ($act == "delcert") {
172
	if (!is_array($thiscrl['cert'])) {
173
		pfSenseHeader("system_crlmanager.php");
174
		exit;
175
	}
176
	$found = false;
177
	foreach ($thiscrl['cert'] as $acert) {
178
		if ($acert['refid'] == $_GET['certref']) {
179
			$found = true;
180
			$thiscert = $acert;
181
		}
182
	}
183
	if (!$found) {
184
		pfSenseHeader("system_crlmanager.php");
185
		exit;
186
	}
187
	$name = $thiscert['descr'];
188
	if (cert_unrevoke($thiscert, $thiscrl)) {
189
		$savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br />";
190
		openvpn_refresh_crls();
191
		write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr']));
192
	} else {
193
		$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br />";
194
	}
195
	$act="edit";
196
}
197

    
198
if ($_POST) {
199
	unset($input_errors);
200
	$pconfig = $_POST;
201

    
202
	/* input validation */
203
	if (($pconfig['method'] == "existing") || ($act == "editimported")) {
204
		$reqdfields = explode(" ", "descr crltext");
205
		$reqdfieldsn = array(
206
			gettext("Descriptive name"),
207
			gettext("Certificate Revocation List data"));
208
	}
209
	if ($pconfig['method'] == "internal") {
210
		$reqdfields = explode(" ", "descr caref");
211
		$reqdfieldsn = array(
212
			gettext("Descriptive name"),
213
			gettext("Certificate Authority"));
214
	}
215

    
216
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
217

    
218
	/* if this is an AJAX caller then handle via JSON */
219
	if (isAjax() && is_array($input_errors)) {
220
		input_errors2Ajax($input_errors);
221
		exit;
222
	}
223

    
224
	/* save modifications */
225
	if (!$input_errors) {
226
		$result = false;
227

    
228
		if ($thiscrl) {
229
			$crl =& $thiscrl;
230
		} else {
231
			$crl = array();
232
			$crl['refid'] = uniqid();
233
		}
234

    
235
		$crl['descr'] = $pconfig['descr'];
236
		if ($act != "editimported") {
237
			$crl['caref'] = $pconfig['caref'];
238
			$crl['method'] = $pconfig['method'];
239
		}
240

    
241
		if (($pconfig['method'] == "existing") || ($act == "editimported")) {
242
			$crl['text'] = base64_encode($pconfig['crltext']);
243
		}
244

    
245
		if ($pconfig['method'] == "internal") {
246
			$crl['serial'] = empty($pconfig['serial']) ? 9999 : $pconfig['serial'];
247
			$crl['lifetime'] = empty($pconfig['lifetime']) ? 9999 : $pconfig['lifetime'];
248
			$crl['cert'] = array();
249
		}
250

    
251
		if (!$thiscrl) {
252
			$a_crl[] = $crl;
253
		}
254

    
255
		write_config("Saved CRL {$crl['descr']}");
256
		openvpn_refresh_crls();
257
		pfSenseHeader("system_crlmanager.php");
258
	}
259
}
260

    
261
include("head.inc");
262
?>
263

    
264
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
265
<?php include("fbegin.inc"); ?>
266
<script type="text/javascript">
267
//<![CDATA[
268

    
269
function method_change() {
270

    
271
	method = document.iform.method.value;
272

    
273
	switch (method) {
274
		case "internal":
275
			document.getElementById("existing").style.display="none";
276
			document.getElementById("internal").style.display="";
277
			break;
278
		case "existing":
279
			document.getElementById("existing").style.display="";
280
			document.getElementById("internal").style.display="none";
281
			break;
282
	}
283
}
284

    
285
//]]>
286
</script>
287
<?php
288
	if ($input_errors) {
289
		print_input_errors($input_errors);
290
	}
291
	if ($savemsg) {
292
		print_info_box($savemsg);
293
	}
294
?>
295
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="CRL manager">
296
	<tr>
297
		<td>
298
		<?php
299
			$tab_array = array();
300
			$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
301
			$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
302
			$tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php");
303
			display_top_tabs($tab_array);
304
		?>
305
		</td>
306
	</tr>
307
	<tr>
308
		<td id="mainarea">
309
			<div class="tabcont">
310

    
311
<?php
312
	if ($act == "new" || $act == gettext("Save") || $input_errors):
313
?>
314

    
315
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
316
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
317
						<?php if (!isset($id)): ?>
318
						<tr>
319
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Method");?></td>
320
							<td width="78%" class="vtable">
321
								<select name='method' id='method' class="formselect" onchange='method_change()'>
322
								<?php
323
									$rowIndex = 0;
324
									foreach ($crl_methods as $method => $desc):
325
										if (($_GET['importonly'] == "yes") && ($method != "existing")) {
326
											continue;
327
										}
328
										$selected = "";
329
										if ($pconfig['method'] == $method) {
330
											$selected = "selected=\"selected\"";
331
										}
332
										$rowIndex++;
333
								?>
334
									<option value="<?=$method;?>" <?=$selected;?>><?=$desc;?></option>
335
								<?php
336
									endforeach;
337
									if ($rowIndex == 0) {
338
										echo "<option></option>";
339
									}
340
								?>
341
								</select>
342
							</td>
343
						</tr>
344
						<?php endif; ?>
345
						<tr>
346
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
347
							<td width="78%" class="vtable">
348
								<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>"/>
349
							</td>
350
						</tr>
351
						<tr>
352
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate Authority");?></td>
353
							<td width="78%" class="vtable">
354
								<select name='caref' id='caref' class="formselect">
355
								<?php
356
									$rowIndex = 0;
357
									foreach ($a_ca as $ca):
358
										$selected = "";
359
										if ($pconfig['caref'] == $ca['refid']) {
360
											$selected = "selected=\"selected\"";
361
										}
362
										$rowIndex++;
363
								?>
364
									<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
365
								<?php
366
									endforeach;
367
									if ($rowIndex == 0) {
368
										echo "<option></option>";
369
									}
370
								?>
371
								</select>
372
							</td>
373
						</tr>
374
					</table>
375

    
376
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="existing" summary="existing">
377
						<tr>
378
							<td colspan="2" class="list" height="12"></td>
379
						</tr>
380
						<tr>
381
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Existing Certificate Revocation List");?></td>
382
						</tr>
383

    
384
						<tr>
385
							<td width="22%" valign="top" class="vncellreq"><?=gettext("CRL data");?></td>
386
							<td width="78%" class="vtable">
387
								<textarea name="crltext" id="crltext" cols="65" rows="7" class="formfld_crl"><?=$pconfig['crltext'];?></textarea>
388
								<br />
389
								<?=gettext("Paste a Certificate Revocation List in X.509 CRL format here.");?>
390
							</td>
391
						</tr>
392
					</table>
393

    
394
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="internal" summary="internal">
395
						<tr>
396
							<td colspan="2" class="list" height="12"></td>
397
						</tr>
398
						<tr>
399
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Internal Certificate Revocation List");?></td>
400
						</tr>
401
						<tr>
402
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
403
							<td width="78%" class="vtable">
404
								<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>"/>
405
								<?=gettext("days");?><br />
406
								<?=gettext("Default: 9999");?>
407
							</td>
408
						</tr>
409
						<tr>
410
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Serial");?></td>
411
							<td width="78%" class="vtable">
412
								<input name="serial" type="text" class="formfld unknown" id="serial" size="5" value="<?=htmlspecialchars($pconfig['serial']);?>"/>
413
								<br />
414
								<?=gettext("Default: 0");?>
415
							</td>
416
						</tr>
417
					</table>
418

    
419
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="save">
420
						<tr>
421
							<td width="22%" valign="top">&nbsp;</td>
422
							<td width="78%">
423
								<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
424
								<?php if (isset($id) && $thiscrl): ?>
425
								<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
426
								<?php endif;?>
427
							</td>
428
						</tr>
429
					</table>
430
				</form>
431
<?php
432
	elseif ($act == "editimported"):
433
		$crl = $thiscrl;
434
?>
435
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
436
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="editimported" summary="import">
437
						<tr>
438
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Imported Certificate Revocation List");?></td>
439
						</tr>
440
						<tr>
441
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
442
							<td width="78%" class="vtable">
443
								<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($crl['descr']);?>"/>
444
							</td>
445
						</tr>
446
						<tr>
447
							<td width="22%" valign="top" class="vncellreq"><?=gettext("CRL data");?></td>
448
							<td width="78%" class="vtable">
449
								<textarea name="crltext" id="crltext" cols="65" rows="7" class="formfld_crl"><?=base64_decode($crl['text']);?></textarea>
450
								<br />
451
								<?=gettext("Paste a Certificate Revocation List in X.509 CRL format here.");?></td>
452
							</td>
453
						</tr>
454
						<tr>
455
							<td width="22%" valign="top">&nbsp;</td>
456
							<td width="78%">
457
								<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
458
								<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
459
								<input name="act" type="hidden" value="editimported" />
460
							</td>
461
						</tr>
462
					</table>
463
				</form>
464

    
465
<?php
466
	elseif ($act == "edit"):
467
		$crl = $thiscrl;
468
?>
469
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
470
				<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="revoke">
471
					<thead>
472
					<tr>
473
						<th width="90%" class="listhdrr" colspan="3"><b><?php echo gettext("Currently Revoked Certificates for CRL") . ': ' . $crl['descr']; ?></b></th>
474
						<th width="10%" class="list"></th>
475
					</tr>
476
					<tr>
477
						<th width="30%" class="listhdrr"><b><?php echo gettext("Certificate Name")?></b></th>
478
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revocation Reason")?></b></th>
479
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revoked At")?></b></th>
480
						<th width="10%" class="list"></th>
481
					</tr>
482
					</thead>
483
					<tbody>
484
				<?php /* List Certs on CRL */
485
					if (!is_array($crl['cert']) || (count($crl['cert']) == 0)):
486
				?>
487
					<tr>
488
						<td class="listlr" colspan="3">
489
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CRL."); ?>
490
						</td>
491
						<td class="list">&nbsp;</td>
492
					</tr>
493
				<?php
494
					else:
495
						foreach ($crl['cert'] as $i => $cert):
496
							$name = htmlspecialchars($cert['descr']);
497
				 ?>
498
					<tr>
499
						<td class="listlr">
500
							<?php echo $name; ?>
501
						</td>
502
						<td class="listlr">
503
							<?php echo $openssl_crl_status[$cert["reason"]]; ?>
504
						</td>
505
						<td class="listlr">
506
							<?php echo date("D M j G:i:s T Y", $cert["revoke_time"]); ?>
507
						</td>
508
						<td class="list">
509
							<a href="system_crlmanager.php?act=delcert&amp;id=<?php echo $crl['refid']; ?>&amp;certref=<?php echo $cert['refid']; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate from the CRL?");?>')">
510
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("Delete this certificate from the CRL ");?>" alt="<?=gettext("Delete this certificate from the CRL ");?>" width="17" height="17" border="0" />
511
							</a>
512
						</td>
513
					</tr>
514
				<?php
515
						endforeach;
516
					endif;
517
				?>
518
				<?php /* Drop-down with other certs from this CA. */
519
					// Map Certs to CAs in one pass
520
					$ca_certs = array();
521
					foreach ($a_cert as $cert) {
522
						if ($cert['caref'] == $crl['caref']) {
523
							$ca_certs[] = $cert;
524
						}
525
					}
526
					if (count($ca_certs) == 0): ?>
527
					<tr>
528
						<td class="listlr" colspan="3">
529
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CA."); ?>
530
						</td>
531
						<td class="list">&nbsp;</td>
532
					</tr>
533
				<?php
534
					else:
535
				?>
536
					<tr>
537
						<td class="listlr" colspan="3" align="center">
538
							<b><?php echo gettext("Choose a Certificate to Revoke"); ?></b>:
539
							<select name='certref' id='certref' class="formselect">
540
				<?php	$rowIndex = 0;
541
						foreach ($ca_certs as $cert):
542
							$rowIndex++;
543
				?>
544
								<option value="<?=$cert['refid'];?>"><?=htmlspecialchars($cert['descr'])?></option>
545
				<?php
546
						endforeach;
547
						if ($rowIndex == 0) {
548
							echo "<option></option>";
549
						}
550
				?>
551
							</select>
552
							<b><?php echo gettext("Reason");?></b>:
553
							<select name='crlreason' id='crlreason' class="formselect">
554
				<?php	$rowIndex = 0;
555
						foreach ($openssl_crl_status as $code => $reason):
556
							$rowIndex++;
557
				?>
558
								<option value="<?= $code ?>"><?= htmlspecialchars($reason) ?></option>
559
				<?php
560
						endforeach;
561
						if ($rowIndex == 0) {
562
							echo "<option></option>";
563
						}
564
				?>
565
							</select>
566
							<input name="act" type="hidden" value="addcert" />
567
							<input name="crlref" type="hidden" value="<?=$crl['refid'];?>" />
568
							<input name="id" type="hidden" value="<?=$crl['refid'];?>" />
569
							<input id="submit" name="add" type="submit" class="formbtn" value="<?=gettext("Add"); ?>" />
570
						</td>
571
						<td class="list">&nbsp;</td>
572
					</tr>
573
				<?php
574
					endif;
575
				?>
576
					</tbody>
577
				</table>
578
				</form>
579
<?php
580
	else:
581
?>
582
				<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ocpms">
583
					<thead>
584
					<tr>
585
						<td width="35%" class="listhdrr"><?=gettext("Name");?></td>
586
						<td width="10%" class="listhdrr"><?=gettext("Internal");?></td>
587
						<td width="35%" class="listhdrr"><?=gettext("Certificates");?></td>
588
						<td width="10%" class="listhdrr"><?=gettext("In Use");?></td>
589
						<td width="10%" class="list"></td>
590
					</tr>
591
					</thead>
592
					<tfoot>
593
					<tr>
594
						<td colspan="5">
595
							<p>
596
								<?=gettext("Additional Certificate Revocation Lists can be added here.");?>
597
							</p>
598
						</td>
599
					</tr>
600
					</tfoot>
601
					<tbody>
602
				<?php
603
					$caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
604
					// Map CRLs to CAs in one pass
605
					$ca_crl_map = array();
606
					foreach ($a_crl as $crl) {
607
						$ca_crl_map[$crl['caref']][] = $crl['refid'];
608
					}
609

    
610
					$i = 0;
611
					foreach ($a_ca as $ca):
612
						$name = htmlspecialchars($ca['descr']);
613

    
614
						if ($ca['prv']) {
615
							$cainternal = "YES";
616
						} else {
617
							$cainternal = "NO";
618
						}
619
				?>
620
					<tr>
621
						<td class="listlr" colspan="4">
622
							<table border="0" cellpadding="0" cellspacing="0" summary="icon">
623
								<tr>
624
									<td align="left" valign="middle">
625
										<img src="<?=$caimg;?>" alt="CA" title="CA" border="0" height="16" width="16" />
626
									</td>
627
									<td align="left" valign="middle">
628
										<?=$name;?>
629
									</td>
630
								</tr>
631
							</table>
632
						</td>
633
						<td class="list">
634
						<?php if ($cainternal == "YES"): ?>
635
							<a href="system_crlmanager.php?act=new&amp;caref=<?php echo $ca['refid']; ?>">
636
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Add or Import CRL for %s"), $ca['descr']);?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
637
							</a>
638
						<?php else: ?>
639
							<a href="system_crlmanager.php?act=new&amp;caref=<?php echo $ca['refid']; ?>&amp;importonly=yes">
640
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Import CRL for %s"), $ca['descr']);?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
641
							</a>
642
						<?php endif; ?>
643
						</td>
644
					</tr>
645
						<?php
646
						if (is_array($ca_crl_map[$ca['refid']])):
647
							foreach ($ca_crl_map[$ca['refid']] as $crl):
648
								$tmpcrl = lookup_crl($crl);
649
								$internal = is_crl_internal($tmpcrl);
650
								$inuse = crl_in_use($tmpcrl['refid']);
651
						?>
652
					<tr>
653
						<td class="listlr"><?php echo $tmpcrl['descr']; ?></td>
654
						<td class="listr"><?php echo ($internal) ? "YES" : "NO"; ?></td>
655
						<td class="listr"><?php echo ($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
656
						<td class="listr"><?php echo ($inuse) ? "YES" : "NO"; ?></td>
657
						<td valign="middle" class="list nowrap">
658
							<a href="system_crlmanager.php?act=exp&amp;id=<?=$tmpcrl['refid'];?>">
659
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("Export CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Export CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" />
660
							</a>
661
							<?php if ($internal): ?>
662
							<a href="system_crlmanager.php?act=edit&amp;id=<?=$tmpcrl['refid'];?>">
663
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" />
664
							</a>
665
							<?php else: ?>
666
							<a href="system_crlmanager.php?act=editimported&amp;id=<?=$tmpcrl['refid'];?>">
667
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" />
668
							</a>
669
							<?php endif; ?>
670
							<?php if (!$inuse): ?>
671
							<a href="system_crlmanager.php?act=del&amp;id=<?=$tmpcrl['refid'];?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate Revocation List?") . ' (' . htmlspecialchars($tmpcrl['descr']) . ')';?>')">
672
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("Delete CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Delete CRL") . " " . htmlspecialchars($tmpcrl['descr']); ?>" width="17" height="17" border="0" />
673
							</a>
674
							<?php endif; ?>
675
						</td>
676
					</tr>
677
						<?php
678
								$i++;
679
							endforeach;
680
						endif;
681
						?>
682
					<tr>
683
						<td colspan="5">&nbsp;</td>
684
					</tr>
685
				<?php
686
						$i++;
687
					endforeach;
688
				?>
689
					</tbody>
690
				</table>
691

    
692
<?php
693
	endif;
694
?>
695

    
696
			</div>
697
		</td>
698
	</tr>
699
</table>
700
<?php include("fend.inc");?>
701
<script type="text/javascript">
702
//<![CDATA[
703

    
704
method_change();
705

    
706
//]]>
707
</script>
708

    
709
</body>
710
</html>
(210-210/252)