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.

!!! note As of v5.0.0, people can also sign in through your organization's identity provider (see Single Sign-On). A single sign-on sign-in skips DomainMOD's own MFA, so Require MFA for All Users applies to password sign-ins only.

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. As of v5.0.0, no link is sent to a user who can't sign in with a password, and a link already sent stops working if they can't by the time they use it (see Single Sign-On).

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. As of v5.0.0, it applies to password sign-ins only. Users with password sign-in who don't have MFA on are signed out, single sign-on sessions included, and after a password sign-in they can only change their password and set up MFA until they've set it up. A sign-in through the provider skips DomainMOD's MFA, so they can still sign in that way without setting it up, and users without password sign-in aren't affected at all. Make sure your provider requires MFA (see Single Sign-On).

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 password sign-in (or under Settings if MFA isn't required). A user without password sign-in doesn't use DomainMOD's MFA, so if they lose their authenticator, reset it at your identity provider instead. 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 an MFA key: $secret_key in /_includes/config.inc.php (Docker installs use the DOMAINMOD_SECRET_KEY variable), set to a long random value. Administration -> MFA Key shows whether a key is set, its key ID, and how many users' secrets it can't read. While no key is set, it suggests one to administrators who aren't read-only, and so does the installer's last step. The installer suggests one only for a database with no MFA secrets yet, and the MFA Key page only when no secret is encrypted with a key that isn't set. Both show a key only over HTTPS. Otherwise, they give a command that makes one on your server (openssl rand -hex 32). Set the key once, ideally when you install, before anyone turns on MFA or saves a credential. As of v5.0.0, it can be changed without locking anyone out, as long as the old key is kept as the previous key for a while (see Changing the Key). Secrets saved before the key was set are encrypted the next time each user enters a correct code from their authenticator app, at sign-in or on the Security page.

The key isn't in DomainMOD's backups, so store it safely, apart from them, labelled with its key ID, and note which key each backup you keep needs. Use the same key when you move or restore your installation. If it's lost, users whose MFA secrets it encrypted need a recovery code or an administrator's reset to sign in, and the saved credentials it encrypted have to be entered again. The MFA Key page shows how many users' secrets the key can't read, and the Dashboard warns when values are encrypted and no key is set. DomainMOD reads with the current key and the previous one, so if your data holds secrets from more keys than that, the users whose secrets neither key opens need a recovery code or a reset.

Behind a reverse proxy: Remember This Device and the suggested MFA key count a request as HTTPS when your proxy sends X-Forwarded-Proto: https and the Full DomainMOD URL in Administration -> System Settings is an https address. The proxy has to set that header itself, replacing any value it's sent, and DomainMOD's own plain HTTP port should only be reachable by the proxy. The installer has no Full DomainMOD URL yet, so behind a proxy it gives the command instead of a key.

Encrypting Saved Credentials

As of v5.0.0, the MFA key also encrypts every credential you save: registrar and SSL provider account passwords, registrar API keys, API secrets, and account IDs, the Data Warehouse servers' API tokens and remote access keys, the SMTP password, and the single sign-on client secret. Usernames, email addresses, reseller IDs, and API app names aren't secrets on their own, so they're stored as they are.

Setting a key: With a key set, each credential is encrypted when it's saved. The upgrade to v5.0.0 encrypts the ones already saved if a key is set at the time. If you set one later, the System Cleanup task encrypts them once a day, or you can run Administration -> Cleanup -> Encrypt Saved Credentials right away. Without a key, credentials are stored as before, and the Dashboard suggests setting one. Once anything is encrypted, DomainMOD refuses to save a credential or set up a user's MFA while the key is missing (such as after a Docker redeployment that left out DOMAINMOD_SECRET_KEY), rather than storing it unencrypted, and the Dashboard says to put that key back. Users who have to set up MFA to sign in can't finish until it's back. Don't make a new key then, since it won't open the saved values, unless the original key is lost for good: then set a new one, enter the saved credentials again, and users whose MFA secrets it can't read need a recovery code or an administrator's reset.

Values that can't be read: A saved value the key can't read, such as after restoring a backup from an installation with a different key, has a line under its field on its edit page saying it can't be read with this installation's key. Enter it again or remove it. Until then, the Domain Queue marks that account's domains as failed instead of retrying them, a refresh uses public RDAP and WHOIS data, the Data Warehouse isn't rebuilt, and email isn't sent through an SMTP server that needs a password. Administration -> MFA Key counts the values each key opens, the ones no configured key opens (with the key ID they need), and the ones that aren't encrypted.

Changing the key: Put the old key in $previous_secret_key (DOMAINMOD_PREVIOUS_SECRET_KEY for Docker) and the new one in $secret_key. If a previous key is still set from an earlier change, wait until Administration -> MFA Key says it can come out (step 2 below) before you replace it, since values that still need it can't be read once it's gone. DomainMOD then reads values with either key, and new values are encrypted with the new one. To retire the old key:

  1. Restart the web server, and PHP-FPM if your server uses it (or recreate the container on Docker), wait until Administration -> Task Scheduler shows no task still running from before the change, and run Encrypt Saved Credentials.
  2. Check that Administration -> MFA Key shows no value on the previous key and none that's unreadable or damaged. It then says the previous key can come out of the configuration.
  3. Take a new backup, then remove the previous key from the configuration, and restart again (or recreate the container).

Backups taken before the change still need the old key, and so do backups taken after it until step 1 has finished. Keep a copy of each old key, labelled with its key ID, with the record of the backups that use it, but not in the same place as the backups, and discard it only once the last of those backups is deleted.

Use This Key Again: DomainMOD records the ID of each key it has used, never the key itself, and never goes back to an older key on its own, so a process still running with the old key can't take over again. To go back to a key this installation used before on purpose, set it and run Administration -> Cleanup -> Use This Key Again.

Stop Encrypting: To stop using the key, run Administration -> Cleanup -> Stop Encrypting while the key is still set. It stores every saved credential and MFA secret without encryption again, and then the key can be removed. If any can't be read, or have characters (such as emoji) that can't be stored without encryption, it changes nothing and lists them. Keep the key until Stop Encrypting reports that encryption was stopped. While the key is still set, Use This Key Again turns encryption back on for new values, and Encrypt Saved Credentials encrypts the saved ones again.

What DomainMOD Sends

Your portfolio stays in your own self-hosted database. DomainMOD only contacts an outside service when a feature needs it, and this list covers each one.

  • Your registrars' APIs: when DomainMOD supports a registrar's API and the registrar account has its API details filled in, the Domain Queue, the Refresh button, and the Refresh Domains task send that account's credentials to the registrar's API, to list the account's domains or to look up each domain by name.
  • RDAP and WHOIS: for domains without an API, the same features send each domain name to its registry's RDAP server (and to the registrar's RDAP server when the registry's record links to it), or to its WHOIS server when the TLD has no RDAP server. A refresh does the same when the registrar's API doesn't return a domain's details, and the Check Watch List task and each watched domain's Check Now button use RDAP and WHOIS for every lookup they make, since the Watch List only uses public data. When the Refresh button or the Refresh Domains task uses a registrar's API, it also sends the domain name to its registry's RDAP server (and to the registrar's RDAP server when the registry's record has no statuses and links to it), to read the domain's statuses, such as its transfer lock. To find those servers, DomainMOD downloads IANA's list of RDAP servers about once a week, and asks IANA's root zone database for a TLD's WHOIS server, sending only the TLD.
  • Live DNS: at the end of a refresh, DomainMOD looks up each domain's name servers, addresses, and mail servers, and when the Domain Queue adds a domain, it looks up the domain's IP address and that address's reverse DNS name, all through your server's own DNS resolver.
  • SSL certificates: the SSL Queue, the Domain Queue's SSL certificate import, each certificate's Refresh button, and the Refresh SSL Certificates and Find Missing SSL Certificates tasks look up each site's address through your server's own DNS resolver, connect to it on port 443, giving its hostname in the TLS handshake as a browser does, and read the certificate it serves. Nothing else is sent.
  • Currency rates: the Update Conversion Rates task, and any page that needs a rate it doesn't have yet, fetch exchange rates from the Free Currency Rates API through cdn.jsdelivr.net, sending only the currency code.
  • New versions: the Check For New Version task, each sign-in while that task is on, and the Check Now button on Administration -> Upgrade read DomainMOD's version.txt file from GitHub (raw.githubusercontent.com). Nothing else is sent. As of v5.0.0, turning the task off stops the sign-in check too. With the task off, DomainMOD checks GitHub for a new version only when you press Check Now or run the task yourself with Run Now in Administration -> Task Scheduler.
  • Installation and upgrade notices: after an installation or upgrade, the next sign-in tells domainmod.org, sending only the event, the version (the old and new ones for an upgrade), and the installation type (such as Docker). DomainMOD deletes its own record of each notice just before sending it, and doesn't send it again if domainmod.org can't be reached. The v5.0.0 upgrade also deletes the records earlier versions kept after sending, and removes the IP address, user agent, and language from any still waiting to be sent. For each notice, domainmod.org keeps the event, the versions, the installation type, and when it recorded the notice, but no IP address. To limit floods of fake notices, it also adds a scrambled network tag, made with a key that changes daily, and normally deletes the tag within about three hours (later only if the hourly cleanup fails). Separately, it counts notices per country, worked out from the connection, with nothing else stored alongside the count.
  • Email: expiration emails (which list your upcoming renewals), password resets, and MFA notices go through the SMTP server set in Administration -> System Settings, or through your server's own mail system when none is set.
  • Single sign-on: as of v5.0.0, while it's set up (see Single Sign-On), DomainMOD fetches your identity provider's discovery document and signing keys, sends people there to sign in, and sends the provider's token endpoint the sign-in's code, its PKCE verifier, the Redirect URI, and DomainMOD's client ID and secret. Test on Administration -> Single Sign-On fetches the discovery document and keys too, even before single sign-on is saved. With Also Sign Out of Okta (with your provider's name) on, clicking Logout in a single sign-on session sends the user's browser to the provider's sign-out address, when it has one, with their ID token and the sign-out return address.
  • Data Warehouse: each build connects to the WHM servers you've added, using the credentials you saved for them, and reads their accounts, DNS zones, and records.
  • Remote IP Address: on Administration -> System Information, clicking Look up asks ipify (api.ipify.org) for your server's public IP address. It's never looked up otherwise.

As of v5.0.0, Refresh Domains and Refresh SSL Certificates are on by default in new installations, and the upgrade to v5.0.0 turns on Refresh SSL Certificates as well. Find Missing SSL Certificates stays off until you turn it on. You can turn off any task in Administration -> Task Scheduler.

There aren't any published security advisories