Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:web_c7:apache_2 [09.06.2015 11:43. ] – [manuelle Erstellung unserer eigenen CA] django | centos: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 mod_ssl für Apache httpd 2.4 unter CentOS 7.x ====== | ====== SSL gesicherter Webserver mit mod_ssl für Apache httpd 2.4 unter CentOS 7.x ====== | ||
{{: | {{: | ||
- | Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen. | + | Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen. |
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, | 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, | ||
- | Nicht nur auf [[centos: | + | Nicht nur auf [[centos: |
- | Mit Hilfe von **[[http:// | + | Mit Hilfe von **[[http:// |
- | 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 | + | 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 |
Die für die Verschlüsselung notwendigen // | Die für die Verschlüsselung notwendigen // | ||
Zeile 32: | Zeile 32: | ||
| | ||
- | | + | |
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 | Version | ||
- | Release | + | Release |
Architecture: | Architecture: | ||
- | 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/ | Group : System Environment/ | ||
- | Size : 1609970 | + | Size : 1611113 |
License | License | ||
- | Signature | + | Signature |
- | 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: | ||
/ | / | ||
/ | / | ||
- | / | + | / |
- | </ | + | |
- | === 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: | ||
</ | </ | ||
+ | ===== Dokumentation ===== | ||
+ | ==== Fachliteratur ==== | ||
+ | <WRAP center round tip 90%> | ||
+ | Das Buch **[[https:// | ||
+ | |||
+ | 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. | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Seiten im WWW ==== | ||
+ | Natürlich finden sich im ***WWW** unzählige Seiten, die sich dem Thema TLS/SSL annehmen. Die Seiten bei zu **[[https:// | ||
+ | |||
+ | ==== man-Pages ==== | ||
+ | === openssl === | ||
+ | # man openssl | ||
+ | < | ||
+ | |||
+ | NAME | ||
+ | | ||
+ | |||
+ | SYNOPSIS | ||
+ | | ||
+ | |||
+ | | ||
+ | | list-cipher-algorithms | list-message-digest-algorithms | list-public-key- | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | DESCRIPTION | ||
+ | | ||
+ | and Transport Layer Security (TLS v1) network protocols and related cryptography | ||
+ | | ||
+ | |||
+ | The openssl program is a command line tool for using the various cryptography | ||
+ | | ||
+ | |||
+ | o Creation and management of private keys, public keys and parameters | ||
+ | o Public key cryptographic operations | ||
+ | o Creation of X.509 certificates, | ||
+ | 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 | ||
+ | | ||
+ | | ||
+ | |||
+ | The pseudo-commands list-standard-commands, | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The pseudo-commands list-cipher-algorithms and list-message-digest-algorithms list all | ||
+ | | ||
+ | |||
+ | from => to | ||
+ | |||
+ | The pseudo-command list-public-key-algorithms lists all supported public key | ||
+ | | ||
+ | |||
+ | 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 | ||
+ | | ||
+ | | ||
+ | each cipher there is a command of the same name, this provides an easy way for shell | ||
+ | | ||
+ | not able to detect pseudo-commands such as quit, list-...-commands, | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | pkey | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | all functionality of the OpenSSL ssl library. | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | bf bf-cbc bf-cfb bf-ecb bf-ofb | ||
+ | | ||
+ | |||
+ | cast cast-cbc | ||
+ | CAST Cipher | ||
+ | |||
+ | | ||
+ | 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 | ||
+ | | ||
+ | |||
+ | idea idea-cbc idea-cfb idea-ecb idea-ofb | ||
+ | IDEA Cipher | ||
+ | |||
+ | rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb | ||
+ | RC2 Cipher | ||
+ | |||
+ | RC2 Cipher | ||
+ | |||
+ | | ||
+ | |||
+ | rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb | ||
+ | RC5 Cipher | ||
+ | |||
+ | PASS PHRASE ARGUMENTS | ||
+ | | ||
+ | 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 | ||
+ | | ||
+ | user is prompted to enter one: this will typically be read from the current terminal | ||
+ | with echoing turned off. | ||
+ | |||
+ | | ||
+ | the actual password is password. Since the password is visible to utilities | ||
+ | (like ' | ||
+ | | ||
+ | |||
+ | | ||
+ | of other processes is visible on certain platforms (e.g. ps under certain | ||
+ | Unix OSes) this option should be used with caution. | ||
+ | |||
+ | | ||
+ | the first line of pathname is the password. If the same pathname argument is | ||
+ | | ||
+ | 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. | ||
+ | |||
+ | | ||
+ | the data via a pipe for example. | ||
+ | |||
+ | | ||
+ | |||
+ | SEE ALSO | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | HISTORY | ||
+ | The openssl(1) document appeared in OpenSSL 0.9.2. | ||
+ | | ||
+ | added in OpenSSL 1.0.0; the no-XXX pseudo-commands were added in OpenSSL 0.9.5a. | ||
+ | notes on the availability of other commands, see their individual manual pages. | ||
+ | |||
+ | 1.0.1e | ||
+ | </ | ||
+ | |||
+ | === dhparam === | ||
+ | # man dhparam | ||
+ | < | ||
+ | |||
+ | NAME | ||
+ | | ||
+ | |||
+ | SYNOPSIS | ||
+ | | ||
+ | | ||
+ | |||
+ | DESCRIPTION | ||
+ | This command is used to manipulate DH parameter files. | ||
+ | |||
+ | OPTIONS | ||
+ | | ||
+ | This specifies the input format. The DER option uses an ASN1 DER encoded form | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | This specifies the output format, the options have the same meaning as the -inform | ||
+ | | ||
+ | |||
+ | -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 | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | If this option is used, DSA rather than DH parameters are read or created; they | ||
+ | are converted to DH format. | ||
+ | | ||
+ | |||
+ | DH parameter generation with the -dsaparam option is much faster, and the | ||
+ | | ||
+ | | ||
+ | be created for each use to avoid small-subgroup attacks that may be possible | ||
+ | | ||
+ | |||
+ | -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)). | ||
+ | or an EGD socket (see RAND_egd(3)). | ||
+ | a OS-dependent character. | ||
+ | for all others. | ||
+ | |||
+ | | ||
+ | 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 | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | this option inhibits the output of the encoded version of the parameters. | ||
+ | |||
+ | -text | ||
+ | this option prints out the DH parameters in human readable form. | ||
+ | |||
+ | | ||
+ | by calling the get_dhnumbits() function. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | WARNINGS | ||
+ | The program dhparam combines the functionality of the programs dh and gendh in | ||
+ | | ||
+ | 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----- | ||
+ | |||
+ | | ||
+ | |||
+ | This program manipulates DH parameters not keys. | ||
+ | |||
+ | BUGS | ||
+ | There should be a way to generate and manipulate DH keys. | ||
+ | |||
+ | SEE ALSO | ||
+ | | ||
+ | |||
+ | HISTORY | ||
+ | The dhparam command was added in OpenSSL 0.9.5. | ||
+ | | ||
+ | |||
+ | 1.0.1e | ||
+ | </ | ||
+ | |||
+ | ==== Apache.org ==== | ||
+ | Viele wervolle Hinweise zu den Konfigurationsparameter zu **mod_ssl** findet man in der Dokumentation zum [[http:// | ||
+ | |||
+ | |||
+ | ===== 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:// | ||
+ | |||
+ | <WRAP center round important 85%> | ||
+ | Ein Umstand, den sich z.B. alle [[https:// | ||
+ | </ | ||
+ | |||
+ | 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> | ||
+ | {{page> | ||
===== Zertifikatserstellung ===== | ===== Zertifikatserstellung ===== | ||
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. | ||
< | < | ||
- | <font style=" | + | <font style=" |
</ | </ | ||
< | < | ||
Zeile 1137: | Zeile 1521: | ||
Im folgenden Schritt zu unserem eigenen Zertifikat erzeugen wir einen **CSR**((**C**ertificate **S**igning **R**equest)), | Im folgenden Schritt zu unserem eigenen Zertifikat erzeugen wir einen **CSR**((**C**ertificate **S**igning **R**equest)), | ||
- | <WRAP round alert> **__Wichtig__**: | + | <WRAP round alert> **__Wichtig__**: |
Auch hier sind die Eingaben in der Farbe < | Auch hier sind die Eingaben in der Farbe < | ||
Zeile 1428: | Zeile 1812: | ||
├── cert.pem -> / | ├── cert.pem -> / | ||
├── certs | ├── certs | ||
- | │ ├── ca-bundle.crt -> / | + | │ |
- | │ ├── ca-bundle.trust.crt -> / | + | │ |
- | │ ├── localhost.crt | + | │ |
- | │ ├── make-dummy-cert | + | │ |
- | │ ├── Makefile | + | │ |
- | │ └── renew-dummy-cert | + | │ |
├── misc | ├── misc | ||
- | │ ├── CA | + | │ |
- | │ ├── c_hash | + | │ |
- | │ ├── c_info | + | │ |
- | │ ├── c_issuer | + | │ |
- | │ └── c_name | + | │ |
├── openssl.cnf | ├── openssl.cnf | ||
└── private | └── private | ||
Zeile 1452: | Zeile 1836: | ||
# chmod 400 / | # chmod 400 / | ||
+ | ===== Konfiguration ===== | ||
+ | ==== ssl.conf ==== | ||
+ | Bei der Konfiguration unseres TLS-gesicherten Apache-Webservers benutzen wir nun nicht die (komplette) mitgelieferte Konfigurationsdatei // | ||
+ | Wir sichern dazu erst einmal die originale Konfigurationsdatei. | ||
+ | # cp -a / | ||
+ | Im ersten Schritt werden wir nun bestehende Konfigurationsdatei soweit " | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # 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: | ||
+ | # | ||
+ | # The filtering dialog program (`builtin' | ||
+ | # | ||
+ | SSLPassPhraseDialog exec:/ | ||
- | ===== Konfiguration ==== | + | # |
- | Viele wervolle Hinweise zu den Konfigurationsparameter findet man in der Dokumentation zum [[http:// | + | # |
+ | # to use and second the expiring timeout (in seconds). | ||
+ | SSLSessionCache | ||
+ | SSLSessionCacheTimeout | ||
- | http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslciphersuite | + | # |
+ | # | ||
+ | # SSL library. The seed data should be of good random quality. | ||
+ | # | ||
+ | # is available. This means you then cannot use the /dev/random device | ||
+ | # | ||
+ | # it requires to make more entropy available). But usually those | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | SSLRandomSeed startup file:/ | ||
+ | SSLRandomSeed connect builtin | ||
+ | #SSLRandomSeed startup file:/ | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Use " | ||
+ | # accelerators. Use " | ||
+ | # engine names. | ||
+ | # server does not start, consult the error logs and ensure | ||
+ | # your accelerator is functioning properly. | ||
+ | # | ||
+ | SSLCryptoDevice builtin | ||
+ | # | ||
+ | ## | ||
+ | ## SSL Virtual Host Context | ||
+ | ## | ||
+ | #< | ||
+ | # | ||
+ | ## General setup for the virtual host, inherited from global configuration | ||
+ | ## | ||
+ | ## | ||
+ | # | ||
+ | ## Use separate log files for the SSL virtual host; note that LogLevel | ||
+ | ## is not inherited from httpd.conf. | ||
+ | #ErrorLog logs/ | ||
+ | # | ||
+ | #LogLevel warn | ||
+ | # | ||
+ | ## SSL Engine Switch: | ||
+ | ## | ||
+ | #SSLEngine on | ||
+ | # | ||
+ | ## SSL Protocol support: | ||
+ | ## List the enable protocol levels with which clients will be able to | ||
+ | ## connect. | ||
+ | # | ||
+ | # | ||
+ | ## SSL Cipher Suite: | ||
+ | ## List the ciphers that the client is permitted to negotiate. | ||
+ | ## See the mod_ssl documentation for a complete list. | ||
+ | # | ||
+ | # | ||
+ | ## | ||
+ | ## If speed is your main concern (on busy HTTPS servers e.g.), | ||
+ | ## you might want to force clients to specific, performance | ||
+ | ## | ||
+ | ## to the SSLCipherSuite list, and enable SSLHonorCipherOrder. | ||
+ | ## | ||
+ | ## (as in the example below), most connections will no longer | ||
+ | ## have perfect forward secrecy - if the server' | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | # | ||
+ | ## | ||
+ | ## Point SSLCertificateFile at a PEM encoded certificate. | ||
+ | ## the certificate is encrypted, then you will be prompted for a | ||
+ | ## pass phrase. | ||
+ | ## certificate can be generated using the genkey(1) command. | ||
+ | # | ||
+ | # | ||
+ | ## | ||
+ | ## If the key is not combined with the certificate, | ||
+ | ## | ||
+ | ## | ||
+ | ## both in parallel (to also allow the use of DSA ciphers, etc.) | ||
+ | # | ||
+ | # | ||
+ | ## | ||
+ | ## Point SSLCertificateChainFile at a file containing the | ||
+ | ## | ||
+ | ## | ||
+ | ## the referenced file can be the same as SSLCertificateFile | ||
+ | ## when the CA certificates are directly appended to the server | ||
+ | ## | ||
+ | ## | ||
+ | # | ||
+ | ## | ||
+ | ## Set the CA certificate verification path where to find CA | ||
+ | ## | ||
+ | ## huge file containing all of them (file must be PEM encoded) | ||
+ | ## | ||
+ | # | ||
+ | ## | ||
+ | ## | ||
+ | ## none, optional, require and optional_no_ca. | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | # | ||
+ | ## | ||
+ | ## With SSLRequire you can do per-directory access control based | ||
+ | ## on arbitrary complex boolean expressions containing server | ||
+ | ## | ||
+ | ## | ||
+ | ## for more details. | ||
+ | ##< | ||
+ | ## | ||
+ | ## and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ | ||
+ | ## and %{SSL_CLIENT_S_DN_OU} in {" | ||
+ | ## and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ | ||
+ | ## and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ | ||
+ | ## or %{REMOTE_ADDR} =~ m/ | ||
+ | ##</ | ||
+ | # | ||
+ | ## SSL Engine Options: | ||
+ | ## Set various options for the SSL engine. | ||
+ | ## o FakeBasicAuth: | ||
+ | ## | ||
+ | ## the standard Auth/ | ||
+ | ## user name is the `one line' version of the client' | ||
+ | ## 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 | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## into CGI scripts. | ||
+ | ## o StdEnvVars: | ||
+ | ## This exports the standard SSL/TLS related `SSL_*' | ||
+ | ## Per default this exportation is switched off for performance reasons, | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## o StrictRequire: | ||
+ | ## This denies access when " | ||
+ | ## under a " | ||
+ | ## and no other module can change it. | ||
+ | ## o OptRenegotiate: | ||
+ | ## This enables optimized SSL connection renegotiation handling when SSL | ||
+ | ## | ||
+ | ## | ||
+ | #<Files ~ " | ||
+ | # SSLOptions +StdEnvVars | ||
+ | #</ | ||
+ | #< | ||
+ | # SSLOptions +StdEnvVars | ||
+ | #</ | ||
+ | # | ||
+ | ## SSL Protocol Adjustments: | ||
+ | ## The safe and default but still SSL/TLS standard compliant shutdown | ||
+ | ## | ||
+ | ## the close notify alert from client. When you need a different shutdown | ||
+ | ## | ||
+ | ## 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. | ||
+ | ## 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 | ||
+ | ## | ||
+ | ## 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 | ||
+ | ## | ||
+ | ## this only for browsers where you know that their SSL implementation | ||
+ | ## works correctly. | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | ## their broken HTTP/1.1 implementation. Use variables " | ||
+ | ## " | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ## | ||
+ | ## The home of a custom SSL log file. Use this when you want a | ||
+ | ## | ||
+ | #CustomLog logs/ | ||
+ | # "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \" | ||
+ | # | ||
+ | #</ | ||
+ | </ | ||
+ | |||
+ | Die Hauptkonfiguration beschrängt sich demnach auf folgende sieben Zeilen: | ||
+ | # egrep -v ' | ||
+ | |||
+ | <code bash> | ||
+ | SSLPassPhraseDialog exec:/ | ||
+ | SSLSessionCache | ||
+ | SSLSessionCacheTimeout | ||
+ | SSLRandomSeed startup file:/ | ||
+ | SSLRandomSeed connect builtin | ||
+ | SSLCryptoDevice builtin</ | ||
+ | |||
+ | |||
+ | ==== vHost.conf ==== | ||
+ | |||
+ | # vim / | ||
+ | <file apache / | ||
+ | # Django : 2015-10-30 | ||
+ | # vHost hk-forum | ||
+ | # | ||
+ | |||
+ | # Variablen der Hostvariablen | ||
+ | Define vhost hk-forum | ||
+ | Define errors_log logs/ | ||
+ | Define access_log logs/ | ||
+ | Define ssl_log logs/ | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@nausch.org | ||
+ | ServerName ${vhost}.nausch.org | ||
+ | |||
+ | RewriteEngine on | ||
+ | RewriteCond %{HTTPS} off | ||
+ | RewriteRule (.*) https:// | ||
+ | |||
+ | # Welche Logdateien sollen beschrieben werden | ||
+ | SetEnvIf Remote_Addr " | ||
+ | ErrorLog | ||
+ | CustomLog ${access_log} combined env=!dontlog | ||
+ | </ | ||
+ | < | ||
+ | ServerAdmin webmaster@nausch.org | ||
+ | ServerName ${vhost}.nausch.org | ||
+ | ServerPath / | ||
+ | |||
+ | # Wer soll Zugriff auf die Webseite(n) bekommen? | ||
+ | #< | ||
+ | # Options +FollowSymLinks +Multiviews -Indexes | ||
+ | # AllowOverride None | ||
+ | # AuthType Basic | ||
+ | # AuthName "Fuer den Zugriff auf den Webserver bitte Anmeldedaten eingeben!" | ||
+ | # AuthBasicProvider ldap | ||
+ | # AuthLDAPUrl ldaps:// | ||
+ | # AuthLDAPBindDN cn=Technischeruser, | ||
+ | # AuthLDAPBindPassword " | ||
+ | # AuthLDAPBindAuthoritative on | ||
+ | # Require ldap-user accessuser | ||
+ | #</ | ||
+ | |||
+ | # Welcher Inhalt soll angezeigt bzw. auf welchen Server sollen die HTTP-Requests | ||
+ | # | ||
+ | DocumentRoot | ||
+ | DirectoryIndex index.php | ||
+ | |||
+ | < | ||
+ | Options none | ||
+ | AllowOverride Limit | ||
+ | Require all granted | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Require all denied | ||
+ | </ | ||
+ | |||
+ | # Welche Logdateien sollen beschrieben werden | ||
+ | SetEnvIf Remote_Addr " | ||
+ | ErrorLog | ||
+ | CustomLog ${access_log} combined env=!dontlog | ||
+ | CustomLog ${ssl_log} "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \" | ||
+ | |||
+ | # 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 " | ||
+ | # Schlüsseldatei, | ||
+ | SSLCertificateKeyFile / | ||
+ | # Zertifikatsdatei , die von der CA signiert wurde | ||
+ | SSLCertificateFile / | ||
+ | # Zertifikatsdatei des bzw. der Intermediate-Zertifikate(s) | ||
+ | SSLCertificateChainFile / | ||
+ | # Ä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 | ||
+ | SSLStaplingResponderTimeout 5 | ||
+ | SSLStaplingReturnResponderErrors off | ||
+ | # ist in der ssl.conf | ||
+ | # SSLStaplingCache | ||
+ | |||
+ | # 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 " | ||
+ | |||
+ | # 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:// | ||
+ | Header set X-XSS-Protection "1; mode=block" | ||
+ | |||
+ | # when serving user-supplied content, include a X-Content-Type-Options: | ||
+ | # header along with the Content-Type: | ||
+ | # some browsers. https:// | ||
+ | # currently suppoorted in IE > 8 | ||
+ | # http:// | ||
+ | # http:// | ||
+ | # ' | ||
+ | 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:// | ||
+ | # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with | ||
+ | # ALLOW-FROM uri https:// | ||
+ | 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 ' | ||
+ | |||
+ | # Add Secure and HTTP only attributes to cookies | ||
+ | Header edit Set-Cookie ^(.*)$ $1; | ||
+ | |||
+ | # prevent Clickjacking Attack | ||
+ | #Header always append X-Frame-Options SAMEORIGIN | ||
+ | Header set Content-Security-Policy " | ||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
FIXME | FIXME | ||
Zeile 1749: | Zeile 2496: | ||
https:// | https:// | ||
+ | https:// | ||
+ | |||
+ | ==== HSTS ==== | ||
+ | |||
+ | |||
+ | In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende Zeile '' | ||
+ | # vim / | ||
+ | |||
+ | <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 " | ||
+ | |||
+ | ...</ | ||
+ | |||
+ | ==== OCSP Stapling ==== | ||
+ | |||
+ | In der // | ||
+ | # vim / | ||
+ | <code bash>... | ||
+ | |||
+ | # Django : 2015-11-11 | ||
+ | # Chache-Definition für Online Certificate Status Protocol stapling | ||
+ | SSLStaplingCache " | ||
+ | |||
+ | ...</ | ||
+ | |||
+ | In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende drei Zeilen. | ||
+ | # vim / | ||
+ | |||
+ | <code bash>... | ||
+ | |||
+ | # Online Certificate Status Protocol stapling zum Prüfen des Gültigkeitsstatus | ||
+ | # des Serverzertifikats. | ||
+ | SSLUseStapling | ||
+ | SSLStaplingResponderTimeout 5 | ||
+ | SSLStaplingReturnResponderErrors off | ||
+ | |||
+ | ...</ | ||
+ | |||
+ | |||
+ | $ openssl s_client -connect forum.nausch.org: | ||
+ | < | ||
+ | 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 | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | ==== Secure Cookie mit HttpOnly ==== | ||
+ | |||
+ | In der vHost-Definition unseres Apache-vHOST ergänzen wir folgende Zeile '' | ||
+ | '' | ||
+ | # vim / | ||
+ | |||
+ | <code bash>... | ||
+ | |||
+ | # Add Secure and HTTP only attributes to cookies | ||
+ | Header edit Set-Cookie ^(.*)$ $1; | ||
+ | |||
+ | ...</ | ||
+ | |||
+ | https:// | ||
+ | |||
+ | | set-cookie: | ||
+ | |||
+ | **HttpOnly** und **Secure** kennzeichnen die erfolgreiche Änderung! | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== HPKP ==== | ||
+ | [[https:// | ||
+ | # openssl rsa -pubout -in / | ||
+ | | ||
+ | |||
+ | writing RSA key | ||
+ | nMiOpb6vUnjCoWCkPkDaG4ND8SNWzFTsQf2ZfruLno0= | ||
+ | |||
+ | pin-sha256=" | ||
+ | |||
+ | # openssl rsa -pubout -in / | ||
+ | | ||
+ | |||
+ | 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 ~/ | ||
+ | |||
+ | Nach dem Speichern unserer Änderungen starten wir den Browser neu und können wieder auf die zuvor blockierten Seiten zugreifen. | ||
+ | |||
+ | ===== Tests ===== | ||
+ | |||
+ | Artikel auf [[http:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||