Authentication System
Dockhand’s authentication system is designed with security and flexibility in mind:- Optional Authentication - Run without auth for trusted environments, or enable it for multi-user deployments
- Multiple Providers - Support for local users, OIDC/SSO, and LDAP (Enterprise)
- Strong Security - Argon2id password hashing, secure session management, and optional 2FA
- Session Management - Configurable session timeouts with HttpOnly, Secure, and SameSite cookies
Edition Comparison
| Feature | Free Edition | Enterprise Edition |
|---|---|---|
| Local Users | ✅ | ✅ |
| OIDC/SSO Integration | ✅ | ✅ |
| Two-Factor Authentication | ✅ | ✅ |
| LDAP/Active Directory | ❌ | ✅ |
| Role-Based Access Control | ❌ | ✅ |
| Audit Logging | ❌ | ✅ |
Security Features
Password Security
- Argon2id Hashing - Memory-hard algorithm resistant to GPU attacks
- Custom Parameters - 64MB memory cost, 3 iterations, 256-bit output
- Timing Attack Protection - Constant-time comparison prevents username enumeration
Session Security
- Cryptographically Secure Tokens - 256-bit random session IDs
- HttpOnly Cookies - Prevents XSS attacks from reading session tokens
- SameSite=Strict - CSRF protection
- Secure Flag - Automatic HTTPS detection via
x-forwarded-protoheader - Configurable Timeouts - 1 hour to 7 days (default: 24 hours)
Rate Limiting
- Failed Login Protection - 5 attempts per 15 minutes
- 15 Minute Lockout - Automatic lockout after threshold
- IP + Username Tracking - Per-user rate limiting
Initial Setup
1. Enable Authentication
Navigate to Settings > Authentication in the Dockhand UI:2. Create First Admin User
When authentication is enabled but no users exist, Dockhand allows creating the first admin user:3. Configure Session Timeout
Adjust session timeout in Settings > Authentication:- Minimum: 1 hour (3600 seconds)
- Maximum: 7 days (604800 seconds)
- Default: 24 hours (86400 seconds)
Authentication Flow
Local Authentication
- User submits username and password
- System verifies credentials using Argon2id
- If 2FA enabled, user must provide TOTP code
- Session created with secure cookie
- User redirected to dashboard
OIDC/SSO Authentication
- User clicks “Sign in with [Provider]”
- Redirected to Identity Provider (IdP)
- User authenticates with IdP
- IdP redirects back with authorization code
- Dockhand exchanges code for tokens
- User account created/updated from claims
- Session created and user logged in
LDAP Authentication
- User submits username and password
- System searches LDAP directory for user DN
- Binds as user to verify password
- Retrieves user attributes (email, display name)
- Checks group membership for admin/role assignment
- Local user account created/synced
- Session created and user logged in
Configuration Files
Dockhand stores authentication settings in the SQLite/PostgreSQL database:auth_settings- Global auth configurationusers- Local user accountssessions- Active user sessionsoidc_config- OIDC provider configurationsldap_config- LDAP directory configurations (Enterprise)
Environment Variables
Force Secure flag on session cookies. Set to
true for HTTPS, false for HTTP.
Defaults to auto-detection via x-forwarded-proto header.Disable local username/password authentication. Useful for SSO-only deployments.
Hostname used for 2FA issuer name and license validation.
Public Endpoints
These endpoints are always accessible without authentication:/login- Login page/api/auth/login- Authentication endpoint/api/auth/logout- Logout endpoint/api/auth/session- Session validation/api/auth/settings- Auth configuration (read-only when auth disabled)/api/auth/providers- List available auth providers/api/auth/oidc/callback- OIDC callback handler/api/health- Health check endpoint/api/git/*/webhook- Git webhook receivers (signature verification)
Security Best Practices
For Production Deployments
-
Always Enable HTTPS
- Use a reverse proxy (Traefik, Nginx, Caddy)
- Set
x-forwarded-proto: httpsheader - Verify
Secureflag is set on cookies
-
Use Strong Passwords
- Minimum 12 characters
- Mix of uppercase, lowercase, numbers, symbols
- Consider using a password manager
-
Enable 2FA for Admins
- All admin accounts should use TOTP
- Store backup codes securely
- Test recovery process
-
Configure Session Timeout
- Balance security vs. convenience
- Shorter timeouts (4 hours) for sensitive environments
- Longer timeouts (7 days) for trusted networks
-
Monitor Authentication Logs
- Review server logs for failed login attempts
- Watch for unusual IP addresses
- Enable audit logging (Enterprise)
For SSO Deployments
-
Disable Local Login
- Set
DISABLE_LOCAL_LOGIN=true - Forces all users through IdP
- Prevents password-based attacks
- Set
-
Configure Role Mappings
- Map IdP groups to Dockhand roles
- Automate role assignment
- Keep permissions in sync with IdP
-
Test Failure Scenarios
- What happens if IdP is down?
- Can admins still access via local account?
- Consider keeping one local admin as backup
Troubleshooting
Login Loop on HTTP
If you experience a login loop when accessing Dockhand over HTTP:Session Expires Immediately
Check session timeout configuration:Can’t Create First User
Ensure authentication is enabled:Next Steps
Local Users
Manage local user accounts and passwords
OIDC/SSO
Integrate with your Identity Provider
Two-Factor Auth
Add TOTP-based 2FA for enhanced security
RBAC
Configure role-based access control (Enterprise)
