I can access the service fine with vault.example.com but the admin token doesn’t work.
The vaultwarden config looks something like this:
{
...
}:
{
config = let
subdomainName = "vault";
in {
sops.secrets."vaultwarden/env".sopsFile = ../../../secrets/other/. + "/${config.hostname}.yaml";
modules.server.domain.subs = [subdomainName];
services.vaultwarden = {
enable = true;
environmentFile = config.sops.secrets."vaultwarden/env".path;
config = {
DOMAIN = "https://${subdomainName}.${config.modules.server.domain.main}";
SIGNUPS_ALLOWED = false;
ROCKET_ADDRESS = "127.0.0.1";
ROCKET_PORT = 8222;
ROCKET_LOG = "critical";
};
};
services.nginx.virtualHosts.${"${subdomainName}.${config.modules.server.domain.main}"} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.vaultwarden.config.ROCKET_PORT}";
};
};
};
}
The sops file looks something like this:
vaultwarden:
env: ADMIN_TOKEN='argonBlahblahblah'
Looking up the env files with:
systemctl cat vaultwarden
Gives me the files:
/run/secrets/vaultwarden/env something like this:
ADMIN_TOKEN='argonBlahblahblah'
/nix/store/nypfnz8kbwm1afwrqjf3n0p2f77jxsxz-vaultwarden.env something like this:
DATA_FOLDER=/var/lib/vaultwarden
DOMAIN=https://vault.example.com
ROCKET_ADDRESS=127.0.0.1
ROCKET_LOG=critical
ROCKET_PORT=8222
SIGNUPS_ALLOWED=false
WEB_VAULT_FOLDER=/nix/store/kl9mz9a9fsq53f1zs5icgwdgh5d2ic37-vaultwarden-webvault-2025.7.0.0/share/vaultwarden/vault
The token was hashed with:
echo -n "MySecretPassword" | argon2 "$(openssl rand -base64 32)" -e -id -k 65540 -t 3 -p 4
And when logging into the admin panel token MySecrectPassword was used. The actual token was generated with:
openssl rand -base64 60
Journalctl only has the failed login attempts nothing else.