Fail2ban (crazy-max)

Deploy a container that scans log files and bans IPs showing malicious signs. Configure custom jails, actions, and filters for robust server protection.

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:

  • Multi-platform support: Runs on various architectures including amd64, arm/v7, and arm64.
  • Easy configuration: Manage settings like log levels, timezone, and database purge age using environment variables.
  • Persistent data: Use a dedicated volume to store the Fail2ban database, custom jails, actions, and filters.
  • Docker network integration: Properly integrates with Docker's iptables chains (DOCKER-USER and INPUT) to ensure rules are applied correctly to container traffic.
  • Full customization: Add your own custom jails, actions, and filters in the data volume to tailor the protection to your specific needs.

By using this image, you can quickly add a robust layer of security to your server, blocking malicious actors before they can gain access.

Directory Structure

fail2ban-crazy-max
fail2ban
data
.env
docker-compose.yml

docker-compose.yml

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-stopped

.env

SSMTP_USER=your_smtp_username
SSMTP_PASSWORD=your_super_secret_smtp_password
Categories:

Share:

Ad
Favicon

 

  
 

Similar to Fail2ban (crazy-max)

Favicon

 

  
  
Favicon

 

  
  
Favicon