HTTP over SSL (HTTPS)


Sicherheitsaspekte

==> Problem bei vertraulichen Informationen

==> sichere Übertragung ist erforderlich um Nutzungsmöglichkeiten des Internets zu erhöhen

Sicherheitsbegriffe

C/S und Lauscher

Pakete können

werden.

Sicherheit ist

Client/Server selber müssen sicher sein


Einführung Kryptographie

Transformation von Nachrichten (messages, plain text) in verschlüsselte Nachrichten (cipher text) mit Hilfe von Algorithmen / Programmen (cipher suites) und Schlüsseln (keys).

Kryptographische Basisalgorithmen

Symmetrisch
 
  • gleicher Schlüssel für Ver- und Entschlüsselung

  • sehr schnell

  • Problem: Anzahl der Schlüssel

  • Problem: Austausch der Schlüssel

  • Beispiele: DES, RC4, Triple-DES, RC2, Idea, Fortezza (PINs, TANs)

Asymmetrisch
 
  • unterschiedliche Schlüssel für Ver- und Entschlüsselung

  • public und private key

  • relativ langsam

  • bei richtiger Wahl der Parameter sehr / beliebig sicher

  • Sicherheit basiert auf der Schwierigkeit der Faktorisierung grosser Zahlen

  • Beispiele: RSA, DSA, DSS, Diffie-Hellman

  • Diffie-Hellman (exponential key exchange): zum Aufbau von sicheren Verbindungen aus einem unsicheren Zustand (allerdings ohne Authentifizierung)

Message Digests
 
  • Prüfsummenbildung (Hash Verfahren)

  • Berechnung einer Zahl aus einer Nachricht

  • Zahl verändert sich, wenn Nachricht sich ändert

  • Beispiele: MD5, SHA, SHA1

  • Message Authentication Code (MAC)

Kryptographische Basistechniken

Digitale Signatur, Digitale Unterschriften
 
  • basiert auf Digest (Hash) und asymmetrischer Verschlüsselung

  • Berechnung und Verschlüsselung der Prüfsumme

  • gewährleistet Authentizität

Certification, Zertifizierung
 
  • benötigt unabhängige Verwalter: Certification Authority (CA),
    sichert die Authentizität von Schlüsseln zu.

  • basiert auf asymmetrischer Verschlüsselung,
    die CA codiert public keys von Teilnehmern mit ihrem private key

  • Server verschickt sein Zertifikat an Client
    bzw. auch umgekehrt: Client verschickt sein Zertifikat an Server

  • Zertifikat bestätigt Echtheit des Servers (Echtheit = Zuordnung Server zu public key)

  • public key der CA muß dem Client bekannt sein

Blinde Unterschriften
 
  • löst Anonymitätsproblem bei digitalem Geld

  • Unterschrift durch Umschlag mit Kohlepapier

  • zB. Zertifizierung von eCash unter Wahrung der Anonymität

Certificates, Zertifikate

Zertifikat verbindet einen public key mit der Identifikation einer Person.

Die Personen-Identifikation erfolgt mit einem Distinguished Name (DN).

Die Spezifikation eines DN ist im X.509 Standard festgelegt.

DN Feld Abkürzung Bedeutung
Common Name CN Name der Person
Organization O Firma oder Organisation
Organizational Unit OU Abteilung oder Firmenteil
Locality L Stadt, Sitz der Organisation
State ST Staat, Provinz, Gegend
Country C ISO Länderkode

Beispiel:

     CN=Karl Dall
      O=Schlangenöl AG     
     OU=Brillenabteilung
      L=Schlangenbad
     ST=Hessen
      C=de

Ein Zertifikat kombiniert die Informationen über das Individuum mit Informationen über die Ausgabestelle und diversen Verwaltungsinformationen:

