PF firewall for Web Server

Posted: September 30, 2013 in Freebsd

PF Firewall for Web Server using freebsd

1. write in on rc.conf

pf_enable=”YES”
pf_rules=”/etc/pf.conf”

2. Write this /etc/pf.conf

########################### pf.conf ######################

# Macros

EXT=”em0″

set skip on lo0

# Block everything by default

block log all

# In

pass in quick on $EXT inet proto tcp from any to port {22, 80, 443}

# Out

pass out quick on $EXT inet all

########################### pf.conf ######################

3. Start & test with this command

/etc/rc.d/pf start or kldload pf

pfctl -f /etc/pf.conf 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s