6962c43ce62fb257544a45ed4f04845b04993541
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

16) 
17) include_once('certs.php');
18) require_role(ROLE_SYSTEMUSER);
19) 
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

20) $hint = '';
21) $oldcert = NULL;
22) if (isset($_REQUEST['replace']))
23) {
Bernd Wurst Titel und Hilfetext auf der...

Bernd Wurst authored 11 years ago

24)   title('Zertifikat ersetzen');
25) 
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

26)   $cert = cert_details($_REQUEST['replace']);
27)   $oldcert = $cert['id'];
Bernd Wurst Neuer Workflow für Cert-Rep...

Bernd Wurst authored 11 years ago

28)   $hint = "<div style=\"border: 2px solid red; padding: 1em; margin: 1em;\"<p><strong>Hinweis:</strong> Dieses Zertifikat soll als Ersatz für ein bestehendes Zertifikat eingetragen werden. Dabei wird jede Benutzung des alten Zertifikats durch das neue ersetzt. Das alte Zertifikat wird dann umgehend gelöscht.<p>
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

29) 
30) <p><strong>Daten des alten Zertifikats:</strong></p>
Bernd Wurst Neuer Workflow für Cert-Rep...

Bernd Wurst authored 11 years ago

31) <p><strong>CN:</strong> {$cert['cn']}<br /><strong>Gültigkeit:</strong> {$cert['valid_from']} - {$cert['valid_until']}</p></div>";
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

32) 
Bernd Wurst Titel und Hilfetext auf der...

Bernd Wurst authored 11 years ago

33) } else {
34)   title('Neues Server-Zertifikat hinzufügen');
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

35) }
36) 
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

37) 
Bernd Wurst Titel und Hilfetext auf der...

Bernd Wurst authored 11 years ago

38) $section = 'vhosts_certs';
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

39) 
40) 
Bernd Wurst Neuer Workflow für Cert-Rep...

Bernd Wurst authored 11 years ago

41) output($hint.'
42) <h4>CSR automatisch erzeugen</h4>
43) <p>Mit unserem CSR-Generator können Sie einen Certificate-signing-request (CSR) automatisch erzeugen lassen. Nutzen Sie diese Möglichkeit bitte nur, wenn Sie ein so genanntes "Domain validated"-Zertifikat beantragen werden, das keine persönlichen Daten bzw. Firmendaten enthält. Kostenlose Zertifikate von CAcert oder StartSSL können Sie mit dieser Funktion erzeugen.</p>');
44) 
45) if ($oldcert) {
46)   $cn = urlencode($cert['cn']);
47)   addnew('savecert', "Einen neuen CSR für {$cert['cn']} erzeugen lassen", "action=newcsr&commonname={$cn}&replace={$oldcert}");
48) } else {
49)   addnew('newcsr', 'CSR automatisch erzeugen lassen');
50) }
51) 
52) 
53) output('<h4>Vorhandenes Zertifikat eintragen</h4>
54) <p>Sie können Ihr eigenes SSL-Zertifikat hinterlegen, das Sie dann für eine oder mehrere Webserver-Konfigurationen verwenden können.</p>
55) ');
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

56) 
57) 
58) $form = '
59) <h4>Server-Zertifikat:</h4>
60) <p><textarea name="cert" rows="10" cols="70"></textarea></p>
61) 
Bernd Wurst Ermögliche einen Zertifikat...

Bernd Wurst authored 10 years ago

62) <h4>privater Schlüssel:</h4>';
63) 
64) if ($oldcert) {
65)   $form .= '<p>Wenn Ihre Zertifizierungsstelle einen echten <em>renew</em>-Vorgang durchführt und das Zertifikat basierend auf dem alten CSR neu ausgestellt hat, brauchen Sie hier keinen privaten Schlüssel anzugeben.</p>';
66) }
67) 
68) $form .= '<p><textarea name="key" rows="10" cols="70"></textarea></p>
bernd Neue Zertifikatsverwaltung

bernd authored 14 years ago

69) 
70) <p><input type="submit" value="Speichern" /></p>
71) 
72) ';
73) 
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

74) output(html_form('vhosts_certs_new', 'savecert', 'action=new&replace='.$oldcert, $form));
Bernd Wurst Titel und Hilfetext auf der...

Bernd Wurst authored 11 years ago

75) 
76) output('<p>Es ist ein <strong>Zertifikat</strong> und ein dazu passender <strong>privater Schlüssel</strong> (ohne Passwort!) nötig. Alle Daten müssen im <strong>PEM-Format</strong> vorliegen, also in etwa die Form</p>
77) <pre>-----BEGIN CERTIFICATE-----
78) ...
79) -----END CERTIFICATE-----</pre>