Subject: Individuum
Distinguished Name, Public Key
Issuer: Ausgabestelle
Distinguished Name, Signature
Period of Validity: Geltungsdauer
Not Before Date, Not After Date
Administrative Infos:
Certificate Version, Serial Number
Extended Infos: Zusatzinformationen
Basic Constraints, Netscape Flags, etc.
Certificate:
  Data:
     Version: 3 (0x2)
     Serial Number: 1 (0x1)
     Signature Algorithm: md5WithRSAEncryption
     Issuer: C=XY, ST=Snake Desert, L=Snake Town, O=Snake Oil, Ltd, 
             OU=Certificate Authority, CN=Snake Oil CA/Email=ca@snakeoil.dom
     Validity
         Not Before: Oct 29 17:39:10 2000 GMT
         Not After : Oct 29 17:39:10 2001 GMT
     Subject: C=DE, ST=Germany, L=Weinheim, O=Home, OU=Web Lab, 
              CN=kredel-wh.isdn.uni-mannheim.de/Email=kredel@rz.uni-mannheim.de
     Subject Public Key Info:
         Public Key Algorithm: rsaEncryption
         RSA Public Key: (1024 bit)
             Modulus (1024 bit):
                 00:c4:40:4c:6e:14:1b:61:36:84:24:b2:61:c0:b5:
                 ...
                 f0:b4:95:f5:f9:34:9f:f8:43
             Exponent: 65537 (0x10001)
     X509v3 extensions:
         X509v3 Subject Alternative Name: 
             email:kredel@rz.uni-mannheim.de
         Netscape Comment: 
             mod_ssl generated test server certificate
         Netscape Cert Type: 
             SSL Server
  Signature Algorithm: md5WithRSAEncryption
     12:ed:f7:b3:5e:a0:93:3f:a0:1d:60:cb:47:19:7d:15:59:9b:
     ...

Zertifikate können bei verschiedenen Organisationen (gegen Gebühr) bestellt werden. Zum Beispiel bei Verisign, Thawte, CertiSign oder IKS GmbH.

Kryptographie und TCP/IP

Einsatzpunkte im Schichtenmodell

Schicht Bemerkungen Kryptographie
5. Verarbeitung
Anwendung
Telnet, FTP, SMTP, NNTP, HTTP S-HTTP,
HTTP over SSL
4. Transport TCP, UDP SSL
3. Vermittlung IP, Internet Protocoll IPv6
2. Sicherung Adapter-Karten  
1. Bitübertragung Leitungen, Elektronik  

Verarbeitungs- / Anwendungsebene

Transportschicht

Netzwerkschicht / Vermittlungsebene

S-HTTP

Secure Hypertext Transfer Protocol

Vorteile

flexibel, sehr viele Verfahren unterstützt
keine Probleme mit Firewalls
erweiterbar ohne Rücksicht auf TCP/IP

Nachteile

nur für HTTP anwendbar
benötigt spezielle Browser Unterstützung


Secure Socket Layer (SSL)

Ziele

Vorteile

für alle TCP/IP Anwendungen nutzbar
leichter zu benutzen und zu verwalten
effizient

Nachteile

evtl. Probleme mit Firewalls
erweiterbar nur mit Rücksicht auf TCP/IP

SSL in TCP/IP

SSL in TCP/IP

SSL Protokoll liegt zwischen der Transportschicht und der Anwendungsschicht

SSL - Aufbau

SSS - Aufbau

SSL besteht aus zwei Schichten plus Statusinformationen

Steuerprotokolle

Recordprotokoll

Status

SSL - Sessions

SSL Verbindungen
 
Ablauf einer Verbindung

SSL - Verbindungsaufbau

durch SSL Handshake Protokoll

SSL - Cipher Suites

SSL - Fehlerbehandlung

SSL Alert Protokoll behandelt folgende Fehlerarten

=> Fehlerfall: Nachricht und Verbindungsabbruch

SSL - Implementierungen

Probleme:


Apache mod_ssl

mod_ssl

mod_ssl wurde von von Ralf S. Engelschall im April 1998 entwickelt.

Weiterentwicklung des Apache-SSL Packets von Ben Laurie.

Verwendet OpenSSL von Eric A. Young and Tim Hudson.

Implementiert den https: Dienst.
Default Port ist 443.

Konfiguration

für Apache, mod_ssl, OpenSSL der SuSE Linux Distribution

  1. Sicherstellen, dass alle benötigten Teile installiert sind
    Apache, mod_ssl, OpenSSL

  2. Erzeugen eines Zertifikats
    cd /usr/share/doc/packages/mod_ssl
    ./certificate.sh
    siehe Beispiel

  3. Aktivieren von mod_ssl in der Apache Konfiguration
    in conf/httpd.conf
    SSLEngine on
    und einstellen der weiteren erforderlichen Parameter, siehe Beispiel

  4. Apache restarten

  5. Log Files überwachen

  6. SSL Zugriff auf beliebige Seiten mit
    https://host/path/x.html

Erzeugen eines Zertifikats

  1. Kryptographischen Algorithmus auswählen

  2. entsprechenden Schlüssel erzeugen

  3. Distinguished Name festlegen
    damit kann eine Zertifikatanforderung generiert werden

  4. erzeugen eines Spiel-Zertifikats

  5. schützen des generierten Schlüssels durch Pass-Phrase

