Skip to content

Commit eda05ae

Browse files
authored
Beta 4
🆕 What's New in V 0.4.0 🧱 Firewall & JSON Optimized firewall-update.sh for faster batch processing of IPs. Batch blocking per jail with a single ufw reload. Safe unblocking with rule renumbering and reload after each deletion. JSON updates and cleanup done once per jail, not per IP. Core mechanisms, logging, and permissions unchanged. This significantly reduces both the runtime and the lock duration of the blocklists, especially during ban events. 🖥️ UI & Statistics Minor visual improvements in: header.php, fail2ban-logstats.php, fail2ban-logstats.js index.php (IP sorting) style.css 🟡🔴 Marker Feature IP Event Markers: Highlights repeated events per IP (yellow) and IPs in multiple jails (red). Sortable & Filterable Mark Column: New column Mark with dropdown filter. Dynamic Filtering: Markers update live with Action, Jail, IP, or Date filters. Marker column placed between Action and IP, responsive layout preserved. ✨ New Feature: Copy Filtered Data to Clipboard Added a new "Copy to Clipboard" button to export the currently filtered table data. Implemented a dedicated JavaScript file assets/js/table-export.js for the copy functionality. Integration with existing DataTables filtering logic to ensure only visible/filtered rows are copied. Output Format: Tab-separated values (TSV) with all HTML tags removed for clean text export. User Feedback: Shows a warning if there’s no data to copy. Shows a success or error alert based on the clipboard operation result. This Feature will only work with enabled https for security reasons
2 parents 50a479d + 14aa852 commit eda05ae

File tree

13 files changed

+637
-169
lines changed

13 files changed

+637
-169
lines changed

.htaccess

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,94 @@
11
# ----------------------------------------------------
2-
# BASIC PROTECTION
2+
# Fail2Ban-Report Docker
33
# ----------------------------------------------------
44

5-
# Redirect to https
6-
<IfModule mod_rewrite.c>
7-
RewriteEngine On
8-
# Check if HTTPS is not enabled
9-
RewriteCond %{HTTPS} !=on
10-
# Redirect to the same URL but with https
11-
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
12-
</IfModule>
5+
# Do not modify up here !
136

7+
# ----------------------------------------------------
148
# Disable directory listing
9+
# ----------------------------------------------------
1510
Options -Indexes
1611

12+
# ----------------------------------------------------
1713
# Block direct access to sensitive file types
14+
# ----------------------------------------------------
1815
<FilesMatch "\.(sh|ini|log|json)$">
1916
Require all denied
2017
</FilesMatch>
2118

19+
# ----------------------------------------------------
2220
# Protect the .htaccess file itself
21+
# ----------------------------------------------------
2322
<Files .htaccess>
2423
Require all denied
2524
</Files>
2625

26+
# ----------------------------------------------------
27+
# Protect archive/
28+
# ----------------------------------------------------
2729
<IfModule mod_rewrite.c>
2830
RewriteEngine On
2931
RewriteRule ^archive/ - [F,L]
3032
</IfModule>
3133

32-
# ----------------------------------------------------
33-
# BASIC HTTPS HEADERS
34-
# ----------------------------------------------------
35-
<IfModule mod_headers.c>
36-
Header always set X-Content-Type-Options "nosniff"
37-
Header always set X-Frame-Options "SAMEORIGIN"
38-
Header always set X-XSS-Protection "1; mode=block"
39-
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
40-
</IfModule>
4134

4235
# ----------------------------------------------------
43-
# Set UTF-8 as default charset
36+
# Set UTF-8 as default charset and RewriteEngine on
4437
# ----------------------------------------------------
4538
AddDefaultCharset utf-8
39+
RewriteEngine On
4640

47-
48-
41+
##########################################################
42+
##########################################################
43+
##########################################################
4944

5045
# ----------------------------------------------------
5146
# Set your own Rules to fit your needs down here
5247
# Example for additonal configuration
5348
# ----------------------------------------------------
5449

50+
# This is mandatory for a save setup!
51+
# Never expose this to the internet without https and restrictions (auth / ip)
52+
53+
# ----------------------------------------------------
54+
# BASIC HTTPS HEADERS
55+
# ----------------------------------------------------
56+
57+
# Redirect to HTTPS (also works behind reverse proxies using X-Forwarded-Proto)
58+
# If HTTPS is not on AND X-Forwarded-Proto is not https, redirect to https URL
59+
60+
#RewriteCond %{HTTPS} !=on
61+
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
62+
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
63+
64+
# Set environment variable HTTPS=1 if X-Forwarded-Proto is https (for header conditions)
65+
#SetEnvIf X-Forwarded-Proto https HTTPS=1
66+
67+
# Security headers (set only when HTTPS is active)
68+
<IfModule mod_headers.c>
69+
# Header always set X-Content-Type-Options "nosniff"
70+
# Header always set X-Frame-Options "SAMEORIGIN"
71+
# Header always set X-XSS-Protection "1; mode=block"
72+
# Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
73+
</IfModule>
74+
75+
# ----------------------------------------------------
76+
# Set Basic Auth
77+
# ----------------------------------------------------
5578
# Enable Basic Authentication (uncomment and configure if needed)
56-
# AuthType Basic
57-
# AuthName "Restricted Area"
58-
# AuthUserFile /path/to/.htpasswd
59-
# Require valid-user
79+
#AuthType Basic
80+
#AuthName "Restricted Area"
81+
#AuthUserFile /var/www/.htpasswd
82+
#Require valid-user
83+
6084

