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 [28.11.2016 17:50. ] – [Konfiguration] django | centos:web_c7:apache_2 [02.02.2018 09:39. ] (aktuell) – Löschen von falschen HPKP-Daten beim Browser Firefox django | ||
|---|---|---|---|
| Zeile 263: | Zeile 263: | ||
| ===== Dokumentation ===== | ===== Dokumentation ===== | ||
| ==== Fachliteratur ==== | ==== Fachliteratur ==== | ||
| - | Das Buch **[[https:// | + | <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 ==== | ==== Seiten im WWW ==== | ||
| Zeile 1830: | Zeile 1835: | ||
| - und schützen diese Dateien mit den Dateirechten **400**: < | - und schützen diese Dateien mit den Dateirechten **400**: < | ||
| # chmod 400 / | # chmod 400 / | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| ===== Konfiguration ===== | ===== Konfiguration ===== | ||
| Zeile 1846: | Zeile 1845: | ||
| Im ersten Schritt werden wir nun bestehende Konfigurationsdatei soweit " | Im ersten Schritt werden wir nun bestehende Konfigurationsdatei soweit " | ||
| - | + | # vim / | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| <file bash / | <file bash / | ||
| # When we also provide SSL we have to listen to the | # When we also provide SSL we have to listen to the | ||
| Zeile 2070: | Zeile 2063: | ||
| # | # | ||
| #</ | #</ | ||
| - | </code> | + | </file> |
| - | Die Hauptkonfiguration beschrängt sich demnach auf olgende | + | Die Hauptkonfiguration beschrängt sich demnach auf folgende |
| # egrep -v ' | # egrep -v ' | ||
| - | | + | <code bash>Listen 443 https |
| - | SSLPassPhraseDialog exec:/ | + | SSLPassPhraseDialog exec:/ |
| - | SSLSessionCache | + | SSLSessionCache |
| - | SSLSessionCacheTimeout | + | SSLSessionCacheTimeout |
| - | SSLRandomSeed startup file:/ | + | SSLRandomSeed startup file:/ |
| - | SSLRandomSeed connect builtin | + | SSLRandomSeed connect builtin |
| - | SSLCryptoDevice builtin | + | SSLCryptoDevice builtin</ |
| ==== vHost.conf ==== | ==== 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 2368: | 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:// | ||