Topic: Enabling HSTS on nginx
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.42
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: RHEL 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mariadb
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? not yet but will
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hello, I'm trying all the functionality of iredmail before buying PRO version and put it in production.
I have a correct letsencrypt cert and enabled TLS 1.3 in nginx.
Testing server with https://www.ssllabs.com I score "A" because it misses HSTS
Testing server with https://securityheaders.com I score "B" because it misses HSTS
First question: Enabling HSTS on iredmail will cause any known problem? Maybe HTTPS (sogo) will be OK but settings will be applied to other protocol and software (postfix/dovecot), causing problem with email or client connection?
As I said this is still a test server so I've tried to enable HSTS to see results with my own eyes.
In file /etc/nginx/sites-available/00-default-ssl.conf I've added
include /etc/nginx/templates/hsts.tmpl;
In file /etc/nginx/templates I've just added includeSubDomains so this is the content of the file:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
then i restart the server. Everything seems OK but If I try to test my webserver again
On https://www.ssllabs.com I score "A+" with HSTS and everything seems to be perfect
On https://securityheaders.com I score "D" , (much worse) because HSTS looks OK but now I'm missing:
Content-Security-Policy
X-Frame-Options
X-Content-Type-Options
Referrer-Policy
(in previous test without HSTS all these headers were OK)
Looks like enabling HSTS on nginx disabled some other headers that were enabled by default.
Second question: Why does this happen? Am I doing something wrong? Any suggestions are welcome
Thanks
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.