1 { pkgs, lib, config, ... }:
3 inherit (builtins) hasAttr readFile;
4 inherit (pkgs.lib) unlinesAttrs;
5 inherit (config.users) users;
6 inherit (config.services) shorewall shorewall6;
12 DNS(ACCEPT) $FW net {user=${users.unbound.name}}
14 HKP(ACCEPT) $FW net {user=${users.julm.name}}
17 IRCS(ACCEPT) $FW net {user=${users.julm.name}}
18 NTP(ACCEPT) $FW net {user=${users.systemd-timesync.name}}
19 NNTP(ACCEPT) $FW net {user=${users.julm.name}}
20 NNTPS(ACCEPT) $FW net {user=${users.julm.name}}
36 ACCEPT net $FW {proto=tcp, dport=8080}
41 SSH(ACCEPT) net $FW {rate=s:1/min:10}
59 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
60 # PORT(S) PORT(S) LIMIT GROUP
65 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
66 # PORT(S) PORT(S) LIMIT GROUP
71 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
72 # PORT(S) PORT(S) LIMIT GROUP
73 PARAM - - udp 60000-61000
78 services.shorewall = {
82 ${readFile "${shorewall.package}/etc-example/shorewall/shorewall.conf"}
90 # DOC: shorewall-zones(5)
97 # DOC: shorewall-interfaces(5)
99 net enp1s0 arp_filter,nosmurfs,routefilter=1,tcpflags
100 lan enp2s0 arp_filter,nosmurfs,routefilter=1,tcpflags
101 unused enp3s0 arp_filter,nosmurfs,routefilter=1,tcpflags
104 # DOC: shorewall-policy(5)
109 # WARNING: the following policy must be last
112 rules = lib.mkBefore ''
113 # DOC: shorewall-rules(5)
127 services.shorewall6 = {
129 configs = macros // {
130 "shorewall6.conf" = ''
131 ${readFile "${shorewall6.package}/etc-example/shorewall6/shorewall6.conf"}
139 # DOC: shorewall-zones(5)
146 # DOC: shorewall-interfaces(5)
148 net enp1s0 nosmurfs,tcpflags
149 lan enp2s0 nosmurfs,tcpflags
150 unused enp3s0 nosmurfs,tcpflags
153 # DOC: shorewall-policy(5)
158 # WARNING: the following policy must be last
161 rules = lib.mkBefore ''
162 # DOC: shorewall-rules(5)