3. HSTS and Hardening for Apache and nginx
for Apache, add to config/apache/parts/domain_ssl.tpl
Code
- <VirtualHost {DOMAIN_IP}:443> ... Header always set Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" Header always set X-Content-Type-Options "nosniff" Header always set X-Frame-Options "SAMEORIGIN" Header always set X-Xss-Protection "1; mode=block" ... </VirtualHost>
for nginx add to config/nginx/00_master_ssl.conf
Code
- server {
- server_name {BASE_SERVER_VHOST};
- ....
- add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" always;
- add_header Strict-Transport-Security max-age=31536000;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-Frame-Options "SAMEORIGIN" always;
- add_header X-Xss-Protection "1; mode=block" always;
- ....
- }
4. HPKP for Apache and nginx
For HPKP you need to get a base64 encoded fingerprint of the certificate, please have a look at https://scotthelme.co.uk/hpkp-http-public-key-pinning/