Project

General

Profile

Download (19.7 KB) Statistics
| Branch: | Tag: | Revision:
1 81bfb231 jim-p
<?php
2
/*
3
	system_crlmanager.php
4
	
5
	Copyright (C) 2010 Jim Pingle
6
	All rights reserved.
7
	
8
	Redistribution and use in source and binary forms, with or without
9
	modification, 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 the
16
	documentation and/or other materials provided with the distribution.
17
	
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29
/*
30
	pfSense_MODULE:	certificate_managaer
31
*/
32
33
##|+PRIV
34
##|*IDENT=page-system-crlmanager
35
##|*NAME=System: CRL Manager
36
##|*DESCR=Allow access to the 'System: CRL Manager' page.
37
##|*MATCH=system_crlmanager.php*
38
##|-PRIV
39
40
require("guiconfig.inc");
41
require_once("certs.inc");
42
43 fc54f29b jim-p
global $openssl_crl_status;
44
45 81bfb231 jim-p
$pgtitle = array(gettext("System"), gettext("Certificate Revocation List Manager"));
46
47
$crl_methods = array(
48
	"internal" => gettext("Create an internal Certificate Revocation List"),
49
	"existing" => gettext("Import an existing Certificate Revocation List"));
50
51
$id = $_GET['id'];
52
if (isset($_POST['id']))
53
	$id = $_POST['id'];
54
55
if (!is_array($config['ca']))
56
	$config['ca'] = array();
57
58
$a_ca =& $config['ca'];
59
60
if (!is_array($config['cert']))
61
	$config['cert'] = array();
62
63
$a_cert =& $config['cert'];
64
65
if (!is_array($config['crl']))
66
	$config['crl'] = array();
67
68
$a_crl =& $config['crl'];
69
70 c1f95f5c jim-p
foreach ($a_crl as $cid => $acrl)
71
	if (!isset($acrl['refid']))
72
		unset ($a_crl[$cid]);
73
74 81bfb231 jim-p
$act = $_GET['act'];
75
if ($_POST['act'])
76
	$act = $_POST['act'];
77
78 c1f95f5c jim-p
if (!empty($id))
79
	$thiscrl =& lookup_crl($id);
80 81bfb231 jim-p
81 c1f95f5c jim-p
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
82
if (!$thiscrl && (($act != "") && ($act != "new"))) {
83
	pfSenseHeader("system_crlmanager.php");
84
	$act="";
85
	$savemsg = gettext("Invalid CRL reference.");
86
}
87
88
if ($act == "del") {
89
	$name = $thiscrl['descr'];
90
	if (crl_in_use($id)) {
91 ad8df715 jim-p
		$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name) . "<br/>";
92
	} else {
93 c1f95f5c jim-p
		foreach ($a_crl as $cid => $acrl)
94
			if ($acrl['refid'] == $thiscrl['refid'])
95
				unset($a_crl[$cid]);
96 ad08687b jim-p
		write_config("Deleted CRL {$name}.");
97 ad8df715 jim-p
		$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name) . "<br/>";
98
	}