6185
# Restrict access by IP address (adjust IP ranges accordingly)
62-
# <RequireAny>
63-
# Require ip 192.168.1.0/24
64-
# Require ip 203.0.113.5
65-
# </RequireAny>
86+
# If you want to restrict access by IP addresses only, you can use RequireAny instead of RequireAll
87+
# <RequireAll>
88+
# Require valid-user
89+
# Require ip 192.168.1.1 # Single IP (recommended)
90+
# Require ip 192.168.1.0/24 # Network-Range
91+
# </RequireAll>
6692

6793
# Block access to backup files (optional)
6894
# <FilesMatch "\.(bak|old|backup)$">

README.md

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Fail2Ban-Report
2-
> Beta 3.4 | Version 0.3.4
2+
> Beta 4.0 | Version 0.4.0
33
44
> A simple and clean web-based dashboard to turn your daily Fail2Ban logs into searchable and filterable JSON reports — with optional IP blocklist management for UFW.
55
6+
> This version brings more stability and performance, as well as improved visibility into Fail2Ban events.
7+
68
**Integration**
79
>Designed for easy integration on a wide range of Linux systems — from small Raspberry Pis to modest business setups — though it’s not (yet) targeted at large-scale enterprise environments.
810
Flexibility comes from the two backend shell scripts, which you can adapt to your specific environment or log sources to provide the JSON data the web interface needs (daily JSON event files).
@@ -29,10 +31,11 @@ Fail2Ban-Report parses your `fail2ban.log` and generates JSON-based reports view
2931
It provides optional tools to:
3032

3133
- 📊 Visualize **ban** and **unban** events, including per-jail statistics
32-
- ⚡ Interact with IPs (e.g., manually block, unblock, or report to external services)
34+
- ⚡ Interact with IPs (e.g., manually block, unblock, get report from external services)
3335
- 📂 Maintain **jail-specific** persistent blocklists (JSON) with `active` and `pending` status
3436
- 🔄 Sync those lists with your system firewall using **ufw**
35-
- 🚨 Show **warning indicators** when ban rates exceed configurable thresholds
37+
- 🚨 Show **warning indicators** when ban rates exceed configurable thresholds
38+
- 🚨 Show **Markers** when a IP Address is present more than once in one (yellow) or more (red) jails.
3639

3740
> **Note:** Direct integration with other firewalls or native Fail2Ban jail commands is not yet implemented.
3841
@@ -78,40 +81,54 @@ It provides optional tools to:
7881
7982
---
8083

81-
## 🆕 Fix V 0.3.4
82-
Json Files should not loose Data anymore when several write processes trying to write the json file at the same time.
8384

84-
- `firewall-update.sh`: Added FLOCK to lock json when writing
85-
- `block-ip.php`: Added FLOCK to lock json when writing
86-
- `unblock-ip.php`: Added FLOCK to lock json when writing
87-
- `blocklist-stats.php`: Shows now more correct States of active and pending when blocking and unblocking
85+
## 🆕 What's New in V 0.4.0
86+
87+
### 🧱 Firewall & JSON
88+
- Optimized `firewall-update.sh` for faster batch processing of IPs.
89+
- Batch blocking per jail with a single `ufw reload`.
90+
- Safe unblocking with rule renumbering and reload after each deletion.
91+
- JSON updates and cleanup done once per jail, not per IP.
92+
- Core mechanisms, logging, and permissions unchanged.
93+
> This significantly reduces both the runtime and the lock duration of the blocklists, especially during ban events.
94+
95+
### 🖥️ UI & Statistics
96+
- Minor visual improvements in:
97+
- `header.php`, `fail2ban-logstats.php`, `fail2ban-logstats.js`
98+
- `index.php` (IP sorting)
99+
- `style.css`
88100

89-
just copy those 4 Files to apply the fix.
101+
### 🟡🔴 Marker Feature
102+
- **IP Event Markers**: Highlights repeated events per IP (yellow) and IPs in multiple jails (red).
103+
- **Sortable & Filterable Mark Column**: New column `Mark` with dropdown filter.
104+
- **Dynamic Filtering**: Markers update live with Action, Jail, IP, or Date filters.
105+
- Marker column placed between Action and IP, responsive layout preserved.
90106

107+
### ✨ New Feature: Copy Filtered Data to Clipboard
91108

