table <blocked-hosts> persist
block in quick from <blocked-hosts>
Then edit: /etc/pf.conf and append the lines:
anchor "org.user.block.out"
load anchor "org.user.block.out" from "/etc/pf.anchors/org.user.block.out"
Then to reload the firewalling rules run:
$ sudo pfctl -f /etc/pf.conf
and if you haven't got pf enabled you also need to enable it with:
$ sudo pfctl -e
Then you can manage the blocked IPs with these commands:
# Block some IPs
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T add 1.2.3.4 5.6.7.8
# Remove all the blocked IPs
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T flush
# Remove a single IP
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T delete 1.2.3.4
No comments:
Post a Comment