I want to change my Admin-Token to a argon2 hashed one. But I cant get it working. I receive “Error: Invalid admin token, please try again.” when I try to log in on the admin page.
I have done the following:
/usr/bin/docker run -u 1000:1000 -d --name vaultwarden_latest
-v /bw-data/:/data/
-p 8083:8083
-e ADMIN_TOKEN=$argon2id$v=19$m=65540,t=3,p=–deleted--
…
I tried also the one with the double $ (sed command).
If you pass it via the command line you should use ' around the value of the ADMIN_TOKEN (as it is returned by the new vaultwarden hash command) otherwise your shell will interpret $argon2id, $v, $m, … as variables and replace the value with nothing sensible. E.g.
And just so I’m clear, once I have set the argon2 token correctly, then I should enter just the password I used to create the token into the prompt on the admin page, right?
Hello, using a plain text ADMIN_TOKEN which is insecure, Then modify “ADMIN_TOKEN” in the management panel. Can this ensure the security of “ADMIN_TOKEN”?
Please generate a secure Argon2 PHC string by using “vaultwarden hash” or “argon2”.-----This is a bit complicated for me, I’m not very good at using command line operations yet.
Is it forced to work only with m=65540?
In my case the parameter for argon2 -k 65540 does not exist int the cli and I replaced it with -m 16 (2^16 = 65536).
It does not work in my case.
Any ideas?
Thx for helping out!
argon2 commands:
argon2
Usage: argon2 [-h] salt [-i|-d|-id] [-t iterations] [-m memory] [-p parallelism] [-l hash length] [-e|-r]
Password is read from stdin
Parameters:
salt The salt to use, at least 8 characters
-i Use Argon2i (this is the default)
-d Use Argon2d instead of Argon2i
-id Use Argon2id instead of Argon2i
-t N Sets the number of iterations to N (default = 3)
-m N Sets the memory usage of 2^N KiB (default 12)
-p N Sets parallelism to N threads (default 1)
-l N Sets hash output length to N bytes (default 32)
-e Output only encoded hash
-r Output only the raw bytes of the hash
-h Print argon2 usage
That’s not enough information. What does not work? What parameters are you passing? If you can’t get it to work with argon2 because of an old version, try the vaultwarden hash method which should work regardless.
Also make sure you set the variable correctly (which depends on how you configured the settings, e.g. with single quotes or by escaping the variable sigil).
I copied the output to my .env called ADMIN_TOKEN via ADMIN_TOKEN='$argon2id$v=19$m=65536,t=3,p=4$TkxKS...' and added it to docker-compose.yaml with the same key
environment:
- ADMIN_TOKEN=${ADMIN_TOKEN}
=> docker-compose up -d
I expected to be able to login via “my_password” but it didn’t work
Do you have a config.json in your data folder? That will override all env variables. Either remove that file, but make sure all settings are correct in the compose file compared to the config file.
If you copy the full string '$argon2id$v=19$m=65536,t=3,p=4$bmJ...' and use that as your admin password, does that log you in? That is the issue I am having as described here.
What are you trying to do?
Login using $argon2.... inn the password field during login?
If that is the case that would be stupid. It would be the exact same as a plain text password in that case.
You need to use the password you provided to generate that string.
I agree that this is not the desired outcome, but it is also the behavior I have been experiencing. I have not been able to get the admin token to properly be set to A2id. I think bergmast and I are having the same issue. Here is my config (no config.json exists)