1 { pkgs, lib, config, hosts, ... }:
3 inherit (builtins) hasAttr readFile;
4 inherit (pkgs.lib) unlinesAttrs;
5 inherit (config.users) users groups;
8 networking.firewall.enable = false;
9 security.lockKernelModules = false;
10 systemd.services.disable-kernel-module-loading.after = [ "nftables.service" ];
11 # echo -e "$(nix eval hosts.losurdo.config.networking.nftables.ruleset)"
13 networking.nftables = {
15 ruleset = lib.mkBefore ''
17 include "${../../../networking/nftables/filter.txt}"
20 # Some .nix append rules here with: add rule inet filter net2fw ...
23 tcp dport { 80, 443 } counter accept comment "HTTP"
24 udp dport 123 skuid ${users.systemd-timesync.name} counter accept comment "NTP"
25 tcp dport 9418 counter accept comment "Git"
27 # Some .nix append rules here with: add rule inet filter fw2net ...
31 # Some .nix append rules here with: add rule inet filter lan2fw ...
35 # Some .nix append rules here with: add rule inet filter fw2lan ...
38 # Some .nix append rules here with: add rule inet filter intra2fw ...
41 # Some .nix append rules here with: add rule inet filter fw2intra ...
45 type filter hook input priority 0
54 # accept traffic already established
55 ct state { established, related } accept
56 jump accept-connectivity-input
60 tcp dport 22 counter accept comment "SSH"
61 udp dport 60000-61000 counter accept comment "Mosh"
63 # Some .nix append gotos here with: add rule inet filter input iffname ... goto ...
66 type filter hook output priority 0
71 tcp flags syn tcp option maxseg size set rt mtu
73 ct state { established, related } accept
74 jump accept-connectivity-output
76 tcp dport 22 counter accept comment "SSH"
78 # Some .nix append gotos here with: add rule inet filter output oifname ... goto ...
81 type filter hook forward priority 0
87 type nat hook prerouting priority filter
91 type nat hook postrouting priority srcnat