1 {pkgs, lib, config, ...}:
2 let inherit (config.services) shorewall shorewall6;
3 when = x: y: if x == null then "" else y;
11 ${builtins.readFile "${shorewall.package}/etc/shorewall/shorewall.conf"}
19 # DOC: shorewall-zones(5)
21 ${when config.networking.net "net ipv4"}
22 ${when config.networking.lan "lan ipv4"}
25 # DOC: shorewall-interfaces(5)
27 ${when config.networking.net "net ${config.networking.net.iface} arp_filter,nosmurfs,routefilter,tcpflags"}
28 ${when config.networking.lan "lan ${config.networking.lan.iface} arp_filter,nosmurfs,routefilter,tcpflags"}
31 # DOC: shorewall-policy(5)
33 ${when config.networking.net "net all DROP none"}
34 ${when config.networking.lan "lan all DROP none"}
35 # XXX: the following policy must be last
39 # DOC: shorewall-rules(5)
45 + when config.networking.lan ''
49 ACCEPT $FW lan:${config.networking.lan.ipv4}/24
54 ACCEPT lan:${config.networking.lan.ipv4}/24 $FW
56 + when config.networking.net ''
81 #HTTPS(ACCEPT) net $FW
90 #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
91 # PORT(S) PORT(S) LIMIT GROUP
96 services.shorewall6 = {
99 "shorewall6.conf" = ''
100 ${builtins.readFile "${shorewall6.package}/etc/shorewall6/shorewall6.conf"}
108 # DOC: shorewall-zones(5)
110 ${when config.networking.net "net ipv6"}
111 ${when config.networking.lan "lan ipv6"}
114 # DOC: shorewall-interfaces(5)
116 ${when config.networking.net "net ${config.networking.net.iface} nosmurfs,tcpflags"}
117 ${when config.networking.lan "lan ${config.networking.lan.iface} nosmurfs,tcpflags"}
120 # DOC: shorewall-policy(5)
122 ${when config.networking.net "net all DROP none"}
123 ${when config.networking.lan "lan all DROP none"}
124 # XXX: the following policy must be last
128 # DOC: shorewall-rules(5)
134 + when config.networking.lan ''
138 Ping(ACCEPT) $FW lan:fe80::/10
143 Ping(ACCEPT) lan:fe80::/10 $FW