Downloads multiple external IP blocklists, merges them, sorts them, and loads them into persistent PF tables for automatic blocking of malicious sources.
It dynamically adjusts net.pf.request_maxcount based on the amount of IPs inside of blocklist file.
sudo fbsd-ipbl-blocker {daemon|update|list|restore}- daemon → Run continuously, updating blocklists every 24 hours.
- update → Perform a one-time update of blocklists and reload PF.
- list → Show the current blocklist and count of IPs.
- restore → Restore the most recent pf.conf backup.
You can override these defaults by editing the script:
| Variable | Default | Description |
|---|---|---|
| PF_TABLE | blocked_ips | Base name of PF tables |
| PFCONF | /etc/pf.conf | PF configuration file |
| BACKUP_DIR | /etc | Directory for pf.conf backups |
| BLOCKLIST | /etc/pf.blocked_ips | Path to merged blocklist file |
| TMPFILE | /tmp/pf.blocked_ips.tmp | Temporary file used during updates |
| LASTFILE | /tmp/pf.blocked_ips.last | Snapshot of last blocklist to detect changes |
| SYSCTL_CONF | /etc/sysctl.conf | System configuration file for persistence |
| URLS | (list of IP feeds) | External IP blocklist sources |
- Downloads multiple IP blocklists from trusted sources.
- Extracts valid IPv4 addresses and sorts them numerically.
- Ensures PF configuration contains persistent table definitions.
- Dynamically adjusts net.pf.request_maxcount via sysctl with margin.
- Updates /etc/sysctl.conf to persist net.pf.request_maxcount across reboots.
- Reloads PF and replaces table contents atomically.
- Provides daemon mode for daily refresh.
- Backup and restore functionality for pf.conf.
- FreeBSD system with root privileges.
- PF enabled and configured.
- Utilities: bash, fetch, grep, sort, uniq, wc, sed.
Run in daemon mode:
sudo fbsd-ipbl-blocker daemonPerform a one-time update:
sudo fbsd-ipbl-blocker updateList blocked IPs:
sudo fbsd-ipbl-blocker listRestore last pf.conf backup:
sudo fbsd-ipbl-blocker restoreClone the repository and run the installer:
git clone https://github.com/geobarrod/FBSD-IPBL-Blocker.git
cd FBSD-IPBL-Blocker
sudo make installTo remove the fbsd-ipbl-blocker and service:
cd FBSD-IPBL-Blocker
sudo make uninstall- Initial release of fbsd-ipbl-blocker.
- Features:
- Dynamic adjustment of net.pf.request_maxcount.
- Backup and restore of pf.conf.
- Daemon mode for daily refresh.
- rc.d service integration (ipbl_blocker).