Compare commits

...
2 Commits
Author SHA1 Message Date
wymiller 9056f6dcdb mod: firewall changes 2026-10-16 19:15:55 -04:00
gitea-actions[bot] 3fa4fb8ef7 chore: update flake lock 2026-10-11 07:08:06 +00:00
3 changed files with 37 additions and 13 deletions

No files matched your search

Generated
+12 -12
View File
@@ -267,11 +267,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1790872110, "lastModified": 1791626528,
"narHash": "sha256-dXrMwUGE/9pT0J7MeW1BuYxpnnPPc52/oLxfqQF/5q8=", "narHash": "sha256-kWT9qwTKo6igVW+PweF2yZGlnfGRAcK4gsxpC/Yv7vA=",
"owner": "purpleclay", "owner": "purpleclay",
"repo": "go-overlay", "repo": "go-overlay",
"rev": "8e136930a2a34c501d612f7b7b0ee8806531768f", "rev": "63bc96eab718f6f78c6d78f1309c3a58a8babfc6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -417,11 +417,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1790920529, "lastModified": 1791426274,
"narHash": "sha256-nQyFkMR78WP6PiXKkDW2SjqzLf/spQqjRuxRGSbcV8k=", "narHash": "sha256-MWhktfFtFE8Jl7bf9Pkp7TR5MSdYCjCswSo0Gkb4ywc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "774debe7a0d1b496e35677ad955a1011c6ff74f3", "rev": "7c8764b7c7b09b34f632464276218ef9090eaa11",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -507,11 +507,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1790797021, "lastModified": 1791651540,
"narHash": "sha256-H2vA5yUaS58Wtdp46piMbRqSQe3Qn716i/oZPYoyhp8=", "narHash": "sha256-cxmegj6Tg0xYk8A2icSl3v1+SeVDj+bESU2BnCqERPE=",
"owner": "notashelf", "owner": "notashelf",
"repo": "nvf", "repo": "nvf",
"rev": "2477cb0a5f394df36ddc72867c2657225d93d157", "rev": "19992540d372466340ededda0c065a3a0a962fd6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -624,11 +624,11 @@
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1791013993, "lastModified": 1791620365,
"narHash": "sha256-BiFPwFsbFnZH5GfWbQFKYuQNg+67aNQCoRSRNTeJFQc=", "narHash": "sha256-CVZXIDNw7HEwyD8X6q9Ln370Sc0ZqRlTzDRwOZ1hJMY=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "7470661ba2b51156048af08464b82020223dc942", "rev": "e90fafa71b440fabcd52dd7fb017ab2da81c781a",
"type": "github" "type": "github"
}, },
"original": { "original": {
+4 -1
View File
@@ -151,7 +151,10 @@ in {
# Core networking module (see ../../networking/core.nix) # Core networking module (see ../../networking/core.nix)
network = { network = {
firewall.enable = true; firewall = {
enable = true;
firewalld.enable = true;
};
networkManager.enable = true; networkManager.enable = true;
}; };
+21
View File
@@ -8,6 +8,12 @@ in {
options.network = { options.network = {
firewall = { firewall = {
enable = lib.mkEnableOption "system firewall"; enable = lib.mkEnableOption "system firewall";
firewalld.enable = lib.mkEnableOption "firewalld with its nftables backend";
nftables.extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Rules inside a separate inet nftables table alongside firewalld";
};
tcpPorts = { tcpPorts = {
ssh.enable = lib.mkEnableOption "SSH service port (22)"; ssh.enable = lib.mkEnableOption "SSH service port (22)";
web.enable = lib.mkEnableOption "common web service ports (80, 443)"; web.enable = lib.mkEnableOption "common web service ports (80, 443)";
@@ -42,6 +48,21 @@ in {
}; };
}; };
config = { config = {
assertions = [
{
assertion = cfg.firewall.nftables.extraConfig == "" || cfg.firewall.firewalld.enable;
message = "network.firewall.nftables.extraConfig requires network.firewall.firewalld.enable";
}
];
services.firewalld.enable = cfg.firewall.firewalld.enable;
networking.nftables = lib.mkIf cfg.firewall.firewalld.enable {
enable = true;
flushRuleset = false;
tables."local-extra" = lib.mkIf (cfg.firewall.nftables.extraConfig != "") {
family = "inet";
content = cfg.firewall.nftables.extraConfig;
};
};
networking.firewall = { networking.firewall = {
enable = cfg.firewall.enable; enable = cfg.firewall.enable;
allowedTCPPorts = lib.flatten [ allowedTCPPorts = lib.flatten [