Security headers of a port#
The web listeners send headers that tell a browser what a page of the server may do: where it may load scripts from, who may show it in a frame, whether it must be reached over HTTPS. These headers are set once for the whole server, on the CSP tab of the WebInterface section: see Content Security Policy. Every HTTP and HTTPS listener sends the same.
This page is about what the listeners have to do with it.
What saving the listeners changes#
The content security policy lists the outside hosts the server's pages may talk to. Some settings of a web listener need such a host. When you Save in IP / Servers, the page looks at all web listeners and brings the policy in line by itself:
| A web listener has | Hosts put into the policy |
|---|---|
| a reCAPTCHA site key, on the Re-Captcha tab | www.recaptcha.net, www.gstatic.com |
| sign-in with Google turned on | accounts.google.com |
| sign-in with Microsoft turned on | cdn.jsdelivr.net, alcdn.msauth.net, login.microsoftonline.com |
| the SAML plugin set up | the hosts of the identity provider and of the return address |
When the setting is turned off again, the hosts are taken out again at the next save. Hosts you added by hand on the CSP tab are kept.
The policy is only changed when the server already sends one. A server whose policy header was removed stays without.
If the listeners are stored and the headers are not, the page says so: "The listeners were saved, but the server settings (ServerBeat commands, Content-Security-Policy header) were not saved". Open the CSP tab and check the policy then.
Per-listener switches that are about the same things#
| Goal | Setting of the listener |
|---|---|
| everything over HTTPS | Redirected to HTTPS:// on the plain HTTP listener: HTTP and HTTPS ports. The header that makes browsers remember it, HSTS, is on the CSP tab. |
| no API on a public port | Answer the API off |
| no WebDAV on a public port | Allow Users To Use WebDAV off |
| only known clients | Require valid client certificate: SSL on a port, SNI |
| only known networks | IP restrictions of a port |
Different headers on different ports?#
The server has one set. Where two audiences need different headers, such as an internal port that may be shown in a frame of an intranet page and a public one that may not, put a reverse proxy in front of one of them and let it set the headers: see CrushMFT behind Apache, nginx or a load balancer.
Checking what a port sends#
curl -sI https://files.example.com/WebInterface/login.html
shows the headers as a browser gets them. Look for Content-Security-Policy, Strict-Transport-Security, X-Frame-Options and the like. After a change of the policy, try the login page in a private window of a browser and look at its console: a policy that is too tight shows there as blocked requests.