1 |
64cc39d3
|
Matthew Grooms
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
system_camanager.php
|
4 |
|
|
|
5 |
|
|
Copyright (C) 2008 Shrew Soft Inc.
|
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 |
1d333258
|
Scott Ullrich
|
/*
|
30 |
|
|
pfSense_MODULE: certificate_managaer
|
31 |
|
|
*/
|
32 |
64cc39d3
|
Matthew Grooms
|
|
33 |
|
|
##|+PRIV
|
34 |
|
|
##|*IDENT=page-system-camanager
|
35 |
|
|
##|*NAME=System: CA Manager
|
36 |
|
|
##|*DESCR=Allow access to the 'System: CA Manager' page.
|
37 |
|
|
##|*MATCH=system_camanager.php*
|
38 |
|
|
##|-PRIV
|
39 |
|
|
|
40 |
|
|
require("guiconfig.inc");
|
41 |
742d9c2d
|
Ermal Lu?i
|
require_once("certs.inc");
|
42 |
64cc39d3
|
Matthew Grooms
|
|
43 |
|
|
$ca_methods = array(
|
44 |
a37753d7
|
Vinicius Coque
|
"existing" => gettext("Import an existing Certificate Authority"),
|
45 |
|
|
"internal" => gettext("Create an internal Certificate Authority"));
|
46 |
64cc39d3
|
Matthew Grooms
|
|
47 |
|
|
$ca_keylens = array( "512", "1024", "2048", "4096");
|
48 |
|
|
|
49 |
a37753d7
|
Vinicius Coque
|
$pgtitle = array(gettext("System"), gettext("Certificate Authority Manager"));
|
50 |
64cc39d3
|
Matthew Grooms
|
|
51 |
|
|
$id = $_GET['id'];
|
52 |
|
|
if (isset($_POST['id']))
|
53 |
|
|
$id = $_POST['id'];
|
54 |
|
|
|
55 |
b4e6524c
|
jim-p
|
if (!is_array($config['ca']))
|
56 |
|
|
$config['ca'] = array();
|
57 |
64cc39d3
|
Matthew Grooms
|
|
58 |
b4e6524c
|
jim-p
|
$a_ca =& $config['ca'];
|
59 |
64cc39d3
|
Matthew Grooms
|
|
60 |
b4e6524c
|
jim-p
|
if (!is_array($config['cert']))
|
61 |
|
|
$config['cert'] = array();
|
62 |
64cc39d3
|
Matthew Grooms
|
|
63 |
b4e6524c
|
jim-p
|
$a_cert =& $config['cert'];
|
64 |
64cc39d3
|
Matthew Grooms
|
|
65 |
|
|
$act = $_GET['act'];
|
66 |
|
|
if ($_POST['act'])
|
67 |
|
|
$act = $_POST['act'];
|
68 |
|
|
|
69 |
|
|
if ($act == "del") {
|
70 |
|
|
|
71 |
|
|
if (!$a_ca[$id]) {
|
72 |
|
|
pfSenseHeader("system_camanager.php");
|
73 |
|
|
exit;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
$index = count($a_cert) - 1;
|
77 |
|
|
for (;$index >=0; $index--)
|
78 |
|
|
if ($a_cert[$index]['caref'] == $a_ca[$id]['refid'])
|
79 |
|
|
unset($a_cert[$index]);
|
80 |
|
|
|
81 |
f2a86ca9
|
jim-p
|
$name = $a_ca[$id]['descr'];
|
82 |
64cc39d3
|
Matthew Grooms
|
unset($a_ca[$id]);
|
83 |
|
|
write_config();
|
84 |
ea53e38f
|
Renato Botelho
|
$savemsg = sprintf(gettext("Certificate Authority %s successfully deleted"), $name) . "<br/>";
|
85 |
64cc39d3
|
Matthew Grooms
|
}
|
86 |
|
|
|
87 |
|
|
if ($act == "new") {
|
88 |
|
|
$pconfig['method'] = $_GET['method'];
|
89 |
|
|
$pconfig['keylen'] = "2048";
|
90 |
cf360495
|
Chris Buechler
|
$pconfig['lifetime'] = "3650";
|
91 |
64cc39d3
|
Matthew Grooms
|
$pconfig['dn_commonname'] = "internal-ca";
|
92 |
|
|
}
|
93 |
|
|
|
94 |
93823b10
|
Matthew Grooms
|
if ($act == "exp") {
|
95 |
|
|
|
96 |
|
|
if (!$a_ca[$id]) {
|
97 |
|
|
pfSenseHeader("system_camanager.php");
|
98 |
|
|
exit;
|
99 |
|
|
}
|
100 |
|
|
|
101 |
f2a86ca9
|
jim-p
|
$exp_name = urlencode("{$a_ca[$id]['descr']}.crt");
|
102 |
93823b10
|
Matthew Grooms
|
$exp_data = base64_decode($a_ca[$id]['crt']);
|
103 |
|
|
$exp_size = strlen($exp_data);
|
104 |
|
|
|
105 |
|
|
header("Content-Type: application/octet-stream");
|
106 |
|
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
107 |
|
|
header("Content-Length: $exp_size");
|
108 |
|
|
echo $exp_data;
|
109 |
|
|
exit;
|
110 |
|
|
}
|
111 |
|
|
|
112 |
ecefc738
|
jim-p
|
if ($act == "expkey") {
|
113 |
|
|
|
114 |
|
|
if (!$a_ca[$id]) {
|
115 |
|
|
pfSenseHeader("system_camanager.php");
|
116 |
|
|
exit;
|
117 |
|
|
}
|
118 |
|
|
|
119 |
f2a86ca9
|
jim-p
|
$exp_name = urlencode("{$a_ca[$id]['descr']}.key");
|
120 |
ecefc738
|
jim-p
|
$exp_data = base64_decode($a_ca[$id]['prv']);
|
121 |
|
|
$exp_size = strlen($exp_data);
|
122 |
|
|
|
123 |
|
|
header("Content-Type: application/octet-stream");
|
124 |
|
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
125 |
|
|
header("Content-Length: $exp_size");
|
126 |
|
|
echo $exp_data;
|
127 |
|
|
exit;
|
128 |
|
|
}
|
129 |
|
|
|
130 |
64cc39d3
|
Matthew Grooms
|
if ($_POST) {
|
131 |
|
|
|
132 |
|
|
unset($input_errors);
|
133 |
|
|
$pconfig = $_POST;
|
134 |
|
|
|
135 |
|
|
/* input validation */
|
136 |
|
|
if ($pconfig['method'] == "existing") {
|
137 |
5293bfec
|
jim-p
|
$reqdfields = explode(" ", "descr cert");
|
138 |
38fb1109
|
Vinicius Coque
|
$reqdfieldsn = array(
|
139 |
|
|
gettext("Descriptive name"),
|
140 |
|
|
gettext("Certificate data"));
|
141 |
64cc39d3
|
Matthew Grooms
|
}
|
142 |
|
|
if ($pconfig['method'] == "internal") {
|
143 |
|
|
$reqdfields = explode(" ",
|
144 |
5293bfec
|
jim-p
|
"descr keylen lifetime dn_country dn_state dn_city ".
|
145 |
64cc39d3
|
Matthew Grooms
|
"dn_organization dn_email dn_commonname");
|
146 |
38fb1109
|
Vinicius Coque
|
$reqdfieldsn = array(
|
147 |
|
|
gettext("Descriptive name"),
|
148 |
|
|
gettext("Key length"),
|
149 |
|
|
gettext("Lifetime"),
|
150 |
|
|
gettext("Distinguished name Country Code"),
|
151 |
|
|
gettext("Distinguished name State or Province"),
|
152 |
|
|
gettext("Distinguished name City"),
|
153 |
|
|
gettext("Distinguished name Organization"),
|
154 |
|
|
gettext("Distinguished name Email Address"),
|
155 |
a37753d7
|
Vinicius Coque
|
gettext("Distinguished name Common Name"));
|
156 |
64cc39d3
|
Matthew Grooms
|
}
|
157 |
|
|
|
158 |
|
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
159 |
|
|
|
160 |
|
|
/* if this is an AJAX caller then handle via JSON */
|
161 |
|
|
if (isAjax() && is_array($input_errors)) {
|
162 |
|
|
input_errors2Ajax($input_errors);
|
163 |
|
|
exit;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
/* save modifications */
|
167 |
|
|
if (!$input_errors) {
|
168 |
|
|
|
169 |
|
|
$ca = array();
|
170 |
|
|
$ca['refid'] = uniqid();
|
171 |
|
|
if (isset($id) && $a_ca[$id])
|
172 |
|
|
$ca = $a_ca[$id];
|
173 |
|
|
|
174 |
f2a86ca9
|
jim-p
|
$ca['descr'] = $pconfig['descr'];
|
175 |
64cc39d3
|
Matthew Grooms
|
|
176 |
|
|
if ($pconfig['method'] == "existing")
|
177 |
ecefc738
|
jim-p
|
ca_import($ca, $pconfig['cert'], $pconfig['key']);
|
178 |
64cc39d3
|
Matthew Grooms
|
|
179 |
|
|
if ($pconfig['method'] == "internal")
|
180 |
|
|
{
|
181 |
|
|
$dn = array(
|
182 |
|
|
'countryName' => $pconfig['dn_country'],
|
183 |
|
|
'stateOrProvinceName' => $pconfig['dn_state'],
|
184 |
|
|
'localityName' => $pconfig['dn_city'],
|
185 |
|
|
'organizationName' => $pconfig['dn_organization'],
|
186 |
|
|
'emailAddress' => $pconfig['dn_email'],
|
187 |
|
|
'commonName' => $pconfig['dn_commonname']);
|
188 |
|
|
|
189 |
|
|
ca_create($ca, $pconfig['keylen'], $pconfig['lifetime'], $dn);
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
if (isset($id) && $a_ca[$id])
|
193 |
|
|
$a_ca[$id] = $ca;
|
194 |
|
|
else
|
195 |
|
|
$a_ca[] = $ca;
|
196 |
|
|
|
197 |
|
|
write_config();
|
198 |
|
|
|
199 |
|
|
// pfSenseHeader("system_camanager.php");
|
200 |
|
|
}
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
include("head.inc");
|
204 |
|
|
?>
|
205 |
|
|
|
206 |
|
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
207 |
|
|
<?php include("fbegin.inc"); ?>
|
208 |
|
|
<script type="text/javascript">
|
209 |
|
|
<!--
|
210 |
|
|
|
211 |
|
|
function method_change() {
|
212 |
|
|
|
213 |
|
|
method = document.iform.method.selectedIndex;
|
214 |
|
|
|
215 |
|
|
switch (method) {
|
216 |
|
|
case 0:
|
217 |
|
|
document.getElementById("existing").style.display="";
|
218 |
|
|
document.getElementById("internal").style.display="none";
|
219 |
|
|
break;
|
220 |
|
|
case 1:
|
221 |
|
|
document.getElementById("existing").style.display="none";
|
222 |
|
|
document.getElementById("internal").style.display="";
|
223 |
|
|
break;
|
224 |
|
|
}
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
//-->
|
228 |
|
|
</script>
|
229 |
|
|
<?php
|
230 |
|
|
if ($input_errors)
|
231 |
|
|
print_input_errors($input_errors);
|
232 |
|
|
if ($savemsg)
|
233 |
|
|
print_info_box($savemsg);
|
234 |
|
|
?>
|
235 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
236 |
|
|
<tr>
|
237 |
96c7a492
|
Matthew Grooms
|
<td>
|
238 |
64cc39d3
|
Matthew Grooms
|
<?php
|
239 |
|
|
$tab_array = array();
|
240 |
|
|
$tab_array[] = array(gettext("CAs"), true, "system_camanager.php");
|
241 |
|
|
$tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php");
|
242 |
3d57d2d5
|
jim-p
|
$tab_array[] = array(gettext("Certificate Revocation"), false, "system_crlmanager.php");
|
243 |
64cc39d3
|
Matthew Grooms
|
display_top_tabs($tab_array);
|
244 |
|
|
?>
|
245 |
|
|
</td>
|
246 |
|
|
</tr>
|
247 |
|
|
<tr>
|
248 |
96c7a492
|
Matthew Grooms
|
<td id="mainarea">
|
249 |
|
|
<div class="tabcont">
|
250 |
|
|
|
251 |
ea53e38f
|
Renato Botelho
|
<?php if ($act == "new" || $act == gettext("Save") || $input_errors): ?>
|
252 |
96c7a492
|
Matthew Grooms
|
|
253 |
|
|
<form action="system_camanager.php" method="post" name="iform" id="iform">
|
254 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
255 |
|
|
<tr>
|
256 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
|
257 |
|
|
<td width="78%" class="vtable">
|
258 |
f2a86ca9
|
jim-p
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>"/>
|
259 |
96c7a492
|
Matthew Grooms
|
</td>
|
260 |
|
|
</tr>
|
261 |
|
|
<?php if (!isset($id)): ?>
|
262 |
|
|
<tr>
|
263 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Method");?></td>
|
264 |
|
|
<td width="78%" class="vtable">
|
265 |
|
|
<select name='method' id='method' class="formselect" onchange='method_change()'>
|
266 |
|
|
<?php
|
267 |
|
|
foreach($ca_methods as $method => $desc):
|
268 |
|
|
$selected = "";
|
269 |
|
|
if ($pconfig['method'] == $method)
|
270 |
|
|
$selected = "selected";
|
271 |
|
|
?>
|
272 |
|
|
<option value="<?=$method;?>"<?=$selected;?>><?=$desc;?></option>
|
273 |
|
|
<?php endforeach; ?>
|
274 |
|
|
</select>
|
275 |
|
|
</td>
|
276 |
|
|
</tr>
|
277 |
|
|
<?php endif; ?>
|
278 |
|
|
</table>
|
279 |
|
|
|
280 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="existing">
|
281 |
|
|
<tr>
|
282 |
|
|
<td colspan="2" class="list" height="12"></td>
|
283 |
|
|
</tr>
|
284 |
|
|
<tr>
|
285 |
a37753d7
|
Vinicius Coque
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Existing Certificate Authority");?></td>
|
286 |
96c7a492
|
Matthew Grooms
|
</tr>
|
287 |
|
|
|
288 |
|
|
<tr>
|
289 |
a37753d7
|
Vinicius Coque
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate data");?></td>
|
290 |
96c7a492
|
Matthew Grooms
|
<td width="78%" class="vtable">
|
291 |
|
|
<textarea name="cert" id="cert" cols="65" rows="7" class="formfld_cert"><?=$pconfig['cert'];?></textarea>
|
292 |
|
|
<br>
|
293 |
a37753d7
|
Vinicius Coque
|
<?=gettext("Paste a certificate in X.509 PEM format here.");?></td>
|
294 |
96c7a492
|
Matthew Grooms
|
</td>
|
295 |
|
|
</tr>
|
296 |
ecefc738
|
jim-p
|
<tr>
|
297 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate Private Key");?><br/><?=gettext("(optional)");?></td>
|
298 |
|
|
<td width="78%" class="vtable">
|
299 |
|
|
<textarea name="key" id="key" cols="65" rows="7" class="formfld_cert"><?=$pconfig['key'];?></textarea>
|
300 |
|
|
<br>
|
301 |
|
|
<?=gettext("Paste the private key for the above certificate here. This is optional in most cases, but required if you need to generate a Certificate Revocation List (CRL).");?></td>
|
302 |
|
|
</td>
|
303 |
|
|
</tr>
|
304 |
96c7a492
|
Matthew Grooms
|
</table>
|
305 |
|
|
|
306 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="internal">
|
307 |
|
|
<tr>
|
308 |
|
|
<td colspan="2" class="list" height="12"></td>
|
309 |
|
|
</tr>
|
310 |
|
|
<tr>
|
311 |
a37753d7
|
Vinicius Coque
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Internal Certificate Authority");?></td>
|
312 |
96c7a492
|
Matthew Grooms
|
</tr>
|
313 |
|
|
<tr>
|
314 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
|
315 |
|
|
<td width="78%" class="vtable">
|
316 |
|
|
<select name='keylen' id='keylen' class="formselect">
|
317 |
|
|
<?php
|
318 |
|
|
foreach( $ca_keylens as $len):
|
319 |
|
|
$selected = "";
|
320 |
|
|
if ($pconfig['keylen'] == $len)
|
321 |
|
|
$selected = "selected";
|
322 |
|
|
?>
|
323 |
|
|
<option value="<?=$len;?>"<?=$selected;?>><?=$len;?></option>
|
324 |
|
|
<?php endforeach; ?>
|
325 |
|
|
</select>
|
326 |
ea53e38f
|
Renato Botelho
|
<?=gettext("bits");?>
|
327 |
96c7a492
|
Matthew Grooms
|
</td>
|
328 |
|
|
</tr>
|
329 |
|
|
<tr>
|
330 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
|
331 |
|
|
<td width="78%" class="vtable">
|
332 |
|
|
<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>"/>
|
333 |
ea53e38f
|
Renato Botelho
|
<?=gettext("days");?>
|
334 |
96c7a492
|
Matthew Grooms
|
</td>
|
335 |
|
|
</tr>
|
336 |
|
|
<tr>
|
337 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Distinguished name");?></td>
|
338 |
|
|
<td width="78%" class="vtable">
|
339 |
|
|
<table border="0" cellspacing="0" cellpadding="2">
|
340 |
|
|
<tr>
|
341 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("Country Code");?> : </td>
|
342 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
343 |
cee476e8
|
Ermal Lu?i
|
<input name="dn_country" type="text" class="formfld unknown" maxlength="2" size="2" value="<?=htmlspecialchars($pconfig['dn_country']);?>"/>
|
344 |
96c7a492
|
Matthew Grooms
|
|
345 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
346 |
96c7a492
|
Matthew Grooms
|
|
347 |
a37753d7
|
Vinicius Coque
|
<?=gettext("US");?>
|
348 |
|
|
<em><?=gettext("( two letters )");?></em>
|
349 |
96c7a492
|
Matthew Grooms
|
</td>
|
350 |
|
|
</tr>
|
351 |
|
|
<tr>
|
352 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("State or Province");?> : </td>
|
353 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
354 |
|
|
<input name="dn_state" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_state']);?>"/>
|
355 |
|
|
|
356 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
357 |
96c7a492
|
Matthew Grooms
|
|
358 |
a37753d7
|
Vinicius Coque
|
<?=gettext("Texas");?>
|
359 |
96c7a492
|
Matthew Grooms
|
</td>
|
360 |
|
|
</tr>
|
361 |
|
|
<tr>
|
362 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("City");?> : </td>
|
363 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
364 |
|
|
<input name="dn_city" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_city']);?>"/>
|
365 |
|
|
|
366 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
367 |
96c7a492
|
Matthew Grooms
|
|
368 |
a37753d7
|
Vinicius Coque
|
<?=gettext("Austin");?>
|
369 |
96c7a492
|
Matthew Grooms
|
</td>
|
370 |
|
|
</tr>
|
371 |
|
|
<tr>
|
372 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("Organization");?> : </td>
|
373 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
374 |
|
|
<input name="dn_organization" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_organization']);?>"/>
|
375 |
|
|
|
376 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
377 |
96c7a492
|
Matthew Grooms
|
|
378 |
a37753d7
|
Vinicius Coque
|
<?=gettext("My Company Inc.");?>
|
379 |
96c7a492
|
Matthew Grooms
|
</td>
|
380 |
|
|
</tr>
|
381 |
|
|
<tr>
|
382 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("Email Address");?> : </td>
|
383 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
384 |
|
|
<input name="dn_email" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['dn_email']);?>"/>
|
385 |
|
|
|
386 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
387 |
96c7a492
|
Matthew Grooms
|
|
388 |
a37753d7
|
Vinicius Coque
|
<?=gettext("admin@mycompany.com");?>
|
389 |
96c7a492
|
Matthew Grooms
|
</td>
|
390 |
|
|
</tr>
|
391 |
|
|
<tr>
|
392 |
a37753d7
|
Vinicius Coque
|
<td align="right"><?=gettext("Common Name");?> : </td>
|
393 |
96c7a492
|
Matthew Grooms
|
<td align="left">
|
394 |
|
|
<input name="dn_commonname" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['dn_commonname']);?>"/>
|
395 |
|
|
|
396 |
ea53e38f
|
Renato Botelho
|
<em><?=gettext("ex:");?></em>
|
397 |
96c7a492
|
Matthew Grooms
|
|
398 |
a37753d7
|
Vinicius Coque
|
<?=gettext("internal-ca");?>
|
399 |
96c7a492
|
Matthew Grooms
|
</td>
|
400 |
|
|
</tr>
|
401 |
|
|
</table>
|
402 |
|
|
</td>
|
403 |
|
|
</tr>
|
404 |
|
|
</table>
|
405 |
|
|
|
406 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
407 |
|
|
<tr>
|
408 |
|
|
<td width="22%" valign="top"> </td>
|
409 |
|
|
<td width="78%">
|
410 |
443ddf6f
|
Carlos Eduardo Ramos
|
<input id="submit" name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
|
411 |
96c7a492
|
Matthew Grooms
|
<?php if (isset($id) && $a_ca[$id]): ?>
|
412 |
|
|
<input name="id" type="hidden" value="<?=$id;?>" />
|
413 |
|
|
<?php endif;?>
|
414 |
|
|
</td>
|
415 |
|
|
</tr>
|
416 |
|
|
</table>
|
417 |
|
|
</form>
|
418 |
|
|
|
419 |
|
|
<?php else: ?>
|
420 |
|
|
|
421 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
422 |
64cc39d3
|
Matthew Grooms
|
<tr>
|
423 |
a37753d7
|
Vinicius Coque
|
<td width="20%" class="listhdrr"><?=gettext("Name");?></td>
|
424 |
|
|
<td width="10%" class="listhdrr"><?=gettext("Internal");?></td>
|
425 |
|
|
<td width="10%" class="listhdrr"><?=gettext("Issuer");?></td>
|
426 |
|
|
<td width="10%" class="listhdrr"><?=gettext("Certificates");?></td>
|
427 |
|
|
<td width="40%" class="listhdrr"><?=gettext("Distinguished Name");?></td>
|
428 |
96c7a492
|
Matthew Grooms
|
<td width="10%" class="list"></td>
|
429 |
64cc39d3
|
Matthew Grooms
|
</tr>
|
430 |
96c7a492
|
Matthew Grooms
|
<?php
|
431 |
|
|
$i = 0;
|
432 |
|
|
foreach($a_ca as $ca):
|
433 |
f2a86ca9
|
jim-p
|
$name = htmlspecialchars($ca['descr']);
|
434 |
96c7a492
|
Matthew Grooms
|
$subj = cert_get_subject($ca['crt']);
|
435 |
2cf6ddcb
|
Nigel Graham
|
$issuer = cert_get_issuer($ca['crt']);
|
436 |
|
|
if($subj == $issuer)
|
437 |
a37753d7
|
Vinicius Coque
|
$issuer_name = "<em>" . gettext("self-signed") . "</em>";
|
438 |
2cf6ddcb
|
Nigel Graham
|
else
|
439 |
a37753d7
|
Vinicius Coque
|
$issuer_name = "<em>" . gettext("external") . "</em>";
|
440 |
96c7a492
|
Matthew Grooms
|
$subj = htmlspecialchars($subj);
|
441 |
2cf6ddcb
|
Nigel Graham
|
$issuer = htmlspecialchars($issuer);
|
442 |
96c7a492
|
Matthew Grooms
|
$certcount = 0;
|
443 |
|
|
|
444 |
2cf6ddcb
|
Nigel Graham
|
$issuer_ca = lookup_ca($ca['caref']);
|
445 |
|
|
if ($issuer_ca)
|
446 |
f2a86ca9
|
jim-p
|
$issuer_name = $issuer_ca['descr'];
|
447 |
2cf6ddcb
|
Nigel Graham
|
|
448 |
96c7a492
|
Matthew Grooms
|
// TODO : Need gray certificate icon
|
449 |
|
|
|
450 |
|
|
if($ca['prv']) {
|
451 |
|
|
$caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
|
452 |
|
|
$internal = "YES";
|
453 |
|
|
|
454 |
|
|
} else {
|
455 |
|
|
$caimg = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
|
456 |
|
|
$internal = "NO";
|
457 |
|
|
}
|
458 |
2cf6ddcb
|
Nigel Graham
|
foreach ($a_cert as $cert)
|
459 |
|
|
if ($cert['caref'] == $ca['refid'])
|
460 |
|
|
$certcount++;
|
461 |
|
|
foreach ($a_ca as $cert)
|
462 |
|
|
if ($cert['caref'] == $ca['refid'])
|
463 |
|
|
$certcount++;
|
464 |
96c7a492
|
Matthew Grooms
|
?>
|
465 |
64cc39d3
|
Matthew Grooms
|
<tr>
|
466 |
96c7a492
|
Matthew Grooms
|
<td class="listlr">
|
467 |
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
468 |
64cc39d3
|
Matthew Grooms
|
<tr>
|
469 |
96c7a492
|
Matthew Grooms
|
<td align="left" valign="center">
|
470 |
|
|
<img src="<?=$caimg;?>" alt="CA" title="CA" border="0" height="16" width="16" />
|
471 |
64cc39d3
|
Matthew Grooms
|
</td>
|
472 |
96c7a492
|
Matthew Grooms
|
<td align="left" valign="middle">
|
473 |
|
|
<?=$name;?>
|
474 |
64cc39d3
|
Matthew Grooms
|
</td>
|
475 |
|
|
</tr>
|
476 |
|
|
</table>
|
477 |
|
|
</td>
|
478 |
96c7a492
|
Matthew Grooms
|
<td class="listr"><?=$internal;?> </td>
|
479 |
2cf6ddcb
|
Nigel Graham
|
<td class="listr"><?=$issuer_name;?> </td>
|
480 |
96c7a492
|
Matthew Grooms
|
<td class="listr"><?=$certcount;?> </td>
|
481 |
|
|
<td class="listr"><?=$subj;?> </td>
|
482 |
|
|
<td valign="middle" nowrap class="list">
|
483 |
|
|
<a href="system_camanager.php?act=exp&id=<?=$i;?>")">
|
484 |
a37753d7
|
Vinicius Coque
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export ca");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" />
|
485 |
96c7a492
|
Matthew Grooms
|
</a>
|
486 |
ecefc738
|
jim-p
|
<?php if ($ca['prv']): ?>
|
487 |
|
|
<a href="system_camanager.php?act=expkey&id=<?=$i;?>")">
|
488 |
|
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export ca private key");?>" alt="<?=gettext("export ca private key");?>" width="17" height="17" border="0" />
|
489 |
|
|
</a>
|
490 |
|
|
<?php endif; ?>
|
491 |
22a11a58
|
Larry Gilbert
|
<a href="system_camanager.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate Authority and all associated certificates?");?>')">
|
492 |
2b33f342
|
Renato Botelho
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete ca");?>" alt="<?=gettext("delete ca"); ?>" width="17" height="17" border="0" />
|
493 |
96c7a492
|
Matthew Grooms
|
</a>
|
494 |
|
|
</td>
|
495 |
|
|
</tr>
|
496 |
|
|
<?php
|
497 |
|
|
$i++;
|
498 |
|
|
endforeach;
|
499 |
|
|
?>
|
500 |
|
|
<tr>
|
501 |
2cf6ddcb
|
Nigel Graham
|
<td class="list" colspan="5"></td>
|
502 |
96c7a492
|
Matthew Grooms
|
<td class="list">
|
503 |
|
|
<a href="system_camanager.php?act=new">
|
504 |
a37753d7
|
Vinicius Coque
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add or import ca");?>" alt="<?=gettext("add ca");?>" width="17" height="17" border="0" />
|
505 |
96c7a492
|
Matthew Grooms
|
</a>
|
506 |
|
|
</td>
|
507 |
64cc39d3
|
Matthew Grooms
|
</tr>
|
508 |
|
|
<tr>
|
509 |
2cf6ddcb
|
Nigel Graham
|
<td colspan="5">
|
510 |
96c7a492
|
Matthew Grooms
|
<p>
|
511 |
22a11a58
|
Larry Gilbert
|
<?=gettext("Additional trusted Certificate Authorities can be added here.");?>
|
512 |
96c7a492
|
Matthew Grooms
|
</p>
|
513 |
64cc39d3
|
Matthew Grooms
|
</td>
|
514 |
|
|
</tr>
|
515 |
|
|
</table>
|
516 |
|
|
|
517 |
96c7a492
|
Matthew Grooms
|
<?php endif; ?>
|
518 |
|
|
|
519 |
|
|
</div>
|
520 |
64cc39d3
|
Matthew Grooms
|
</td>
|
521 |
|
|
</tr>
|
522 |
|
|
</table>
|
523 |
|
|
<?php include("fend.inc");?>
|
524 |
|
|
<script type="text/javascript">
|
525 |
|
|
<!--
|
526 |
|
|
|
527 |
|
|
method_change();
|
528 |
|
|
|
529 |
|
|
//-->
|
530 |
|
|
</script>
|
531 |
|
|
|
532 |
|
|
</body>
|