Two-Factor Authentication Setup¶
Guide to setting up 2FA (TOTP) for administrator accounts.
Overview¶
Two-factor authentication adds security by requiring: 1. Something you know - Password 2. Something you have - Phone with authenticator app
Supported: TOTP (Time-based One-Time Password) Compatible apps: Google Authenticator, Authy, Microsoft Authenticator, 1Password
Enabling 2FA¶
Via Web Interface¶
- Navigate: Profile → Security → Two-Factor Authentication
- Click "Enable 2FA"
- Scan QR code with authenticator app
- Enter test code from app (6 digits)
- Save backup codes (important!)
- Click "Activate"
2FA now required for all future logins.
Via Command Line (Admin)¶
Enable for user:
Displays: - QR code (ASCII art) - Secret key (manual entry) - Backup codes
User must scan QR code and verify.
Using 2FA¶
Login flow: 1. Enter email and password 2. Click "Login" 3. Enter 6-digit code from authenticator app 4. Click "Verify" 5. Access granted
Code refreshes every 30 seconds - use current code.
Backup Codes¶
Purpose: Access if phone lost/broken
When enabled: - 10 backup codes generated - Each code single-use - Save in secure location
Using backup code: 1. Login with email/password 2. Click "Use backup code" 3. Enter one backup code 4. Access granted 5. Code is consumed
Regenerate codes: Profile → Security → 2FA → Generate New Backup Codes
Disabling 2FA¶
Via web interface: 1. Profile → Security → 2FA 2. Click "Disable 2FA" 3. Enter current password 4. Enter current 2FA code 5. Confirm disable
Via CLI (admin emergency):
Security
Only disable 2FA in emergencies. Re-enable immediately after access restored.
Troubleshooting¶
Invalid Code¶
Common causes: 1. Time sync issue - Authenticator app and server must have accurate time - Check phone time settings - Enable auto-sync
- Old code
- Codes refresh every 30 seconds
-
Wait for new code
-
Wrong account
- Multiple accounts in authenticator?
- Verify correct account selected
Lost Phone¶
Use backup code: 1. Click "Use backup code" at login 2. Enter one of your backup codes
If no backup codes: - Contact another admin to disable your 2FA - Or use CLI access: sudo mb-2fa-disable --email user@example.com
Time Sync Issues¶
Verify server time:
Sync time:
Check phone time: - Settings → Date & Time - Enable "Automatic date & time"
Best Practices¶
Setup¶
- Use reputable authenticator app
- Google Authenticator
- Authy (with cloud backup)
- Microsoft Authenticator
-
1Password
-
Save backup codes securely
- Print and store in safe
- Password manager
-
Encrypted file
-
Label accounts clearly
- Add label in authenticator app
- Include "Mailborder - example.com"
Usage¶
- Enable for all admin accounts
- Require for super admins (mandatory)
- Test backup codes after setup
- Regenerate backup codes if used
Recovery¶
- Keep backup codes accessible
- Document recovery procedure
- Maintain list of admin contacts
- Have CLI access method
Enforcing 2FA¶
Require for all users:
Settings → Authentication → Two-Factor Authentication - Check "Require 2FA for all users" - Set grace period: 7 days
Users without 2FA: - Prompted to set up on next login - Cannot access system after grace period
Exceptions: - Service accounts (API keys instead) - Emergency break-glass account (document carefully)
CLI Commands¶
Enable:
Disable:
Verify code:
Generate backup codes:
List users with 2FA:
See Also¶
- Passkey Setup - Passwordless authentication
- Authentication - Auth configuration
- Users - User management
- Security Hardening