localhost:/usr/share/doc/packages/mod_ssl # ./certificate.sh 
SSL Certificate Generation Utility (mkcert.sh)
Copyright (c) 1998 Ralf S. Engelschall, All Rights Reserved.

Generating test certificate signed by Snake Oil CA [TEST]
WARNING: Do not use this for real-life/production systems
______________________________________________________________________

STEP 0: Decide the signature algorithm used for certificate
The generated X.509 CA certificate can contain either
RSA or DSA based ingredients. Select the one you want to use.
Signature Algorithm ((R)SA or (D)SA) [R]:
______________________________________________________________________

STEP 1: Generating RSA private key (1024 bit) [server.key]
4139358 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
........++++++
.++++++
e is 65537 (0x10001)
______________________________________________________________________

STEP 2: Generating X.509 certificate signing request [server.csr]
Using configuration from .mkcert.cfg
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
1. Country Name             (2 letter code) [XY]:DE
2. State or Province Name   (full name)     [Snake Desert]:Germany
3. Locality Name            (eg, city)      [Snake Town]:Weinheim
4. Organization Name        (eg, company)   [Snake Oil, Ltd]:Home   
5. Organizational Unit Name (eg, section)   [Webserver Team]:Web Lab
6. Common Name              (eg, FQDN)      [www.snakeoil.dom]:kredel-wh.uni-mannheim.de
7. Email Address            (eg, name@FQDN) [www@snakeoil.dom]:kredel@rz.uni-mannheim.de
______________________________________________________________________

STEP 3: Generating X.509 certificate signed by Snake Oil CA [server.crt]
Certificate Version (1 or 3) [3]:
Signature ok
subject=/C=DE/ST=Germany/L=Weinheim/O=Home/OU=Web Lab/CN=kredel-wh.uni-mannheim.de/Email=kredel@rz.uni-mannheim.de
Getting CA Private Key
Verify: matching certificate & key modulus
read RSA key
Verify: matching certificate signature
/etc/httpd/ssl.crt/server.crt: OK
______________________________________________________________________

STEP 4: Enrypting RSA private key with a pass phrase for security [server.key]
The contents of the server.key file (the generated private key) has to be
kept secret. So we strongly recommend you to encrypt the server.key file
with a Triple-DES cipher and a Pass Phrase.
Encrypt the private key now? [Y/n]: n
Warning, you're using an unencrypted RSA private key.
Please notice this fact and do this on your own risk.
______________________________________________________________________

RESULT: Server Certification Files

o  conf/ssl.key/server.key
   The PEM-encoded RSA private key file which you configure
   with the 'SSLCertificateKeyFile' directive (automatically done
   when you install via APACI). KEEP THIS FILE PRIVATE!

o  conf/ssl.crt/server.crt
   The PEM-encoded X.509 certificate file which you configure
   with the 'SSLCertificateFile' directive (automatically done
   when you install via APACI).

o  conf/ssl.csr/server.csr
   The PEM-encoded X.509 certificate signing request file which
   you can send to an official Certificate Authority (CA) in order
   to request a real server certificate (signed by this CA instead
   of our demonstration-only Snake Oil CA) which later can replace
   the conf/ssl.crt/server.crt file.

WARNING: Do not use this for real-life/production systems

Beispiel Schlüssel und Zertifikate

Die Schlüssel und Zertifikate kann man sich mit einem Tool aus OpenSSL anzeigen lassen.

  openssl rsa  -noout -text -in conf/ssl.key/server.key 
  openssl x509 -noout -text -in conf/ssl.crt/server.crt 
  openssl req  -noout -text -in conf/ssl.csr/server.csr 

  openssl s_client -connect localhost:443 -state -debug

Der Parameter rsa zeigt einen RSA Schlüssel, x509 zeigt ein Zertifikat und req zeigt eine Zertifikatanforderung an.

Private Key des Servers: conf/ssl.key/server.key

