I have the following pf rules, and need help regarding on why portsnap in general failed to update and I am not able to connect to certain hosts (portsnap mirrors) unless pf is disabled. Also suggestions about optimization and security are welcome.
Portsnap problems:
Ruleset:
Running on:
Portsnap problems:
Code:
root@:~ # portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... failed.
Fetching snapshot tag from your-org.portsnap.freebsd.org... failed.
Fetching snapshot tag from isc.portsnap.freebsd.org... done.
Fetching snapshot metadata...
Ruleset:
Code:
####Interfaces
ext_if="em0"
jail_if_www="lo888"
jail_if_db="lo777"
jail_if_irc="lo999"
jail_if_dns="lo111"
jail_if_psql="lo555"
jail_if_mail="lo444"
jail_if_torrent="lo222"
jail_if_voip="lo333"
####IP Assignment
IP_PUB="123.123.123.123"
IP_JAIL_WWW="10.8.8.8"
IP_JAIL_DB="10.7.7.7"
IP_JAIL_IRC="10.9.9.9"
IP_JAIL_DNS="10.1.1.1"
IP_JAIL_PSQL="10.5.5.5"
IP_JAIL_MAIL="10.4.4.4"
IP_JAIL_TORRENT="10.2.2.2"
IP_JAIL_VOIP="10.3.3.3"
###Jail Network
NET_JAIL_WWW="10.8.8.0/24"
NET_JAIL_DB="10.7.7.0/24"
NET_JAIL_IRC="10.9.9.0/24"
NET_JAIL_DNS="10.1.1.0/24"
NET_JAIL_PSQL="10.5.5.0/24"
NET_JAIL_MAIL="10.4.4.0/24"
NET_JAIL_TORRENT="10.2.2.0/24"
NET_JAIL_VOIP="10.3.3.0/24"
###PORT
PORT_WWW="{80,443,4242,44777}"
PORT_DB="{3306,9200}"
PORT_IRC="{6665,6666,6667,6668,6669,6697,7000}"
PORT_IRC_LOCAL="{8080}"
PORT_DNS="{53}"
PORT_MAIL="{993,465,25,4190,9090,9093}"
PORT_PSQL="{}"
PORT_TORRENT="{20152:65535,8081}"
PORT_VOIP="{1719:1720,3478:3479,5002:5003,5060,5070,5080,16384:32768,50888}"
set block-policy drop
set loginterface $ext_if
set optimization normal
set ruleset-optimization profile
set skip on lo0
scrub on $ext_if all reassemble tcp no-df random-id
scrub in on $ext_if all fragment reassemble no-df random-id
scrub out on $ext_if all random-id fragment reassemble no-df
#scrub in all
# nat all www jail traffic
nat pass on $ext_if from $NET_JAIL_WWW to any -> $IP_PUB
# nat all torrent to outside
nat pass on $ext_if from $NET_JAIL_TORRENT to any -> $IP_PUB
# redirect torrent port traffic from outbound
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORT_TORRENT -> $IP_JAIL_TORRENT
rdr pass on $ext_if proto udp from any to $IP_PUB port $PORT_TORRENT -> $IP_JAIL_TORRENT
# redirect torrent port voip from outbound
nat pass on $ext_if from $NET_JAIL_VOIP to any -> $IP_PUB
#TCP
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORT_VOIP -> $IP_JAIL_VOIP
#UDP
rdr pass on $ext_if proto udp from any to $IP_PUB port $PORT_VOIP -> $IP_JAIL_VOIP
# temp outbound access for DB
nat pass on $ext_if from $NET_JAIL_DB to any -> $IP_PUB
# temp outbound access for IRC
nat pass on $ext_if from $NET_JAIL_IRC to any -> $IP_PUB
# temp outbound access for PSQL
nat pass on $ext_if from $NET_JAIL_PSQL to any -> $IP_PUB
# temp outbound access for MAIL
nat pass on $ext_if from $NET_JAIL_MAIL to any -> $IP_PUB
# redirect mail port traffic from outbound
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORT_MAIL -> $IP_JAIL_MAIL
rdr pass on $ext_if proto udp from any to $IP_PUB port $PORT_MAIL -> $IP_JAIL_MAIL
# redirect mail port traffic from www jail
rdr pass on $jail_if_www proto tcp from any to $IP_PUB port $PORT_MAIL -> $IP_JAIL_MAIL
rdr pass on $jail_if_www proto udp from any to $IP_PUB port $PORT_MAIL -> $IP_JAIL_MAIL
# redirect irc port traffic from outbound
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORT_IRC -> $IP_JAIL_IRC
# redirect www port traffic
rdr pass on $ext_if proto tcp from any to $IP_PUB port $PORT_WWW -> $IP_JAIL_WWW
# enable DB access from www
rdr pass on $jail_if_www proto tcp from any to $IP_JAIL_DB port $PORT_DB -> $IP_JAIL_DB
# enable xml-rpc irc access from www
rdr pass on $jail_if_www proto tcp from any to $IP_JAIL_IRC port $PORT_IRC_LOCAL -> $IP_JAIL_IRC
## enable DNS access from all lumniousify network
##tcp
rdr pass on $jail_if_www proto tcp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
rdr pass on $jail_if_db proto tcp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
rdr pass on $jail_if_irc proto tcp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
##udp
rdr pass on $jail_if_www proto udp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
rdr pass on $jail_if_db proto udp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
rdr pass on $jail_if_irc proto udp from any to $IP_JAIL_DNS port $PORT_DNS -> $IP_JAIL_DNS
##Jail dns
nat pass on $ext_if from $NET_JAIL_DNS to any -> $IP_PUB
#antispoof is a common special case of filtering and blocking. This mechanism protects against activity from spoofed or forged IP addresses
antispoof log for $ext_if
# activate spoofing protection for all interfaces
block in quick from urpf-failed
block in quick on $ext_if from any to 255.255.255.255
block in quick on $ext_if from urpf-failed
block in quick on $ext_if from no-route to any
# Try to block nmap scans
block in log quick on $ext_if inet proto tcp from any to any flags FUP/FUP
Running on:
Code:
FreeBSD 9.1-STABLE FreeBSD 9.1-STABLE #0 r252471: Mon Jul 1 18:58:48 GMT 2013 root@:/usr/obj/usr/src/sys/HOST amd64