99 81bfb231 jim-p
}
100
101
if ($act == "new") {
102
	$pconfig['method'] = $_GET['method'];
103
	$pconfig['caref'] = $_GET['caref'];
104
	$pconfig['lifetime'] = "9999";
105
	$pconfig['serial'] = "0";
106
}
107
108
if ($act == "exp") {
109 c1f95f5c jim-p
	$exp_name = urlencode("{$thiscrl['descr']}.crl");
110
	$exp_data = base64_decode($thiscrl['text']);
111 81bfb231 jim-p
	$exp_size = strlen($exp_data);
112
113
	header("Content-Type: application/octet-stream");
114
	header("Content-Disposition: attachment; filename={$exp_name}");
115
	header("Content-Length: $exp_size");
116
	echo $exp_data;
117
	exit;
118
}
119
120 28ff7ace jim-p
if ($act == "addcert") {
121
	if ($_POST) {
122
		unset($input_errors);
123
		$pconfig = $_POST;
124
125
		if (!$pconfig['crlref'] || !$pconfig['certref']) {
126
			pfSenseHeader("system_crlmanager.php");
127
			exit;
128
		}
129
130
		// certref, crlref
131
		$crl =& lookup_crl($pconfig['crlref']);
132
		$cert = lookup_cert($pconfig['certref']);
133
134
		if (!$crl['caref'] || !$cert['caref']) {
135
			$input_errors[] = gettext("Both the Certificate and CRL must be specified.");
136
		}
137
138
		if ($crl['caref'] != $cert['caref']) {
139
			$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
140
		}
141
		if (!is_crl_internal($crl)) {
142
			$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
143
		}
144
145
		if (!$input_errors) {
146 fc54f29b jim-p
			$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
147
			cert_revoke($cert, $crl, $reason);
148 28ff7ace jim-p
			write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
149 8e022a76 jim-p
			require_once('openvpn.inc');
150
			openvpn_refresh_crls();
151 28ff7ace jim-p
			pfSenseHeader("system_crlmanager.php");
152 ad08687b jim-p
			exit;
153 28ff7ace jim-p
		}
154
	}
155
}
156
157
if ($act == "delcert") {
158 c1f95f5c jim-p
	if (!is_array($thiscrl['cert'])) {
159 28ff7ace jim-p
		pfSenseHeader("system_crlmanager.php");
160
		exit;
161
	}
162 c1f95f5c jim-p
	$found = false;
163
	foreach ($thiscrl['cert'] as $acert) {
164
		if ($acert['refid'] == $_GET['certref']) {
165
			$found = true;
166
			$thiscert = $acert;
167
		}
168
	}
169
	if (!$found) {
170
		pfSenseHeader("system_crlmanager.php");
171
		exit;
172
	}
173
	$name = $thiscert['descr'];
174
	if (cert_unrevoke($thiscert, $thiscrl)) {
175
		write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr']));
176
		$savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br/>";
177
		require_once('openvpn.inc');
178
		openvpn_refresh_crls();
179
	} else {
180
		$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br/>";
181
	}
182
	$act="edit";
183 28ff7ace jim-p
}
184
185 81bfb231 jim-p
if ($_POST) {
186
187
	unset($input_errors);
188
	$pconfig = $_POST;
189
190
	/* input validation */
191
	if ($pconfig['method'] == "existing") {
192 5293bfec jim-p
		$reqdfields = explode(" ", "descr crltext");
193 81bfb231 jim-p
		$reqdfieldsn = array(
194
				gettext("Descriptive name"),
195
				gettext("Certificate Revocation List data"));
196
	}
197
	if ($pconfig['method'] == "internal") {
198
		$reqdfields = explode(" ",
199 5293bfec jim-p
				"descr caref");
200 81bfb231 jim-p
		$reqdfieldsn = array(
201
				gettext("Descriptive name"),
202
				gettext("Certificate Authority"));
203
	}
204
205
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
206
207
	/* if this is an AJAX caller then handle via JSON */
208
	if (isAjax() && is_array($input_errors)) {
209
		input_errors2Ajax($input_errors);
210
		exit;
211
	}
212
213
	/* save modifications */
214
	if (!$input_errors) {
215
		$result = false;
216
217 304af9d8 jim-p
		if ($thiscrl) {
218 c1f95f5c jim-p
			$crl =& $thiscrl;
219 304af9d8 jim-p
		} else {
220
			$crl = array();
221
			$crl['refid'] = uniqid();
222
		}
223 81bfb231 jim-p
224 f2a86ca9 jim-p
		$crl['descr'] = $pconfig['descr'];
225 81bfb231 jim-p
		$crl['caref'] = $pconfig['caref'];
226 728003c8 jim-p
		$crl['method'] = $pconfig['method'];
227 81bfb231 jim-p
228
		if ($pconfig['method'] == "existing") {
229 304af9d8 jim-p
			$crl['text'] = base64_encode($pconfig['crltext']);
230 81bfb231 jim-p
		}
231
232
		if ($pconfig['method'] == "internal") {
233
			$crl['serial'] = empty($pconfig['serial']) ? 9999 : $pconfig['serial'];
234
			$crl['lifetime'] = empty($pconfig['lifetime']) ? 9999 : $pconfig['lifetime'];
235
			$crl['cert'] = array();
236
		}
237
238 c1f95f5c jim-p
		if (!$thiscrl)
239 81bfb231 jim-p
			$a_crl[] = $crl;
240
241 304af9d8 jim-p
		write_config("Saved CRL {$crl['descr']}");
242 81bfb231 jim-p
243
		pfSenseHeader("system_crlmanager.php");
244
	}
245
}
246
247
include("head.inc");
248
?>
249
250
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
251
<?php include("fbegin.inc"); ?>
252
<script type="text/javascript">
253
<!--
254
255
function method_change() {
256
257 44bcc1be jim-p
	method = document.iform.method.value;
258 81bfb231 jim-p
259
	switch (method) {
260 44bcc1be jim-p
		case "internal":
261 81bfb231 jim-p
			document.getElementById("existing").style.display="none";
262
			document.getElementById("internal").style.display="";
263
			break;
264 44bcc1be jim-p
		case "existing":
265 81bfb231 jim-p
			document.getElementById("existing").style.display="";
266
			document.getElementById("internal").style.display="none";
267
			break;
268
	}
269
}
270
271
//-->
272
</script>
273
<?php
274
	if ($input_errors)
275
		print_input_errors($input_errors);
276
	if ($savemsg)
277
		print_info_box($savemsg);
278
?>
279
<table width="100%" border="0" cellpadding="0" cellspacing="0">
280
	<tr>
281
		<td>
282
		<?php
283
			$tab_array = array();
284
			$tab_array[] = array(gettext("CAs"), false, "system_camanager.php");
285
			$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
286
			$tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php");
287
			display_top_tabs($tab_array);
288
		?>
289
		</td>
290
	</tr>
291
	<tr>
292
		<td id="mainarea">
293
			<div class="tabcont">
294
295
				<?php if ($act == "new" || $act == gettext("Save") || $input_errors): ?>
296
297
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
298
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
299
						<?php if (!isset($id)): ?>
300
						<tr>
301
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Method");?></td>
302
							<td width="78%" class="vtable">
303
								<select name='method' id='method' class="formselect" onchange='method_change()'>
304
								<?php
305
									foreach($crl_methods as $method => $desc):
306 44bcc1be jim-p
									if (($_GET['importonly'] == "yes") && ($method != "existing"))
307
										continue;
308 81bfb231 jim-p
									$selected = "";
309
									if ($pconfig['method'] == $method)
310
										$selected = "selected";
311
								?>
312
									<option value="<?=$method;?>"<?=$selected;?>><?=$desc;?></option>
313
								<?php endforeach; ?>
314
								</select>
315
							</td>
316
						</tr>
317
						<?php endif; ?>
318
						<tr>
319
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
320
							<td width="78%" class="vtable">
321 f2a86ca9 jim-p
								<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>"/>
322 81bfb231 jim-p
							</td>
323
						</tr>
324
						<tr>
325
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate Authority");?></td>
326
							<td width="78%" class="vtable">
327
								<select name='caref' id='caref' class="formselect">
328
								<?php
329
									foreach($a_ca as $ca):
330
									$selected = "";
331
									if ($pconfig['caref'] == $ca['refid'])
332
										$selected = "selected";
333
								?>
334 f2a86ca9 jim-p
									<option value="<?=$ca['refid'];?>"<?=$selected;?>><?=$ca['descr'];?></option>
335 81bfb231 jim-p
								<?php endforeach; ?>
336
								</select>
337
							</td>
338
						</tr>
339
					</table>
340
341
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="existing">
342
						<tr>
343
							<td colspan="2" class="list" height="12"></td>
344
						</tr>
345
						<tr>
346
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Existing Certificate Revocation List");?></td>
347
						</tr>
348
349
						<tr>
350
							<td width="22%" valign="top" class="vncellreq"><?=gettext("CRL data");?></td>
351
							<td width="78%" class="vtable">
352 364ecdd1 jim-p
								<textarea name="crltext" id="crltext" cols="65" rows="7" class="formfld_crl"><?=$pconfig['crltext'];?></textarea>
353 81bfb231 jim-p
								<br>
354
								<?=gettext("Paste a Certificate Revocation List in X.509 CRL format here.");?></td>
355
							</td>
356
						</tr>
357
					</table>
358
359
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="internal">
360
						<tr>
361
							<td colspan="2" class="list" height="12"></td>
362
						</tr>
363
						<tr>
364
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Internal Certificate Revocation List");?></td>
365
						</tr>
366
						<tr>
367
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
368
							<td width="78%" class="vtable">
369
								<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>"/>
370
								<?=gettext("days");?><br/>
371
								<?=gettext("Default: 9999");?>
372
							</td>
373
						</tr>
374
						<tr>
375
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Serial");?></td>
376
							<td width="78%" class="vtable">
377
								<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['serial']);?>"/>
378
								<br/>
379
								<?=gettext("Default: 0");?>
380
							</td>
381
						</tr>
382
					</table>
383
384
					<table width="100%" border="0" cellpadding="6" cellspacing="0">
385
						<tr>
386
							<td width="22%" valign="top">&nbsp;</td>
387
							<td width="78%">
388
								<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
389 c1f95f5c jim-p
								<?php if (isset($id) && $thiscrl): ?>
390 81bfb231 jim-p
								<input name="id" type="hidden" value="<?=$id;?>" />
391
								<?php endif;?>
392
							</td>
393
						</tr>
394
					</table>
395
				</form>
396 28ff7ace jim-p
				<?php elseif ($act == "edit"): ?>
397 c1f95f5c jim-p
				<?php 	$crl = $thiscrl; ?>
398 28ff7ace jim-p
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
399
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
400
					<thead>
401
					<tr>
402 fc54f29b jim-p
						<th width="90%" class="listhdrr" colspan="3"><b><?php echo gettext("Currently Revoked Certificates for CRL") . ': ' . $crl['descr']; ?></b></th>
403
						<th width="10%" class="list"></th>
404
					</tr>
405
					<tr>
406
						<th width="30%" class="listhdrr"><b><?php echo gettext("Certificate Name")?></b></th>
407
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revocation Reason")?></b></th>
408
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revoked At")?></b></th>
409
						<th width="10%" class="list"></th>
410 28ff7ace jim-p
					</tr>
411
					</thead>
412
					<tbody>
413
				<?php /* List Certs on CRL */
414
					if (!is_array($crl['cert']) || (count($crl['cert']) == 0)): ?>
415
					<tr>
416 fc54f29b jim-p
						<td class="listlr" colspan="3">
417 28ff7ace jim-p
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CRL."); ?>
418
						</td>
419
						<td class="list">&nbsp;</td>
420
					</td>
421
				<?php	else:
422
					foreach($crl['cert'] as $i => $cert):
423
						$name = htmlspecialchars($cert['descr']);
424
				 ?>
425
					<tr>
426
						<td class="listlr">
427
							<?php echo $name; ?>
428
						</td>
429 fc54f29b jim-p
						<td class="listlr">
430
							<?php echo $openssl_crl_status[$cert["reason"]]; ?>
431
						</td>
432
						<td class="listlr">
433
							<?php echo date("D M j G:i:s T Y", $cert["revoke_time"]); ?>
434
						</td>
435 28ff7ace jim-p
						<td class="list">
436 c1f95f5c jim-p
							<a href="system_crlmanager.php?act=delcert&id=<?php echo $crl['refid']; ?>&certref=<?php echo $cert['refid']; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate from the CRL?");?>')">
437 28ff7ace jim-p
								<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" />
438
							</a>
439
						</td>
440
					</tr>
441
					<?php
442
					endforeach;
443
					endif;
444
					?>
445
				<?php /* Drop-down with other certs from this CA. */
446
					// Map Certs to CAs in one pass
447
					$ca_certs = array();
448
					foreach($a_cert as $cert)
449
						if ($cert['caref'] == $crl['caref'])
450
							$ca_certs[] = $cert;
451
					if (count($ca_certs) == 0): ?>
452
					<tr>
453 fc54f29b jim-p
						<td class="listlr" colspan="3">
454 28ff7ace jim-p
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CA."); ?>
455
						</td>
456
						<td class="list">&nbsp;</td>
457
					</td>
458
				<?php	else: ?>
459
					<tr>
460 fc54f29b jim-p
						<td class="listlr" colspan="3" align="center">
461 28ff7ace jim-p
							<b><?php echo gettext("Choose a Certificate to Revoke"); ?></b>: <select name='certref' id='certref' class="formselect">
462
				<?php	foreach($ca_certs as $cert): ?>
463 fc54f29b jim-p
							<option value="<?=$cert['refid'];?>"><?=htmlspecialchars($cert['descr'])?></option>
464 28ff7ace jim-p
				<?php	endforeach; ?>
465 fc54f29b jim-p
							</select>
466
							<b><?php echo gettext("Reason");?></b>:
467
							<select name='crlreason' id='crlreason' class="formselect">
468
				<?php	foreach($openssl_crl_status as $code => $reason): ?>
469
							<option value="<?= $code ?>"><?= htmlspecialchars($reason) ?></option>
470
				<?php	endforeach; ?>
471
							</select>
472 28ff7ace jim-p
							<input name="act" type="hidden" value="addcert" />
473
							<input name="crlref" type="hidden" value="<?=$crl['refid'];?>" />
474 c1f95f5c jim-p
							<input name="id" type="hidden" value="<?=$crl['refid'];?>" />
475 28ff7ace jim-p
							<input id="submit" name="add" type="submit" class="formbtn" value="<?=gettext("Add"); ?>" />
476
						</td>
477
						<td class="list">&nbsp;</td>
478
					</tr>
479
				<?php	endif; ?>
480
					</tbody>
481
				</table>
482
				</form>
483 81bfb231 jim-p
				<?php else: ?>
484
485
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
486
					<thead>
487
					<tr>
488
						<td width="35%" class="listhdrr"><?=gettext("Name");?></td>
489
						<td width="10%" class="listhdrr"><?=gettext("Internal");?></td>
490
						<td width="35%" class="listhdrr"><?=gettext("Certificates");?></td>
491
						<td width="10%" class="listhdrr"><?=gettext("In Use");?></td>
492
						<td width="10%" class="list"></td>
493
					</tr>
494
					</thead>
495
					<tbody>
496
					<?php
497 0d5c21f7 Chris Buechler
						$caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
498 28ff7ace jim-p
						// Map CRLs to CAs in one pass
499 81bfb231 jim-p
						$ca_crl_map = array();
500
						foreach($a_crl as $crl)
501
							$ca_crl_map[$crl['caref']][] = $crl['refid'];
502
503
						$i = 0;
504
						foreach($a_ca as $ca):
505 f2a86ca9 jim-p
							$name = htmlspecialchars($ca['descr']);
506 81bfb231 jim-p
507
							if($ca['prv']) {
508 44bcc1be jim-p
								$cainternal = "YES";
509 81bfb231 jim-p
							} else 
510 44bcc1be jim-p
								$cainternal = "NO";
511 81bfb231 jim-p
					?>
512
					<tr>
513
						<td class="listlr" colspan="4">