-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQDEQExuFBthNoQksmHAtdfkeqVLlO/ZXkN/wWSA/Z9QQWtwc4BI
kPNYv/BMuZAygVkYFj8Z9F8RaDaF9hyprxqpqHtEhXm18SDTJX0c3mgVDLa8WUYK
2JlOB1AKXYNh1NvJfcMu6wqPYo9+AOE3Zz821QQ4RER36fC0lfX5NJ/4QwIDAQAB
AoGARVmPaKrUThMMuUcMAiSASS4J8V6NL1v/MEsv7+EwBhVIGTHHmF0YkTkqeoJs
cVyCFl/uJobTfXw9IDOrR08odUMvuHMdFOdC4n80HMk4WC3l7LuXIFL+ircZ3EFe
6kFc8WNFT2d-lnhIG3aqRKApP6Mkc+ZoL0EtN/m0WsICYlECQQDlCa7+sFRlX56j
jokOWmN595ouqn1tFIW/em4gSlj7s8Blsij8dPOen3NHGjPZwbon6EdmaZhaVoco
E5elwgGbAkEA21qNMZC6oF9vW7B53YE5z7KDi/CXiHh7gNsRKn7SnTr5S6MHOjol
3VsDsqaIsY+S2KONFWOxTpPJW6nj014CeQJAdiJfg3hZn4wJXB0priCLDJ7chNNl
LD0Ym2G/qaIPcYwOYaXaJBUCjz95CySFt/yHUwwov7cZYQceYVpxrop5nwJAQyQo
a699MHGFyG7wHljbtTNTCJaQC3m1c++aBYPkO7Q9cmVoZO4/gM3HB/vpg1ALBryp
Bo8JSp/51lDeJ2hzIQJBAKu15hbskAfQVCXK21ShoojHsg03W6G58j+O0OgR8x+E
QTDemBaP2ARbGqvFbe+px6nUy0COS6+CGmNvYAaIr74=
-----END RSA PRIVATE KEY-----
openssl rsa -noout -text -in conf/ssl.key/server.key 
read RSA key
Private-Key: (1024 bit)
modulus:
    00:c4:40:4c:6e:14:1b:61:36:84:24:b2:61:c0:b5:
    d7:e4:7a:a5:4b:94:ef:d9:5e:43:7f:c1:64:80:fd:
    9f:50:41:6b:70:73:80:48:90:f3:58:bf:f0:4c:b9:
    90:32:81:59:18:16:3f:19:f4:5f:11:68:36:85:f6:
    1c:a9:af:1a:a9:a8:7b:44:85:79:b5:f1:20:d3:25:
    7d:1c:de:68:15:0c:b6:bc:59:46:0a:d8:99:4e:07:
    50:0a:5d:34:61:d4:db:c9:7d:c3:2e:eb:0a:8f:62:
    8f:7e:00:e1:37:67:3f:36:d5:04:38:44:44:77:e9:
    f0:b4:95:f5:f9:34:9f:f8:43
publicExponent: 65537 (0x10001)
privateExponent:
    45:59:8f:68:aa:d4:4e:13:0c:b9:47:0c:02:24:80:
    49:2e:09:f1:5e:8d:2f:5b:ff:30:4b:2f:ef:e1:30:
    06:15:48:19:31:c7:98:5d:18:91:39:2a:7a:82:6c:
    71:5c:82:16:5f:ee:26:86:d3:7d:7c:3d:20:33:ab:
    47:4f:28:75:93:2f:b8:73:1d:14:e7:42:e2:7f:34:
    1c:c9:38:58:2d:e5:ec:bb:97:20:52:fe:8a:b7:19:
    dc:41:5e:ea:41:5c:f1:63:45:4f:67:7e:96:78:48:
    1b:76:aa:44:a0:29:3f:a3:24:73:e6:68:2f:41:2d:
    37:f9:b4:5a:c2:02:62:51
prime1:
    00:e5:09:ae:fe:b0:54:65:5f:9e:a3:8e:89:0e:5a:
    63:79:f7:9a:2e:aa:7d:6d:14:85:bf:7a:6e:20:4a:
    58:fb:b3:c0:66:b2:28:fc:74:f3:9e:9f:73:47:1a:
    33:d9:c1:ba:27:e8:47:66:69:98:5a:56:87:28:13:
    97:a5:c2:01:9b
prime2:
    00:db:5a:8d:31:90:ba:a0:5f:6f:5b:b0:79:dd:81:
    39:cf:b2:83:8b:f0:97:88:78:7b:80:db:11:2a:7e:
    d2:9d:3a:f9:4b:f3:07:3a:3a:25:dd:5b:03:b2:a6:
    88:b1:8f:92:d8:a3:8d:15:63:b1:4e:93:c9:5b:a9:
    e3:d3:5e:02:79
exponent1:
    76:22:5f:83:78:59:9f:8c:09:5c:1d:29:ae:20:8b:
    0c:9e:dc:84:d3:65:2c:3d:18:9b:61:bf:a9:a2:0f:
    71:8c:0e:61:a5:df:24:15:02:8f:3f:79:0b:24:85:
    b7:fc:87:53:0c:28:bf:b7:19:61:07:1e:61:5a:71:
    ae:8a:79:9f