92-
## 🆕 What's New in V 0.3.3 (QoL Update)
93-
### ⚠️ Warning System and Pending Status Indicators
94-
- 🚨 New [Warnings] section in .config to configure warning & critical thresholds (events per minute per jail) in format warning:critical (e.g: 20:50).
95-
- 👀 warning & critical status indicators (colored dots) in the header for quick overview.
96-
- ⏳ Manual block/unblock actions now mark IPs as pending until processed by firewall-update.
97-
- 📊 Pending entries are now visible in blocklist stats for better tracking.
109+
- **Added** a new "Copy to Clipboard" button to export the currently **filtered table data**.
110+
- **Implemented** a dedicated JavaScript file `assets/js/table-export.js` for the copy functionality.
111+
- **Integration** with existing DataTables filtering logic to ensure only visible/filtered rows are copied.
112+
- **Output Format**: Tab-separated values (TSV) with all HTML tags removed for clean text export.
113+
- **User Feedback**:
114+
- Shows a warning if there’s no data to copy.
115+
- Shows a success or error alert based on the clipboard operation result.
98116

99-
### ✔️ Multi-Selection UI and Bulk Actions for Ban & Report
100-
- ✅ Switched from per-row action buttons to checkbox multi-selection for IPs.
101-
- 📋 New dedicated “Ban” and “Info” buttons for bulk processing.
102-
- 🔄 Frontend updated to handle and display results for multiple IP actions simultaneously.
103-
- 🔔 New notification system for success/info/error messages on each action.
117+
> This Feature will only work with enabled https for security reasons
104118
105-
### 🛠 Backend Improvements & New IP Reporting
106-
- 🔄 Backend now accept arrays of IPs for ban and report actions, with detailed aggregated feedback.
107-
- 🆕 Added IPInfo API integration alongside AbuseIPDB for richer geolocation and network info.
108-
- ⏲️ Built-in delay between report requests to avoid API rate limits.
109-
- ⚙️ Improved error handling and user feedback for multi-IP operations.
110119

111120
---
112121

113122
### ⚠️ Upgrade Notice
114123

124+
If you're upgrading from an existing installation : from 0.3.3 and later
125+
126+
1. 📦 Replace all or changed files with the new version (overwrite).
127+
2. 👀 List of changed files: ![changelog.md#list-of-changed-files](changelog.md#list-of-changed-files)
128+
3. 📦 make sure new shellscripts are executable
129+
4. 🛠️ Control needed Paths
130+
5. 🛠️ Control .htaccess
131+
115132
If you're upgrading from an existing installation : pre 0.3.2 and also from 0.3.2
116133

117134
- ⚠️ **The new blocklist format is not compatible with the old `blocklist.json`.** and got new field `pending` is in json since 0.3.3
@@ -164,7 +181,6 @@ This is especially useful if you want to manually patch or update individual fil
164181
### 🔐 Security
165182
- ✅ Hardened `.htaccess` with best practices
166183
- ✅ add security layer between json and js
167-
- 🧩 move `archive/` out of webdirectory
168184
- ⏳ Further improvements (ongoing goal)
169185

170186
### 🔥 Active Defense
@@ -173,23 +189,26 @@ This is especially useful if you want to manually patch or update individual fil
173189
- ✅ IP GeoLoc and Provider Data with IP-Info (optional)
174190
- ✅ Bulk blocking of multiple IPs
175191
- ✅ Shows warnings/critical states threshold for Bans/Minute/Jail (setable in config)
192+
- ✅ Shows warning states for Ips that are more than once on List
193+
- ✅ Shows critical states for IPs that are in more than one Jail in List
176194
- 🧩 Support for nftables, firewalld
177-
- 🧩 full integration with fail2ban jails for block/unblock actions
178-
- ⏳ Optional automatic blocking based on patterns or thresholds
179-
- ⏳ Integration with external services (e.g. AbuseIPDB reporting)
195+
- ⏳ LTG: Integration with external services (e.g. AbuseIPDB reporting)
196+
- ⏳ LTG: Integration with fail2ban-jails directly
180197

181198
### 🌿 User Interface
182199
- ⏳ Improve CSS and styling
183200

184201
## 👀 Outlook
185-
- 📦 The next major version will focus on security by mooving and restructuring the `archive/` folder layout.
186-
- 🐳 A Docker image is expected probably around version v0.5.x, following the restructuring.
202+
- 📦 Further Improvements & Security Enhancements
203+
- Moving `archive/` to `/opt` makes little sense if `www-data` still needs access.
204+
- Working on a solution to authorize changes made to JSON files via the web interface.
205+
- 🐳 A Docker image is expected probably around version v0.5.x
187206

188207
---
189208

190209
## 🖼️ Screenshots
191210

192-
![Main interface with log overview](assets/images/Main-List-033.png)
211+
![Main interface with log overview](assets/images/Main-List-040.png)
193212
![Blocklist interface with unblock actions](assets/images/Block-List-033.png)
194213
![Result after banning an IP](assets/images/Message-Toast-033.png)
195214
![Result after Info](assets/images/Info-Msg-033.png)

0 commit comments

Comments
 (0)