Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:web_c7:apache_2 [30.08.2014 19:54. ] – [Konfiguration] djangocentos:web_c7:apache_2 [02.02.2018 09:39. ] (aktuell) – Löschen von falschen HPKP-Daten beim Browser Firefox django
Zeile 1: Zeile 1:
-====== SSL gesicherter Webserver mit Apache httpd unter CentOS 7.x ======+====== SSL gesicherter Webserver mit mod_ssl für Apache httpd 2.4 unter CentOS 7.x ======
 {{:centos:world.png?nolink&80 |Bild: Weltkugel }} \\ {{:centos:world.png?nolink&80 |Bild: Weltkugel }} \\
-Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen.  Daten durchlaufen von der Quelle bis zum Ziel zahlreiche Server und Systeme, an denen die Daten, abgegriffen und/oder manipuliert werden können. Persönliche und vertrauliche Daten können so einfach Dritten in die Hände fallen, die mit großer krimineller Energie versuchen an diese Daten zu kommen. +Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen.  Daten durchlaufen von der Quelle bis zum Ziel zahlreiche Server und Systeme, an denen die Daten, abgegriffen und/oder manipuliert werden können. Selbst in als vertrauenswürdig geltende Netze werden unter dem Vorwand von Sicherheit, verschlüsselte Verbindungen aufgebrochen und kompromitiert. Persönliche und vertrauliche Daten können so einfach Dritten in die Hände fallen, die mit grosser krimineller Energie versuchen an diese Daten zu kommen. 
  
 Inwieweit staatliche Stellen den Datenverkehr abhören, protokollieren und abgreifen und zu manipulieren bzw. zensieren versuchen, weiss  Inwieweit staatliche Stellen den Datenverkehr abhören, protokollieren und abgreifen und zu manipulieren bzw. zensieren versuchen, weiss 
Zeile 13: Zeile 13:
 Was lernen wir aus dieser Tatsache? Unsere Kommunikation ist nach besten Wissen und Gewissen, so zu gestalten, damit andere unsere Daten nicht mitlesen und manipulieren können. Ferner ist sicherzustellen, dass Empfänger vertrauen können, dass Informationen tatsächlich von dem versandt wurden, von dem wir glauben, diese zu bekommen. Was lernen wir aus dieser Tatsache? Unsere Kommunikation ist nach besten Wissen und Gewissen, so zu gestalten, damit andere unsere Daten nicht mitlesen und manipulieren können. Ferner ist sicherzustellen, dass Empfänger vertrauen können, dass Informationen tatsächlich von dem versandt wurden, von dem wir glauben, diese zu bekommen.
  
-Nicht nur auf [[centos:openpgp_beim_mua|Seiten der Endkunden]], die mit Hilfe von [[http://www.openpgp.org/|OpenPGP]] oder [[http://www.smime.org/|S/MIME]] vertraulich kommunizieren, sondern auch serverseitig kann der Übertragungsweg mit einfachen Mitteln entsprechend verschlüsselt werden. {{:centos:mailserver:lan_security.png?96 |SSL/TLS Logo}} Für die vertrauliche Kommunikation zwischen unseren Usern und unserm [[centos:mail_c7:start#dovecot_imap-server|Dovcot-Mailserver]] bietet sich eine verschlüsselte Kommunikation mit Hilfe von **SSL/TLS** an.+Nicht nur auf [[centos:openpgp_beim_mua|Seiten der Endkunden]], die mit Hilfe von [[http://www.openpgp.org/|OpenPGP]] oder [[http://www.smime.org/|S/MIME]] vertraulich kommunizieren, sondern auch serverseitig kann der Übertragungsweg mit einfachen Mitteln entsprechend verschlüsselt werden. {{:centos:mailserver:lan_security.png?96 |SSL/TLS Logo}} Für die vertrauliche Kommunikation zwischen unseren Usern und z.B. unserm [[centos:mail_c7:start#dovecot_imap-server|Dovcot-Mailserver]] bietet sich eine verschlüsselte Kommunikation mit Hilfe von **SSL/TLS** an.
  
-Mit Hilfe von **[[http://de.wikipedia.org/wiki/Perfect_Forward_Secrecy|PFS]]**((**P**erfect **F**orward **S**ecrecy)) können wir leicht und einfach sicherstellen, dass aufgezeichnete Datenströme im nachhinein nicht entschlüsselt werden können. Dies wird erreicht, da die beiden Kommunikationspartner, einen separaten und individuellen temporären Schlüssel zur Datensicherung verweden. Dieser Schlüssel ist dabei nicht fix, sondern wird bei jeder Verbindung neu ausgehandelt. Da aber der Schlüssel an sich nicht ausgetauscht werden muss, ist es auch nicht möglich, den eventuell aufgezeichneten Datenstrom zu entschlüsseln, da der dazu benötigte Schlüssel nicht im Datenstrom enthalten war. +Mit Hilfe von **[[http://de.wikipedia.org/wiki/Perfect_Forward_Secrecy|PFS]]**((**P**erfect **F**orward **S**ecrecy)) können wir leicht und einfach sicherstellen, dass aufgezeichnete Datenströme im nach hinein nicht entschlüsselt werden können. Dies wird erreicht, da die beiden Kommunikationspartner, einen separaten und individuellen temporären Schlüssel zur Datensicherung verwenden. Dieser Schlüssel ist dabei nicht fix, sondern wird bei jeder Verbindung neu ausgehandelt. Da aber der Schlüssel an sich nicht ausgetauscht werden muss, ist es auch nicht möglich, den eventuell aufgezeichneten Datenstrom zu entschlüsseln, da der dazu benötigte Schlüssel nicht im Datenstrom enthalten war. 
  
-Perfect Forward Secrecy (PFS) basiert auf der Idee, dass Client und Server ihre Kommunikation über einen zusätzlichen temporären Schlüssel absichern, der wechselt. Da der Verbindungsaufbau so gestrickt ist, daß der Schlüssel selbst gar nicht ausgetauscht werden muß, kann der jeweils benutzte Sitzungsschlüssel selbst auch nicht aufgezeichnet werden. Eine nachträgliche Entschlüsselung einer früher aufgezeichneten Session ist damit nicht mehr möglich. +Perfect Forward Secrecy (PFS) basiert auf der Idee, dass Client und Server ihre Kommunikation über einen zusätzlichen temporären Schlüssel absichern, der wechselt. Da der Verbindungsaufbau so gestrickt ist, dass der Schlüssel selbst gar nicht ausgetauscht werden muss, kann der jeweils benutzte Sitzungsschlüssel selbst auch nicht aufgezeichnet werden. Eine nachträgliche Entschlüsselung einer früher aufgezeichneten Session ist damit nicht mehr möglich. 
  
 Die für die Verschlüsselung notwendigen //Schlüssel// und //Zertifikate// erstellen wir mittels [[http://www.openssl.org|OpenSSL]], einer freien Implementierung von **SSL**((**S**ecure **S**ockets **L**ayer)). **SSL** oder **TLS**((**T**ransport **L**ayer **S**ecurity)) ist ein hybrides Verschlüsselungsprotokoll zur Datenübertragung im Internet. Unter TLS 1.0, 1.1 und 1.2 versteht man die standardisierten Weiterentwicklungen von SSL 3.0 (TLS 1.0 steht neu für SSL 3.1). Dies bedeutet also, SSL wird nun unter dem Namen TLS weiterentwickelt. Die für die Verschlüsselung notwendigen //Schlüssel// und //Zertifikate// erstellen wir mittels [[http://www.openssl.org|OpenSSL]], einer freien Implementierung von **SSL**((**S**ecure **S**ockets **L**ayer)). **SSL** oder **TLS**((**T**ransport **L**ayer **S**ecurity)) ist ein hybrides Verschlüsselungsprotokoll zur Datenübertragung im Internet. Unter TLS 1.0, 1.1 und 1.2 versteht man die standardisierten Weiterentwicklungen von SSL 3.0 (TLS 1.0 steht neu für SSL 3.1). Dies bedeutet also, SSL wird nun unter dem Namen TLS weiterentwickelt.
Zeile 32: Zeile 32:
  
    Installed Packages    Installed Packages
-   openssl.x86_64                     1:1.0.1e-34.el7_0.                            @updates-LC+   openssl.x86_64                     1:1.0.1e-51.el7_2.                            @updates-LC
  
 Sollte das Paket noch fehlen, installieren wir dies einfach via: Sollte das Paket noch fehlen, installieren wir dies einfach via:
Zeile 41: Zeile 41:
 Epoch       : 1 Epoch       : 1
 Version     : 1.0.1e Version     : 1.0.1e
-Release     : 34.el7_0.3+Release     : 51.el7_2.7
 Architecture: x86_64 Architecture: x86_64
-Install Date: Mon 21 Jul 2014 03:25:15 PM CEST+Install Date: Wed 28 Sep 2016 07:57:19 PM CEST
 Group       : System Environment/Libraries Group       : System Environment/Libraries
-Size        : 1609970+Size        : 1611113
 License     : OpenSSL License     : OpenSSL
-Signature   : RSA/SHA256, Sat 05 Jul 2014 05:29:46 PM CEST, Key ID 24c6a8a7f4a80eb5 +Signature   : RSA/SHA256, Tue 27 Sep 2016 04:21:24 PM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : openssl-1.0.1e-34.el7_0.3.src.rpm +Source RPM  : openssl-1.0.1e-51.el7_2.7.src.rpm 
-Build Date  : Tue 24 Jun 2014 02:59:00 PM CEST+Build Date  : Tue 27 Sep 2016 03:41:26 PM CEST
 Build Host  : worker1.bsys.centos.org Build Host  : worker1.bsys.centos.org
 Relocations : (not relocatable) Relocations : (not relocatable)
Zeile 141: Zeile 141:
 /usr/share/man/man5/openssl.cnf.5ssl.gz /usr/share/man/man5/openssl.cnf.5ssl.gz
 /usr/share/man/man5/x509v3_config.5ssl.gz /usr/share/man/man5/x509v3_config.5ssl.gz
-/usr/share/man/man7/des_modes.7ssl.gz +/usr/share/man/man7/des_modes.7ssl.gz</code> 
-</code>+
  
-=== Cipher-Suites und Diffie-Hellmann ===+==== Cipher-Suites und Diffie-Hellman ====
 Möchte man in Erfahrung bringen, welche Cipher-Suites((Sammlung von standardisierten kryptographischer Algorithmen)) unser installiertes OpenSSL-Paket mitbringt, können wir wie folgt abfragen((Ausgabe in formatierter Tabelle)). Möchte man in Erfahrung bringen, welche Cipher-Suites((Sammlung von standardisierten kryptographischer Algorithmen)) unser installiertes OpenSSL-Paket mitbringt, können wir wie folgt abfragen((Ausgabe in formatierter Tabelle)).
    # openssl ciphers -v    # openssl ciphers -v
Zeile 261: Zeile 261:
 </code> </code>
  
 +===== Dokumentation =====
 +==== Fachliteratur ====
 +<WRAP center round tip 90%>
 +Das Buch **[[https://www.feistyduck.com/books/bulletproof-ssl-and-tls/|Bulletproof SSL and TLS]]** von **[[http://blog.ivanristic.com/|Ivan Ristić]]** bringt viele wertvoller Erklärungen und kann jedem interessierten Webmaster wärmstens empfohlen werden! Neben den Grundlagen zu SSL/TLS und PKI finden sich dort auch weiterführende Konfigurationsbeispiele unter anderem zu unserem **//Apache-Webserver 2.4//**. Ausserdem erhält man als registrierter Leser wertvolle aktualisierte News in Form von regelmässigen eMails, in denen aktuellste Entwicklungen und Schwachstellen beleuchtet werden. 
 +
 +Also alles in allem sehr gut angelegte 55€ - das Buch **978-1-907117-04-6** (ISBN) ist in jedem gut sortierten Buchhandel vor Ort erhältlich sein sollte. 
 +</WRAP>
 + 
 +
 +==== Seiten im WWW ====
 +Natürlich finden sich im ***WWW** unzählige Seiten, die sich dem Thema TLS/SSL annehmen. Die Seiten bei zu **[[https://wiki.mozilla.org/Security/Server_Side_TLS|Security/Server Side TLS]]** im Mozilla WIKI sind neben dem **[[https://blog.mozilla.org/security/|Blog]]** und dem **[[https://wiki.mozilla.org/Security/Guidelines/Web_Security|Security Guidelines zur Web Security]]** als sehr gute Quelle zu bewerten. Auch die **[[https://de.wikipedia.org|Wikipedia]]** Seite zu **[[https://de.wikipedia.org/wiki/Transport_Layer_Security|Transport Layer Security]]** erklärt anschaulich das Thema Transportverschlüsselung.
 +
 +==== man-Pages ====
 +=== openssl ===
 +   # man openssl
 +<code>OPENSSL(1)                                 OpenSSL                                 OPENSSL(1)
 +
 +NAME
 +       openssl - OpenSSL command line tool
 +
 +SYNOPSIS
 +       openssl command [ command_opts ] [ command_args ]
 +
 +       openssl [ list-standard-commands | list-message-digest-commands | list-cipher-commands
 +       | list-cipher-algorithms | list-message-digest-algorithms | list-public-key-
 +       algorithms]
 +
 +       openssl no-XXX [ arbitrary options ]
 +
 +DESCRIPTION
 +       OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3)
 +       and Transport Layer Security (TLS v1) network protocols and related cryptography
 +       standards required by them.
 +
 +       The openssl program is a command line tool for using the various cryptography
 +       functions of OpenSSL's crypto library from the shell.  It can be used for
 +
 +        o  Creation and management of private keys, public keys and parameters
 +        o  Public key cryptographic operations
 +        o  Creation of X.509 certificates, CSRs and CRLs
 +        o  Calculation of Message Digests
 +        o  Encryption and Decryption with Ciphers
 +        o  SSL/TLS Client and Server Tests
 +        o  Handling of S/MIME signed or encrypted mail
 +        o  Time Stamp requests, generation and verification
 +
 +COMMAND SUMMARY
 +       The openssl program provides a rich variety of commands (command in the SYNOPSIS
 +       above), each of which often has a wealth of options and arguments (command_opts and
 +       command_args in the SYNOPSIS).
 +
 +       The pseudo-commands list-standard-commands, list-message-digest-commands, and list-
 +       cipher-commands output a list (one entry per line) of the names of all standard
 +       commands, message digest commands, or cipher commands, respectively, that are
 +       available in the present openssl utility.
 +
 +       The pseudo-commands list-cipher-algorithms and list-message-digest-algorithms list all
 +       cipher and message digest names, one entry per line. Aliases are listed as:
 +
 +        from => to
 +
 +       The pseudo-command list-public-key-algorithms lists all supported public key
 +       algorithms.
 +
 +       The pseudo-command no-XXX tests whether a command of the specified name is available.
 +       If no command named XXX exists, it returns 0 (success) and prints no-XXX; otherwise it
 +       returns 1 and prints XXX.  In both cases, the output goes to stdout and nothing is
 +       printed to stderr.  Additional command line arguments are always ignored.  Since for
 +       each cipher there is a command of the same name, this provides an easy way for shell
 +       scripts to test for the availability of ciphers in the openssl program.  (no-XXX is
 +       not able to detect pseudo-commands such as quit, list-...-commands, or no-XXX itself.)
 +
 +   STANDARD COMMANDS
 +       asn1parse Parse an ASN.1 sequence.
 +
 +       ca        Certificate Authority (CA) Management.
 +
 +       ciphers   Cipher Suite Description Determination.
 +
 +       cms       CMS (Cryptographic Message Syntax) utility
 +
 +       crl       Certificate Revocation List (CRL) Management.
 +
 +       crl2pkcs7 CRL to PKCS#7 Conversion.
 +
 +       dgst      Message Digest Calculation.
 +
 +       dh        Diffie-Hellman Parameter Management.  Obsoleted by dhparam.
 +
 +       dhparam   Generation and Management of Diffie-Hellman Parameters. Superseded by
 +                 genpkey and pkeyparam
 +
 +       dsa       DSA Data Management.
 +
 +       dsaparam  DSA Parameter Generation and Management. Superseded by genpkey and pkeyparam
 +
 +       ec        EC (Elliptic curve) key processing
 +
 +       ecparam   EC parameter manipulation and generation
 +
 +       enc       Encoding with Ciphers.
 +
 +       engine    Engine (loadble module) information and manipulation.
 +
 +       errstr    Error Number to Error String Conversion.
 +
 +       gendh     Generation of Diffie-Hellman Parameters.  Obsoleted by dhparam.
 +
 +       gendsa    Generation of DSA Private Key from Parameters. Superseded by genpkey and
 +                 pkey
 +
 +       genpkey   Generation of Private Key or Parameters.
 +
 +       genrsa    Generation of RSA Private Key. Superceded by genpkey.
 +
 +       nseq      Create or examine a netscape certificate sequence
 +
 +       ocsp      Online Certificate Status Protocol utility.
 +
 +       passwd    Generation of hashed passwords.
 +
 +       pkcs12    PKCS#12 Data Management.
 +
 +       pkcs7     PKCS#7 Data Management.
 +
 +       pkey      Public and private key management.
 +
 +       pkeyparam Public key algorithm parameter management.
 +
 +       pkeyutl   Public key algorithm cryptographic operation utility.
 +
 +       rand      Generate pseudo-random bytes.
 +
 +       req       PKCS#10 X.509 Certificate Signing Request (CSR) Management.
 +
 +       rsa       RSA key management.
 +
 +       rsautl    RSA utility for signing, verification, encryption, and decryption.
 +                 Superseded by  pkeyutl
 +
 +       s_client  This implements a generic SSL/TLS client which can establish a transparent
 +                 connection to a remote server speaking SSL/TLS. It's intended for testing
 +                 purposes only and provides only rudimentary interface functionality but
 +                 internally uses mostly all functionality of the OpenSSL ssl library.
 +
 +       s_server  This implements a generic SSL/TLS server which accepts connections from
 +                 remote clients speaking SSL/TLS. It's intended for testing purposes only and
 +                 provides only rudimentary interface functionality but internally uses mostly
 +                 all functionality of the OpenSSL ssl library.  It provides both an own
 +                 command line oriented protocol for testing SSL functions and a simple HTTP
 +                 response facility to emulate an SSL/TLS-aware webserver.
 +
 +       s_time    SSL Connection Timer.
 +
 +       sess_id   SSL Session Data Management.
 +
 +       smime     S/MIME mail processing.
 +
 +       speed     Algorithm Speed Measurement.
 +
 +       spkac     SPKAC printing and generating utility
 +
 +       ts        Time Stamping Authority tool (client/server)
 +
 +       verify    X.509 Certificate Verification.
 +       version   OpenSSL Version Information.
 +
 +       x509      X.509 Certificate Data Management.
 +
 +   MESSAGE DIGEST COMMANDS
 +       md2       MD2 Digest
 +
 +       md5       MD5 Digest
 +
 +       mdc2      MDC2 Digest
 +
 +       rmd160    RMD-160 Digest
 +
 +       sha       SHA Digest
 +
 +       sha1      SHA-1 Digest
 +
 +       sha224    SHA-224 Digest
 +
 +       sha256    SHA-256 Digest
 +
 +       sha384    SHA-384 Digest
 +
 +       sha512    SHA-512 Digest
 +
 +   ENCODING AND CIPHER COMMANDS
 +       base64    Base64 Encoding
 +
 +       bf bf-cbc bf-cfb bf-ecb bf-ofb
 +                 Blowfish Cipher
 +
 +       cast cast-cbc
 +                 CAST Cipher
 +
 +       cast5-cbc cast5-cfb cast5-ecb cast5-ofb
 +                 CAST5 Cipher
 +
 +       des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ofb
 +                 DES Cipher
 +
 +       des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb
 +                 Triple-DES Cipher
 +
 +       idea idea-cbc idea-cfb idea-ecb idea-ofb
 +                 IDEA Cipher
 +
 +       rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb
 +                 RC2 Cipher
 +
 +                 RC2 Cipher
 +
 +       rc4       RC4 Cipher
 +
 +       rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb
 +                 RC5 Cipher
 +
 +PASS PHRASE ARGUMENTS
 +       Several commands accept password arguments, typically using -passin and -passout for
 +       input and output passwords respectively. These allow the password to be obtained from
 +       a variety of sources. Both of these options take a single argument whose format is
 +       described below. If no password argument is given and a password is required then the
 +       user is prompted to enter one: this will typically be read from the current terminal
 +       with echoing turned off.
 +
 +       pass:password
 +                 the actual password is password. Since the password is visible to utilities
 +                 (like 'ps' under Unix) this form should only be used where security is not
 +                 important.
 +
 +       env:var   obtain the password from the environment variable var. Since the environment
 +                 of other processes is visible on certain platforms (e.g. ps under certain
 +                 Unix OSes) this option should be used with caution.
 +
 +       file:pathname
 +                 the first line of pathname is the password. If the same pathname argument is
 +                 supplied to -passin and -passout arguments then the first line will be used
 +                 for the input password and the next line for the output password. pathname
 +                 need not refer to a regular file: it could for example refer to a device or
 +                 named pipe.
 +
 +       fd:number read the password from the file descriptor number. This can be used to send
 +                 the data via a pipe for example.
 +
 +       stdin     read the password from standard input.
 +
 +SEE ALSO
 +       asn1parse(1), ca(1), config(5), crl(1), crl2pkcs7(1), dgst(1), dhparam(1), dsa(1),
 +       dsaparam(1), enc(1), gendsa(1), genpkey(1), genrsa(1), nseq(1), openssl(1),
 +       sslpasswd(1), pkcs12(1), pkcs7(1), pkcs8(1), sslrand(1), req(1), rsa(1), rsautl(1),
 +       s_client(1), s_server(1), s_time(1), smime(1), spkac(1), verify(1), version(1),
 +       x509(1), crypto(3), ssl(3), x509v3_config(5)
 +
 +HISTORY
 +       The openssl(1) document appeared in OpenSSL 0.9.2.  The list-XXX-commands pseudo-
 +       commands were added in OpenSSL 0.9.3; The list-XXX-algorithms pseudo-commands were
 +       added in OpenSSL 1.0.0; the no-XXX pseudo-commands were added in OpenSSL 0.9.5a.  For
 +       notes on the availability of other commands, see their individual manual pages.
 +
 +1.0.1e                                    2016-09-27                               OPENSSL(1)
 +</code>
 +
 +=== dhparam ===
 +   # man dhparam
 +<code>DHPARAM(1)                                 OpenSSL                                 DHPARAM(1)
 +
 +NAME
 +       dhparam - DH parameter manipulation and generation
 +
 +SYNOPSIS
 +       openssl dhparam [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename]
 +       [-dsaparam] [-noout] [-text] [-C] [-2] [-5] [-rand file(s)] [-engine id] [numbits]
 +
 +DESCRIPTION
 +       This command is used to manipulate DH parameter files.
 +
 +OPTIONS
 +       -inform DER|PEM
 +           This specifies the input format. The DER option uses an ASN1 DER encoded form
 +           compatible with the PKCS#3 DHparameter structure. The PEM form is the default
 +           format: it consists of the DER format base64 encoded with additional header and
 +           footer lines.
 +
 +       -outform DER|PEM
 +           This specifies the output format, the options have the same meaning as the -inform
 +           option.
 +
 +       -in filename
 +           This specifies the input filename to read parameters from or standard input if
 +           this option is not specified.
 +
 +       -out filename
 +           This specifies the output filename parameters to. Standard output is used if this
 +           option is not present. The output filename should not be the same as the input
 +           filename.
 +
 +       -dsaparam
 +           If this option is used, DSA rather than DH parameters are read or created; they
 +           are converted to DH format.  Otherwise, "strong" primes (such that (p-1)/2 is also
 +           prime) will be used for DH parameter generation.
 +
 +           DH parameter generation with the -dsaparam option is much faster, and the
 +           recommended exponent length is shorter, which makes DH key exchange more
 +           efficient.  Beware that with such DSA-style DH parameters, a fresh DH key should
 +           be created for each use to avoid small-subgroup attacks that may be possible
 +           otherwise.
 +
 +       -2, -5
 +           The generator to use, either 2 or 5. 2 is the default. If present then the input
 +           file is ignored and parameters are generated instead.
 +
 +       -rand file(s)
 +           a file or files containing random data used to seed the random number generator,
 +           or an EGD socket (see RAND_egd(3)).  Multiple files can be specified separated by
 +           or an EGD socket (see RAND_egd(3)).  Multiple files can be specified separated by
 +           a OS-dependent character.  The separator is ; for MS-Windows, , for OpenVMS, and :
 +           for all others.
 +
 +       numbits
 +           this option specifies that a parameter set should be generated of size numbits. It
 +           must be the last option. If not present then a value of 512 is used. If this
 +           option is present then the input file is ignored and parameters are generated
 +           instead.
 +
 +       -noout
 +           this option inhibits the output of the encoded version of the parameters.
 +
 +       -text
 +           this option prints out the DH parameters in human readable form.
 +
 +       -C  this option converts the parameters into C code. The parameters can then be loaded
 +           by calling the get_dhnumbits() function.
 +
 +       -engine id
 +           specifying an engine (by its unique id string) will cause dhparam to attempt to
 +           obtain a functional reference to the specified engine, thus initialising it if
 +           needed. The engine will then be set as the default for all available algorithms.
 +
 +WARNINGS
 +       The program dhparam combines the functionality of the programs dh and gendh in
 +       previous versions of OpenSSL and SSLeay. The dh and gendh programs are retained for
 +       now but may have different purposes in future versions of OpenSSL.
 +
 +NOTES
 +       PEM format DH parameters use the header and footer lines:
 +
 +        -----BEGIN DH PARAMETERS-----
 +        -----END DH PARAMETERS-----
 +
 +       OpenSSL currently only supports the older PKCS#3 DH, not the newer X9.42 DH.
 +
 +       This program manipulates DH parameters not keys.
 +
 +BUGS
 +       There should be a way to generate and manipulate DH keys.
 +
 +SEE ALSO
 +       dsaparam(1)
 +
 +HISTORY
 +       The dhparam command was added in OpenSSL 0.9.5.  The -dsaparam option was added in
 +       OpenSSL 0.9.6.
 +
 +1.0.1e                                    2013-02-11                               DHPARAM(1)
 +</code>
 +
 +==== Apache.org ====
 +Viele wervolle Hinweise zu den Konfigurationsparameter zu **mod_ssl** findet man in der Dokumentation zum [[http://httpd.apache.org/docs/current/mod/mod_ssl.html|Apache Module mod_ssl]] und [[http://httpd.apache.org/docs/current/ssl/ssl_howto.html|SSL/TLS Strong Encryption How-To]].
 +
 +
 +===== CA Trust =====
 +Dreh- und Angelpunkt bei den CAs und den zugehörigen Root-Zertifikaten ist das Vertrauen, welches man diesen schenken ma und/oder kann. Mit sehr hoher Wahrscheinlichkeit kann man davon ausgehen dass eine CA wie z.B. **[[https://www.swisssign.com/de/|swiss sign]]** die von den Browserherstellern geforderten Sicherheitsprüfungen erfüllen. Eine wesentliche Schwachstelle der ganzen CAs ist aber, wer garantiert, dass nicht eine x-beliebige zweite CA ein Zertifikat für z.B. **nausch.org** erstellt, obwohl bereits //GlobalSign// hierzu ein X.509-Zertifikat ausgestellt hat?
 +
 +<WRAP center round important 85%>
 +Ein Umstand, den sich z.B. alle [[https://de.wikipedia.org/wiki/Man-in-the-Middle-Angriff|Man-in-the-Middle-Angriffe]] zu nutze machen und unberechtigter Weise falsche Zertifikate ausstellen und somit dem sorglosen Endanwender in betrügerischer Art und Weise einen gefälschte Identität und eine nicht mehr existierende Ende zu Ende Verschlüsselung zwischen dem Webserver und Browser vorgaukeln.
 +</WRAP>
 +
 +Wir werden später noch Lösungen aufzeigen, wie wir zum einen auf Serverseite diese betrügerischen Angriffsversuche serverseitig soweit wie möglich zu unterbinden und auch auf Clientseite Lösungen aufzeigen, wie ein Kunde am Browser sehr leicht feststellen kann, ob die Verbindung sicher ist, oder ob jemand mit krimineller Energie versucht an vertrauliche Informationen durch einen MitM-Angriff zu kommen!
  
 +{{page>centos:ca-trust&nofooter&showheader}}
  
 +{{page>centos:ca-chain&nofooter&showheader}}
  
 ===== Zertifikatserstellung ===== ===== Zertifikatserstellung =====
Zeile 725: Zeile 1109:
  
 <html><pre class="code"> <html><pre class="code">
-<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa <cakey.pem >cakey_ohne_passphrase.pem</font>+<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa &lt;cakey.pem &gt;cakey_ohne_passphrase.pem</font>
 </pre></html> </pre></html>
 <html><pre class="code"> <html><pre class="code">
Zeile 1106: Zeile 1490:
  
 <html><pre class="code"> <html><pre class="code">
-<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl genrsa -out serverkey.pem -aes256 4096 /font>+<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl genrsa -out serverkey.pem -aes256 4096 </font>
 </pre></html> </pre></html>
 <html><pre class="code"> <html><pre class="code">
Zeile 1119: Zeile 1503:
 Wie schon erwähnt, entfernen wir die Passphrase nun wieder, in dem wir bei der Frage **Enter pass phrase:** einfach die Taste **[ENTER]** drücken. Wie schon erwähnt, entfernen wir die Passphrase nun wieder, in dem wir bei der Frage **Enter pass phrase:** einfach die Taste **[ENTER]** drücken.
 <html><pre class="code"> <html><pre class="code">
-<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa <serverkey.pem >serverkey_2.pem</font>+<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa &lt;serverkey.pem &gt;serverkey_2.pem</font>
 </pre></html> </pre></html>
 <html><pre class="code"> <html><pre class="code">
Zeile 1137: Zeile 1521:
 Im folgenden Schritt zu unserem eigenen Zertifikat erzeugen wir einen **CSR**((**C**ertificate **S**igning **R**equest)), den wir dann in einem weiteren Schritt von unserer eigenen CA signieren lassen werden, oder bei der ausgewählten **kommerziellen CA** einkippen. Im folgenden Schritt zu unserem eigenen Zertifikat erzeugen wir einen **CSR**((**C**ertificate **S**igning **R**equest)), den wir dann in einem weiteren Schritt von unserer eigenen CA signieren lassen werden, oder bei der ausgewählten **kommerziellen CA** einkippen.
  
-<WRAP round alert> **__Wichtig__**: Bei unserem Serverzertifikat ist der **Common Name** von entscheidender Bedeutung. Hier muss der DNS-Name unseres Dovecot-Servers eingetragen werden, unter dem der Mailserver angesprochen wird!</WRAP>+<WRAP round alert> **__Wichtig__**: Bei unserem Serverzertifikat ist der **Common Name** von entscheidender Bedeutung. Hier muss der DNS-Name unseres Apache-WebServers bzw. des vHosts eingetragen werden, unter dem der Webserver später angesprochen wird!</WRAP>
  
 Auch hier sind die Eingaben in der Farbe <html><font style="color: rgb(0, 0, 255)"><b>blau</b></font></html> und die Rückmeldungen in der Farbe <html><font style="color: rgb(0, 0, 0)"><b>schwarz</b></font></html> gekennzeichnet.  Auch hier sind die Eingaben in der Farbe <html><font style="color: rgb(0, 0, 255)"><b>blau</b></font></html> und die Rückmeldungen in der Farbe <html><font style="color: rgb(0, 0, 0)"><b>schwarz</b></font></html> gekennzeichnet. 
Zeile 1428: Zeile 1812:
 ├── cert.pem -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ├── cert.pem -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
 ├── certs ├── certs
-│   ├── ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem +│   ├── ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem 
-│   ├── ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt +│   ├── ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt 
-│   ├── localhost.crt +│   ├── localhost.crt 
-│   ├── make-dummy-cert +│   ├── make-dummy-cert 
-│   ├── Makefile +│   ├── Makefile 
-│   └── renew-dummy-cert+│   └── renew-dummy-cert
 ├── misc ├── misc
-│   ├── CA +│   ├── CA 
-│   ├── c_hash +│   ├── c_hash 
-│   ├── c_info +│   ├── c_info 
-│   ├── c_issuer +│   ├── c_issuer 
-│   └── c_name+│   └── c_name
 ├── openssl.cnf ├── openssl.cnf
 └── private └── private
Zeile 1452: Zeile 1836:
  # chmod 400 /etc/pki/tls/certs/*.pem</code>  # chmod 400 /etc/pki/tls/certs/*.pem</code>
  
 +===== Konfiguration =====
 +==== ssl.conf ====
 +Bei der Konfiguration unseres TLS-gesicherten Apache-Webservers benutzen wir nun nicht die (komplette) mitgelieferte Konfigurationsdatei //**/etc/httpd/conf.d/sssl.conf**//, sondern verlagern die zum Apache vHost, egal ob name based oder IP based, passende Konfigurationsdatei.
  
 +Wir sichern dazu erst einmal die originale Konfigurationsdatei.
 +   # cp -a /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.orig
  
 +Im ersten Schritt werden wir nun bestehende Konfigurationsdatei soweit "ausdünnen und nur den ersten Teil verwenden. Den Abschnitt **SSL Virtual Host Context** können wir nun entweder komplett löschen oder entsprechend auskommentieren.
  
 +   # vim /etc/http/conf.d/ssl.conf
 +<file bash /etc/http/conf.d/ssl.conf>#
 +# When we also provide SSL we have to listen to the 
 +# the HTTPS port in addition.
 +#
 +Listen 443 https
  
 +##
 +##  SSL Global Context
 +##
 +##  All SSL configuration in this context applies both to
 +##  the main server and all SSL-enabled virtual hosts.
 +##
  
 +#   Pass Phrase Dialog:
 +#   Configure the pass phrase gathering process.
 +#   The filtering dialog program (`builtin' is a internal
 +#   terminal dialog) has to provide the pass phrase on stdout.
 +SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
  
-===== Konfiguration ==== +#   Inter-Process Session Cache: 
-Viele wervolle Hinweise zu den Konfigurationsparameter findet man in der Dokumentation zum [[http://httpd.apache.org/docs/current/mod/mod_ssl.html|Apache Module mod_ssl]] und [[http://httpd.apache.org/docs/current/ssl/ssl_howto.html|SSL/TLS Strong Encryption How-To]].+#   Configure the SSL Session Cache: First the mechanism  
 +#   to use and second the expiring timeout (in seconds). 
 +SSLSessionCache         shmcb:/run/httpd/sslcache(512000) 
 +SSLSessionCacheTimeout  300
  
 +#   Pseudo Random Number Generator (PRNG):
 +#   Configure one or more sources to seed the PRNG of the 
 +#   SSL library. The seed data should be of good random quality.
 +#   WARNING! On some platforms /dev/random blocks if not enough entropy
 +#   is available. This means you then cannot use the /dev/random device
 +#   because it would lead to very long connection times (as long as
 +#   it requires to make more entropy available). But usually those
 +#   platforms additionally provide a /dev/urandom device which doesn't
 +#   block. So, if available, use this one instead. Read the mod_ssl User
 +#   Manual for more details.
 +SSLRandomSeed startup file:/dev/urandom  256
 +SSLRandomSeed connect builtin
 +#SSLRandomSeed startup file:/dev/random  512
 +#SSLRandomSeed connect file:/dev/random  512
 +#SSLRandomSeed connect file:/dev/urandom 512
 +
 +#
 +# Use "SSLCryptoDevice" to enable any supported hardware
 +# accelerators. Use "openssl engine -v" to list supported
 +# engine names.  NOTE: If you enable an accelerator and the
 +# server does not start, consult the error logs and ensure
 +# your accelerator is functioning properly. 
 +#
 +SSLCryptoDevice builtin
 +#SSLCryptoDevice ubsec
 +
 +
 +##
 +## SSL Virtual Host Context
 +##
 +
 +#<VirtualHost _default_:443>
 +#
 +## General setup for the virtual host, inherited from global configuration
 +##DocumentRoot "/var/www/html"
 +##ServerName www.example.com:443
 +#
 +## Use separate log files for the SSL virtual host; note that LogLevel
 +## is not inherited from httpd.conf.
 +#ErrorLog logs/ssl_error_log
 +#TransferLog logs/ssl_access_log
 +#LogLevel warn
 +#
 +##   SSL Engine Switch:
 +##   Enable/Disable SSL for this virtual host.
 +#SSLEngine on
 +#
 +##   SSL Protocol support:
 +## List the enable protocol levels with which clients will be able to
 +## connect.  Disable SSLv2 access by default:
 +#SSLProtocol all -SSLv2
 +#
 +##   SSL Cipher Suite:
 +##   List the ciphers that the client is permitted to negotiate.
 +##   See the mod_ssl documentation for a complete list.
 +#SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
 +#
 +##   Speed-optimized SSL Cipher configuration:
 +##   If speed is your main concern (on busy HTTPS servers e.g.),
 +##   you might want to force clients to specific, performance
 +##   optimized ciphers. In this case, prepend those ciphers
 +##   to the SSLCipherSuite list, and enable SSLHonorCipherOrder.
 +##   Caveat: by giving precedence to RC4-SHA and AES128-SHA
 +##   (as in the example below), most connections will no longer
 +##   have perfect forward secrecy - if the server's key is
 +##   compromised, captures of past or future traffic must be
 +##   considered compromised, too.
 +##SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
 +##SSLHonorCipherOrder on 
 +#
 +##   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 new
 +## certificate can be generated using the genkey(1) command.
 +#SSLCertificateFile /etc/pki/tls/certs/localhost.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/pki/tls/private/localhost.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/pki/tls/certs/server-chain.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)
 +##SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
 +#
 +##   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 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 +StrictRequire
 +#<Files ~ "\.(cgi|shtml|phtml|php3?)$">
 +#    SSLOptions +StdEnvVars
 +#</Files>
 +#<Directory "/var/www/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.
 +#BrowserMatch "MSIE [2-5]" \
 +#         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 logs/ssl_request_log \
 +#          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
 +#
 +#</VirtualHost> 
 +</file>
 +
 +Die Hauptkonfiguration beschrängt sich demnach auf folgende sieben Zeilen:
 +   # egrep -v '(^.*#|^$)' /etc/httpd/conf.d/ssl.conf
 +
 +<code bash>Listen 443 https
 +SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
 +SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
 +SSLSessionCacheTimeout  300
 +SSLRandomSeed startup file:/dev/urandom  256
 +SSLRandomSeed connect builtin
 +SSLCryptoDevice builtin</code>
 +
 +
 +==== vHost.conf ====
 +
 +   # vim  /etc/httpd/conf.d/forum.conf
 +<file apache /etc/httpd/conf.d/forum.conf>#
 +# Django : 2015-10-30
 +#          vHost hk-forum
 +#
 +
 +# Variablen der Hostvariablen
 +Define vhost hk-forum
 +Define errors_log logs/${vhost}_error.log
 +Define access_log logs/${vhost}_access.log
 +Define ssl_log logs/${vhost}_ssl_request.log
 +
 +<VirtualHost 10.0.0.97:80>
 +    ServerAdmin webmaster@nausch.org
 +    ServerName ${vhost}.nausch.org
 +
 +    RewriteEngine on
 +    RewriteCond %{HTTPS} off
 +    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
 +
 +    # Welche Logdateien sollen beschrieben werden
 +    SetEnvIf Remote_Addr "10\.0\.0\.20" dontlog
 +    ErrorLog  ${errors_log}
 +    CustomLog ${access_log} combined env=!dontlog
 +</VirtualHost>
 +<VirtualHost 10.0.0.97:443>
 +    ServerAdmin webmaster@nausch.org
 +    ServerName ${vhost}.nausch.org
 +    ServerPath /
 +
 +    # Wer soll Zugriff auf die Webseite(n) bekommen?
 +    #<Location />
 +    #    Options +FollowSymLinks +Multiviews -Indexes
 +    #    AllowOverride None
 +    #    AuthType Basic
 +    #    AuthName "Fuer den Zugriff auf den Webserver bitte Anmeldedaten eingeben!"
 +    #    AuthBasicProvider ldap
 +    #    AuthLDAPUrl ldaps://openldap.dmz.nausch.org:636/ou=People,dc=nausch,dc=org?uid
 +    #    AuthLDAPBindDN cn=Technischeruser,dc=nausch,dc=org
 +    #    AuthLDAPBindPassword "M52wFn0r0w95z5bn/\EU64FE!" 
 +    #    AuthLDAPBindAuthoritative on
 +    #    Require ldap-user accessuser
 +    #</Location>
 +
 +    # Welcher Inhalt soll angezeigt bzw. auf welchen Server sollen die HTTP-Requests 
 +    #weitergeleitet werden?
 +    DocumentRoot   "/srv/www/html/${vhost}/"
 +    DirectoryIndex index.php
 +
 +    <Directory /srv/www/html/${vhost}/>
 +        Options none
 +        AllowOverride Limit
 +        Require all granted
 +    </Directory>
 +
 +    <LocationMatch "/(config.inc.php|configs|scripts|tests|users|VIRTUALVACATIONS)/">
 +        Require all denied
 +    </LocationMatch>
 +
 +    # Welche Logdateien sollen beschrieben werden
 +    SetEnvIf Remote_Addr "10\.0\.0\.20" dontlog
 +    ErrorLog  ${errors_log}
 +    CustomLog ${access_log} combined env=!dontlog
 +    CustomLog ${ssl_log} "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
 +
 +    # Absicherung der Übertragung mit Hilfe von TLS
 +    # Django : 2015-10-04 - TLS-Verschlüsselung mit Hilfe von mod_ssl
 +    SSLEngine on
 +    # Definition der anzubietenden Protokolle
 +    SSLProtocol All -SSLv2 -SSLv3
 +    # Definition der Cipher
 +    SSLCipherSuite "AES256+EECDH +AEAD"
 +    # Schlüsseldatei, mit der der CSR erstellt wurde
 +    SSLCertificateKeyFile /etc/pki/tls/private/${vhost}.nausch.org.serverkey.pem
 +    # Zertifikatsdatei , die von der CA signiert wurde
 +    SSLCertificateFile /etc/pki/tls/certs/${vhost}.nausch.org.certificate.pem
 +    # Zertifikatsdatei des bzw. der Intermediate-Zertifikate(s)
 +    SSLCertificateChainFile /etc/pki/tls/certs/Intermediate.certificate.pem
 +    # Änderung der Cipherorder der Clienets verneinen 
 +    SSLHonorCipherOrder on
 +    # TLS 1.0 Kompremmierung deaktivieren (CRIME attacks)
 +    SSLCompression off
 +    # Online Certificate Status Protocol stapling zum Prüfen des
 +    # Gültigkeitsstatus des Serverzertifikats.
 +    SSLUseStapling      on
 +    SSLStaplingResponderTimeout 5
 +    SSLStaplingReturnResponderErrors off
 +    # ist in der ssl.conf 
 +    # SSLStaplingCache        shmcb:/var/run/ocsp(128000)
 +
 +    # special stuff ###
 +
 +    # HTTP Strict Transport Security (HSTS), bei dem der Server dem Client im HTTP-Header 
 +    # mitteilt, dass dieser nur noch verschlüsselt mit dem Server kommunizieren soll.
 +    Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
 +
 +    # This header enables the Cross-site scripting (XSS) filter built into most recent 
 +    # web browsers. It's usually enabled by default anyway, so the role of this header 
 +    # is to re-enable the filter for this particular website if it was disabled by the 
 +    # user. https://www.owasp.org/index.php/List_of_useful_HTTP_headers
 +    Header set X-XSS-Protection "1; mode=block"
 +
 +    # when serving user-supplied content, include a X-Content-Type-Options: nosniff 
 +    # header along with the Content-Type: header, to disable content-type sniffing on 
 +    # some browsers. https://www.owasp.org/index.php/List_of_useful_HTTP_headers
 +    # currently suppoorted in IE > 8 
 +    # http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
 +    # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx
 +    # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020
 +    Header set X-Content-Type-Options nosniff
 +
 +    # config to don't allow the browser to render the page inside an frame or iframe
 +    # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
 +    # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with 
 +    # ALLOW-FROM uri https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
 +    header set X-Frame-Options DENY
 +
 +    # hide server header (apache and php version)
 +    Header unset Server
 +
 +    # Only allow JavaScript from the same domain to be run.
 +    # don't allow inline JavaScript to run.
 +    Header set X-Content-Security-Policy "allow 'self';"
 +
 +    # Add Secure and HTTP only attributes to cookies
 +    Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
 +
 +    # prevent Clickjacking Attack
 +    #Header always append X-Frame-Options SAMEORIGIN
 +    Header set Content-Security-Policy "default-src 'self';"
 +</VirtualHost>
 +
 +
 +</file>
 FIXME FIXME
  
Zeile 1564: Zeile 2316:
 # Django : 2014-08-30 Nur die beiden folgenden Protokolle SSLv3 und TLSv1 anbieten:  # Django : 2014-08-30 Nur die beiden folgenden Protokolle SSLv3 und TLSv1 anbieten: 
 # default: SSLProtocol all -SSLv2 # default: SSLProtocol all -SSLv2
-SSLProtocol -ALL +SSLv3 +TLSv1+SSLProtocol All -SSLv2 -SSLv3
  
 #   SSL Cipher Suite: #   SSL Cipher Suite:
Zeile 1744: Zeile 2496:
 https://addons.mozilla.org/de/firefox/addon/calomel-ssl-validation/ https://addons.mozilla.org/de/firefox/addon/calomel-ssl-validation/
  
 +https://mozilla.github.io/server-side-tls/ssl-config-generator/
 +
 +==== HSTS ====
 +
 +
 +In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende Zeile ''Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"''.
 +   # vim /etc/httpd/conf.d/forum.conf
 +
 +<code bash>...
 +
 +# HTTP Strict Transport Security (HSTS), bei dem der Server dem Client im 
 +# HTTP-Header mitteilt, dass dieser nur noch verschlüsselt mit dem Server 
 +# kommunizieren soll.
 +Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
 +
 +...</code>
 +
 +==== OCSP Stapling ====
 +
 +In der //**/etc/httpd/conf.d/ssl.conf**// folgende Konfigurationszeile nachtragen ''SSLStaplingCache "shmcb:/var/run/httpd/stapling_cache(128000)"''.
 +   # vim /etc/httpd/conf.d/ssl.conf
 +<code bash>...
 +
 +# Django : 2015-11-11
 +# Chache-Definition für Online Certificate Status Protocol stapling
 +SSLStaplingCache "shmcb:/var/run/httpd/stapling_cache(128000)"
 +
 +...</code>
 +
 +In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende drei Zeilen.
 +   # vim /etc/httpd/conf.d/forum.conf
 +
 +<code bash>...
 +
 +    # Online Certificate Status Protocol stapling zum Prüfen des Gültigkeitsstatus 
 +    # des Serverzertifikats.
 +    SSLUseStapling      on
 +    SSLStaplingResponderTimeout 5
 +    SSLStaplingReturnResponderErrors off
 +
 +...</code>
 +
 +
 +   $ openssl s_client -connect forum.nausch.org:443 -servername forum.nausch.org -status < /dev/null
 +<code>CONNECTED(00000003)
 +depth=2 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
 +verify return:1
 +depth=1 C = BE, O = GlobalSign nv-sa, CN = AlphaSSL CA - SHA256 - G2
 +verify return:1
 +depth=0 OU = Domain Control Validated, CN = forum.nausch.org
 +verify return:1
 +OCSP response: 
 +======================================
 +OCSP Response Data:
 +    OCSP Response Status: successful (0x0)
 +    Response Type: Basic OCSP Response
 +    Version: 1 (0x0)
 +    Responder Id: EE5EFFFE85DB26C626FBD3698410AD1D0DD3EF58
 +    Produced At: Nov 29 18:16:05 2016 GMT
 +    Responses:
 +    Certificate ID:
 +      Hash Algorithm: sha1
 +      Issuer Name Hash: 84D56BF8098BD307B766D8E1EBAD6596AA6B6761
 +      Issuer Key Hash: F5CDD53C0850F96A4F3AB797DA5683E669D268F7
 +      Serial Number: 6922D213277B49AC169E77A9
 +    Cert Status: good
 +    This Update: Nov 29 18:16:05 2016 GMT
 +    Next Update: Dec  3 18:16:05 2016 GMT
 +
 +...
 +</code>
 +
 +Werden **__keine__** OCSP-Response Daten angezeigt, ist dies ein Hinweis, dass die OCSP_Konfiguration nnoch nicht richtig abgeschlossen wurde!
 +
 +Zum Testen kann man alternativ auch den Test bei [[https://www.ssllabs.com/ssltest/|Qualys SSL Labs]] oder [[https://observatory.mozilla.org/|Observatory by Mozilla]] nutzen.
 +
 +==== Secure Cookie mit HttpOnly ====
 +
 +In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende Zeile ''Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
 +''.
 +   # vim /etc/httpd/conf.d/forum.conf
 +
 +<code bash>...
 +
 +# Add Secure and HTTP only attributes to cookies
 +Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
 +
 +...</code>
 +
 +https://tools.geekflare.com/web-tools/http-header-analyzer
 +
 +| set-cookie:   | Forum=rtg65np1t1cvnrg7n30l8mad67; path=/; secure; \\ HttpOnly;HttpOnly;SecureDW7fa065a06cb74b536c124cfbe56ac6d3=deleted; \\ expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; secure; httponly;HttpOnly;Secure |
 +
 +**HttpOnly** und **Secure** kennzeichnen die erfolgreiche Änderung!
 +
 +
 +
 +
 +
 +
 +
 +
 +==== HPKP ====
 +[[https://tools.ietf.org/rfc/rfc7469.txt|RFC 7469]]
 +   # openssl rsa -pubout -in /etc/pki/tls/private/forum.nausch.org.serverkey.pem \
 +                 -outform der | openssl dgst -sha256 -binary | base64
 +
 +  writing RSA key
 +  nMiOpb6vUnjCoWCkPkDaG4ND8SNWzFTsQf2ZfruLno0=
 +
 +pin-sha256="nMiOpb6vUnjCoWCkPkDaG4ND8SNWzFTsQf2ZfruLno0="
 +
 +   # openssl rsa -pubout -in /etc/pki/tls/private/forum.nausch.org._BACKUP_serverkey.pem \
 +                 -outform der | openssl dgst -sha256 -binary | base64
 +
 +  writing RSA key
 +  INhxSQ38nCS6ijaAAyo4xAhAZj9xeL3Xaak+GGiM2fo=
 +
 +Zum Löschen von outdated bzw. falschen key-hashes beim Firefox zuerst einam den Browser stoppen. Anschließend bearbeiten wir die Einträge in der Datei **SiteSecurityServiceState.txt** im profile-Pafd unserer Installation.
 +   # vim ~/.mozilla/firefox/[unique-id].default/SiteSecurityServiceState.txt
 +
 +Nach dem Speichern unserer Änderungen starten wir den Browser neu und können wieder auf die zuvor blockierten Seiten zugreifen.
 +
 +===== Tests =====
 +
 +Artikel auf [[http://www.golem.de|golem]] [[http://www.golem.de/news/observatory-mozilla-bietet-sicherheitscheck-fuer-websites-1608-122923.html|Mozilla bietet Sicherheitscheck für Websites]]. \\
 +[[https://observatory.mozilla.org/|Observatory by Mozilla]] \\
 +[[https://www.ssllabs.com|Qualys SSl Labs SSL Server Test]] \\
 +[[https://securityheaders.io|SecurityHeaders.io by Scott Helme]] \\
  
  • centos/web_c7/apache_2.1409428488.txt.gz
  • Zuletzt geändert: 30.08.2014 19:54.
  • von django