]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon/networking/nftables.nix
nftables: revamp using nested declarations
[julm/julm-nix.git] / hosts / oignon / networking / nftables.nix
1 { pkgs, lib, config, hostName, ... }:
2 let
3 inherit (config.users) users;
4 in
5 {
6 networking.firewall.enable = false;
7 security.lockKernelModules = false;
8 systemd.services.disable-kernel-module-loading.after = [ "nftables.service" ];
9 # echo -e "$(nix eval hosts.aubergine.config.networking.nftables.ruleset)"
10 # nft list ruleset
11 networking.nftables = {
12 enable = true;
13 ruleset = ''
14 table inet filter {
15 chain input-intra {
16 tcp dport { ssh, 2222 } counter accept comment "SSH"
17 udp dport 60000-61000 counter accept comment "Mosh"
18 }
19 chain input-net {
20 }
21
22 chain output-lan {
23 tcp dport { ssh, 2222 } counter accept comment "SSH"
24 tcp dport bootps counter accept comment "DHCP"
25 }
26 chain output-intra {
27 tcp dport { ssh, 2222 } counter accept comment "SSH"
28 udp dport 60001-60010 counter accept comment "Mosh"
29 tcp dport { http, https } counter accept comment "HTTP"
30 tcp dport git counter accept comment "Git"
31 }
32 chain output-net {
33 tcp dport { ssh, 2222 } counter accept comment "SSH"
34 udp dport 60001-60010 counter accept comment "Mosh"
35 udp dport ntp skuid ${users.systemd-timesync.name} counter accept comment "NTP"
36 meta l4proto { udp, tcp } skuid dnscrypt-proxy2 counter accept comment "dnscrypt-proxy2"
37 tcp dport { http, https } counter accept comment "HTTP"
38 tcp dport git counter accept comment "Git"
39 tcp dport imaps counter accept comment "IMAPS"
40 tcp dport xmpp-client counter accept comment "XMPP"
41 tcp dport nntps counter accept comment "NNTPS"
42 }
43 }
44 '';
45 };
46 }