TLS in a hard way

How I've push it to the limits.
1. Use only most secure ciphers with forward secrecy.
SSLCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA
SSLProxyCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA

2. Enable SSL.
# diff httpd.conf httpd.conf.ORIGINAL
90c90
< LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
---
> #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
148c148
< LoadModule ssl_module modules/mod_ssl.so
---
> #LoadModule ssl_module modules/mod_ssl.so
516c516
< Include conf/extra/httpd-ssl.conf
---
> #Include conf/extra/httpd-ssl.conf

3. Enable vhosts. Note that SSL is enabled before vhosts (as SSL config contains VHost, and default VHost is first)...
# diff httpd.conf httpd.conf.ORIGINAL
515,517c515,516
< # Secure (SSL/TLS) connections and Virtual hosts
< Include conf/extra/httpd-ssl.conf
< Include conf/extra/httpd-vhosts.conf
---
> # Secure (SSL/TLS) connections
> #Include conf/extra/httpd-ssl.conf

4. Restart HTTPD daemon: # systemctl restart httpd and ensure all works: # ss -tl

5. Ensure that only the very first vhost defined is httpd-vhosts.conf is HTTP host. All other must be HTTPS. It also perform HTTP redirect to corresponding HTTPS resource:
<VirtualHost *:80>
    DocumentRoot "/srv/http/html-static"
    ServerName web.prokop.net
    RewriteEngine On
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>

6. Make redirect rule a bit more powerful, by adding just after RewriteEngine on conditions excluding HTTPS and Let's Encrypt (ACME) challenge:
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge

7. Add HSTS header to all SSL responses:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

8. Submit your page to https://hstspreload.appspot.com/

9. Ensure you got A+ from qualsys:



Comments

Popular posts from this blog

Hardening OpenWRT - adding non-root user account

Dropbear SSH keys and autossh on OpenWRT

SSH Tunel with OpenWRT