Two-Factor Authentication#
Znuny can ask for a six-digit code from an authenticator app in addition to the password. This uses Time-based One-Time Passwords (TOTP). Any app that follows RFC 6238 works, for example:
Google Authenticator
Microsoft Authenticator
FreeOTP
Aegis
The module is called GoogleAuthenticator, but it is not tied to that app.
This page sets up two-factor authentication for agents in five steps. The same steps work for the customer interface, see Customer Interface.
All settings are in Admin -> System Configuration.
Before You Start#
Keep one admin account without two-factor authentication until you have tested everything, so a mistake cannot lock you out.
The server clock must be correct. Codes are time-based and change every 30 seconds. Check that NTP is running on the Znuny server.
Step 1: Enable the Two-Factor Module#
Navigate to Admin -> System Configuration and search for
AuthTwoFactorModule.Edit the setting
AuthTwoFactorModule.Keep the value
Kernel::System::Auth::TwoFactor::GoogleAuthenticator, tick Enabled and save.Deploy the change.
The agent login page now shows an additional field, 2 Factor Token.
Note
Do not change AuthTwoFactorModule::SecretPreferencesKey. Its default UserGoogleAuthenticatorSecretKey must match the preference used in step 2.
Step 2: Let Agents Enter Their Own Secret#
By default only an admin can store an agent’s secret. To let agents do it themselves in their personal preferences:
Search for
PreferencesGroups###GoogleAuthenticatorSecretKey.Change Active from
0to1and save.Deploy the change.
Agents now see a Google Authenticator box with a Shared Secret field under Personal Preferences -> User Profile.
If you skip this step, an admin enters the secret for each agent under Admin -> Agents -> (agent).
Step 4: Connect the Authenticator App, Then Save in Znuny#
The order matters. Set up the app first and save in Znuny last, so you can log in again afterwards.
Copy the secret from step 3.
In the authenticator app, choose Add account and then Enter a setup key (the wording varies by app).
Account name: anything, for example
Znuny (jdoe).Key: the 16-character secret.
Type: Time-based.
Check that the app now shows a six-digit code that changes every 30 seconds.
In Znuny, make sure the same secret is in Personal Preferences -> User Profile -> Shared Secret, and save.
Step 5: Test the Login#
Log out.
Log in with user name, password and the current code from the app in 2 Factor Token.
If the login fails, check the server time first, then check that the secret in the app and in Znuny are identical.
Make Two-Factor Authentication Mandatory#
As long as AuthTwoFactorModule::AllowEmptySecret is enabled (the default), agents without a secret log in with just their password. To require two-factor authentication for everyone:
Make sure every agent, including your admins, has a secret stored and has tested their login.
Search for
AuthTwoFactorModule::AllowEmptySecret, untick the checkbox, save and deploy.
Agents without a secret can no longer log in.
Other Settings#
AuthTwoFactorModule::AllowPreviousTokenEnabled by default. Also accepts the code from the previous 30 seconds, which helps users who need a little more time to type it. Untick it for slightly stricter security.
Lost Device#
If an agent loses their phone, an admin opens Admin -> Agents, selects the agent, clears the Shared Secret field and saves. If empty secrets are allowed, the agent can log in with the password again and repeat steps 3 and 4. If two-factor authentication is mandatory, the admin enters a new secret for the agent and hands it over securely.
Customer Interface#
Customer users work the same way. Use the settings with the Customer:: prefix:
Agents |
Customer users |
|---|---|
|
|
|
|
|
|
|
|
Once Active is set to 1, customer users find the Shared Secret field in the Miscellaneous section of their preferences in the customer interface.
Web Service Logins#
If you use the REST web service with sessions (SessionCreate), send the current code as TwoFactorToken together with the user name and password. See HTTP-Header Authentication.
See also