Two-factor

Meerkat's own second factor is TOTP: the six-digit code an authenticator app shows. Two other pieces sit around it - a code by e-mail for the day the authenticator is out of reach, and trusted browsers so the challenge is not asked on every sign-in.

The code, its e-mail fallback and trusted browsers are available in the community and Enterprise editions; approving on a phone is Enterprise.

Application > Security: the Two-factor card, with Require two-factor for everyone and Allow a one-time code by e-mail, above Sign in by e-mail and the session duration

Codes from an authenticator app

Standard TOTP, RFC 6238: 6 digits, a new code every 30 seconds, and the code before and the code after are accepted as well, so a phone whose clock is slightly off still works. The secret is 160 bits.

Enrolling is self-service, on /profile/mfa. The page shows a QR code - drawn by the gateway itself, with nothing fetched from anywhere - and the same secret in text for a key you type by hand. Nothing is switched on until you prove it works with a live code.

Enrolling, as a user

Prerequisite: an authenticator app on your phone (Google Authenticator, Microsoft Authenticator, 1Password, Bitwarden...).

  1. Signed in, open your profile (/profile), Security, then Two-factor authentication. The page is /profile/mfa.
  2. Set up two-factor shows a QR code. Scan it with the app, or type the Setup key shown under it by hand.
  3. Type the 6-digit code the app shows, and click Verify.
  4. Save your backup codes: ten codes, shown this once. Print them or keep them in a password manager, then click I've saved them, continue.

The profile's Two-factor authentication line now says On, and the next sign-in asks for a code after the password.

The QR code names your application, because the issuer it carries is the application name from Application > Built-in pages > Branding. Change that name and existing enrolments keep the old label: the issuer is baked into what the app already stored.

Backup codes. Enrolment ends with 10 single-use codes, shown once and never again. They read k7m2p-3xrqh, from an alphabet with no confusable characters. Only their hashes are kept, so a lost sheet cannot be recovered - it can only be replaced, from the same page, which mints ten new ones and retires the old. The page says how many are left.

Changing the factor asks for it. Replacing the authenticator, minting new backup codes and turning the second factor off each take a current code first - or a backup code, for whoever lost the phone - under the same per-account counter as the challenge. A session alone, a borrowed laptop or a stolen cookie, is not enough to point the factor at somebody else's phone.

Enrolling again, or turning the second factor off, forgets every trusted browser of that account. That is deliberate: the old challenge is gone, and so is anything that was allowed to skip it.

TOTP secrets are sealed in the database with the vault's master key, like vault secrets and TLS private keys: a database dump holds no secret anybody could compute codes from. See the master key.

A code by e-mail, as a fallback

Ships off. It is a way back in for someone who is already enrolled in TOTP and cannot reach their authenticator - not a second factor of its own. Nobody enrols in it, and an account without TOTP is never offered it.

The link only appears on the challenge page when all of this holds:

The code is 6 digits, valid for 10 minutes, single-use, and tied to the account - it is typed in the same box as the TOTP code. Asking again within 45 seconds shows the same "we sent it" page without sending a second mail. A successful sign-in wipes any code still pending.

With the switch off, the link is absent and the endpoint behind it answers 404.

Trusted browsers

Ships off, with a trust lasting 7 days when you turn it on (the console offers one day, seven, fourteen or thirty, in Application > Security).

After a successful challenge, the person may tick trust this browser. The next sign-in from it skips the code.

The trust is a random token in a cookie, not a fingerprint of the machine. Nothing about the browser, the address or the device is compared on the way back in. The name you see in the profile - Chrome - macOS - is a label read off the user agent for your benefit; it is never checked. Whoever holds the cookie skips the challenge, which is why the duration is worth keeping short.

Only the hash of the token is stored. The person sees their trusted browsers on /profile/mfa (profile, Security, Two-factor authentication), under Trusted browsers: the one they are on is marked, and they revoke them one at a time or with Revoke all trusted browsers. Turning the setting off restores the challenge for everyone immediately - the policy is re-read on every sign-in.

Who has to use a second factor

Two levels, and that is all there is:

Level Where Values
The installation Application > Security, Require two-factor for everyone on or off, ships off
One account Application > Users, in the account's editor Inherited, Required, Optional

The account's own setting wins; otherwise the installation's answers. Optional on an account exempts it even when the installation requires it.

Someone for whom the second factor is required and who has none is sent through enrolment at their next sign-in, before they reach anything, and cannot turn it off afterwards - the self-service disable answers 403 and says why.

There is deliberately no per-tenant level: the second factor is asked before the tenant is known, so a rule per tenant could not be read in time. There is no per-role level either, for the same reason.

An authority can waive the challenge for people arriving through it: the box Exempt from Meerkat's two-factor on an OIDC, SAML, directory or GitHub authority, ticked on a new one. Unticked, Meerkat's rules above apply to those people as to anybody else. To make Meerkat ask its own code of everybody who comes through GitHub, for instance, require two-factor for everyone and leave that authority unticked. See OpenID Connect for what the box does and does not do.

Require two-factor for everyone

Do the safety step first: a person who loses their phone needs a way back in, and an administrator cannot reset a second factor (below).

  1. Configure a mail relay in Infra > Mail relay, and send its test mail.
  2. In Application > Security, card Two-factor, turn on Allow a one-time code by e-mail.
  3. In the same card, turn on Require two-factor for everyone.
  4. Exempt the accounts that must not be asked, if any: Application > Users, the account, Security, Two-factor set to Optional.

At their next sign-in, everybody who has no second factor yet lands on /totp-enroll after their password: the same QR code and backup codes as on the profile, before they reach anything. Sessions already open are not interrupted. People arriving through an authority with Exempt from Meerkat's two-factor ticked are not asked (see above).

Approving on a phone

Enterprise edition. Beside the code, a sign-in can be approved on the phone paired with the account through the Meerkat app: the sign-in page shows two digits, the app asks for them, and the phone's biometrics sign the answer. It counts as the second factor. Application > Security, Allow approving sign-ins on a paired phone, then each person turns it on in the app, on a phone already paired (Pair it).

The sign-in page after the password, for an account whose phone approves its sign-ins: Approve on your phone, with the two digits the app asks for

Not me, pressed on the phone, refuses the sign-in and mails the account. Three refusals in a row pause the approval for a quarter of an hour; the code stays open meanwhile. What the person sees on the phone is on Using the Meerkat app.

Turning it off - the switch, or the mobile app altogether - does not leave anybody on their password alone. An account whose only second factor was the phone is sent to set up an authenticator app at its next sign-in, whether two-factor is required for it or not, and is told so by mail when a relay is configured. Its phones keep their approval key: turning the approval back on gives them back as they were.

The one gap worth planning around

An administrator cannot reset, clear or disable somebody's second factor. There is no such endpoint and no such screen: the enrolment belongs to the account, and the admin API never touches those columns.

So a person who loses their authenticator and their backup codes, on an installation where the e-mail fallback is off, has no way back into that account. The ways back in are, in this order: a backup code, the code by e-mail, or - if the second factor is not required for them - turning it off themselves. Failing all three, what remains is deleting the account and making another.

Turning on the e-mail fallback is the cheapest insurance against that call.