mirror of
https://github.com/SubleXBle/Fail2Ban-Report.git
synced 2026-04-25 16:58:44 -05:00
2.9 KiB
2.9 KiB
Sync Concept of Fail2Ban-Report
Username of the Client and Displayed Servername in Web-UI are the same.
Web UI
When a block or unblock action is triggered via the Web UI (example: block):
- The IP is sent to the blocklist of the respective jail from the correct server, containing:
- IP address
- Timestamp
active=truepending=true
- An entry is created in
/archive/update.jsonwith server name, updated blocklist, andtrue.
On the Client
When the client synchronizes its firewall, it processes the blocklist and applies it to the firewall.
If a block was set:
active=trueremainspendingis set tofalse
After Sync on the Server
Once the blocklist is synced back to the server, the entry is no longer shown as pending but instead as active.
Endpoints
index.php
- Client authenticates using server name, password, UUID, and IP (validated via
client-list.json). index.phpacceptsfail2ban-event.jsonfrom the client and overwrites the server version.
update.php
- Client authenticates with server name, password, UUID, and IP (validated via
client-list.json). - Client queries
update.phpto check if an update is available (update.jsonis checked). - Client receives a JSON response with a list of updated blocklists.
update.phpcopies the corresponding blocklists into a protected download directory.update.phpsets the entry for the copied blocklist inupdate.jsontofalse.
download.php
- Client authenticates (same as with
update.php). - Upon successful authentication, the client receives its blocklists (no direct downloads allowed).
- After delivery, blocklists are removed from the download directory.
syncback.php
- Client authenticates (same as above).
- Client uploads blocklists to
syncback.php. syncback.phpsaves the blocklists in a temp directory, locks the server-side blocklist, and overwrites it with the client’s latest valid version.- Note: This can cause intermediate changes (between download and sync-back) to be lost. However, it guarantees that server and client are fully consistent afterward.
- After overwriting,
syncback.phpremoves the corresponding blocklist fromupdate.jsonand releases it again.
Resulting Behavior
- Data authority is with the server until the client downloads the blocklist.
- Data authority shifts to the client until the blocklist is synced back.
- Once synced back, data authority returns to the server.
Security
- The server only communicates with authenticated clients.
- No direct access to
.jsonfiles is possible. - No direct download of blocklists is allowed.
- Although “basic authentication” (server name, password, UUID) is sufficient, it is strongly recommended to also restrict client IP addresses for additional security.
- An additional AllowList in
.htaccessis highly recommended.