Webseiten-Werkzeuge


ssl_fuer_apache2

Beispiel kalle.icbm.uni-oldenburg.de

Manuelles Erzeugen von Schlüsseln und Wurzel-Zertifikaten

1. Im ersten Schritt wird ein CA root key generiert: openssl genrsa -aes256 -out ca.key 4096 2. Wenn man den Schlüssel hat, wird das CA root Zertifikat erzeugt: openssl req -new -x509 -days 3650 -key ca.key -out ca.crt

Hier wurde Folgendes eingegeben:

Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]: University of Oldenburg                 
Organizational Unit Name (eg, section) []:ICBM
Common Name (eg, YOUR name) []:kalle.icbm.de
Email Address []:kohlmeier@icbm.de

3. Im nächsten Schritt ist jetzt das eigentlich zu verwendende Zertifikat an der Reihe. In der Regel wird vom Antragsteller ein Certificate Signing Request gestellt, d.h. man muss zuerst einen CSR generieren. Dazu braucht man wieder einen Schlüssel für den Server:

openssl genrsa -aes256 -out server.key 4096

4. Jetzt wird das CSR erstellt, das mit dem neu erstellten Schlüssel signiert wird openssl req -new -key server.key -out server.csr

Hier wurde wieder Folgendes eingegeben:

Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]: University of Oldenburg                 
Organizational Unit Name (eg, section) []:ICBM
Common Name (eg, YOUR name) []:kalle.icbm.de
Email Address []:kohlmeier@icbm.de
A challenge password []: ein anderes als vorher
An optional company name []: MathMod

Dieses CSR wird normalerweise an eine allgemein anerkannte Zertifizierungsstelle gesendet. In diesem Fall aber sind wir das ja.

5. Also muss das Zertifikat nun mit den Root Zertifikat signiert werden:

openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt

6. Für die Benutzung im Apache kann der Schlüssel von der Passwortfreigabe befreit werden, ansonsten muss bei jedem Start das Passwort eingegeben werden:

openssl rsa -in server.key -out server.key.insecure

Enter pass phrase for server.key:(leer bestätigen)

writing RSA key

7. Konfiguration von Apache2

Dann werden alle erzeugten Dateien server.* in kalle.* umbenannt und an die entsprechenden Stellen in der Apache-Konfiguration kopiert:

kalle.crt nach ///etc/apache2/ssl.crt//
kalle.csr nach /etc/apache2/ssl.csr
kalle.key nach /etc/apache2/ssl.key
kalle.key.insecure nach /etc/apache2/ssl.key

8. Zum Schluss wird /etc/apache2/vhosts.d/vhost-ssl.template nach /etc/apache2/vhosts.d/vhost-ssl.conf kopiert und wie folgt angepasst:

      #   Server Certificate:
      #   Point SSLCertificateFile at a PEM encoded certificate.  If
      #   the certificate is encrypted, then you will be prompted for a
      #   pass phrase.  Note that a kill -HUP will prompt again.  Keep
      #   in mind that if you have both an RSA and a DSA certificate you
      #   can configure both in parallel (to also allow the use of DSA
      #   ciphers, etc.)
      SSLCertificateFile /etc/apache2/ssl.crt/kalle.crt
      #SSLCertificateFile /etc/apache2/ssl.crt/server-dsa.crt

      #   Server Private Key:
      #   If the key is not combined with the certificate, use this
      #   directive to point at the key file.  Keep in mind that if
      #   you've both a RSA and a DSA private key you can configure
      #   both in parallel (to also allow the use of DSA ciphers, etc.)
      SSLCertificateKeyFile /etc/apache2/ssl.key/kalle.key.insecure

9. Apache neu starten, fertig.

Siehe auch: [http://forums.opensuse.org/deutsch-german/hilfe-und-helfen/anwendungen/464557-apache-2-besonderheiten-mit-open-suse.html]

ssl_fuer_apache2.txt · Zuletzt geändert: von frank