Enable Two-Factor Authentication for an Antares User¶
This guide describes how to enable TOTP-based two-factor authentication (2FA) for an Antares user.
The examples use the OpenStack CLI and the Antares cloud profile:
The configured authentication rule is:
This means the user must authenticate using both:
- Their Antares password
- A time-based one-time password (TOTP) generated by an authenticator application
Examples of compatible authenticator applications include:
- FreeOTP
- Google Authenticator
- Microsoft Authenticator
- 1Password
- Bitwarden
Prerequisites¶
Verify that the OpenStack CLI is installed:
Verify access to Antares:
Administrative permissions are required to modify another user's 2FA configuration.
Official OpenStack documentation:
1. Find the Antares User¶
List the available users:
Example:
+----------------------------------+---------------------+
| ID | Name |
+----------------------------------+---------------------+
| 5d074c4566ef461697293877f78c0198 | example-user |
+----------------------------------+---------------------+
If the username is already known, query the user directly:
To return only the user ID:
Example result:
Store the user ID for the following steps:
Official OpenStack documentation:
2. Create a TOTP Secret¶
The Antares user requires a shared TOTP secret.
The secret must be Base32 encoded and should contain sufficient random entropy.
A secret can be generated with Python:
python3 -c 'import base64,secrets; print(base64.b32encode(secrets.token_bytes(20)).decode().rstrip("="))'
Example result:
Store the generated secret:
Treat the TOTP secret like a password. Anyone with this secret can generate valid one-time passwords for the user.
Official OpenStack documentation:
3. Create the TOTP Credential¶
Create a TOTP credential for the Antares user:
Using the example user ID directly:
openstack credential create \
--type totp \
5d074c4566ef461697293877f78c0198 \
"$TOTP_SECRET" \
--os-cloud=antares
The command creates a credential of type:
Verify that the credential exists:
Example:
+----------------------------------+----------------------------------+------+---------+
| ID | User ID | Type | Project |
+----------------------------------+----------------------------------+------+---------+
| aabbccddeeff00112233445566778899 | 5d074c4566ef461697293877f78c0198 | totp | None |
+----------------------------------+----------------------------------+------+---------+
Official OpenStack documentation:
4. Add the TOTP Secret to an Authenticator¶
The user must now add the generated secret to an authenticator application.
Use the following values:
For example:
Most authenticator applications allow the secret to be entered manually.
The authenticator will then generate a six-digit one-time password that changes periodically.
Do not enable mandatory 2FA until the user has successfully added the TOTP secret to their authenticator.
Official OpenStack documentation:
5. Enable Two-Factor Authentication¶
Enable multi-factor authentication for the Antares user:
openstack user set \
--enable-multi-factor-auth \
--multi-factor-auth-rule 'password,totp' \
"$USER_ID" \
--os-cloud=antares
Using the example user ID:
openstack user set \
--enable-multi-factor-auth \
--multi-factor-auth-rule 'password,totp' \
5d074c4566ef461697293877f78c0198 \
--os-cloud=antares
The configured rule requires both authentication methods:
The Antares user must now provide both their password and a valid TOTP code when authenticating through an authentication flow that requires this MFA rule.
Official OpenStack documentation:
6. Verify the 2FA Configuration¶
Display the Antares user:
The user should show multi-factor authentication as enabled and contain a rule equivalent to:
For example:
The exact output formatting may depend on the installed OpenStackClient version.
Also verify that the user has a TOTP credential:
Official OpenStack documentation:
7. Authenticate with Password and TOTP¶
For CLI authentication using password and TOTP, the OpenStackClient supports the v3multifactor authentication plugin.
The authentication methods are:
A suitable clouds.yaml entry can look like:
clouds:
antares-mfa:
auth:
auth_url: https://<identity-endpoint>/v3
username: example-user
password: <PASSWORD>
project_name: <PROJECT>
user_domain_name: <DOMAIN>
project_domain_name: <DOMAIN>
auth_type: v3multifactor
auth_methods:
- v3password
- v3totp
The current TOTP passcode can be supplied using:
Test the Antares authentication:
TOTP codes are short-lived. Always use the currently displayed code from the user's authenticator application.
Avoid storing passwords or TOTP codes permanently in configuration files or shell scripts.
Official OpenStack documentation:
8. List a User's TOTP Credentials¶
To list the configured TOTP credentials for an Antares user:
Example:
+----------------------------------+----------------------------------+------+---------+
| ID | User ID | Type | Project |
+----------------------------------+----------------------------------+------+---------+
| aabbccddeeff00112233445566778899 | 5d074c4566ef461697293877f78c0198 | totp | None |
+----------------------------------+----------------------------------+------+---------+
The credential ID is required if the TOTP credential needs to be deleted later.
Official OpenStack documentation:
9. Replace a Lost TOTP Device¶
If the user loses access to their authenticator, first identify the existing TOTP credential:
Delete the old credential:
Generate a new TOTP secret:
TOTP_SECRET=$(python3 -c 'import base64,secrets; print(base64.b32encode(secrets.token_bytes(20)).decode().rstrip("="))')
Create a new credential:
The user must then add the new secret to their authenticator application.
The old TOTP secret should no longer be used after the credential has been replaced.
Official OpenStack documentation:
10. Disable Two-Factor Authentication¶
To disable multi-factor authentication for an Antares user:
Using the example user ID:
openstack user set \
--disable-multi-factor-auth \
5d074c4566ef461697293877f78c0198 \
--os-cloud=antares
Disabling 2FA does not necessarily remove the stored TOTP credential.
If the credential should also be removed, list it:
Delete the credential:
Verify the user configuration:
Official OpenStack documentation:
11. Login Problems and Support¶
If the user cannot log in to Antares after enabling two-factor authentication, first verify:
- The correct Antares username and password are being used.
- The TOTP code is the current code displayed by the authenticator application.
- The date and time on the device running the authenticator application are correct.
- The TOTP credential has been created for the correct Antares user.
- Multi-factor authentication is enabled for the correct Antares user.
- The configured MFA rule is
password,totp.
An administrator can verify the Antares user's MFA configuration:
The user should have MFA enabled with a rule equivalent to:
Verify that a TOTP credential exists:
If the user has lost access to their authenticator application, the TOTP credential may need to be replaced as described in the previous section.
Antares Support¶
If the problem cannot be resolved, please use our help and support page:
When opening a support request, please provide:
- Your Antares username
- Your Antares project name, if applicable
- A short description of the problem
- The exact error message
- Whether the problem started before or after enabling 2FA
Never include your password, TOTP secret, current TOTP code, access credentials, or other secrets in a support request.
Official OpenStack documentation:
Quick Reference¶
1. Find the Antares User ID¶
Check the result:
2. Generate a TOTP Secret¶
TOTP_SECRET=$(python3 -c 'import base64,secrets; print(base64.b32encode(secrets.token_bytes(20)).decode().rstrip("="))')
Display the secret:
3. Create the TOTP Credential¶
4. Configure the Authenticator¶
Add the generated secret to the user's authenticator application:
5. Enable 2FA¶
openstack user set \
--enable-multi-factor-auth \
--multi-factor-auth-rule 'password,totp' \
"$USER_ID" \
--os-cloud=antares
6. Verify¶
List the TOTP credential:
Recommended Procedure¶
The recommended order for enabling 2FA is:
Find the Antares user
|
v
Generate a TOTP secret
|
v
Create the TOTP credential
|
v
Configure the user's authenticator
|
v
Enable password + TOTP authentication
|
v
Verify the configuration
|
v
Test the Antares login
Do not enable mandatory
password,totpauthentication before the user has configured the TOTP secret. Otherwise, the user may be unable to authenticate to Antares.
Further Documentation¶
Official OpenStack documentation:
- Keystone Multi-Factor Authentication
- Keystone TOTP Authentication
- OpenStackClient Documentation
- OpenStackClient Authentication
- OpenStackClient Identity Commands
- OpenStackClient Credential Commands
Antares help and support: