Vaultwarden in the home lab: a self-hosted password manager, set up safely
Every other service in a home lab holds something replaceable. The password manager holds the keys to everything else, banking, email, the registrar account the lab's domain lives on. Self-hosting it with Vaultwarden, the community server that works with the official Bitwarden clients, is a reasonable and popular choice. It is also the one install where the default settings are not a safe resting place: a fresh instance lets anyone who can reach it create an account, and most setup guides race to make it reachable from the whole internet before they lock that door. This guide works in the safer order, reachability decided first, lockdown as one verified sequence, and a backup that is only called a backup after it has been restored.
Disclaimer: this is general educational information about securing a self-hosted service, not professional security advice. A password manager concentrates risk by design. If the duties in this guide, updates, backups, restores, do not fit the time you actually have, the hosted alternative discussed at the end is the responsible choice, not a failure.
Decide first: who can reach it?
Vaultwarden must be served over HTTPS, the clients rely on a secure context, and a vault should never travel over plain HTTP. HTTPS, though, says nothing about who may knock. Three postures cover the honest options:
| Posture | Trade-off |
|---|---|
| LAN-only, behind a reverse proxy | Smallest attack surface. Phones sync at home; away from home they use their encrypted local copy until they return or connect by VPN. |
| VPN-only | Reachable from anywhere your tunnel reaches, still invisible to internet scanning. Every accessing device must run the VPN. |
| Public HTTPS | Convenient for shared family vaults and new-device enrolment anywhere. The login page faces constant automated attention, so the lockdown sequence below and prompt updates stop being optional. |
For a single-household lab, the first two rows cover nearly every real need. Choose public only for a named reason, usually other people whose devices you do not control, and treat that choice as signing up for the maintenance that follows.
Setup, step by step
- Place it behind the proxy, bound locally. A
documented hardened Compose setup binds Vaultwarden itself to
127.0.0.1:8080:80so the only network path in is through the reverse proxy, setsDOMAINto the fullhttps://address clients will use, and enablesWEBSOCKET_ENABLEDfor live-sync notifications. Its data lives in a single data folder (the/datavolume), remember that folder; the backup section is about nothing else. - Start it and create exactly the accounts you need. Registration starts open by default, which the first-run moment relies on: create your own account, plus any household accounts, now, the next section closes the door behind you.
- Set a strong master password and two-factor authentication on every account, immediately. Self-hosting changes who runs the server; it does not change the basics. Use an authenticator on a separate device for the second factor, for the obvious reason: a code stored inside the vault cannot help you log into the vault.
- Point the clients at your server. In each official
Bitwarden app or extension, choose the self-hosted option and enter
your
DOMAINaddress before signing in. Confirm each device shows your items, not an empty cloud account of the same email.
The lockdown sequence
Do these three, in this order, before the service is considered live:
- Hash the admin token, or do not enable the admin page at
all. The admin page at
/adminis enabled by setting anADMIN_TOKEN. Store it as an argon2id PHC string rather than readable plain text, generated with the built-in commanddocker run --rm -it vaultwarden/server /vaultwarden hash(the same generator runs viadocker execon a live container). Two traps are documented: the admin page accepts the original passphrase you hashed, not the PHC string; and because the string contains$characters that Compose interpolates, passing it through anenv_fileavoids the escaping pitfall. Prefer no admin page? Leaving the token unset disables it, configuration then happens by environment variable and restart. - Disable signups, then prove it. Set
SIGNUPS_ALLOWEDtofalse(or uncheck Allow new signups under the admin page's General Settings) and recreate the container. The verification is part of the step: in a private browser window, attempt to create an account and confirm it is refused. - Decide how new users get in from here. With signups closed, adding a person later is a deliberate act: briefly re-enabling signups while they register, or inviting them if you have configured mail delivery. Write down which route your household uses, so a future lockout is a procedure, not a surprise discovered at the worst moment.
Backup: the whole data folder, proven by a restore
The data folder is the vault. Its restore-critical contents are a
set, not a single file: db.sqlite3 (the vault database,
including two-factor seeds), the attachments/ and
sends/ folders, config.json if the admin page
has written one, and the rsa_key.pem / rsa_key.pub.pem
signing keys, lose the keys and every client session breaks on restore.
Back the set up as one unit, and handle the database correctly inside
it: SQLite's own .backup command produces a consistent hot
snapshot that copes with write-ahead logging while Vaultwarden is
running; a plain file copy of a live database is not the same thing, and
before restoring from a .backup file, remove any stale
db.sqlite3-wal so it cannot corrupt the restored database.
Encrypt the backup if it contains configuration such as an admin token,
and copy it off the server, a backup stored beside the original is a
second copy of the same accident, not protection from it.
Then do the part most guides omit: restore it. On a spare machine or
throwaway container, lay the backed-up data folder down, start
Vaultwarden against it, and sign in. One successful sign-in against
restored data converts the backup from a hope into a procedure, and it
takes minutes. Repeat the drill after any major update. Keep updates
themselves routine, docker compose pull then
docker compose up -d, and read release notes before major
version jumps, because this is the one container where "update later"
quietly becomes the vulnerability.
What success looks like
Five checks: the vault loads over HTTPS at its domain with no warning; a private-window registration attempt is refused; the admin page, if enabled, opens only with the original passphrase and its stored token is a PHC hash, not plain text; every account shows two-factor enabled; and a restored copy on separate hardware signs in and displays your items. All five, not four out of five, each one corresponds to a real way this service fails its owner.
When not to self-host your passwords
The hosted Bitwarden service runs the same clients against infrastructure maintained by people whose whole job is its uptime and patching. If restores will not get tested, updates will slide for months, or the vault must work for family members who cannot use a VPN, hosting is the safer engineering decision. Self-hosting buys control and removes a subscription; it charges ongoing attention. Pay the right currency on purpose.
FAQ
Lost the admin passphrase, is the vault gone? No:
the admin token guards the admin page, not the vault contents. Removing
rsa_key.pem from the data folder and restarting invalidates
sessions and forces fresh sign-ins; account access still rests on each
user's master password.
Can the admin page be switched off later? Yes.
Remove the token from the configuration (and any
admin_token entry in config.json), recreate
the container, and the page is disabled; configuration then happens by
environment variable and restart.
Is Fail2Ban required? It is a sensible layer when the vault is publicly reachable, banning addresses after repeated failed logins. On a LAN- or VPN-only instance the knocking it would police largely does not exist, one more dividend of the reachability decision.