summaryrefslogtreecommitdiff
path: root/apache2/conf-available/security.conf.diff
blob: 66829ed7d05005b2738b59b057f2249804566c00 (plain)
  1. --- security.conf.orig
  2. +++ security.conf
  3. @@ -22,7 +22,7 @@
  4.  # Set to one of: Full | OS | Minimal | Minor | Major | Prod
  5. # where Full conveys the most information, and Prod the least.
  6. #ServerTokens Minimal
  7. -ServerTokens OS
  8. +ServerTokens Prod
  9. #ServerTokens Full
  10. #
  11. @@ -60,14 +60,52 @@
  12. # else than declared by the content type in the HTTP headers.
  13. # Requires mod_headers to be enabled.
  14. #
  15. -#Header set X-Content-Type-Options: "nosniff"
  16. +Header always set X-Content-Type-Options: "nosniff"
  17. #
  18. # Setting this header will prevent other sites from embedding pages from this
  19. # site as frames. This defends against clickjacking attacks.
  20. # Requires mod_headers to be enabled.
  21. #
  22. -#Header set X-Frame-Options: "sameorigin"
  23. +Header always set X-Frame-Options: "sameorigin"
  24. +# Enable reflective XSS protection and block response when detecting an attack
  25. +Header always set X-Xss-Protection "1; mode=block"
  26. +
  27. +# Allow images, scripts, AJAX, form actions, and CSS from the same origin,
  28. +# and disallow any other resources to load (eg object, frame, media, etc).
  29. +# More info: <https://content-security-policy.com/>
  30. +Header always set Content-Security-Policy "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; base-uri 'self'; form-action 'self';"
  31. +
  32. +# Forbid use of browser features
  33. +# More info: <https://www.w3.org/TR/permissions-policy-1/>
  34. +# <https://github.com/w3c/webappsec-permissions-policy/blob/master/features.md>
  35. +Header always set Permissions-Policy "accelerometer(), ambient-light-sensor(), autoplay(), battery(), camera(), cross-origin-isolated(), display-capture(), document-domain(), encrypted-media(), execution-while-not-rendered(), execution-while-out-of-viewport(), fullscreen(), geolocation(), gyroscope(), layout-animations(), legacy-image-formats(), magnetometer(), microphone(), midi(), oversized-images(), navigation-override(), payment(), picture-in-picture(), publickey-credentials-get(), screen-wake-lock(), sync-xhr(), usb(), vr(), wake-lock(), web-share(), xr-spatial-tracking()"
  36. +
  37. +# Do not send the referrer header when navigating from HTTPS to HTTP,
  38. +# but always send the full URL when navigating from HTTP to any origin.
  39. +# More info: <https://scotthelme.co.uk/a-new-security-header-referrer-policy/>
  40. +Header always set Referrer-Policy "no-referrer-when-downgrade"
  41. +
  42. +# enable Strict Transport Security
  43. +# <http://www.debian-administration.org/articles/662>
  44. +<IfDefine !_NO_HSTS>
  45. +<IfDefine !_NO_HSTS_SUBDOMAINS>
  46. +<IfDefine !_NO_HSTS_PRELOAD>
  47. + Header set Strict-Transport-Security: "max-age=15768000;includeSubdomains;preload"
  48. +</IfDefine>
  49. +<IfDefine _NO_HSTS_PRELOAD>
  50. + Header set Strict-Transport-Security: "max-age=15768000;includeSubdomains"
  51. +</IfDefine>
  52. +</IfDefine>
  53. +<IfDefine _NO_HSTS_SUBDOMAINS>
  54. +<IfDefine !_NO_HSTS_PRELOAD>
  55. + Header set Strict-Transport-Security: "max-age=15768000;preload"
  56. +</IfDefine>
  57. +<IfDefine _NO_HSTS_PRELOAD>
  58. + Header set Strict-Transport-Security: "max-age=15768000"
  59. +</IfDefine>
  60. +</IfDefine>
  61. +</IfDefine>
  62. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet