All pastes #3037 Raw Edit

pf.conf ache

public text v1 · immutable
#3037 ·published 2004-12-16 14:42 UTC
rendered paste body
#	$OpenBSD: pf.conf,v 1.28 2004/04/29 21:03:09 frantzen Exp $
#
# See pf.conf(5) and /usr/share/pf for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.


# macros
int_if = "sis0"
ext_if = "xl0"

tcp_services = "{ 22, 113 }"
icmp_types = "echoreq"
rdr_outgoing = " 21 "
main_comp = " 172.30.20.2 "
main_services = "{ 555, 80 }"

priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"

# options
set block-policy return
set loginterface $ext_if

# scrub
scrub in all

# nat/rdr
nat on $ext_if from $int_if:network to any -> ($ext_if)
rdr on $int_if proto tcp from any to any port $rdr_outgoing -> 127.0.0.1 port 8021
rdr on $ext_if proto tcp from any to any port $main_services -> $main_comp

# filter rules
block all

pass quick on lo0 all

block drop in quick on $ext_if from $priv_nets to any
block drop out quick on $ext_if from any to $priv_nets

pass in on $ext_if inet proto tcp from any to ($ext_if) port $tcp_services flags S/SA keep state

pass in on $ext_if proto tcp from any to $main_comp port $main_services flags S/SA synproxy state

pass in on $ext_if inet proto tcp from port 20 to ($ext_if) user proxy flags S/SA keep state

pass in inet proto icmp all icmp-type $icmp_types keep state

pass in on $int_if from $int_if:network to any keep state
pass out on $int_if from any to $int_if:network keep state

pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all keep state