Overview
UTMStack implements Time-based One-Time Password (TOTP) two-factor authentication using industry-standard libraries including Google Authenticator and ZXing for QR code generation. 2FA adds an additional security layer beyond passwords, protecting against credential compromise.2FA Implementation
UTMStack’s 2FA system is built on:- totp-spring-boot-starter (v1.7.1): Spring Boot integration for TOTP
- googleauth (v1.4.0): Google Authenticator compatibility
- ZXing (v3.4.1): QR code generation for easy setup
- Google Authenticator
- Microsoft Authenticator
- Authy
- 1Password
- Any RFC 6238 compliant TOTP app
Enabling 2FA for Users
Administrator Enrollment for Users
User Self-Enrollment
Scan QR Code
A QR code is displayed containing the TOTP secret:
- Open your authenticator app
- Scan the QR code with your device camera
- The account will be added to your authenticator app
2FA Login Process
Once 2FA is enabled, the login process requires two steps:Enter TOTP Code
After successful password authentication, a second screen prompts for the 6-digit TOTP code.
- 6-digit numeric code
- Refreshes every 30 seconds
- Time-synchronized between server and authenticator
- Small time drift tolerance (±1 time window)
System-Wide 2FA Policies
Administrators can enforce 2FA policies:Mandatory 2FA
Role-Based 2FA Requirements
Require 2FA for specific roles:- Navigate to Settings > Roles
- Edit a role (e.g., Administrator)
- Enable Require Two-Factor Authentication
- Save the role configuration
Managing 2FA for Users
Viewing 2FA Status
Check which users have 2FA enabled:- Go to Settings > Users
- Add the 2FA Status column to the user list
- Filter by “2FA Enabled” or “2FA Disabled”
Disabling 2FA for a User
Administrators can disable 2FA for troubleshooting:Resetting 2FA for a User
If a user loses access to their authenticator device:Verify User Identity
Confirm the user’s identity through an alternative secure channel (phone call, in-person verification).
Recovery Codes
Recovery codes provide backup access if the authenticator device is unavailable.Using Recovery Codes
If a user cannot access their authenticator app:- On the 2FA prompt, click Use Recovery Code
- Enter one of the saved recovery codes
- The code is validated and the user is logged in
- Used codes are immediately invalidated
Generating New Recovery Codes
Users can regenerate recovery codes:TOTP Configuration
Technical parameters for TOTP implementation: Default Settings:Time Synchronization
TOTP requires accurate time synchronization:- Server time should be synchronized with NTP
- Client device time should be accurate (automatic time sync recommended)
- Maximum time drift tolerance: ±30 seconds (1 time window)
2FA for API Access
When users with 2FA access APIs:API Key Authentication
- API keys bypass 2FA for automated processes
- API keys should have limited permissions
- Rotate API keys regularly
Personal Access Tokens
For interactive API access:Monitoring 2FA Activity
All 2FA events are logged in the audit trail: Logged Events:- 2FA enrollment
- 2FA verification success/failure
- 2FA reset by administrator
- Recovery code usage
- Failed verification attempts
Failed 2FA Alerts
Configure alerts for suspicious 2FA activity:- Navigate to Settings > Alerts
- Create a new alert rule
- Set condition: “Failed 2FA attempts > 3 in 5 minutes”
- Configure notification channels
- Save the alert rule
Best Practices
Troubleshooting
”Invalid Code” Errors
Common Causes:- Time synchronization issues (most common)
- User entering expired code
- User reading code from wrong account in authenticator app
- Code already used (TOTP codes are single-use)
- Verify server time with NTP
- Verify user device time is accurate
- Ensure user is viewing the correct account in authenticator
- Wait for code to refresh and try again
Lost Authenticator Device
Recovery Process:- User contacts administrator through verified channel
- Administrator verifies user identity
- User provides recovery code if available
- If no recovery code: Administrator resets 2FA after identity verification
- User re-enrolls with new device
Administrator Locked Out
Emergency Access: If all administrators are locked out of 2FA:- Access server via SSH/console
- Run emergency 2FA bypass command (documented in installation guide)
- Log in and reset 2FA for affected accounts
- Re-enroll administrators immediately
- Review security procedures to prevent recurrence
Compliance Considerations
2FA helps meet compliance requirements:- PCI DSS: Multi-factor authentication for administrative access
- HIPAA: Additional authentication for PHI access
- SOC 2: Strong authentication controls
- GDPR: Technical measures to ensure data security
Related Topics
- Authentication Configuration - Configure authentication methods
- User Management - Manage user accounts
- SAML SSO Configuration - Enterprise SSO with MFA integration
- Roles and Permissions - Configure access control