🚨 Emergency Account Recovery¶
📋 Overview¶
This guide provides detailed instructions for recovering access to the Mail Archiver application when you've forgotten the administrator password. This emergency procedure allows you to regain access to your system without losing any data.
📝 Version Requirement: This recovery method is available in Mail Archiver version 2601.1 and later.
⚠️ Important Security Notice¶
This recovery method should only be used in emergency situations when you cannot access your administrator account. It requires temporary modification of your application configuration and should be reversed immediately after password recovery.
🛠️ Recovery Steps¶
1. Create Emergency Administrator Account¶
Modify your appsettings.json or Docker environment variables to create a temporary emergency administrator account:
For Docker Compose (Recommended):
services:
mailarchive-app:
image: s1t5/mailarchiver:latest
environment:
# Emergency admin account
- Authentication__Username=emergency_admin
- Authentication__Password=TempPass123!
# ... other settings remain unchanged
For direct appsettings.json modification:
{
"Authentication": {
"Username": "emergency_admin",
"Password": "TempPass123!",
// ... other settings remain unchanged
}
}
2. Restart the Application/Container¶
After modifying the configuration, restart your application:
For Docker Compose:
For direct application:
3. Login with Emergency Account¶
- Access the Mail Archiver web interface
- Login using the emergency credentials:
- Username:
emergency_admin(or whatever you set) - Password:
TempPass123!(or whatever you set)
4. Reset Original Administrator Password¶
- Navigate to the "Users" section from the main menu
- Find your original administrator account in the user list
- Click "Edit" for that user
- Change the password to a new secure password
- Click "Save Changes"
5. Restore Original Configuration¶
Revert your configuration changes back to the original administrator username:
For Docker Compose:
services:
mailarchive-app:
image: s1t5/mailarchiver:latest
environment:
# Original admin account
- Authentication__Username=admin
- Authentication__Password=YourNewSecurePassword
# ... other settings
For direct appsettings.json:
{
"Authentication": {
"Username": "admin",
"Password": "YourNewSecurePassword",
// ... other settings
}
}
6. Restart Application Again¶
Restart the application with the restored configuration:
For Docker Compose:
🎯 Example: Complete Docker Compose Recovery Process¶
Here's a complete example of the emergency recovery process using Docker Compose:
Step 1: Emergency Configuration¶
version: '3.8'
services:
mailarchive-app:
image: s1t5/mailarchiver:latest
restart: always
environment:
# Database Connection
- ConnectionStrings__DefaultConnection=Host=postgres;Database=MailArchiver;Username=mailuser;Password=your_secure_password;
# EMERGENCY ADMIN ACCOUNT
- Authentication__Username=emergency_admin
- Authentication__Password=TempEmergencyPass2026!
# Other settings remain unchanged...
- MailSync__IntervalMinutes=15
- TimeZone__DisplayTimeZoneId=Europe/Berlin
# ... rest of configuration
ports:
- "5000:5000"
networks:
- postgres
volumes:
- ./data-protection-keys:/app/DataProtection-Keys
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:17-alpine
# ... postgres configuration unchanged
Step 2: Restart and Login¶
docker compose down
docker compose up -d
# Wait for application to start, then login with emergency_admin/TempEmergencyPass2026!
Step 3: Reset Original Password¶
- Login to web interface with emergency credentials
- Go to Users section
- Edit original admin user and set new password
- Save changes
Step 4: Restore Normal Configuration¶
version: '3.8'
services:
mailarchive-app:
image: s1t5/mailarchiver:latest
restart: always
environment:
# Database Connection
- ConnectionStrings__DefaultConnection=Host=postgres;Database=MailArchiver;Username=mailuser;Password=your_secure_password;
# RESTORED ORIGINAL ADMIN ACCOUNT
- Authentication__Username=admin
- Authentication__Password=YourNewSecurePassword2026!
# ... rest of configuration unchanged
ports:
- "5000:5000"
networks:
- postgres
volumes:
- ./data-protection-keys:/app/DataProtection-Keys
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:17-alpine
# ... postgres configuration unchanged
Step 5: Final Restart¶
🔑 Lost Credential Encryption Key¶
If Security__CredentialEncryptionKey (credential encryption at rest) is lost, the stored
mail account credentials can no longer be decrypted. The application does not crash: the
affected values are treated as "no credential" and a warning is logged. To recover:
- Restore the key from your backup / secret manager and restart the application. The credentials work again immediately, no data changes are required.
- If the key is permanently lost, the encrypted credentials cannot be recovered. Affected accounts are easy to identify: their synchronization fails and a decryption warning is written to the application log (and shows up as a sync issue in the UI).
- Open each affected account under Mail Accounts → Edit and re-enter its credentials: the IMAP password, the M365 client secret, or re-authorize the account (MSA). Saving the form re-encrypts the credential with the now-configured key — no manual database changes are necessary.
💡 The key is never stored in the database, so database backups alone are not sufficient — always back up the key separately.
🔒 Security Best Practices¶
- Use Strong Temporary Passwords: Make your emergency password complex and unique
- Change It Immediately: Reset the emergency password as soon as you regain access