-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HSTS to caddy configuration #395
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a sound approach to me.
I'm not entirely sure how caddy works but I believe it's a linux service, so I imagine the config change won't take effect until that we use sytemctl reload
to reboot it.
The good news is that doing that is just a matter of calling this function.
The bad news is I'm not sure how safe it is to do so while other services are running, so it'll need some fairly annoying testing.
So, I suggest the following:
- Test this code as-is, maybe we get lucky and caddy is smart enough to just take effect
- If it doesn't work, add restartSPService("caddy"), test that it worked, and then test that the other services didn't break.
- If they did break, maybe we need to restart everything when we reload caddy.
Happy to hop on a call to help figure it out!
If someone more confident than I about how caddy works can tell us that reloading doesn't mess everything up (from a bit of further reading it seems that's what reload is supposed to do), then we can save ourselves some of the hassle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving on the condition that it gets tested and works. Based on reading the code looks good though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
New control-plane endpoint
/add-hsts
, when invoked modifies this part of Caddyfile:to
So adds
header Strict-Transport-Security max-age=31536000; includeSubDomains
HSTS response header to HTTPS calls.