514
							<table border="0" cellpadding="0" cellspacing="0">
515
								<tr>
516
									<td align="left" valign="center">
517
										<img src="<?=$caimg;?>" alt="CA" title="CA" border="0" height="16" width="16" />
518
									</td>
519
									<td align="left" valign="middle">
520
										<?=$name;?>
521
									</td>
522
								</tr>
523
							</table>
524
						</td>
525
						<td class="list">
526 44bcc1be jim-p
						<?php if ($cainternal == "YES"): ?>
527 81bfb231 jim-p
							<a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>">
528 f2a86ca9 jim-p
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Add or Import CRL for ") . $ca['descr'];?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
529 81bfb231 jim-p
							</a>
530 44bcc1be jim-p
						<?php else: ?>
531
							<a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>&importonly=yes">
532
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("Import CRL for ") . $ca['descr'];?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
533
							</a>
534
						<?php endif; ?>
535 81bfb231 jim-p
						</td>
536
					</tr>
537
					
538
						<?php
539
						if (is_array($ca_crl_map[$ca['refid']])):
540
							foreach($ca_crl_map[$ca['refid']] as $crl):
541
								$tmpcrl = lookup_crl($crl);
542 ad8df715 jim-p
								$internal = is_crl_internal($tmpcrl);
543
								$inuse = crl_in_use($tmpcrl['refid']);
544 81bfb231 jim-p
						?>
545
					<tr>
546 f2a86ca9 jim-p
						<td class="listlr"><?php echo $tmpcrl['descr']; ?></td>
547 ad8df715 jim-p
						<td class="listr"><?php echo ($internal) ? "YES" : "NO"; ?></td>
548
						<td class="listr"><?php echo ($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
549
						<td class="listr"><?php echo ($inuse) ? "YES" : "NO"; ?></td>
550 81bfb231 jim-p
						<td valign="middle" nowrap class="list">
551 916ee745 jim-p
							<?php if (!$internal || count($tmpcrl['cert'])): ?>
552 c1f95f5c jim-p
							<a href="system_crlmanager.php?act=exp&id=<?=$tmpcrl['refid'];?>")">
553 f2a86ca9 jim-p
								<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" />
554 81bfb231 jim-p
							</a>
555 916ee745 jim-p
							<?php endif; ?>
556 28ff7ace jim-p
							<?php if ($internal): ?>
557 c1f95f5c jim-p
							<a href="system_crlmanager.php?act=edit&id=<?=$tmpcrl['refid'];?>")">
558
								<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" />
559 28ff7ace jim-p
							</a>
560
							<?php endif; ?>
561 ad8df715 jim-p
							<?php if (!$inuse): ?>
562 c1f95f5c jim-p
							<a href="system_crlmanager.php?act=del&id=<?=$tmpcrl['refid'];?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate Revocation List?") . ' (' . htmlspecialchars($tmpcrl['descr']) . ')';?>')">
563 f2a86ca9 jim-p
								<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" />
564 81bfb231 jim-p
							</a>
565 ad8df715 jim-p
							<?php endif; ?>
566 81bfb231 jim-p
						</td>
567
					</tr>
568
						<?php
569
								$i++;
570
							endforeach;
571
						endif;
572
						?>
573
					<tr><td colspan="5">&nbsp;</td></tr>
574
					<?php
575
							$i++;
576
						endforeach;
577
					?>
578
					</tbody>
579
					<tfoot>
580
					<tr>
581
						<td colspan="5">
582
							<p>
583
								<?=gettext("Additional Certificate Revocation Lists can be added here.");?>
584
							</p>
585
						</td>
586
					</tr>
587
					</tfoot>
588
				</table>
589
590
				<?php endif; ?>
591
592
			</div>
593
		</td>
594
	</tr>
595
</table>
596
<?php include("fend.inc");?>
597
<script type="text/javascript">
598
<!--
599
600
method_change();
601
602
//-->
603
</script>
604
605
</body>