]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon/networking/nftables.nix
yt-dlp: limit file length
[julm/julm-nix.git] / hosts / oignon / networking / nftables.nix
1 { config, ... }:
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 preCheckRuleset = ''
14 sed -i ruleset.conf \
15 -e 's/ip daddr losurdo.wg//'
16 '';
17 ruleset = ''
18 table inet filter {
19 chain input-intra {
20 tcp dport { ssh, 2222 } counter accept comment "SSH"
21 udp dport 60001-60010 counter accept comment "Mosh"
22 #tcp dport 4713 counter accept comment "pulseaudio"
23 tcp dport 5201 counter accept comment "iperf"
24 }
25 chain input-net {
26 }
27
28 chain output-lan {
29 tcp dport { ssh, 2222 } counter accept comment "SSH"
30 udp dport 60001-60100 counter accept comment "Mosh"
31 tcp dport bootps counter accept comment "DHCP"
32 tcp dport { 4444, 5555 } counter accept
33 tcp dport 5201 counter accept comment "iperf"
34 }
35 chain output-intra {
36 tcp dport { ssh, 2222 } counter accept comment "SSH"
37 udp dport 60001-60100 counter accept comment "Mosh"
38 tcp dport { http, https } counter accept comment "HTTP"
39 tcp dport git counter accept comment "Git"
40 tcp dport 5201 counter accept comment "iperf"
41 ip daddr losurdo.wg tcp dport 9091 counter accept comment "transmission"
42 }
43 chain output-net {
44 tcp dport { ssh, 2222, 20022 } counter accept comment "SSH"
45 udp dport 60001-60100 counter accept comment "Mosh"
46 udp dport ntp skuid ${users.systemd-timesync.name} counter accept comment "NTP"
47 meta l4proto { udp, tcp } skuid dnscrypt-proxy2 counter accept comment "dnscrypt-proxy2"
48 tcp dport { http, https } counter accept comment "HTTP"
49 tcp dport git counter accept comment "Git"
50 tcp dport imaps counter accept comment "IMAPS"
51 tcp dport submissions counter accept comment "SMTPS"
52 tcp dport xmpp-client counter accept comment "XMPP client"
53 tcp dport 5223 counter accept comment "XMPP client direct TLS"
54 tcp dport 5281 counter accept comment "XMPP HTTPS"
55 tcp dport nntps counter accept comment "NNTPS"
56 tcp dport 5201 counter accept comment "iperf"
57 }
58 }
59 '';
60 };
61 }