bernd commited on 2009-07-20 16:38:09
Zeige 6 geänderte Dateien mit 415 Einfügungen und 2 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1422 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -0,0 +1,42 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+require_once('certs.php');
|
|
| 4 |
+require_role(ROLE_SYSTEMUSER); |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+$section = "vhosts_certs"; |
|
| 8 |
+$title = "Zertifikat zum CSR hinzufügen"; |
|
| 9 |
+ |
|
| 10 |
+$csr = csr_details($_REQUEST['id']); |
|
| 11 |
+ |
|
| 12 |
+output("<h3>Zertifikat zu CSR hinzufügen</h3>
|
|
| 13 |
+<p>Wenn Ihr CSR von der Zertifizierungsstelle akzeptiert und unterschrieben wurde, erhalten Sie ein SSL-Zertifikat zurück. |
|
| 14 |
+Dieses hat in etwa die Form |
|
| 15 |
+<pre>-----BEGIN CERTIFICATE----- |
|
| 16 |
+... |
|
| 17 |
+-----END CERTIFICATE-----</pre> |
|
| 18 |
+und kann direkt unten eingetragen werden.</p> |
|
| 19 |
+ |
|
| 20 |
+<p>Bitte stellen Sie sicher, dass es sich um das richtige Zertifikat handelt. Der CSR wurde ausgestellt auf den |
|
| 21 |
+Host-/Domainnamen <strong>{$csr['hostname']}</strong>. Nur das dazu passende Zertifikat wird akzeptiert.</p>
|
|
| 22 |
+ |
|
| 23 |
+<p>Wenn die Überprüfung erfolgreich verläuft, wird der CSR in unserer Datenbank gelöscht, er wird nicht mehr benötigt. |
|
| 24 |
+Das Zertifikat und der private Schlüssel werden Ihnen umgehend für Ihre Websites zur Verfügung gestellt.</p>"); |
|
| 25 |
+ |
|
| 26 |
+$form = ' |
|
| 27 |
+<h4>Zertifikat:</h4> |
|
| 28 |
+<p><textarea name="cert" rows="10" cols="70"></textarea></p> |
|
| 29 |
+ |
|
| 30 |
+<p><input type="submit" value="Speichern" /></p> |
|
| 31 |
+ |
|
| 32 |
+'; |
|
| 33 |
+ |
|
| 34 |
+output(html_form('vhosts_certs_new', 'savecert', 'action=new&csr='.$csr['id'], $form));
|
|
| 35 |
+ |
|
| 36 |
+ |
|
| 37 |
+ |
|
| 38 |
+ |
|
| 39 |
+ |
|
| 40 |
+ |
|
| 41 |
+ |
|
| 42 |
+ |
| ... | ... |
@@ -19,7 +19,7 @@ if (count($certs) > 0) |
| 19 | 19 |
output("<table><tr><th>Name/Details</th><th>CommonName</th><th>Gültig ab</th><th>Gültig bis</th><th> </th></tr>");
|
| 20 | 20 |
foreach ($certs as $c) |
| 21 | 21 |
{
|
| 22 |
- output("<tr><td>{$c['subject']}</td><td>{$c['cn']}</td><td>{$c['valid_from']}</td><td>{$c['valid_until']}</td><td>".internal_link('savecert', '<img src="'.$prefix.'images/delete.png" />', 'action=delete&id='.$c['id'])."</td></tr>");
|
|
| 22 |
+ output("<tr><td>".internal_link('showcert', $c['subject'], "mode=cert&id={$c['id']}")."</td><td>{$c['cn']}</td><td>{$c['valid_from']}</td><td>{$c['valid_until']}</td><td>".internal_link('savecert', '<img src="'.$prefix.'images/delete.png" />', 'action=delete&id='.$c['id'])."</td></tr>");
|
|
| 23 | 23 |
} |
| 24 | 24 |
output("</table>");
|
| 25 | 25 |
} |
| ... | ... |
@@ -30,6 +30,30 @@ else |
| 30 | 30 |
|
| 31 | 31 |
output('<p>'.internal_link('newcert', 'Neues Zertifikat hinzufügen').'</p>');
|
| 32 | 32 |
|
| 33 |
+output('<h3>offene CSRs</h3>');
|
|
| 34 |
+ |
|
| 35 |
+$csr = user_csr(); |
|
| 36 |
+if (count($csr) > 0) |
|
| 37 |
+{
|
|
| 38 |
+ output("<table><tr><th>Host-/Domainname</th><th>Bitlänge</th><th>Erzeugt am</th><th> </th></tr>");
|
|
| 39 |
+ foreach ($csr AS $c) |
|
| 40 |
+ {
|
|
| 41 |
+ output("<tr><td>".internal_link('showcert', $c['hostname'], 'mode=csr&id='.$c['id'])."</td><td>{$c['bits']}</td><td>{$c['created']}</td><td>".internal_link('savecert', '<img src="'.$prefix.'images/delete.png" />', 'action=deletecsr&id='.$c['id'])."   ".internal_link('certfromcsr', '<img src="'.$prefix.'images/ok.png" alt="Zertifikat hinzufügen" title="Zertifikat hinzufügen" />', "id={$c['id']}")."</td></tr>");
|
|
| 42 |
+ } |
|
| 43 |
+ output("</table>");
|
|
| 44 |
+} |
|
| 45 |
+else |
|
| 46 |
+{
|
|
| 47 |
+ output('<p><em>Es gibt keine offenen CSRs</em></p>');
|
|
| 48 |
+} |
|
| 49 |
+ |
|
| 50 |
+ |
|
| 51 |
+output('
|
|
| 52 |
+<p>Wenn Sie ein einfaches Zertifikat benötigen, können Sie mit Hilfe dieser Funktion einen CSR (»certificate signing request«) |
|
| 53 |
+erstellen, mit dem Sie Ihr endgültiges Zertifikat beantragen können.</p> |
|
| 54 |
+<p>'.internal_link('newcsr', 'Neuen CSR erzeugen').'</p>');
|
|
| 55 |
+ |
|
| 56 |
+ |
|
| 33 | 57 |
|
| 34 | 58 |
|
| 35 | 59 |
|
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
<?php |
| 2 | 2 |
|
| 3 | 3 |
require_once('inc/base.php');
|
| 4 |
+require_once('inc/security.php');
|
|
| 4 | 5 |
|
| 5 | 6 |
define("CERT_OK", 0);
|
| 6 | 7 |
define("CERT_INVALID", 1);
|
| ... | ... |
@@ -17,19 +18,41 @@ function user_certs() |
| 17 | 18 |
return $ret; |
| 18 | 19 |
} |
| 19 | 20 |
|
| 21 |
+function user_csr() |
|
| 22 |
+{
|
|
| 23 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 24 |
+ $result = db_query("SELECT id, created, hostname, bits FROM vhosts.csr WHERE uid=${uid}");
|
|
| 25 |
+ $ret = array(); |
|
| 26 |
+ while ($i = mysql_fetch_assoc($result)) |
|
| 27 |
+ $ret[] = $i; |
|
| 28 |
+ DEBUG($ret); |
|
| 29 |
+ return $ret; |
|
| 30 |
+} |
|
| 20 | 31 |
|
| 21 | 32 |
function cert_details($id) |
| 22 | 33 |
{
|
| 23 | 34 |
$id = (int) $id; |
| 24 | 35 |
$uid = (int) $_SESSION['userinfo']['uid']; |
| 25 | 36 |
|
| 26 |
- $result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, cert, `key`, cabundle FROM vhosts.certs WHERE uid={$uid} AND id={$id}");
|
|
| 37 |
+ $result = db_query("SELECT id, lastchange, valid_from, valid_until, subject, cn, cert, `key` FROM vhosts.certs WHERE uid={$uid} AND id={$id}");
|
|
| 27 | 38 |
if (mysql_num_rows($result) != 1) |
| 28 | 39 |
system_failure("Ungültiges Zertifikat");
|
| 29 | 40 |
return mysql_fetch_assoc($result); |
| 30 | 41 |
} |
| 31 | 42 |
|
| 32 | 43 |
|
| 44 |
+function csr_details($id) |
|
| 45 |
+{
|
|
| 46 |
+ $id = (int) $id; |
|
| 47 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 48 |
+ |
|
| 49 |
+ $result = db_query("SELECT id, created, hostname, bits, csr, `key` FROM vhosts.csr WHERE uid={$uid} AND id={$id}");
|
|
| 50 |
+ if (mysql_num_rows($result) != 1) |
|
| 51 |
+ system_failure("Ungültiger CSR");
|
|
| 52 |
+ return mysql_fetch_assoc($result); |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+ |
|
| 33 | 56 |
function get_available_CAs() |
| 34 | 57 |
{
|
| 35 | 58 |
$path = '/etc/apache2/certs/cabundle/'; |
| ... | ... |
@@ -98,3 +120,151 @@ function delete_cert($id) |
| 98 | 120 |
db_query("DELETE FROM vhosts.certs WHERE uid={$uid} AND id={$id} LIMIT 1");
|
| 99 | 121 |
} |
| 100 | 122 |
|
| 123 |
+function delete_csr($id) |
|
| 124 |
+{
|
|
| 125 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 126 |
+ $id = (int) $id; |
|
| 127 |
+ |
|
| 128 |
+ db_query("DELETE FROM vhosts.csr WHERE uid={$uid} AND id={$id} LIMIT 1");
|
|
| 129 |
+} |
|
| 130 |
+ |
|
| 131 |
+function create_wildcard_csr($cn, $bits) |
|
| 132 |
+{
|
|
| 133 |
+ $cn = filter_input_hostname($cn); |
|
| 134 |
+ $bits = (int) $bits; |
|
| 135 |
+ if ($bits == 0) |
|
| 136 |
+ $bits = 4096; |
|
| 137 |
+ |
|
| 138 |
+ $keyfile = tempnam(ini_get('upload_tmp_dir'), 'key');
|
|
| 139 |
+ $csrfile = tempnam(ini_get('upload_tmp_dir'), 'csr');
|
|
| 140 |
+ $config = tempnam(ini_get('upload_tmp_dir'), 'config');
|
|
| 141 |
+ |
|
| 142 |
+ DEBUG("key: ".$keyfile." / csr: ".$csrfile." / config: ".$config);
|
|
| 143 |
+ |
|
| 144 |
+ $c = fopen($config, "w"); |
|
| 145 |
+ fwrite($c, "[req] |
|
| 146 |
+default_bits = {$bits}
|
|
| 147 |
+default_keyfile = {$keyfile}
|
|
| 148 |
+encrypt_key = no |
|
| 149 |
+distinguished_name = req_distinguished_name |
|
| 150 |
+req_extensions = v3_req |
|
| 151 |
+ |
|
| 152 |
+[v3_req] |
|
| 153 |
+subjectAltName = DNS:{$cn}, DNS:*.{$cn}
|
|
| 154 |
+ |
|
| 155 |
+[ req_distinguished_name ] |
|
| 156 |
+countryName = Country Name (2 letter code) |
|
| 157 |
+countryName_default = DE |
|
| 158 |
+stateOrProvinceName = State or Province Name (full name) |
|
| 159 |
+stateOrProvinceName_default = Baden-Wuerttemberg |
|
| 160 |
+localityName = Locality Name (eg, city) |
|
| 161 |
+localityName_default = Murrhardt |
|
| 162 |
+0.organizationName = Organization Name (eg, company) |
|
| 163 |
+0.organizationName_default = schokokeks.org |
|
| 164 |
+ |
|
| 165 |
+commonName = Common Name |
|
| 166 |
+commonName_default = *.{$cn}
|
|
| 167 |
+"); |
|
| 168 |
+ fclose($c); |
|
| 169 |
+ |
|
| 170 |
+ $output = ''; |
|
| 171 |
+ $cmdline = "openssl req -new -batch -config {$config} -out {$csrfile}";
|
|
| 172 |
+ $retval = 0; |
|
| 173 |
+ exec($cmdline, $output, $retval); |
|
| 174 |
+ DEBUG($output); |
|
| 175 |
+ DEBUG($retval); |
|
| 176 |
+ if ($retval != 0) |
|
| 177 |
+ {
|
|
| 178 |
+ system_failure("Die Erzeugung des CSR ist fehlgeschlagen. Ausgabe des OpenSSL-Befehls: ".$output);
|
|
| 179 |
+ } |
|
| 180 |
+ |
|
| 181 |
+ $csr = file_get_contents($csrfile); |
|
| 182 |
+ $key = file_get_contents($keyfile); |
|
| 183 |
+ |
|
| 184 |
+ unlink($csrfile); |
|
| 185 |
+ unlink($keyfile); |
|
| 186 |
+ unlink($config); |
|
| 187 |
+ |
|
| 188 |
+ return array($csr, $key); |
|
| 189 |
+} |
|
| 190 |
+ |
|
| 191 |
+ |
|
| 192 |
+ |
|
| 193 |
+function create_csr($cn, $bits) |
|
| 194 |
+{
|
|
| 195 |
+ $cn = filter_input_hostname($cn); |
|
| 196 |
+ $bits = (int) $bits; |
|
| 197 |
+ if ($bits == 0) |
|
| 198 |
+ $bits = 4096; |
|
| 199 |
+ |
|
| 200 |
+ $keyfile = tempnam(ini_get('upload_tmp_dir'), 'key');
|
|
| 201 |
+ $csrfile = tempnam(ini_get('upload_tmp_dir'), 'csr');
|
|
| 202 |
+ $config = tempnam(ini_get('upload_tmp_dir'), 'config');
|
|
| 203 |
+ |
|
| 204 |
+ DEBUG("key: ".$keyfile." / csr: ".$csrfile." / config: ".$config);
|
|
| 205 |
+ |
|
| 206 |
+ $c = fopen($config, "w"); |
|
| 207 |
+ fwrite($c, "[req] |
|
| 208 |
+default_bits = {$bits}
|
|
| 209 |
+default_keyfile = {$keyfile}
|
|
| 210 |
+encrypt_key = no |
|
| 211 |
+distinguished_name = req_distinguished_name |
|
| 212 |
+ |
|
| 213 |
+[ req_distinguished_name ] |
|
| 214 |
+countryName = Country Name (2 letter code) |
|
| 215 |
+countryName_default = DE |
|
| 216 |
+stateOrProvinceName = State or Province Name (full name) |
|
| 217 |
+stateOrProvinceName_default = Baden-Wuerttemberg |
|
| 218 |
+localityName = Locality Name (eg, city) |
|
| 219 |
+localityName_default = Murrhardt |
|
| 220 |
+0.organizationName = Organization Name (eg, company) |
|
| 221 |
+0.organizationName_default = schokokeks.org |
|
| 222 |
+ |
|
| 223 |
+commonName = Common Name |
|
| 224 |
+commonName_default = {$cn}
|
|
| 225 |
+"); |
|
| 226 |
+ fclose($c); |
|
| 227 |
+ |
|
| 228 |
+ $output = ''; |
|
| 229 |
+ $cmdline = "openssl req -new -batch -config {$config} -out {$csrfile}";
|
|
| 230 |
+ $retval = 0; |
|
| 231 |
+ exec($cmdline, $output, $retval); |
|
| 232 |
+ DEBUG($output); |
|
| 233 |
+ DEBUG($retval); |
|
| 234 |
+ if ($retval != 0) |
|
| 235 |
+ {
|
|
| 236 |
+ system_failure("Die Erzeugung des CSR ist fehlgeschlagen. Ausgabe des OpenSSL-Befehls: ".$output);
|
|
| 237 |
+ } |
|
| 238 |
+ |
|
| 239 |
+ $csr = file_get_contents($csrfile); |
|
| 240 |
+ $key = file_get_contents($keyfile); |
|
| 241 |
+ |
|
| 242 |
+ unlink($csrfile); |
|
| 243 |
+ unlink($keyfile); |
|
| 244 |
+ unlink($config); |
|
| 245 |
+ |
|
| 246 |
+ return array($csr, $key); |
|
| 247 |
+} |
|
| 248 |
+ |
|
| 249 |
+ |
|
| 250 |
+ |
|
| 251 |
+function save_csr($cn, $bits, $wildcard=true) |
|
| 252 |
+{
|
|
| 253 |
+ $csr = NULL; |
|
| 254 |
+ $key = NULL; |
|
| 255 |
+ if ($wildcard) |
|
| 256 |
+ list($csr, $key) = create_wildcard_csr($cn, $bits); |
|
| 257 |
+ else |
|
| 258 |
+ list($csr, $key) = create_csr($cn, $bits); |
|
| 259 |
+ |
|
| 260 |
+ $uid = (int) $_SESSION['userinfo']['uid']; |
|
| 261 |
+ $cn = mysql_real_escape_string(filter_input_hostname($cn)); |
|
| 262 |
+ $bits = (int) $bits; |
|
| 263 |
+ $csr = mysql_real_escape_string($csr); |
|
| 264 |
+ $key = mysql_real_escape_string($key); |
|
| 265 |
+ db_query("INSERT INTO vhosts.csr (uid, hostname, bits, csr, `key`) VALUES ({$uid}, '{$cn}', {$bits}, '{$csr}', '{$key}')");
|
|
| 266 |
+ $id = mysql_insert_id(); |
|
| 267 |
+ return $id; |
|
| 268 |
+} |
|
| 269 |
+ |
|
| 270 |
+ |
| ... | ... |
@@ -0,0 +1,39 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+require_once("certs.php");
|
|
| 4 |
+require_role(ROLE_SYSTEMUSER); |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+$title="Neues Zertifikat erzeugen"; |
|
| 8 |
+$section = 'vhosts_certs'; |
|
| 9 |
+ |
|
| 10 |
+ |
|
| 11 |
+output("<h3>Neues Zertifikat (CSR) erzeugen</h3>
|
|
| 12 |
+<p>Mit dieser Funktion können Sie ein neues Zertifikat erzeugen lassen. Dabei wird ein so genannter |
|
| 13 |
+CSR (certifikate signing request) erzeugt. Diesen CSR müssen Sie dann (meistens per Webinterface) an |
|
| 14 |
+Ihre Zertifizierungsstelle übergeben. Von dort erhalten Sie dann das fertige, unterschriebene |
|
| 15 |
+Zertifikat zurück.</p> |
|
| 16 |
+ |
|
| 17 |
+<p>Um diese Funktion möglichst einfach zu halten, können Sie damit nicht alle Einstellungen |
|
| 18 |
+eines CSR festlegen. Insbesondere die Angabe des Inhabers wurde hier entfernt. CAcert (und andere |
|
| 19 |
+günstige CAs) würde diese Zusatzinformationen sowieso aus dem Zertifikat entfernen. Für eigene |
|
| 20 |
+Einstellungen stehen Ihnen die OpenSSL-Programme in Ihrem Benutzeraccount zur Verfügung.</p> |
|
| 21 |
+ |
|
| 22 |
+<p>Bei Eingabe einer Domain (»domain.de«) ohne Subdomain (also nicht »www.domain.de«) wird ein |
|
| 23 |
+<strong>Catch-All-Zertifikat</strong> erstellt, das für sämtliche Subdomains genutzt werden kann. Manche kommerziellen |
|
| 24 |
+Zertifikats-Anbieter akzeptieren keine solchen Zertifikate in den günstigen Tarifen.</p> |
|
| 25 |
+"); |
|
| 26 |
+ |
|
| 27 |
+$bitselect = array(1024 => 1024, 2048 => 2048, 4096 => 4096); |
|
| 28 |
+ |
|
| 29 |
+$form = '<p><label for="commonname">Domain-/Hostname:</label> <input type="text" name="commonname" id="commonname" /></p> |
|
| 30 |
+<p><label for="bitlength">Bitlänge:</label> '.html_select('bitlength', $bitselect, 4096).'</p>
|
|
| 31 |
+<p><input type="submit" value="Erzeugen" /></p>'; |
|
| 32 |
+ |
|
| 33 |
+output(html_form('vhosts_csr', 'savecert', 'action=newcsr', $form));
|
|
| 34 |
+ |
|
| 35 |
+ |
|
| 36 |
+ |
|
| 37 |
+ |
|
| 38 |
+ |
|
| 39 |
+ |
| ... | ... |
@@ -10,6 +10,12 @@ if ($_GET['action'] == 'new') |
| 10 | 10 |
check_form_token('vhosts_certs_new');
|
| 11 | 11 |
$cert = $_POST['cert']; |
| 12 | 12 |
$key = $_POST['key']; |
| 13 |
+ if (! isset($_POST['key']) && isset($_REQUEST['csr'])) |
|
| 14 |
+ {
|
|
| 15 |
+ $csr = csr_details($_REQUEST['csr']); |
|
| 16 |
+ $key = $csr['key']; |
|
| 17 |
+ } |
|
| 18 |
+ |
|
| 13 | 19 |
if (! $cert or ! $key) |
| 14 | 20 |
system_failure('Es muss ein Zertifikat und der dazu passende private Schlüssel eingetragen werden');
|
| 15 | 21 |
|
| ... | ... |
@@ -19,6 +25,8 @@ if ($_GET['action'] == 'new') |
| 19 | 25 |
case CERT_OK: |
| 20 | 26 |
$certinfo = parse_cert_details($cert); |
| 21 | 27 |
save_cert($certinfo, $cert, $key, $cabundle); |
| 28 |
+ if (isset($_REQUEST['csr'])) |
|
| 29 |
+ delete_csr($_REQUEST['csr']); |
|
| 22 | 30 |
header('Location: certs');
|
| 23 | 31 |
die(); |
| 24 | 32 |
break; |
| ... | ... |
@@ -30,6 +38,8 @@ if ($_GET['action'] == 'new') |
| 30 | 38 |
$certinfo = parse_cert_details($cert); |
| 31 | 39 |
save_cert($certinfo, $cert, $key, $cabundle); |
| 32 | 40 |
output('<p>'.internal_link('certs', 'Zurück zur Übersicht').'</p>');
|
| 41 |
+ if (isset($_REQUEST['csr'])) |
|
| 42 |
+ delete_csr($_REQUEST['csr']); |
|
| 33 | 43 |
break; |
| 34 | 44 |
} |
| 35 | 45 |
|
| ... | ... |
@@ -54,6 +64,37 @@ elseif ($_GET['action'] == 'delete') |
| 54 | 64 |
die(); |
| 55 | 65 |
} |
| 56 | 66 |
} |
| 67 |
+elseif ($_GET['action'] == 'deletecsr') |
|
| 68 |
+{
|
|
| 69 |
+ $csr = csr_details($_GET['id']); |
|
| 70 |
+ $sure = user_is_sure(); |
|
| 71 |
+ if ($sure === NULL) |
|
| 72 |
+ {
|
|
| 73 |
+ are_you_sure("action=deletecsr&id={$csr['id']}", "Soll der CSR für »{$csr['hostname']}« ({$csr['bits']} Bits, erstellt am {$csr['created']}) wirklich entfernt werden?");
|
|
| 74 |
+ } |
|
| 75 |
+ elseif ($sure === false) |
|
| 76 |
+ {
|
|
| 77 |
+ header('Location: certs');
|
|
| 78 |
+ die(); |
|
| 79 |
+ } |
|
| 80 |
+ elseif ($sure === true) |
|
| 81 |
+ {
|
|
| 82 |
+ delete_csr($csr['id']); |
|
| 83 |
+ header('Location: certs');
|
|
| 84 |
+ die(); |
|
| 85 |
+ } |
|
| 86 |
+} |
|
| 87 |
+elseif ($_GET['action'] == 'newcsr') |
|
| 88 |
+{
|
|
| 89 |
+ $cn = $_POST['commonname']; |
|
| 90 |
+ $bitlength = $_POST['bitlength']; |
|
| 91 |
+ |
|
| 92 |
+ $wildcard = ! (count(explode('.', $cn)) > 2);
|
|
| 93 |
+ $id = save_csr($cn, $bitlength, $wildcard); |
|
| 94 |
+ |
|
| 95 |
+ header("Location: showcert?mode=csr&id={$id}");
|
|
| 96 |
+ die(); |
|
| 97 |
+} |
|
| 57 | 98 |
else |
| 58 | 99 |
{
|
| 59 | 100 |
system_failure('not implemented');
|
| ... | ... |
@@ -0,0 +1,96 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+require_once('certs.php');
|
|
| 4 |
+require_role(ROLE_SYSTEMUSER); |
|
| 5 |
+ |
|
| 6 |
+$mode = 'cert'; |
|
| 7 |
+if ($_REQUEST['mode'] == 'csr') |
|
| 8 |
+ $mode = 'csr'; |
|
| 9 |
+ |
|
| 10 |
+ |
|
| 11 |
+$section = 'vhosts_certs'; |
|
| 12 |
+ |
|
| 13 |
+ |
|
| 14 |
+if ($mode == 'csr') |
|
| 15 |
+{
|
|
| 16 |
+ $data = csr_details($_REQUEST['id']); |
|
| 17 |
+ $cert = $data['csr']; |
|
| 18 |
+ $key = $data['key']; |
|
| 19 |
+ |
|
| 20 |
+ |
|
| 21 |
+ $title = 'CSR anzeigen'; |
|
| 22 |
+ output("<h3>CSR anzeigen</h3>
|
|
| 23 |
+ <p>Untenstehend sehen Sie Ihren automatisch erzeugten CSR (»certificate signing request«) und evtl. |
|
| 24 |
+ den dazu gehörigen privaten Schlüssel. Sofern Sie den privaten Schlüssel auf Ihrer Festplatte |
|
| 25 |
+ speichern, stellen Sie bitte sicher, dass dieser vor unbefugtem Zugriff geschützt ist. Der |
|
| 26 |
+ private Schlüssel ist selbst <strong>nicht verschlüsselt</strong> und nicht mit einem |
|
| 27 |
+ Passwort geschützt.</p>"); |
|
| 28 |
+ |
|
| 29 |
+ output("<h4>CSR</h4>
|
|
| 30 |
+ <pre> |
|
| 31 |
+{$cert}
|
|
| 32 |
+</pre>"); |
|
| 33 |
+ |
|
| 34 |
+ if ($_REQUEST['private'] == 'yes') |
|
| 35 |
+ {
|
|
| 36 |
+ output("<h4>privater Schlüssel</h4>
|
|
| 37 |
+<pre> |
|
| 38 |
+{$key}
|
|
| 39 |
+</pre>"); |
|
| 40 |
+ } |
|
| 41 |
+ else |
|
| 42 |
+ {
|
|
| 43 |
+ output('<p>'.internal_link('', 'privaten Schlüssel auch anzeigen', "mode={$_REQUEST['mode']}&id={$_REQUEST['id']}&private=yes").'</p>');
|
|
| 44 |
+ } |
|
| 45 |
+ |
|
| 46 |
+ |
|
| 47 |
+ output('<p>'.internal_link('certfromcsr', 'Unterschriebenes Zertifikat eingeben', "id={$_REQUEST['id']}").'</p>');
|
|
| 48 |
+ |
|
| 49 |
+ |
|
| 50 |
+} |
|
| 51 |
+else |
|
| 52 |
+{
|
|
| 53 |
+ $data = cert_details($_REQUEST['id']); |
|
| 54 |
+ $cert = $data['cert']; |
|
| 55 |
+ $key = $data['key']; |
|
| 56 |
+ |
|
| 57 |
+ $title = 'Zertifikat anzeigen'; |
|
| 58 |
+ output("<h3>Zertifikat anzeigen</h3>
|
|
| 59 |
+ <p>Untenstehend sehen Sie Ihr SSL-Zertifikat und evtl. den dazu gehörigen privaten |
|
| 60 |
+ Schlüssel. Sofern Sie den privaten Schlüssel auf Ihrer Festplatte speichern, stellen |
|
| 61 |
+ Sie bitte sicher, dass dieser vor unbefugtem Zugriff geschützt ist. Der private |
|
| 62 |
+ Schlüssel ist selbst <strong>nicht verschlüsselt</strong> und nicht mit einem |
|
| 63 |
+ Passwort geschützt.</p>"); |
|
| 64 |
+ |
|
| 65 |
+ output("<h4>Zertifikat</h4>
|
|
| 66 |
+ <pre> |
|
| 67 |
+{$cert}
|
|
| 68 |
+</pre>"); |
|
| 69 |
+ |
|
| 70 |
+ if ($_REQUEST['private'] == 'yes') |
|
| 71 |
+ {
|
|
| 72 |
+ output("<h4>privater Schlüssel</h4>
|
|
| 73 |
+<pre> |
|
| 74 |
+{$key}
|
|
| 75 |
+</pre>"); |
|
| 76 |
+ } |
|
| 77 |
+ else |
|
| 78 |
+ {
|
|
| 79 |
+ output('<p>'.internal_link('', 'privaten Schlüssel auch anzeigen', "mode={$_REQUEST['mode']}&id={$_REQUEST['id']}&private=yes").'</p>');
|
|
| 80 |
+ } |
|
| 81 |
+ |
|
| 82 |
+ |
|
| 83 |
+ |
|
| 84 |
+ |
|
| 85 |
+} |
|
| 86 |
+ |
|
| 87 |
+ |
|
| 88 |
+ |
|
| 89 |
+ |
|
| 90 |
+ |
|
| 91 |
+ |
|
| 92 |
+ |
|
| 93 |
+ |
|
| 94 |
+ |
|
| 95 |
+ |
|
| 96 |
+ |
|
| 0 | 97 |