fail2web is a comprehensive Docker-based solution that includes both the fail2ban intrusion prevention system and a modern web management interface. This all-in-one package provides complete fail2ban functionality with an elegant, user-friendly web application for managing jails, banned IPs, and configurations.
- Production-ready fail2ban: Fully configured intrusion prevention system
- Persistent storage: Configuration and data persistence across restarts
- Log monitoring: Automatic monitoring of mounted log directories
- Modern web dashboard: Clean, intuitive interface for managing fail2ban
- Real-time monitoring: Live updates of jail status and banned IPs
- Configuration management: Full control over jail settings and filters
- Ignore IP management: Easy management of IPs that should never be banned
- Multi-container architecture: Separate, optimized containers for each component
- Easy deployment: One-command setup with docker-compose
- Volume management: Persistent storage for configurations and data
- Network isolation: Secure communication between components
- Real-time Jail Monitoring: View all active fail2ban jails with live status updates
- Banned IP Management: List, search, and unban IPs from any jail
- Manual IP Banning: Ban specific IPs or subnets directly from the web interface
- Auto-refresh: Automatic updates every 30 seconds to show current status
- Create New Jails: Full jail creation wizard with smart defaults
- Custom Filters: Support for custom fail2ban filters with regex validation
- Parameter Configuration: Set maxretry, findtime, bantime, and actions
- IPv4 & IPv6 Support: Full support for both address families
- CIDR Notation: Support for network ranges (e.g., 192.168.0.0/16)
- JWT Authentication: Secure token-based authentication
- Session Management: Automatic token verification and renewal
- Inactivity Timeout: Automatic logout after 1 minute of inactivity
- Responsive Design: Works on desktop and mobile devices
- Modern Dashboard: Clean, intuitive interface with real-time updates
- Search & Filter: Quickly find banned IPs
- RESTful API: JSON-based API for all operations
- Fail2ban Integration: Direct communication via fail2ban-client socket
- Configuration Management: Reads/writes fail2ban config files
- Error Handling: Comprehensive error handling with user-friendly messages
- No Frameworks: Pure JavaScript for lightweight performance
- Real-time Updates: Live updates without page reloads
- Form Validation: Client-side validation for better UX
- Responsive Layout: Adaptive design for different screen sizes
- Multi-container Setup: Separate containers for web app and fail2ban
- Volume Mounts: Persistent configuration and log storage
- Network Isolation: Secure communication between containers
- Easy Deployment: One-command setup with docker-compose
git clone https://github.com/isavage/fail2web.git
cd fail2web# Rename the example environment file
cp .env.example .env
# Edit .env with your credentials
nano .envCreate a .env file with the following variables:
FAIL2WEB_USERNAME=admin
FAIL2WEB_PASSWORD=your_secure_password
FAIL2WEB_SECRET_KEY=your_jwt_secret_key
TZ=America/New_YorkEdit the volumes section in docker-compose.yml to add your log directories:
volumes:
- ./fail2ban/data:/data
- /var/log:/var/log:ro
# Add additional log paths here as needed:
# - /var/log/nginx:/var/log/nginx:ro
# - /opt/app/logs:/var/log/app:ro
# - /home/user/custom_logs:/var/log/custom:ro
# - /var/lib/docker/containers:/var/log/docker:roCommon Log Sources:
- Nginx:
/var/log/nginx:/var/log/nginx:ro - Application Logs:
/opt/app/logs:/var/log/app:ro - Docker Logs:
/var/lib/docker/containers:/var/log/docker:ro - Custom Logs:
/home/user/custom_logs:/var/log/custom:ro
Format: /host/path:/container/path:permissions
host/path: Path on your host machinecontainer/path: Mount point inside fail2ban containerpermissions:ro(read-only) orrw(read-write)
For GitHub Actions VPS deployments, runtime variables are loaded from Doppler. Add
DOPPLER_TOKEN as a secret in each GitHub environment used by deploy.yml (for
example, prod-IN and prod-NL). The deployment injects the Doppler config at
runtime without creating a .env on the VPS; the local .env workflow above
remains the fallback for local development.
# Build and start the containers
docker compose up -d
# View logs
docker compose logs -f
# Stop the application
docker compose down- Web Interface:
http://localhost:5000 - Default Credentials: admin / (password from .env file)
GET /api/jails- List all active jailsGET /api/banned/{jail}- Get banned IPs for a jailPOST /api/ban- Ban an IP in a jailPOST /api/unban- Unban an IP from a jailGET /api/jails/config- List jail configurationsPOST /api/jails/config- Create/update jail configurationGET /api/ignoreip- Get ignore IP listPOST /api/ignoreip- Update ignore IP listGET /api/filters/{filter}- Get filter configurationPOST /api/login- User authentication
fail2web/
βββ src/
β βββ backend/
β β βββ app.py # Flask backend API
β β βββ requirements.txt # Python dependencies
β βββ frontend/
β βββ index.html # Main application
β βββ login.html # Login page
β βββ css/ # Stylesheets
β βββ js/ # JavaScript files
βββ fail2ban/ # Fail2ban configuration
βββ docker-compose.yml # Docker orchestration
βββ Dockerfile # Web app container
βββ README.md # This file
- JWT Tokens: 24-hour expiration with automatic renewal
- Input Validation: Server-side validation for all inputs
- IP Validation: Comprehensive IP/CIDR format checking
- Error Handling: Graceful error recovery without exposing details
- Logging: Appropriate logging levels (WARNING+ in production)
# View all container logs
docker compose logs -f
# View specific container logs
docker compose logs fail2web
docker compose logs fail2ban
# Enter container for debugging
docker compose exec fail2web bash
docker compose exec fail2ban bash
# Check fail2ban status
docker compose exec fail2ban fail2ban-client statusContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Test thoroughly
- Submit a pull request
# Clone your fork
git clone https://github.com/your-username/fail2web.git
cd fail2web
# Set up development environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r src/backend/requirements.txt
# Run backend locally
cd src/backend
python app.py
# The frontend will be served at http://localhost:5000This project is open source and available under the MIT License.
- fail2ban: The underlying intrusion prevention software
- Flask: Python web framework for the backend API
- Docker: Containerization platform for easy deployment
- Contributors: Everyone who has helped improve fail2web
Note: This application is designed to work with fail2ban running in a separate container. It communicates with fail2ban via its socket interface and manages configuration files in the shared /data volume.

