Blog · Security

Mandatory 2FA and access review in virtualization environments

· updated · 2 min read · by

Originally written in Portuguese. Português

Dark cover with the title Mandatory 2FA and access review in virtualization and the command pveum user modify fulano@pve --enable 0

2 min read

The virtualization panel is the key to the entire infrastructure: whoever gets in can shut down, copy or delete any server. Even so, it is common to find these panels protected only by a password, sometimes shared among several people.

That is what we found in our own Proxmox VE environment. This is the step-by-step process we followed to require a second factor from everyone, without locking anyone out.

In short

  • Review the logs before changing anything. They show who accesses the panel, from where and with which user.
  • Set up TOTP and recovery keys on the administrative account first, with the keys stored off the server.
  • Temporarily disable anyone who does not have a second factor yet, keeping their permissions, and require 2FA on the realm.
  • Have the rollback command written down before you apply anything.

Start with the logs

Before changing any configuration, we reviewed the panel’s authentication logs. They show where each login came from and which user it used.

In that review we found administrative logins coming from machines nobody remembered, a sign that the main password had circulated more than it should have. From then on, changing the password was no longer optional.

Step by step

  1. Enable 2FA on the administrative account. In Proxmox VE, TOTP works with any authenticator app. Also generate the recovery keys, which are single-use, and store them off the server.
  2. List all users and check who already has a second factor configured.
  3. Temporarily disable anyone who does not have one yet. Their permissions stay saved, and the account comes back once the second factor is configured:
pveum user modify fulano@pve --enable 0
  1. Require the second factor on the realm. According to the Proxmox VE documentation, when a realm has TFA enabled, only users with a second factor configured can log in:
pveum realm modify pam --tfa type=oath
pveum realm modify pve --tfa type=oath
  1. Change the administrative password and keep the number of people who know it to a minimum.
  2. Document the rollback, in case someone ends up without access:
pveum realm modify pam --delete tfa

Least privilege

With the second factor in place, the next step is to give each person only the access they need: someone who manages one VM does not need to see the others. Proxmox VE supports this with per-resource and per-group permissions. That way, a compromised account causes limited damage.

It is also worth having more than one second factor per person (for example, TOTP and a WebAuthn security key), so that losing a phone does not turn into an emergency ticket.

References

Want a security review of your environment? Talk to us.