summaryrefslogtreecommitdiff
path: root/apache2/conf-available/security.conf
blob: fabdafbe01b3e7e16be431706baf2bdb7530aec9 (plain)
  1. #
  2. # Disable access to the entire file system except for the directories that
  3. # are explicitly allowed later.
  4. #
  5. # This currently breaks the configurations that come with some web application
  6. # Debian packages.
  7. #
  8. #<Directory />
  9. # AllowOverride None
  10. # Require all denied
  11. #</Directory>
  12. # Changing the following options will not really affect the security of the
  13. # server, but might make attacks slightly more difficult in some cases.
  14. #
  15. # ServerTokens
  16. # This directive configures what you return as the Server HTTP response
  17. # Header. The default is 'Full' which sends information about the OS-Type
  18. # and compiled in modules.
  19. # Set to one of: Full | OS | Minimal | Minor | Major | Prod
  20. # where Full conveys the most information, and Prod the least.
  21. #ServerTokens Minimal
  22. ServerTokens Prod
  23. #ServerTokens Full
  24. #
  25. # Optionally add a line containing the server version and virtual host
  26. # name to server-generated pages (internal error documents, FTP directory
  27. # listings, mod_status and mod_info output etc., but not CGI generated
  28. # documents or custom error documents).
  29. # Set to "EMail" to also include a mailto: link to the ServerAdmin.
  30. # Set to one of: On | Off | EMail
  31. #ServerSignature Off
  32. ServerSignature On
  33. #
  34. # Allow TRACE method
  35. #
  36. # Set to "extended" to also reflect the request body (only for testing and
  37. # diagnostic purposes).
  38. #
  39. # Set to one of: On | Off | extended
  40. TraceEnable Off
  41. #TraceEnable On
  42. #
  43. # Forbid access to version control directories
  44. #
  45. # If you use version control systems in your document root, you should
  46. # probably deny access to their directories. For example, for subversion:
  47. #
  48. #<DirectoryMatch "/\.svn">
  49. # Require all denied
  50. #</DirectoryMatch>
  51. #
  52. # Setting this header will prevent MSIE from interpreting files as something
  53. # else than declared by the content type in the HTTP headers.
  54. # Requires mod_headers to be enabled.
  55. #
  56. Header always set X-Content-Type-Options: "nosniff"
  57. #
  58. # Setting this header will prevent other sites from embedding pages from this
  59. # site as frames. This defends against clickjacking attacks.
  60. # Requires mod_headers to be enabled.
  61. #
  62. Header always set X-Frame-Options: "sameorigin"
  63. # Enable reflective XSS protection and block response when detecting an attack
  64. Header always set X-Xss-Protection "1; mode=block"
  65. # Allow images, scripts, AJAX, form actions, and CSS from the same origin,
  66. # and disallow any other resources to load (eg object, frame, media, etc).
  67. # More info: <https://content-security-policy.com/>
  68. 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';"
  69. # Forbid use of browser features
  70. # More info: <https://www.w3.org/TR/permissions-policy-1/>
  71. # <https://github.com/w3c/webappsec-permissions-policy/blob/master/features.md>
  72. 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()"
  73. # Do not send the referrer header when navigating from HTTPS to HTTP,
  74. # but always send the full URL when navigating from HTTP to any origin.
  75. # More info: <https://scotthelme.co.uk/a-new-security-header-referrer-policy/>
  76. Header always set Referrer-Policy "no-referrer-when-downgrade"
  77. # enable Strict Transport Security
  78. Header always set Strict-Transport-Security "max-age=63072000;includeSubdomains;preload" "expr=-n %{HTTPS}"
  79. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet