Protect your server from brute-force attacks by automatically monitoring log files for malicious activity. This intrusion prevention framework scans logs from services like SSH and Apache to identify IP addresses that show signs of an attack, such as repeated password failures. Once an offending IP is detected, it is banned for a configurable period by updating your system's firewall rules.
This tool provides an essential layer of security by stopping attackers before they can gain access. It is highly customizable, allowing you to create your own rules and filters for any application that produces a log file. Key capabilities include:
While it significantly reduces the rate of unauthorized login attempts, it is best used in conjunction with strong authentication policies for comprehensive security.
services:
fail2ban:
image: linuxserver/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=admin
- SSMTP_PASSWORD=${SSMTP_PASSWORD}
- SSMTP_TLS=YES
volumes:
- ./data:/data
- /var/log:/var/log:ro
restart: unless-stopped
SSMTP_PASSWORD=your_super_secret_smtp_password
Auto-fetched about 20 hours ago
Auto-fetched about 20 hours ago