mailcow-dockerized icon indicating copy to clipboard operation
mailcow-dockerized copied to clipboard

Improve headers for security

Open TommyTran732 opened this issue 2 years ago • 22 comments

I added Permissions-Policy and Content-Security-Policy. I have tested these with the admin panel and FIDO2. XSS filtering should be set to 0 as it could cause issues by itself according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection.

HSTS should be preloaded and ~~include subdomains~~. I don't see a reason not to.

TommyTran732 avatar Sep 16 '22 22:09 TommyTran732

We had previously decided to not do HSTS for subdomains because it would affect services on your domain other than Mailcow. I think that still holds, especially since it's near impossible to turn off HSTS later.

mkuron avatar Sep 17 '22 06:09 mkuron

Mkay I removed the includeSubdomains part.

TommyTran732 avatar Sep 17 '22 17:09 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Nov 17 '22 19:11 milkmaker

Please do not mark it as stale.

TommyTran732 avatar Nov 18 '22 04:11 TommyTran732

How does reverse Proxies behave on that?

DerLinkman avatar Nov 22 '22 12:11 DerLinkman

How does reverse Proxies behave on that?

I don't understand the question 0.0

TommyTran732 avatar Nov 22 '22 17:11 TommyTran732

How does reverse Proxies behave on that?

I don't understand the question 0.0

No problem. Will Reverse Proxies still work with that changes? As these are changed directly at the root webserver.

I´m not that fit with those security headers that´s why i ask + to ensure the functionality with reverse proxies.

DerLinkman avatar Nov 22 '22 17:11 DerLinkman

No problem. Will Reverse Proxies still work with that changes? As these are changed directly at the root webserver.

It works fine with Mailcow on the stable branch. I have not tested with SOGo yet, as I do not use it. I am using it on my own server as you can see here: https://mail.tommytran.io

TommyTran732 avatar Nov 26 '22 03:11 TommyTran732

It should work with the bootstrap theme now

TommyTran732 avatar Dec 26 '22 12:12 TommyTran732

@DerLinkman These changes work fine with SOGo, I have tested them. They probably won't work with stuff like Gitea etc that you have in the docs. Maybe we can move them down to the location blocks to make it work. The other approach (and IMO the better approach) is to leave it like this and give instructions to overwrite the headers set at the root inside of the location blocks for those reverse proxies.

I have my CSP policy for Gitea listed here https://github.com/tommytran732/Gitea-Docker-Compose/blob/main/swag/nginx/ssl.conf#L32... I am not sure about the other stuff. Someone gotta make the CSP policies for them.

TommyTran732 avatar Dec 26 '22 13:12 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Feb 24 '23 18:02 milkmaker

Do not close. It is not stale.

TommyTran732 avatar Feb 25 '23 02:02 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Apr 26 '23 03:04 milkmaker

Do not close.

TommyTran732 avatar Apr 28 '23 02:04 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Jun 27 '23 08:06 milkmaker

Do not close.

TommyTran732 avatar Jun 28 '23 01:06 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Oct 16 '23 00:10 milkmaker

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Jan 07 '24 11:01 milkmaker

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Apr 09 '24 20:04 milkmaker

Do not close

TommyTran732 avatar Apr 09 '24 22:04 TommyTran732

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

milkmaker avatar Jun 09 '24 00:06 milkmaker

Do not close

TommyTran732 avatar Jun 09 '24 08:06 TommyTran732