I'm just starting to configure PF on my dedicated server and was curious if I was on the right track. I have a couple questions though ..
Am I using options I shouldn't be using? Should I be scrubbing packets?
Before I add the "block all" option, how do I allow MY IP address in regardless? (so I don't accidentally lock myself out).
Am I using options I shouldn't be using? Should I be scrubbing packets?
Before I add the "block all" option, how do I allow MY IP address in regardless? (so I don't accidentally lock myself out).
Code:
EXT_IF="em0"
MAIL="xx.xx.xx.xx"
WHITELIST="xx.xx.xx.xx"
set limit { states 20000, frags 20000 }
set optimization conservative
set block-policy drop
set state-policy if-bound
set skip on lo0
# http://www.openbsd.gr/faq/pf/scrub.html
#scrub in all
scrub in on $EXT_IF all fragment reassemble
# alternate smtp port
rdr on $EXT_IF proto tcp from any to $MAIL port 8025 -> $MAIL port 25
# this is needed so I can send mail with <domain>
rdr on $EXT_IF proto tcp from any to $MAIL port 587 -> $MAIL port 25
# block anything coming from source we have no back routes for
block in log quick on $EXT_IF from no-route to any
# drop broadcast requests quietly.
block in log quick on $EXT_IF from any to 255.255.255.255
# block packets claiming to come from reserved internal address blocks, as
# they are obviously forged and cannot be contacted from the outside world.
block in log quick on $EXT_IF from { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 255.255.255.255/32 } to any
table <blacklist> persist
block quick from <blacklist>
# block ssh scanners
pass in quick on $EXT_IF proto tcp from { $WHITELIST } to any port ssh
pass in log on $EXT_IF proto tcp from any to any port ssh \
flags S/SA keep state \
(max-src-conn-rate 3/30, overload <blacklist> flush global)