This Docker image provides a convenient way to deploy Fail2ban, an intrusion prevention framework that protects servers from brute-force attacks. It works by monitoring log files for suspicious activity, such as repeated password failures, and automatically updates firewall rules to ban the offending IP addresses. This containerized version simplifies setup and management, allowing you to secure your services with minimal effort.
The image is highly configurable and designed for modern container environments. Key features include:
amd64, arm/v7, and arm64.iptables chains (DOCKER-USER and INPUT) to ensure rules are applied correctly to container traffic.By using this image, you can quickly add a robust layer of security to your server, blocking malicious actors before they can gain access.
services:
fail2ban:
image: crazymax/fail2ban:latest
container_name: fail2ban
network_mode: "host"
cap_add:
- NET_ADMIN
- NET_RAW
environment:
- TZ=UTC
- F2B_LOG_TARGET=STDOUT
- F2B_LOG_LEVEL=INFO
- F2B_DB_PURGE_AGE=1d
- SSMTP_HOST=smtp.example.com
- SSMTP_PORT=587
- SSMTP_USER=${SSMTP_USER}
- SSMTP_PASSWORD=${SSMTP_PASSWORD}
- SSMTP_TLS=YES
volumes:
- ./data:/data
- /var/log:/var/log:ro
restart: unless-stoppedSSMTP_USER=your_smtp_username
SSMTP_PASSWORD=your_super_secret_smtp_passwordAuto-fetched about 15 hours ago
Auto-fetched about 15 hours ago