exponent2:
    43:24:28:6b:af:7d:30:71:85:c8:6e:f0:1e:58:db:
    b5:33:53:08:96:90:0b:79:b5:73:ef:9a:05:83:e4:
    3b:b4:3d:72:6a:68:64:ee:3f:80:cd:c7:07:fb:e9:
    83:50:0b:06:bc:a9:06:8f:09:4a:9f:f9:d6:50:de:
    27:68:73:21
coefficient:
    00:ab:b5:e6:16:ec:90:07:d0:54:25:ca:db:54:a1:
    a2:88:c7:b2:0d:37:5b:a1:b9:f2:3f:8e:d0:e8:11:
    f3:1f:84:41:30:ee:98:16:8f:d8:04:5b:1a:ab:c5:
    6d:ef:a9:c7:a9:d4:cb:40:8e:4b:af:82:1a:63:6f:
    60:06:88:af:be

Server Zertifikat: conf/ssl.key/server.crt

-----BEGIN CERTIFICATE-----
MIIDQDCCAqmgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCWFkx
FTATBgNVBAgTDFNuYWtlIERlc2VydDETMBEGA1UEBxMKU25ha2UgVG93bjEXMBUG
A1UEChMOU25ha2UgT2lsLCBMdGQxHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhv
cml0eTEVMBMGA1UEAxMMU25ha2UgT2lsIENBMR4wHAYJKoZIhvcNAQkBFg9jYUBz
bmFrZW9pbC5kb20wHhcNMDAxMDI5MTczOTEwWhcNMDExMDI5MTczOTEwWjCBqjEL
MAkGA1UEBhMCREUxEDAOBgNVBAgTB0dlcm1hbnkxETAPBgNVBAcTCFdlaW5oZWlt
MREwDwYDVQQKEwhIb21lIExhYjEQMA4GA1UECxMHV2ViIExhYjEnMCUGA1UEAxMe
a3JlZGVsLXdoLmlzZG4udW5pLW1hbm5oZWltLmRlMSgwJgYJKoZIhvcNAQkBFhlr
cmVkZWxAcnoudW5pLW1hbm5oZWltLmRlMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQDEQExuFBthNoQksmHAtdfkeqVLlO/ZXkN/wWSA/Z9QQWtwc4BIkPNYv/BM
uZAygVkYFj8Z9F8RaDaF9hyprxqpqKtEhXm18SDTJX0c3mgVDLa8WUYK2JlOB1AK
XYNh1NvJfcMu6wqPYo9+AOE3Zz821QQ4RER36fC0lfX5NJ/4QwIDAQABo3UwczAk
BgNVHREEHTAbgRlrcmVkZWxAcnoudW5pLW1hbm5oZWltLmRlMDgGCWCGSAGG+EIB
DQQrFiltb2Rfc3NsIGdlbmVyYXRlZCB0ZXN0IHNlcnZlciBjZXJ0aWZpY2F0ZTAR
BglghkgBhvhCAQEEBAMCBkAwDQYJKoZIhvcNAQEEBQADgYEAEu33s16gkz+gHWDL
Rxl9FVmbOyyoo2oDQ9CF04aGL+OqeTnngiDt9BGFo0FeXI02onG2agj5zB7axHgF
dYmbEPAV8J5noE6hTT8WTJsZVmryr4lUUkoGNEIN1UAla7DAogMYzdEHILblxR4h
ROfFCdLVlJ1sEwcvO3xMZJC//44=
-----END CERTIFICATE-----
openssl x509 -noout -text -in conf/ssl.crt/server.crt 
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
        Signature Algorithm: md5WithRSAEncryption
        Issuer: C=XY, ST=Snake Desert, L=Snake Town, O=Snake Oil, Ltd, OU=Certificate Authority, CN=Snake Oil CA/Email=ca@snakeoil.dom
        Validity
            Not Before: Oct 29 17:39:10 2000 GMT
            Not After : Oct 29 17:39:10 2001 GMT
        Subject: C=DE, ST=Germany, L=Weinheim, O=Home, OU=Web Lab, CN=kredel-wh.isdn.uni-mannheim.de/Email=kredel@rz.uni-mannheim.de
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:c4:40:4c:6e:14:1b:61:36:84:24:b2:61:c0:b5:
                    d7:e4:7a:a5:4b:94:ef:d9:5e:43:7f:c1:64:80:fd:
                    9f:50:41:6b:70:73:80:48:90:f3:58:bf:f0:4c:b9:
                    90:32:81:59:18:16:3f:19:f4:5f:11:68:36:85:f6:
                    1c:a9:af:fa:a9:a8:7b:44:85:79:b5:f1:20:d3:25:
                    7d:1c:de:68:15:0c:b6:bc:59:46:0a:d8:99:4e:07:
                    50:0a:5d:83:61:d4:db:c9:7d:c3:2e:eb:0a:8f:62:
                    8f:7e:00:e1:37:67:3f:36:d5:04:38:44:44:77:e9:
                    f0:b4:95:f5:f9:34:9f:f8:43
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Alternative Name: 
                email:kredel@rz.uni-mannheim.de
            Netscape Comment: 
                mod_ssl generated test server certificate
            Netscape Cert Type: 
                SSL Server
    Signature Algorithm: md5WithRSAEncryption
        12:ed:f7:b3:5e:a0:93:3f:a0:1d:60:cb:47:19:7d:15:59:9b:
        3b:2c:a8:a3:6a:03:43:d0:85:d3:86:86:2f:e3:aa:79:39:e7:
        82:20:ed:f4:11:85:a3:41:5e:5c:8d:36:a2:71:b6:6a:08:f9:
        cc:1e:da:c4:78:05:75:8f:9b:10:f0:15:f0:9e:67:a0:4e:a1:
        4d:3f:16:4c:9b:19:56:6a:f2:af:89:54:52:4a:06:34:42:0d:
        d5:40:25:6b:b0:c0:a2:03:18:cd:d1:07:20:b6:e5:c5:1e:21:
        44:e7:c5:09:d2:d5:94:9d:6c:13:07:2f:3b:7c:4c:64:90:bf:
        ff:8e

