Letzte Aktualisierung am 20.07.2022, 15:07:05 Uhr
Ich nutze im privaten Umfeld seit Weihnachten 2018 einen virtuellen Server mit Ubuntu 18.04. Dort habe ich zur einfachen und schnellen Administration das kostenlose Panel KeyHelp installiert. Die Anwendung wird von KeyWeb entwickelt. Ideen und Wünsche der Community fließen regelmäßig in neue Versionen ein.
Vorwort
Aktuell wird der Webserver Apache2 unter Ubuntu 20.04 mit der Versionsnummer 2.4.29 ausgeliefert. Durch die Installation von KeyHelp und der Verwendung Let’s Encrypt wird auch das Modul SSL des Apache2 installiert und aktiviert. Standardmäßig sind natürlich SSL Protokolle wie TLS 1.0, TLS 1.1 und TLS 1.2 aktiviert. Zusätzlich ist eine große Anzahl von Cipher Suites konfiguriert um eine möglichst große Anzahl von Geräten bzw. Betriebssysteme und Browser zu erreichen.
Um unsichere Protokolle und Cipher Suites zu deaktivieren, ist ein Eingriff via SSH direkt auf die zuständige Konfigurationsdatei des Apache2 bzw. Moduls notwendig. In diesem Fall handelt es sich um die Datei /etc/apache2/mods-enabled/ssl.conf.
Bisher/Standard
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA::AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!ECDHE-RSA-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!DSS
# The protocols to enable
SSLProtocol all -SSLv3 -SSLv2
#SSLStaplingResponderTimeout 5
#SSLStaplingReturnResponderErrors off
#SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
#SSLStrictSNIVHostCheck On
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
##
## SSL Global Context
##
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
##
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass Phrase Dialog:
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL Cipher Suite:
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA::AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!ECDHE-RSA-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on
# The protocols to enable
SSLProtocol all -SSLv3 -SSLv2
# OCSP Stapling
#SSLUseStapling on
#SSLStaplingResponderTimeout 5
#SSLStaplingReturnResponderErrors off
#SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
##
## SSL Global Context
##
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
##
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass Phrase Dialog:
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL Cipher Suite:
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA::AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!ECDHE-RSA-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on
# The protocols to enable
SSLProtocol all -SSLv3 -SSLv2
# OCSP Stapling
#SSLUseStapling on
#SSLStaplingResponderTimeout 5
#SSLStaplingReturnResponderErrors off
#SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
Debian 9 und Ubuntu 18.04
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLOpenSSLConfCmd DHParameters "/etc/ssl/dhparams4096.pem"
SSLOpenSSLConfCmd ECDHParameters automatic
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
# The protocols to enable
SSLProtocol -ALL +TLSv1.2
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
#SSLStrictSNIVHostCheck On
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
##
## SSL Global Context
##
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
##
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass Phrase Dialog:
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL Cipher Suite:
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLHonorCipherOrder on
SSLOpenSSLConfCmd DHParameters "/etc/ssl/dhparams4096.pem"
SSLOpenSSLConfCmd ECDHParameters automatic
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
# The protocols to enable
SSLProtocol -ALL +TLSv1.2
# OCSP Stapling
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
##
## SSL Global Context
##
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
##
# Some MIME-types for downloading Certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass Phrase Dialog:
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-Process Session Cache:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL Cipher Suite:
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLHonorCipherOrder on
SSLOpenSSLConfCmd DHParameters "/etc/ssl/dhparams4096.pem"
SSLOpenSSLConfCmd ECDHParameters automatic
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
# The protocols to enable
SSLProtocol -ALL +TLSv1.2
# OCSP Stapling
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
DH-Keys erzeugen:
openssl dhparam -out /etc/ssl/dhparams4096.pem 4096
openssl dhparam -out /etc/ssl/dhparams4096.pem 4096
openssl dhparam -out /etc/ssl/dhparams4096.pem 4096
Dieser Vorgang kann je nach System einige Minuten in Anspruch nehmen. Zeit für einen Tee oder Kaffee. 
Debian 10 / Ubuntu 20.04
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
# Some MIME-types for downloading certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-process session cache
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
#SSLStrictSNIVHostCheck On
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
# Some MIME-types for downloading certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass phrase dialog
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-process session cache
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL configuration
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
# OCSP stapling
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
<IfModule mod_ssl.c>
SSLRandomSeed startup builtin
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
# Some MIME-types for downloading certificates and CRLs
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass phrase dialog
SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase
# Inter-process session cache
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
SSLSessionCacheTimeout 300
# SSL configuration
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
# OCSP stapling
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_ocsp(512000)
# Whether to forbid non-SNI clients to access name based virtual hosts.
# Default: Off
#SSLStrictSNIVHostCheck On
</IfModule>
Abschließend muss die neue Konfiguration noch in den Webserver Apache2 geladen werden:
service apache2 reload
Resultat
Daas Ergebnisbei Qualys SSL Server Test für Debian 9 / Ubuntu 18.04:

Daas Ergebnisbei Qualys SSL Server Test für Debian 10 / Ubuntu 20.04:

12.07.2019, 15:30 Uhr
Anpassung von SSLCipherSuite für die neuste Version des Apache2 bzw. OpenSSL unter Ubuntu 18.04.2 LTS.
02.08.2019, 22:29 Uhr
Anpassung von SSLCipherSuite für Qualys SSL Server Test.
25.11.2019, 11:25 Uhr
Divsere Anpassungen damit Key Exchange 100 Punkte erhält.
27.11.2019, 10:38 Uhr
Ich habe immer wieder per E-Mail Nachfragen bezüglich der Kompatiblität zu Debian 10 (Buster) erhalten. Ich habe daher die obige Konfiguration heute Vormittag getestet. Soweit keine Probleme oder grobe Ausfälligkeiten. Bis auf eine Sache: Mit der verwendung von TLS 1.3 (ist unter Debian 10 möglich, unter Ubuntu 18.04.x aktuell noch nicht) sind aktuell bei SSL Labs in der Kategorie „Cipher Strength“ maximal 90 Punkte möglich. Dies ist auf die Cipher Suite „TLS_AES_128_GCM_SHA256“ zurückzuführen. Ich habe dazu ein Issue auf Github bei SSL Labs gefunden. Dort werden auch mögliche Workarounds aufgeführt, falls jemand unbedingt 100 Punkte haben möchte.
17.09.2020, 21.39 Uhr
Den kompletten Artikel für Debian 10 und Ubuntu 20.04 überarbeitet. Zusätzlich noch einen Screenshot für das Referenz Ergebnis hinzugefügt.
[…] Die Seite wird nun ausschließlich über SSL (HTTPS) ausgeliefert. Wer gerne noch die Sicherheits erhöhen möchte, empfehle ich den Artikel Apache – Anpassung SSL Protokolle und Cipher Suites. […]
[…] Für die Anpassung der SSL Protokolle und dazugehörigen Cipher Suites verweise ich auf den Beitrag Apache – Anpassung SSL Protokolle und Cipher Suites. […]
[…] werde immer wieder gefragt, ob es zu dem Beitrag Apache – Anpassung SSL Protokolle und Cipher Suites auch eine Referenz für Nginx gibt? Der einzigste Beitrag, der das kurz und bündig beschreibt ist […]
Vielen Dank für die ausführliche Erklärung. Wer, wie ich „Let’s Encrypt“ nutzt und trotz geänderter ssl.conf Einstellungen keine Verbesserung sieht, der hat die Rechnung ohne einer ssl Einstellung von Let’s Encrypt gemacht. Sie kommt leider erst nach der globalen Einstellung von apache2 zum Tragen. Die Lösung: Man muss entweder die /etc/letsencrypt/options-ssl-apache.conf ebenfalls bearbeiten: SSLProtocol -all +TLSv1.2 +TLSv1.3 Oder die Datei aus den vhost Einstellungen entfernen. Der Grund dafür ist, dass die Einstellungen des apache2 zwar global gelten, aber durch die nachfolgenden Einstellungen von let’s encrypt überschrieben werden. Siehe auch hier: (Kommentar von ZetaRevan: https://community.letsencrypt.org/t/disabling-tls-1-0-and-tls-1-1/112816/10 Jetzt bin ich bei der Bewertung… Weiterlesen »
Danke, habe durch dich jetzt auch A+ erreicht
Sehr gerne. Vielen Dank für die Blumen!
Ich habe die letzten Tage den Beitrag nochmals ergänzt, damit durchgehend 100 Punkte erreicht werden können. An der Stelle sei aber nochmals erwähnt, dass das noch keine sicheren (Web)server schafft sondern nur die Verbindungssicherheit entsprechend gewährleistet.