Fail2Ban Integration
Run this command as root to install Fail2Ban and configure auto-reporting:
curl -sL https://bl.ipwhois.net/api/fail2ban/install | sudo bash
wget -qO- https://bl.ipwhois.net/api/fail2ban/install | sudo bash
Installs Fail2Ban if needed, creates action + jail config, tests API connection.
Sign in for a personalized command with 1,000 reports/day and profile attribution.
Fail2Ban is an intrusion prevention framework that monitors log files (SSH, Apache, Nginx, etc.) for suspicious activity and automatically bans offending IP addresses by updating firewall rules (iptables/nftables).
By adding a custom action, every banned IP gets reported to the IPWhois.net Blacklist, contributing to community threat intelligence with zero manual effort.
If Fail2Ban is already installed, skip to Step 1.
Ubuntu / Debian
sudo apt update
sudo apt install -y fail2ban curl
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
CentOS / RHEL / Rocky / Alma
sudo dnf install -y epel-release
sudo dnf install -y fail2ban fail2ban-firewalld curl
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
Create /etc/fail2ban/action.d/ipwhois-report.conf:
[Definition]
actionstart =
actionstop =
actionban = curl -s --max-time 10 -X POST "https://bl.ipwhois.net/api/report" \
-d "ip=" -d "type=" \
-d "message=Fail2Ban++ban" \
-d "source=fail2ban" >> /var/log/ipwhois-report.log 2>&1
actionunban =
[Init]
bl_type = brute-force
sudo chmod 644 /etc/fail2ban/action.d/ipwhois-report.confEdit /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 5
findtime = 600
bantime = 3600
# Ban with firewall AND report to IPWhois.net Blacklist
action = iptables-multiport[name=sshd, port="ssh", protocol=tcp]
ipwhois-report[threat_type=brute-force]
logpath = /var/log/secure and firewallcmd-ipset instead of iptables-multiport.Restart Fail2Ban:
sudo systemctl restart fail2ban
sudo fail2ban-client status sshd
Postfix (email spam)
[postfix]
enabled = true
port = smtp,465,submission
filter = postfix[mode=auth]
logpath = /var/log/mail.log
maxretry = 3
bantime = 7200
action = iptables-multiport[name=postfix, port="smtp,465,submission"]
ipwhois-report[threat_type=spam]
Nginx (HTTP auth + bot detection)
[nginx-http-auth]
enabled = true
port = http,https
filter = nginx-http-auth
logpath = /var/log/nginx/error.log
maxretry = 5
bantime = 3600
action = iptables-multiport[name=nginx-auth, port="http,https"]
ipwhois-report[threat_type=brute-force]
[nginx-botsearch]
enabled = true
port = http,https
filter = nginx-botsearch
logpath = /var/log/nginx/access.log
maxretry = 3
bantime = 86400
action = iptables-multiport[name=nginx-bot, port="http,https"]
ipwhois-report[threat_type=scan]
| Jail | threat_type | Description |
|---|---|---|
sshd | brute-force | SSH login attempts |
postfix | spam | Email relay / SMTP auth abuse |
dovecot | brute-force | IMAP/POP3 login attempts |
apache-auth, nginx-http-auth | brute-force | HTTP authentication attempts |
apache-badbots | bot | Malicious crawler / scraper |
apache-noscript, nginx-botsearch | scan | Vulnerability scanning |
recidive | brute-force | Repeat offenders |
Test the API call manually
curl -sSf -X POST https://bl.ipwhois.net/api/report \
-d "ip=192.0.2.1" \
-d "type=brute-force" \
-d "message=Test+report+from+setup"
Trigger a test ban
sudo fail2ban-client set sshd banip 192.0.2.99
sudo fail2ban-client status sshd
sudo fail2ban-client set sshd unbanip 192.0.2.99
Check syslog
sudo grep "ipwhois-bl" /var/log/syslog | tail -10
- curl: command not found - Install with
apt install -y curlordnf install -y curl. - Permission denied - Check ownership:
sudo chown root:root /etc/fail2ban/action.d/ipwhois-report.conf - API unreachable - Test with
curl -v https://bl.ipwhois.net/api/check?ip=8.8.8.8 - Fail2Ban fails to start - Check syntax:
sudo fail2ban-client -t. Ensure action lines are indented with spaces. - Reports not appearing - Private IPs (10.x, 172.16-31.x, 192.168.x) are rejected. Check rate limits (500/day).
Only report repeat offenders
[recidive]
enabled = true
filter = recidive
logpath = /var/log/fail2ban.log
bantime = 604800
findtime = 86400
maxretry = 3
action = iptables-allports[name=recidive]
ipwhois-report[threat_type=brute-force]
This only reports IPs banned 3+ times within 24 hours, filtering out one-off attempts.
Whitelisting IPs
[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 10.0.0.0/8 192.168.0.0/16 YOUR.OFFICE.IP.HERE