Zertifikatanforderung: conf/ssl.key/server.csr

-----BEGIN CERTIFICATE REQUEST-----
MIIB6zCCAVQCAQAwgaoxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdHZXJtYW55MREw
DwYDVQQHEwhXZWluaGVpbTERMA8GA1UEChMISG9tZSBMYWIxEDAOBgNVBAsTB1dl
YiBMYWIxJzAlBgNVBAMTHmtyZWRlbC13aC5pc2RuLnVuaS1tYW5uaGVpbS5kZTEo
MCYGCSqGSIb3DQEJARYZa3JlZGVsQHJ6LnVuaS1tYW5uaGVpbS5kZTCBnzANBgkq
hkiG9w0BAQEFAAOBjQAwgYkCgYEAxEBMbhQbYTaEJLJhwLXX5HqlS5Tv2V5Df8Fk
gP2fUEFrcHOASJDzWL/wTLmQMoFZGBY+GfRfEWg2hfYcqa8aqah7RIV5tfEg0yV9
HN5oFQy2vFlGCtiZTgdQCl2DYdTbyX3DLusKj2KPfgDhN2c/NtUEOEREd+nwtJX1
+TSf+EMCAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GBACSVE7CQiBDJOJSGUhLwt9TA
lp14391PoSF+kszWdpr5q0v3ce95EMdf4uCiqPEWvNibNNpas6LBH2kjfaXRDbLR
sYrGLU45z/Arq+9vsNyC+c3NcXHKSAuHhfXoFieTVjZj7+DE0JCWIhf7KN9dxSwN
srHUPndOfSSiMk6eXbuL
-----END CERTIFICATE REQUEST-----
openssl req -noout -text -in conf/ssl.csr/server.csr 
Using configuration from /usr/ssl/openssl.cnf
Certificate Request:
    Data:
        Version: 0 (0x0)
        Subject: C=DE, ST=Germany, L=Weinheim, O=Home, OU=Web Lab, CN=kredel-wh.isdn.uni-mannheim.de/Email=kredel@rz.uni-mannheim.de
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:c4:40:4c:6e:14:1b:61:36:84:24:b2:61:c0:b5:
                    d7:e4:7a:a5:4b:94:ef:d9:5e:43:7f:c1:64:80:fd:
                    9f:50:41:6b:70:73:80:48:90:f3:58:bf:f0:4c:b9:
                    90:32:81:59:18:16:3f:19:f4:5f:11:68:36:85:f6:
                    1c:a9:af:1a:f9:a8:7b:44:85:79:b5:f1:20:d3:25:
                    7d:1c:de:68:15:0c:b6:bc:59:46:0a:d8:99:4e:07:
                    50:0a:5d:83:61:d4:db:c9:7d:c3:2e:eb:0a:8f:62:
                    8f:7e:00:e1:3e:67:3f:36:d5:04:38:44:44:77:e9:
                    f0:b4:95:f5:f9:34:9f:f8:43
                Exponent: 65537 (0x10001)
        Attributes:
            a0:00
    Signature Algorithm: md5WithRSAEncryption
        24:95:13:b0:90:88:10:c9:38:94:86:52:12:f0:b7:d4:c0:96:
        9d:78:df:dd:4f:a1:21:7e:92:cc:d6:76:9a:f9:ab:4b:f7:71:
        ef:79:10:c7:5f:e2:e0:a2:a8:f1:16:bc:d8:9b:34:da:5a:b3:
        a2:c1:1f:69:23:7d:a5:d1:1d:b2:d1:b1:8a:c6:2d:4e:39:cf:
        f0:2b:ab:ef:6f:b0:dc:82:f9:cd:cd:71:71:ca:48:0b:87:85:
        f5:e8:16:27:93:56:36:63:ef:e0:c4:d0:90:96:22:17:fb:28:
        df:5d:c5:2c:0d:b2:b1:d4:3e:77:4e:7d:24:a2:32:4e:9e:5d:
        bb:8b

Apache Konfiguration

wesentlich SSLEngine on

<VirtualHost _default_:443>

#  General setup for the virtual host
DocumentRoot "/usr/local/httpd/htdocs"
ServerName kredel-wh.isdn.uni-mannheim.de
ServerAdmin root@kredel-wh.isdn.uni-mannheim.de
ErrorLog /var/log/httpd/error_log
TransferLog /var/log/httpd/access_log

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
#SSLEngine off
SSLEngine on

#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXP56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

#   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. A test
#   certificate can be generated with `make certificate' under
#   built time. Keep in mind that if you've both a RSA and a DSA
#   certificate you can configure both in parallel (to also allow
#   the use of DSA ciphers, etc.)
SSLCertificateFile /etc/httpd/ssl.crt/server.crt
#SSLCertificateFile /etc/httpd/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/httpd/ssl.key/server.key
#SSLCertificateKeyFile /etc/httpd/ssl.key/server-dsa.key

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
#SSLCertificateChainFile /etc/httpd/ssl.crt/ca.crt

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#   Note: Inside SSLCACertificatePath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCACertificatePath /etc/httpd/ssl.crt
#SSLCACertificateFile /etc/httpd/ssl.crt/ca-bundle.crt

#   Certificate Revocation Lists (CRL):
#   Set the CA revocation path where to find CA CRLs for client
#   authentication or alternatively one huge file containing all
#   of them (file must be PEM encoded)
#   Note: Inside SSLCARevocationPath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCARevocationPath /etc/httpd/ssl.crl
#SSLCARevocationFile /etc/httpd/ssl.crl/ca-bundle.crl

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.
#<Location />
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line' version of the client's X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA'.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*' environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o CompatEnvVars:
#     This exports obsolete environment variables for backward compatibility
#     to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this
#     to provide compatibility to existing CGI scripts.
#   o StrictRequire:
#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
#     under a "Satisfy any" situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context. 
#SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "/usr/local/httpd/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn't wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is send or allowed to received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is send and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly. 
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog /var/log/httpd/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>                                  

Überwachung der Log Files

Den Ablauf einer Verbindung kann man sich mit einem Tool aus OpenSSL anzeigen lassen.

  openssl s_client -connect localhost:443 -state -debug
  GET / HTTP/1.0

Der Parameter s_client baut eine Verbindung zu einem SSL Server auf, s_server baut eine Verbindung zu einem SSL Client auf.

Startup SSL Engine log

