1 { pkgs, lib, config, ... }:
3 inherit (builtins) hasAttr readFile;
4 inherit (pkgs.lib) unlinesAttrs;
5 inherit (config.users) users groups;
6 inherit (config.services) shorewall shorewall6 transmission;
12 DNS(ACCEPT) $FW net {user=${users.unbound.name}}
14 HKP(ACCEPT) $FW net {user=${users.julm.name}}
17 ACCEPT $FW net {proto=tcp, dport=8080}
18 IRCS(ACCEPT) $FW net {user=${users.julm.name}}
19 NTP(ACCEPT) $FW net {user=${users.systemd-timesync.name}}
38 SSH(ACCEPT) net $FW {rate=s:1/min:10}
44 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
45 # PORT(S) PORT(S) LIMIT GROUP
50 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
51 # PORT(S) PORT(S) LIMIT GROUP
56 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
57 # PORT(S) PORT(S) LIMIT GROUP
58 PARAM - - udp 60000-61000
63 services.shorewall = {
67 ${readFile "${shorewall.package}/etc-example/shorewall/shorewall.conf"}
75 # DOC: shorewall-zones(5)
81 # DOC: shorewall-interfaces(5)
83 net enp5s0 arp_filter,nosmurfs,routefilter=1,tcpflags,upnpclient
84 wet wlp4s0 arp_filter,nosmurfs,routefilter=1,tcpflags
87 # DOC: shorewall-policy(5)
91 # WARNING: the following policy must be last
95 # DOC: shorewall-rules(5)
102 ACCEPT $FW net:192.168.0.0/16
103 ACCEPT $FW net:224.0.0.0/4 udp 1900 # UPnP
104 ACCEPT $FW net udp {user=${users.transmission.name}} # BitTorrent
106 ACCEPT net $FW tcp ${toString transmission.settings.peer-port} # BitTorrent
107 ACCEPT net $FW udp ${toString transmission.settings.peer-port} # BitTorrent
111 services.shorewall6 = {
113 configs = macros // {
114 "shorewall6.conf" = ''
115 ${readFile "${shorewall6.package}/etc-example/shorewall6/shorewall6.conf"}
123 # DOC: shorewall-zones(5)
129 # DOC: shorewall-interfaces(5)
131 net enp5s0 nosmurfs,tcpflags
132 wet wlp4s0 nosmurfs,tcpflags
135 # DOC: shorewall-policy(5)
139 # WARNING: the following policy must be last
143 # DOC: shorewall-rules(5)