← Start of tutorial

WIUNIX ACADEMY

Self-host Vaultwarden with HTTPS, restricted admin access and consistent backups

Page 4 of 5. Review the earlier steps and prerequisites before continuing.

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

Rocky Linux 10.2Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment7 editable values
11

LET’S BUILD

Install without overwriting, then test HTTPS

The exclusive copy refuses an existing Nginx filename. The configuration test must succeed before reload. A failed test leaves the running configuration unchanged; inspect and correct only this new file. Never skip certificate validation to make curl pass.

The expanded configuration must name this exact file; a successful syntax check alone does not establish it was included. Start an inactive unit or reload an active one, and enable boot startup. A real reboot remains an acceptance task.

bash

Dedicated Vaultwarden VM

set -eu
sudo python3 - <<'PY'
import os,stat
from pathlib import Path
p=Path('/srv/academy-vaultwarden/config/nginx.conf')
assert stat.S_ISREG(p.lstat().st_mode) and p.stat().st_uid==0
fd=os.open('/etc/nginx/conf.d/academy_vaultwarden.conf',os.O_WRONLY|os.O_CREAT|os.O_EXCL|os.O_NOFOLLOW,0o644)
with os.fdopen(fd,'wb') as f: f.write(p.read_bytes())
os.chmod('/etc/nginx/conf.d/academy_vaultwarden.conf',0o644)
PY
sudo nginx -t
sudo nginx -T 2>&1 | grep -F 'configuration file /etc/nginx/conf.d/academy_vaultwarden.conf:'
sudo systemctl enable nginx
if sudo systemctl is-active --quiet nginx; then sudo systemctl reload nginx; else sudo systemctl start nginx; fi
curl --fail --silent --show-error 'https://vault.example.com/alive'
How do I know it worked?

Valid Nginx configuration and trusted HTTPS /alive200.

12

LET’S BUILD

Allow HTTPS through the existing host firewall

This panel requires already active firewalld. Identify the ingress interface zone from the active-zone listing; do not guess or choose the Docker zone. Enter that exact reviewed zone. If firewalld is inactive, leave it inactive and use the existing firewall owner.

Allow HTTPS in that zone at runtime and permanently without reloading the entire firewall. Do not open the Docker backend port. Preserve SSH and separately verify the provider firewall and an external client.

bash

Dedicated Vaultwarden VM

set -eu
sudo firewall-cmd --state
sudo firewall-cmd --get-active-zones
printf '%s' 'Reviewed ingress zone: '
read -r ingress_zone
test -n "$ingress_zone"
sudo firewall-cmd --get-active-zones | grep -Fx "$ingress_zone"
sudo firewall-cmd --zone="$ingress_zone" --list-all
sudo firewall-cmd --zone="$ingress_zone" --add-service=https
sudo firewall-cmd --permanent --zone="$ingress_zone" --add-service=https
sudo firewall-cmd --zone="$ingress_zone" --query-service=https
How do I know it worked?

Existing policy permits TCP443 without opening the backend; verify external HTTPS.

13

LET’S BUILD

Check the public and management boundaries

Run from an ordinary client outside 203.0.113.10/32: /admin/ must return403. Then run the same request from the allowed administration source: an unauthenticated login page may return200, but administrative content still needs the separate passphrase. Do not put it into curl argv, this article or browser configuration fields.

On the server, confirm the backend mapping is loopback and that no config.json was created. The public config response is intentionally public and does not include vault items. An HTTP200 health probe does not prove login, sync or recovery.

The public config version is an API compatibility value, not the binary release. Use the explicit binary version command below; the reviewed image reports Vaultwarden1.37.5 and Web-Vault2026.10.1. Loopback and Docker administration assume trusted host operators; untrusted local accounts require a separate reviewed isolation design.

bash

Dedicated Vaultwarden VM

set -eu
curl --fail --silent --show-error 'https://vault.example.com/api/config' | python3 -c 'import json,sys; d=json.load(sys.stdin); print({k:d.get(k) for k in ("version","environment","server")})'
curl --silent --show-error --output /dev/null --write-out '%{http_code}
' 'https://vault.example.com/admin/'
sudo docker exec 'academy_vaultwarden' sh -c 'test -r /run/secrets/admin.phc && test -w /data && test ! -e /data/config.json'
sudo docker exec 'academy_vaultwarden' /vaultwarden --version
sudo docker port 'academy_vaultwarden'
How do I know it worked?