[29/Oct/2000 19:03:09 12827] [info]  Server: Apache/1.3.12, Interface: mod_ssl/2.6.5, Library: OpenSSL/0.9.5a
[29/Oct/2000 19:03:09 12827] [info]  Init: 1st startup round (still not detached)
[29/Oct/2000 19:03:09 12827] [info]  Init: Initializing OpenSSL library
[29/Oct/2000 19:03:09 12827] [info]  Init: Loading certificate & private key of SSL-aware server kredel-wh.isdn.uni-mannheim.de:443
[29/Oct/2000 19:03:09 12827] [info]  Init: Seeding PRNG with 136 bytes of entropy
[29/Oct/2000 19:03:09 12827] [info]  Init: Generating temporary RSA private keys (512/1024 bits)
[29/Oct/2000 19:03:09 12827] [info]  Init: Configuring temporary DH parameters (512/1024 bits)
[29/Oct/2000 19:03:11 12828] [info]  Init: 2nd startup round (already detached)
[29/Oct/2000 19:03:11 12828] [info]  Init: Reinitializing OpenSSL library
[29/Oct/2000 19:03:11 12828] [info]  Init: Seeding PRNG with 136 bytes of entropy
[29/Oct/2000 19:03:11 12828] [info]  Init: Configuring temporary RSA private keys (512/1024 bits)
[29/Oct/2000 19:03:11 12828] [info]  Init: Configuring temporary DH parameters (512/1024 bits)
[29/Oct/2000 19:03:11 12828] [info]  Init: Initializing (virtual) servers for SSL
[29/Oct/2000 19:03:11 12828] [info]  Init: Configuring server kredel-wh.isdn.uni-mannheim.de:443 for SSL protocol
[29/Oct/2000 19:05:11 12841] [info]  Connection to child 0 established (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:05:11 12841] [info]  Seeding PRNG with 1160 bytes of entropy
[29/Oct/2000 19:06:41 12841] [info]  Connection: Client IP: 127.0.0.1, Protocol: SSLv3, Cipher: RC4-MD5 (128/128 bits)
[29/Oct/2000 19:06:41 12841] [info]  Initial (No.1) HTTPS request received for child 0 (server kredel-wh.isdn.uni-mannheim.de:443)
[29/Oct/2000 19:06:41 12841] [info]  Connection to child 0 closed with standard shutdown (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:06:41 12896] [info]  Connection to child 1 established (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:06:41 12896] [info]  Seeding PRNG with 1160 bytes of entropy
[29/Oct/2000 19:06:41 12907] [info]  Connection to child 2 established (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:06:41 12907] [info]  Seeding PRNG with 1160 bytes of entropy
[29/Oct/2000 19:06:42 12841] [info]  Connection to child 0 established (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:06:42 12841] [info]  Seeding PRNG with 1160 bytes of entropy
[29/Oct/2000 19:06:42 12896] [info]  Connection: Client IP: 127.0.0.1, Protocol: SSLv3, Cipher: RC4-MD5 (128/128 bits)
[29/Oct/2000 19:06:42 12896] [info]  Initial (No.1) HTTPS request received for child 1 (server kredel-wh.isdn.uni-mannheim.de:443)
[29/Oct/2000 19:06:42 12907] [info]  Connection: Client IP: 127.0.0.1, Protocol: SSLv3, Cipher: RC4-MD5 (128/128 bits)
[29/Oct/2000 19:06:42 12907] [info]  Initial (No.1) HTTPS request received for child 2 (server kredel-wh.isdn.uni-mannheim.de:443)
[29/Oct/2000 19:06:42 12841] [info]  Connection: Client IP: 127.0.0.1, Protocol: SSLv3, Cipher: RC4-MD5 (128/128 bits)
[29/Oct/2000 19:06:42 12841] [info]  Initial (No.1) HTTPS request received for child 0 (server kredel-wh.isdn.uni-mannheim.de:443)
[29/Oct/2000 19:06:42 12896] [info]  Subsequent (No.2) HTTPS request received for child 1 (server kredel-wh.isdn.uni-mannheim.de:443)
[29/Oct/2000 19:06:42 12908] [info]  Connection to child 3 established (server kredel-wh.isdn.uni-mannheim.de:443, client 127.0.0.1)
[29/Oct/2000 19:06:42 12908] [info]  Seeding PRNG with 1160 bytes of entropy
[29/Oct/2000 19:06:43 12908] [info]  Connection: Client IP: 127.0.0.1, Protocol: SSLv3, Cipher: RC4-MD5 (128/128 bits)
[29/Oct/2000 19:06:43 12908] [info]  Initial (No.1) HTTPS request received for child 3 (server kredel-wh.isdn.uni-mannheim.de:443)

SSL Request log

[29/Oct/2000:19:06:41 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET / HTTP/1.0" 1493
[29/Oct/2000:19:06:42 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET /gif/gl.gif HTTP/1.0" 427
[29/Oct/2000:19:06:42 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET /gif/awlogo.gif HTTP/1.0" 12706
[29/Oct/2000:19:06:42 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET /gif/apache_logo.gif HTTP/1.0" 23439
[29/Oct/2000:19:06:42 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET /gif/apache_pb.gif HTTP/1.0" 2326
[29/Oct/2000:19:06:43 +0100] 127.0.0.1 SSLv3 RC4-MD5 "GET /gif/suse_150.gif HTTP/1.0" 2874

Bemerkungen


Erstellt unter Verwendung eines Seminarvortrags von Robert Schulz und der Apache mod_ssl Dokumentation.

© Universität Mannheim, Rechenzentrum, 1998-2002.

Heinz Kredel
Last modified: Mon Apr 22 22:26:51 MEST 2002