mirror of
https://github.com/SubleXBle/Fail2Ban-Report.git
synced 2025-12-30 22:20:26 -06:00
1.7 KiB
1.7 KiB
🔑 Authentication in Fail2Ban-Report
This version introduces a user-based authentication system to secure access to the Fail2Ban-Report web interface.
✨ Key Features
-
Session-based Login
- Users authenticate with username and password.
- Passwords are securely stored using bcrypt hashing (
password_hash/password_verify). - On successful login, a secure PHP session is established.
-
Secure Session Management
- Session cookies are set with
HttpOnly,Secure, andSameSite=Strict. - Inactivity timeout: 30 minutes.
- Absolute session lifetime: 2 hours.
- Session ID is automatically regenerated every 15 minutes.
- Session is bound to the client using a fingerprint (browser user-agent + IP subnet).
- Session cookies are set with
-
Role-based Access Control
- Default role:
viewer. - Extendable with roles like
admin(configured inusers.json). - Access checks are handled via the
is_admin()function.
- Default role:
-
Login / Logout Mechanism
- Logout reliably destroys the session and clears the session cookie.
- Failed login attempts are logged via
error_log→ compatible with Fail2Ban monitoring.
-
User Data
- User accounts are stored in a local JSON file (
users.json). - Structure:
username,password(hash),role. - File should be protected with strict filesystem permissions.
- User accounts are stored in a local JSON file (
Protection-Level
- Protects the Fail2Ban-Report Blocklists from unauthorized access.
- Hardened against session hijacking and fixation attacks.
- Provides a foundation for future improvements (e.g., CSRF protection [Login Page], additional roles, additional admin features, Fail2Ban Support by logging failed login attempts).