Project

General

Profile

Download (22.9 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
require_once("vpn.inc");
45

    
46
global $openssl_crl_status;
47

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

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

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

    
59
if (!is_array($config['ca']))
60
	$config['ca'] = array();
61

    
62
$a_ca =& $config['ca'];
63

    
64
if (!is_array($config['cert']))
65
	$config['cert'] = array();
66

    
67
$a_cert =& $config['cert'];
68

    
69
if (!is_array($config['crl']))
70
	$config['crl'] = array();
71

    
72
$a_crl =& $config['crl'];
73

    
74
foreach ($a_crl as $cid => $acrl)
75
	if (!isset($acrl['refid']))
76
		unset ($a_crl[$cid]);
77

    
78
$act = $_GET['act'];
79
if ($_POST['act'])
80
	$act = $_POST['act'];
81

    
82
if (!empty($id))
83
	$thiscrl =& lookup_crl($id);
84

    
85
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
86
if (!$thiscrl && (($act != "") && ($act != "new"))) {
87
	pfSenseHeader("system_crlmanager.php");
88
	$act="";
89
	$savemsg = gettext("Invalid CRL reference.");
90
}
91

    
92
if ($act == "del") {
93
	$name = htmlspecialchars($thiscrl['descr']);
94
	if (crl_in_use($id)) {
95
		$savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name) . "<br />";
96
	} else {
97
		foreach ($a_crl as $cid => $acrl)
98
			if ($acrl['refid'] == $thiscrl['refid'])
99
				unset($a_crl[$cid]);
100
		write_config("Deleted CRL {$name}.");
101
		$savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name) . "<br />";
102
	}
103
}
104

    
105
if ($act == "new") {
106
	$pconfig['method'] = $_GET['method'];
107
	$pconfig['caref'] = $_GET['caref'];
108
	$pconfig['lifetime'] = "9999";
109
	$pconfig['serial'] = "0";
110
}
111

    
112
if ($act == "exp") {
113
	crl_update($thiscrl);
114
	$exp_name = urlencode("{$thiscrl['descr']}.crl");
115
	$exp_data = base64_decode($thiscrl['text']);
116
	$exp_size = strlen($exp_data);
117

    
118
	header("Content-Type: application/octet-stream");
119
	header("Content-Disposition: attachment; filename={$exp_name}");
120
	header("Content-Length: $exp_size");
121
	echo $exp_data;
122
	exit;
123
}
124

    
125
if ($act == "addcert") {
126
	if ($_POST) {
127
		unset($input_errors);
128
		$pconfig = $_POST;
129

    
130
		if (!$pconfig['crlref'] || !$pconfig['certref']) {
131
			pfSenseHeader("system_crlmanager.php");
132
			exit;
133
		}
134

    
135
		// certref, crlref
136
		$crl =& lookup_crl($pconfig['crlref']);
137
		$cert = lookup_cert($pconfig['certref']);
138

    
139
		if (!$crl['caref'] || !$cert['caref']) {
140
			$input_errors[] = gettext("Both the Certificate and CRL must be specified.");
141
		}
142

    
143
		if ($crl['caref'] != $cert['caref']) {
144
			$input_errors[] = gettext("CA mismatch between the Certificate and CRL. Unable to Revoke.");
145
		}
146
		if (!is_crl_internal($crl)) {
147
			$input_errors[] = gettext("Cannot revoke certificates for an imported/external CRL.");
148
		}
149

    
150
		if (!$input_errors) {
151
			$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
152
			cert_revoke($cert, $crl, $reason);
153
			// refresh IPsec and OpenVPN CRLs 
154
			openvpn_refresh_crls();
155
			vpn_ipsec_configure();
156
			write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
157
			pfSenseHeader("system_crlmanager.php");
158
			exit;
159
		}
160
	}
161
}
162

    
163
if ($act == "delcert") {
164
	if (!is_array($thiscrl['cert'])) {
165
		pfSenseHeader("system_crlmanager.php");
166
		exit;
167
	}
168
	$found = false;
169
	foreach ($thiscrl['cert'] as $acert) {
170
		if ($acert['refid'] == $_GET['certref']) {
171
			$found = true;
172
			$thiscert = $acert;
173
		}
174
	}
175
	if (!$found) {
176
		pfSenseHeader("system_crlmanager.php");
177
		exit;
178
	}
179
	$certname = htmlspecialchars($thiscert['descr']);
180
	$crlname = htmlspecialchars($thiscrl['descr']);
181
	if (cert_unrevoke($thiscert, $thiscrl)) {
182
		$savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname) . "<br />";
183
		// refresh IPsec and OpenVPN CRLs 
184
		openvpn_refresh_crls();
185
		vpn_ipsec_configure();
186
		write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname));
187
	} else {
188
		$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $certname, $crlname) . "<br />";
189
	}
190
	$act="edit";
191
}
192

    
193
if ($_POST) {
194
	$input_errors = array();
195
	$pconfig = $_POST;
196

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

    
212
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
213

    
214
	if (preg_match("/[\?\>\<\&\/\\\"\']/", $pconfig['descr'])) {
215
		array_push($input_errors, "The field 'Descriptive Name' contains invalid characters.");
216
	}
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
		write_config("Saved CRL {$crl['descr']}");
255
		// refresh IPsec and OpenVPN CRLs 
256
		openvpn_refresh_crls();
257
		vpn_ipsec_configure();
258
		pfSenseHeader("system_crlmanager.php");
259
	}
260
}
261

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

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

    
270
function method_change() {
271

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

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

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

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

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

    
366
					<table width="100%" border="0" cellpadding="6" cellspacing="0" id="existing" summary="existing">
367
						<tr>
368
							<td colspan="2" class="list" height="12"></td>
369
						</tr>
370
						<tr>
371
							<td colspan="2" valign="top" class="listtopic"><?=gettext("Existing Certificate Revocation List");?></td>
372
						</tr>
373

    
374
						<tr>
375
							<td width="22%" valign="top" class="vncellreq"><?=gettext("CRL data");?></td>
376
							<td width="78%" class="vtable">
377
								<textarea name="crltext" id="crltext" cols="65" rows="7" class="formfld_crl"><?=$pconfig['crltext'];?></textarea>
378
								<br />
379
								<?=gettext("Paste a Certificate Revocation List in X.509 CRL format here.");?>
380
							</td>
381
						</tr>
382
					</table>
383

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

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

    
453
				<?php elseif ($act == "edit"): ?>
454
				<?php 	$crl = $thiscrl; ?>
455
				<form action="system_crlmanager.php" method="post" name="iform" id="iform">
456
				<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="revoke">
457
					<thead>
458
					<tr>
459
						<th width="90%" class="listhdrr" colspan="3"><b><?php echo gettext("Currently Revoked Certificates for CRL") . ': ' . htmlspecialchars($crl['descr']); ?></b></th>
460
						<th width="10%" class="list"></th>
461
					</tr>
462
					<tr>
463
						<th width="30%" class="listhdrr"><b><?php echo gettext("Certificate Name")?></b></th>
464
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revocation Reason")?></b></th>
465
						<th width="30%" class="listhdrr"><b><?php echo gettext("Revoked At")?></b></th>
466
						<th width="10%" class="list"></th>
467
					</tr>
468
					</thead>
469
					<tbody>
470
				<?php /* List Certs on CRL */
471
					if (!is_array($crl['cert']) || (count($crl['cert']) == 0)): ?>
472
					<tr>
473
						<td class="listlr" colspan="3">
474
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CRL."); ?>
475
						</td>
476
						<td class="list">&nbsp;</td>
477
					</tr>
478
				<?php	else:
479
					foreach($crl['cert'] as $i => $cert):
480
				 ?>
481
					<tr>
482
						<td class="listlr">
483
							<?php echo htmlspecialchars($cert['descr']); ?>
484
						</td>
485
						<td class="listlr">
486
							<?php echo $openssl_crl_status[$cert["reason"]]; ?>
487
						</td>
488
						<td class="listlr">
489
							<?php echo date("D M j G:i:s T Y", $cert["revoke_time"]); ?>
490
						</td>
491
						<td class="list">
492
							<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?");?>')">
493
								<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" />
494
							</a>
495
						</td>
496
					</tr>
497
					<?php
498
					endforeach;
499
					endif;
500
					?>
501
				<?php /* Drop-down with other certs from this CA. */
502
					// Map Certs to CAs in one pass
503
					$ca_certs = array();
504
					foreach($a_cert as $cert)
505
						if ($cert['caref'] == $crl['caref'])
506
							$ca_certs[] = $cert;
507
					if (count($ca_certs) == 0): ?>
508
					<tr>
509
						<td class="listlr" colspan="3">
510
							&nbsp;&nbsp;&nbsp;&nbsp;<?php echo gettext("No Certificates Found for this CA."); ?>
511
						</td>
512
						<td class="list">&nbsp;</td>
513
					</tr>
514
				<?php	else: ?>
515
					<tr>
516
						<td class="listlr" colspan="3" align="center">
517
							<b><?php echo gettext("Choose a Certificate to Revoke"); ?></b>: <select name='certref' id='certref' class="formselect">
518
				<?php	$rowIndex = 0;
519
						foreach($ca_certs as $cert): 
520
							$rowIndex++; ?>
521
							<option value="<?=$cert['refid'];?>"><?=htmlspecialchars($cert['descr'])?></option>
522
				<?php	endforeach;
523
						if ($rowIndex == 0)
524
							echo "<option></option>"; ?>
525
							</select>
526
							<b><?php echo gettext("Reason");?></b>:
527
							<select name='crlreason' id='crlreason' class="formselect">
528
				<?php	$rowIndex = 0;
529
						foreach($openssl_crl_status as $code => $reason): 
530
							$rowIndex++; ?>
531
							<option value="<?= $code ?>"><?= htmlspecialchars($reason) ?></option>
532
				<?php	endforeach;
533
						if ($rowIndex == 0)
534
							echo "<option></option>"; ?>
535
							</select>
536
							<input name="act" type="hidden" value="addcert" />
537
							<input name="crlref" type="hidden" value="<?=$crl['refid'];?>" />
538
							<input name="id" type="hidden" value="<?=$crl['refid'];?>" />
539
							<input id="submit" name="add" type="submit" class="formbtn" value="<?=gettext("Add"); ?>" />
540
						</td>
541
						<td class="list">&nbsp;</td>
542
					</tr>
543
				<?php	endif; ?>
544
					</tbody>
545
				</table>
546
				</form>
547
				<?php else: ?>
548

    
549
				<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ocpms">
550
					<thead>
551
					<tr>
552
						<td width="35%" class="listhdrr"><?=gettext("Name");?></td>
553
						<td width="10%" class="listhdrr"><?=gettext("Internal");?></td>
554
						<td width="35%" class="listhdrr"><?=gettext("Certificates");?></td>
555
						<td width="10%" class="listhdrr"><?=gettext("In Use");?></td>
556
						<td width="10%" class="list"></td>
557
					</tr>
558
					</thead>
559
					<tfoot>
560
					<tr>
561
						<td colspan="5">
562
							<p>
563
								<?=gettext("Additional Certificate Revocation Lists can be added here.");?>
564
							</p>
565
						</td>
566
					</tr>
567
					</tfoot>					<tbody>
568
					<?php
569
						$caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
570
						// Map CRLs to CAs in one pass
571
						$ca_crl_map = array();
572
						foreach($a_crl as $crl)
573
							$ca_crl_map[$crl['caref']][] = $crl['refid'];
574

    
575
						$i = 0;
576
						foreach($a_ca as $ca):
577
							if($ca['prv']) {
578
								$cainternal = "YES";
579
							} else 
580
								$cainternal = "NO";
581
					?>
582
					<tr>
583
						<td class="listlr" colspan="4">
584
							<table border="0" cellpadding="0" cellspacing="0" summary="icon">
585
								<tr>
586
									<td align="left" valign="middle">
587
										<img src="<?=$caimg;?>" alt="CA" title="CA" border="0" height="16" width="16" />
588
									</td>
589
									<td align="left" valign="middle">
590
										<?=htmlspecialchars($ca['descr']);?>
591
									</td>
592
								</tr>
593
							</table>
594
						</td>
595
						<td class="list">
596
						<?php if ($cainternal == "YES"): ?>
597
							<a href="system_crlmanager.php?act=new&amp;caref=<?php echo $ca['refid']; ?>">
598
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Add or Import CRL for %s"),htmlspecialchars($ca['descr']));?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
599
							</a>
600
						<?php else: ?>
601
							<a href="system_crlmanager.php?act=new&amp;caref=<?php echo $ca['refid']; ?>&amp;importonly=yes">
602
								<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Import CRL for %s"),htmlspecialchars($ca['descr']));?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" />
603
							</a>
604
						<?php endif; ?>
605
						</td>
606
					</tr>
607
					
608
						<?php
609
						if (is_array($ca_crl_map[$ca['refid']])):
610
							foreach($ca_crl_map[$ca['refid']] as $crl):
611
								$tmpcrl = lookup_crl($crl);
612
								$internal = is_crl_internal($tmpcrl);
613
								$inuse = crl_in_use($tmpcrl['refid']);
614
						?>
615
					<tr>
616
						<td class="listlr"><?php echo htmlspecialchars($tmpcrl['descr']); ?></td>
617
						<td class="listr"><?php echo ($internal) ? "YES" : "NO"; ?></td>
618
						<td class="listr"><?php echo ($internal) ? count($tmpcrl['cert']) : "Unknown (imported)"; ?></td>
619
						<td class="listr"><?php echo ($inuse) ? "YES" : "NO"; ?></td>
620
						<td valign="middle" class="list nowrap">
621
							<a href="system_crlmanager.php?act=exp&amp;id=<?=$tmpcrl['refid'];?>">
622
								<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" />
623
							</a>
624
							<?php if ($internal): ?>
625
							<a href="system_crlmanager.php?act=edit&amp;id=<?=$tmpcrl['refid'];?>">
626
								<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" />
627
							</a>
628
							<?php else: ?>
629
							<a href="system_crlmanager.php?act=editimported&amp;id=<?=$tmpcrl['refid'];?>">
630
								<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" />
631
							</a>
632
							<?php endif; ?>
633
							<?php if (!$inuse): ?>
634
							<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']) . ')';?>')">
635
								<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" />
636
							</a>
637
							<?php endif; ?>
638
						</td>
639
					</tr>
640
						<?php
641
								$i++;
642
							endforeach;
643
						endif;
644
						?>
645
					<tr><td colspan="5">&nbsp;</td></tr>
646
					<?php
647
							$i++;
648
						endforeach;
649
					?>
650
					</tbody>
651
				</table>
652

    
653
				<?php endif; ?>
654

    
655
			</div>
656
		</td>
657
	</tr>
658
</table>
659
<?php include("fend.inc");?>
660
<script type="text/javascript">
661
//<![CDATA[
662

    
663
method_change();
664

    
665
//]]>
666
</script>
667

    
668
</body>
669
</html>
(209-209/251)