Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$ sudo mkdir /etc/pf-files
In /etc/pf.conf the following needs to be added:
1. In the prerequisites-section add:
table <blocked_zones> persist file "/etc/pf-files/blocked_zones"
2. In the block-section add early:
block in quick proto tcp from <blocked_zones> to any port { 22 80 }
#! /bin/sh
# Purpose: Block all traffic from specific countries. Use ISO code. #
touch ${ZONE_FILE}
for i in cn az by kz kg ru tj tm uz vn kr se th
wget -4 --no-proxy --no-cookies --no-cache \$
cat $ >> ${ZONE_FILE}
sleep 2
rm *.zone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment