Last active
August 29, 2015 14:19
-
-
Save pedrompcaetano/124303512998a67625f9 to your computer and use it in GitHub Desktop.
replace table contents instead of reloading pf ruleset at each crontab interval
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PFDIR=/etc/pf-files | |
ZONEFILE=blocked_zones | |
mkdir -p ${PFDIR} | |
> ${PFDIR}/${ZONEFILE} | |
for ZONE in cn az by kz kg ru tj tm uz vn | |
do | |
ftp -o - http://ipdeny.com/ipblocks/data/countries/${ZONE}.zone >> ${PFDIR}/${ZONEFILE} | |
#sleep 3 #respect ipdeny policies | |
done | |
pfctl -t blocked_zones -T replace `cat ${PFDIR}/${ZONEFILE}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment