I have a few dozen servers behind OpenBSD firewall with port forwarding. Most rules are very similar and differ only in IPs or sometimes in ports forwarded, so I want to compact them to remove excessive repetition but I've found that it is impossible to use tables with rdr-to
rules. Is there any way to improve this configuration? May be there is option to use pf
macros to generate multiple rules at once? I can't use external preprocessor at the moment.
Example set of rules:
pass in on $extif proto tcp from any to 10.0.0.213 port {25,80,443} rdr-to 172.16.1.193
pass in on $intif proto tcp from $intnet to 10.0.0.213 port {25,80,443} rdr-to 172.16.1.193
pass out on $intif proto tcp from any to 172.16.1.193 port {25,80,443} received-on $intif nat-to $intif
pass in on $extif proto tcp from any to 10.0.0.214 port {25,80,443} rdr-to 172.16.1.194
pass in on $intif proto tcp from $intnet to 10.0.0.214 port {25,80,443} rdr-to 172.16.1.194
pass out on $intif proto tcp from any to 172.16.1.194 port {25,80,443} received-on $intif nat-to $intif
pass in on $extif proto tcp from any to 10.0.0.215 port {25,80,443,3389} rdr-to 172.16.1.195
pass in on $intif proto tcp from $intnet to 10.0.0.215 port {25,80,443,3389} rdr-to 172.16.1.195
pass out on $intif proto tcp from any to 172.16.1.195 port {25,80,443,3389} received-on $intif nat-to $intif