Outside-source admin403, allowed-source login boundary, loopback-only backend and no config override.

Enroll deliberately before adding real secrets

Keep SIGNUPS_ALLOWED=false. The server admin can issue an explicit invitation even with ordinary invitations disabled; SMTP is not configured here. Follow the official invitation workflow using a controlled mailbox and verified SMTP before team enrollment. Do not briefly open unrestricted public registration as a convenience.

Use a disposable account and dummy item for your own manual acceptance: trusted HTTPS/secure context, fresh login, create/edit/sync a dummy record to a second clean client, logout/relogin and verify the saved value. Record exact client versions and server release. Configure user MFA and keep recovery codes outside the vault before real use; an admin PHC is not MFA. SMTP, invitations, MFA, SSO, passkeys and browser/mobile clients are documented acceptance tasks, not executed claims in this guide.

Do not save settings casually in /admin: config.json then overrides the environment. Keep a single reviewed configuration owner, and protect any resulting file and credentials in backups. Keep enrollment closed after invitations; test organization permissions separately before admitting other people.

A database copy is only part of recovery

SQLite uses db.sqlite3 and may have an active WAL. Copying only the main file during writes can lose committed state. SQLite’s online backup API or the built-in backup command produces a consistent database, but it does not atomically capture attachments, Sends and configuration.

This recipe stops the sole writer and archives the complete matching data/config/secrets/TLS set, including SQLite/WAL if present, attachments, sends and RSA signing keys. Sends may be absent because they are disabled; include them if retained from earlier use. icon_cache is optional, but including the whole directory is simpler. Preserve ownership and modes. RSA keys can forge sessions, and config may contain credentials: encrypt and restrict off-host copies with a separately recoverable key.

An archive on the same disk is only a local checkpoint. Transfer an encrypted copy through your existing backup system, verify retrieval and checksum, monitor freshness and retention, and keep recovery keys outside Vaultwarden. A stopped backup causes deliberate downtime; confirm users have synced first.

14

LET’S BUILD

Take one stopped consistent checkpoint

Run in the maintenance window. The helper refuses symlinks, verifies the named container stopped, creates a new private backup directory and never replaces an archive. Finally starts the same container even if archiving fails. A failed copy remains incomplete and must not be used as a recovery set.

bash

Dedicated Vaultwarden VM

set -eu
sudo python3 - <<'PY'
import os,stat,subprocess,tarfile,tempfile,hashlib
from pathlib import Path
r=Path('/srv/academy-vaultwarden');name='academy_vaultwarden'
assert r.resolve()==r and not any(p.is_symlink() for p in r.rglob('*')), 'Symlink refused'
state=subprocess.check_output(['docker','inspect','--format','{{.State.Running}}',name],text=True).strip()
assert state=='true', 'Review unexpected stopped state first'
try:
    subprocess.run(['docker','stop','--time','60',name],check=True,stdout=subprocess.DEVNULL)
    assert subprocess.check_output(['docker','inspect','--format','{{.State.Running}}',name],text=True).strip()=='false'
    dest=Path(tempfile.mkdtemp(prefix='stopped-',dir=r/'backups'));os.chmod(dest,0o700)
    archive=dest/'vaultwarden.tar'
    fd=os.open(archive,os.O_WRONLY|os.O_CREAT|os.O_EXCL|os.O_NOFOLLOW,0o600)
    with os.fdopen(fd,'wb') as out,tarfile.open(fileobj=out,mode='w') as tar:
        for item in ('data','config','secrets','tls'): tar.add(r/item,arcname=item,recursive=True)
    h=hashlib.sha256()
    with archive.open('rb') as source:
        for chunk in iter(lambda: source.read(1024*1024), b''): h.update(chunk)
    digest=h.hexdigest()
    (dest/'SHA256').write_text(digest+'  vaultwarden.tar\n')
    os.chmod(dest/'SHA256',0o600)
    print('Stopped consistent archive:',archive,'SHA256:',digest)
finally:
    subprocess.run(['docker','start',name],check=True,stdout=subprocess.DEVNULL)
PY
curl --fail --silent --show-error --retry 10 --retry-connrefused --retry-delay 1 --retry-max-time 30 --max-time 3 'http://127.0.0.1:8159/alive'
sudo docker inspect --format '{{.State.Status}}' 'academy_vaultwarden'
How do I know it worked?

New private archive/checksum, container running again; encrypt off-host before relying on it.

Explore all tutorials ↗