It depends ..
If you have a
block all statement, then you will need to construct pass statements for both in and out of the interfaces.
Here is a sample configuration that I use as my base if I am standing up a new firewall to sit in front of an network with an Exchange server:
Code:
#macros
ext_if="bge0"
int_if="bge1"
#tables
table <ssh-bruteforce>
#options
set block-policy return
set skip on lo0
scrub in all
#traffic normalization
#queueing
#translation
nat on $ext_if from 172.16.1.0/24 to any -> $ext_if
rdr pass on $ext_if proto tcp from any to $ext_if port 25 -> 172.16.1.11
rdr pass on $ext_if proto tcp from any to $ext_if port 80 -> 172.16.1.12
rdr pass on $ext_if proto tcp from any to $ext_if port 443 -> 172.16.1.11
#packet filtering
block in
pass out
block in quick on $ext_if from <ssh-bruteforce>
pass in on $ext_if proto tcp from any to $ext_if port ssh \
flags S/SA keep state \
(max-src-conn-rate 2/120, overload <ssh-bruteforce> flush global)
pass in quick on $ext_if inet proto { udp, tcp } from any to $ext_if port domain
pass in quick on $int_if inet from 172.16.1.0/24 to any
The premise here is a default block for traffic in and if it can be trusted in, it can pass out on its own.
Be sure to include code for the ssh-bruteforce blocking. It is very effective and simple to implement.
max-src-conn-rate 2/120 translates into a block if more than two connections are attempted within 120 seconds. To check to see what has been blocked:
# pfctl -t ssh-bruteforce -T show
And you should get something like this:
Code:
No ALTQ support in kernel
ALTQ related functions disabled
31.3.245.178
42.120.22.86
58.251.14.198
60.191.220.106
60.220.225.214
61.132.4.85
61.142.106.34
61.155.177.58
61.156.40.44
62.14.45.253
64.15.152.208
67.205.67.147
78.60.146.192
79.172.10.78
80.73.11.173
82.165.129.56
Other than the
rdr statement for ports 25, 80 and 443, I pass DNS traffic in on
$ext_if and RFC1918 traffic in on
$int_if. Make note of joining the
pass option to the
rdr statement as it takes care of two items on one line.
Ummm, what else, oftentimes you will see howto guide that have a parentheses around one of the interfaces and this is not needed unless the IP address is DHCP assigned.
Hope that is of some help.
