This guide explains how to use the
support_loginmanagement command, a secure feature intended for system administrators to gain temporary, one-time access to a user’s account for troubleshooting purposes.
Enabling the Feature
[!warning] This feature is disabled by default.
For security, you must explicitly enable this feature by setting the
ALLOW_SUPPORT_LOGINenvironment variable toTrue.You can set this in your
docker-compose.ymlfile for thespecify7service. You can also configure the token’s lifespan usingSUPPORT_LOGIN_TTL(default is 180 seconds).
# Example snippet for docker-compose.yml
services:
specify7:
image: specify/specify7:latest
environment:
- ALLOW_SUPPORT_LOGIN=True
- SUPPORT_LOGIN_TTL=180 # Optional: Time in seconds token is valid (default: 180)
# ... other settings
How to Generate a Login Token
Follow these steps from a terminal on the host machine running your Docker instance.
-
Enter the Specify 7 container:
docker exec -it specify7 /bin/bash -
Run the management command:
Inside the container’s shell, run thesupport_logincommand, replacingtarget_usernamewith the username of the account you need to access.ve/bin/python manage.py support_login --username target_username -
Copy the token URL:
The command will output a one-time-use URL. The token is only valid for the duration specified bySUPPORT_LOGIN_TTL.Example Output:
specify@2384d44b795e:/opt/specify7$ ve/bin/python manage.py support_login --username sp7demofish The following token is valid for 180 seconds: /accounts/support_login/?token=1-1757106120-7394fa7d5ffc6f87fe8306d25c5b2c71b3f98942d9f9c46aea97f3eda725434b -
Use the login link:
Append the generated path (e.g.,/accounts/support_login/?token=...) to your instance’s base URL and paste the complete URL into your browser to log in as that user.Example:
https://my-specify-instance.org/accounts/support_login/?token=...
Administrator Best Practices
[!danger] Important Security Recommendations
This feature is powerful. To maintain a secure instance, you must follow these security practices.
- Change the
SECRET_KEY: Never use the defaultSECRET_KEY. Change it to a randomly generated, cryptographically secure value upon installation and rotate it periodically.- Secure the Docker Network: Ensure no unnecessary ports are exposed from your Docker containers to the host machine or the wider internet. Specifically, the Redis container should only be accessible to other containers within the Docker network (like
specify7), not to the outside world.- Keep
SUPPORT_LOGIN_TTLSmall: The default of180seconds (3 minutes) is recommended. A shorter time reduces the window for an attacker to intercept and use a generated token.- Monitor Logs: Regularly review your instance, database, and Redis logs for unauthorized access attempts or suspicious activity.
Security & Technical Details
[!info] How it Works (Technical Deep Dive)
This feature uses Redis and JWT (JSON Web Tokens) with AES-GCM encryption to ensure a secure, one-time login.
1. Redis Cache
The system uses the internal Redis cache to temporarily store a cryptographic “salt” and a verification key. This data is set to expire after theSUPPORT_LOGIN_TTLand is deleted immediately after the token is successfully used once. This makes the token truly single-use.2. Cryptography Workflow
Token Generation:
- The
support_logincommand generates two random 256-bit numbers (key_1andkey_2) and asalt.key_1and thesaltare stored together in the Redis cache.key_2and thesaltare hashed with the server’sSECRET_KEYto derive secure encryption and signing keys.- The current timestamp and target user’s details are encrypted (using AES-GCM).
- A JWT is created containing the encrypted data, nonce, and MAC tag.
- The final URL given to you contains the JWT and
key_2.Token Parsing:
- When you visit the URL, the backend receives the JWT and
key_2.- It uses
key_2to look up the correspondingkey_1andsaltfrom the Redis cache. (If not found, or if already used, the login fails).- Once fetched, the entry is deleted from Redis.
- The system re-derives the encryption/signing keys using the fetched
salt, the providedkey_2, and the server’sSECRET_KEY.- It verifies and decodes the JWT, decrypts the payload, and checks if the timestamp is still valid.
- If all checks pass, you are logged in as the target user.
This process ensures that an attacker would need to know the server’s
SECRET_KEY, have read/write access to the Redis cache, and intercept a valid token all within the shortSUPPORT_LOGIN_TTLwindow.