Skip to content

Security: domainmod/userguide

Security

docs/security.md

As of v4.27.0, DomainMOD supports multi-factor authentication (MFA): after your password, you enter a six-digit code from an authenticator app on your phone, so someone who learns your password still can't sign in.

The Security Page

Navigate to Settings -> Security. You can also open it from the menu under your name in the top bar, which shows whether MFA is on for your account. The Security page replaces the old Change Password page. It's where you:

  • change your password (your current password is now required)
  • turn MFA on or off
  • see how many recovery codes you have left, and regenerate them
  • forget the devices you chose to remember

Turning On MFA

  1. On the Security page, click Turn On MFA. If you're asked for your password, enter it and click Continue.

  2. Scan the QR code with your authenticator app, or type the key into it, then enter the six-digit code it shows and click Turn On MFA.

  3. Save the ten recovery codes that are shown, using Copy or Download, somewhere safe such as a password manager. They aren't shown again.

  4. Click I've Saved These Codes.

From then on, DomainMOD asks for a code each time you sign in. When you reach DomainMOD over HTTPS, you can tick Remember This Device for 30 Days to skip the code on that device for 30 days. If you don't have your phone, click Use a Recovery Code. Each recovery code works once, and after signing in with one you can set up a new authenticator on the Security page.

!!! note The codes depend on the time, so your server's clock needs to be correct. If a code is refused during setup because the clock is a few minutes off, DomainMOD may say so.

Forgotten Passwords

On the sign-in page, click Forgot your password?, enter your username or email address, and click Reset Password. As of v4.24.0, DomainMOD emails you a link that works once and expires after an hour. Open it and click Reset Password, and a new password is emailed to you.

For Administrators

Requiring MFA: In Administration -> System Settings, under Set Up MFA, turn on Require MFA for All Users, then click Update MFA Setting. You need MFA on for your own account first. Users who don't have it on are signed out, and until they set it up, they can only change their password and set up MFA.

Resetting a user's MFA: If a user loses their authenticator app and their recovery codes, open Administration -> Users, edit the user, tick Reset this user's MFA, and click Reset MFA. Their other sessions are signed out, and they set it up again at their next sign-in (or under Settings if MFA isn't required). Another administrator can't reset the account with the username admin, so keep its recovery codes especially safe. The Users list shows who has MFA on, and users are emailed when their MFA is turned on, turned off, or reset.

Encrypting MFA secrets: By default, each user's MFA secret is stored in the database without encryption, so a database backup includes it. To encrypt them, set $secret_key in /_includes/config.inc.php to a long random value (openssl rand -hex 32 or php -r 'echo bin2hex(random_bytes(32)), "\n";' makes one), ideally when you install, before anyone turns on MFA, as described in config.SAMPLE.inc.php (Docker installs use the DOMAINMOD_SECRET_KEY variable). Secrets saved before the key was set are encrypted the next time each user signs in with a code from their authenticator app. The key isn't in DomainMOD's backups, so keep it safe and use the same value when you move or restore your installation. If it's lost or changed, users with MFA on need a recovery code or an administrator's reset to sign in. Set Up MFA shows whether a key is set.

There aren't any published security advisories