Docker Quickie (II)

Quickly ban an IP range in docker mailserver.

Docker Quickie (II)
Photo by Mathyas Kurmann / Unsplash

Docker Mailserver is a production-ready full-stack mail server running in docker. It includes fail2ban, which reliably blocks malicious IPs through constantly monitoring access logs.

However I've noticed some party probing my mail-server from an IP range. So here's how to manually ban such range:

for ip in 141.98.{10..11}.{1..254}; 
do 
   docker exec mailserver setup fail2ban ban $ip; 
done