Skip to content

Commit

Permalink
nginx: assert that HSTS header are set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Apr 24, 2024
1 parent d1bb9ac commit 3aa5a47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nginx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ in
];

config = lib.mkIf cfg.enable {
assertions = lib.mkIf cfg.setHSTSHeader (lib.attrValues (lib.mapAttrs (host: hostConfig: {
assertion = hostConfig.root == null;
message = let
name = ''services.nginx.virtualHosts."${host}"'';
in "Use ${name}.locations./.root instead of ${name}.root to properly apply .locations.*.extraConfig set by services.nginx.setHSTSHeader";
}) cfg.virtualHosts));

boot.kernel.sysctl = lib.mkIf cfg.tcpFastOpen {
# enable tcp fastopen for outgoing and incoming connections
"net.ipv4.tcp_fastopen" = 3;
Expand Down

0 comments on commit 3aa5a47

Please sign in to comment.