What's Changed
- Allowing spaces in the input and ensuring the tags container wraps properly by @swissmakers in #61
- Add optional OIDC authentication with Keycloak, Authentik, and Pocket-ID support by @swissmakers in #64
This PR implements optional OpenID Connect (OIDC) authentication for Fail2ban UI, supporting three major identity providers: Keycloak, Authentik, and Pocket-ID. The implementation includes automatic client configuration for development environments, improved logout flows, and comprehensive UI enhancements.
OIDC Authentication
- Optional authentication via environment variables (backward compatible)
- Multi-provider support: Keycloak (recommended), Authentik, and Pocket-ID
- Secure session management: AES-GCM encrypted cookies with automatic HTTPS/HTTP detection
- CSRF protection: State parameter validation in OAuth flow
- Configurable session timeouts: Default 1 hour, customizable via
OIDC_SESSION_MAX_AGE - Automatic logout URL construction: Provider-specific logout handling with redirect back to login page
- Callback endpoint protection:
/api/banand/api/unbanremain accessible without OIDC (protected by callback secret) - Secure cookie handling: Automatic Secure flag detection based on request context
- Session encryption: AES-GCM encryption for session cookies
- Provider-specific logout: Correct logout URL construction for each provider (Keycloak uses
post_logout_redirect_uri)
Development Environment
- Automatic Keycloak client configuration:
init-keycloak.shscript automatically creates and configures OIDC client - Complete OIDC testing environment: Docker Compose setup with Keycloak, PostgreSQL, and optional Authentik/Pocket-ID
- Easy remote access: Configurable via
.envfile withPUBLIC_FRONTEND_URLandKEYCLOAK_URL - Local Fail2ban integration: Optional local Fail2ban instance for complete testing
New Environment Variables
Required (when OIDC enabled)
OIDC_ENABLED=trueOIDC_PROVIDER=keycloak|authentik|pocketidOIDC_ISSUER_URL- Provider issuer URLOIDC_CLIENT_ID- OIDC client IDOIDC_CLIENT_SECRET- OIDC client secret (orOIDC_CLIENT_SECRET_FILEfor auto-config)OIDC_REDIRECT_URL- Callback URL
Optional
OIDC_SCOPES- Default:openid,profile,emailOIDC_SESSION_SECRET- Auto-generated if not providedOIDC_SESSION_MAX_AGE- Default: 3600 secondsOIDC_USERNAME_CLAIM- Default:preferred_usernameOIDC_LOGOUT_URL- Auto-constructed if not setOIDC_SKIP_VERIFY- Skip TLS verification (dev only)
Full Changelog: v1.3.0...v1.3.5