Replies: 2 comments 1 reply
-
|
I think it's better to just change the default. Also since Bitwarden is planning to do the same. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
true agreed as there seems to be no reason not to use the better Argon2id |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Allow server administrators to configure the default KDF type (PBKDF2 or Argon2id) for new user registrations via environment variables, rather than having PBKDF2 hardcoded as the only default.
Motivation
The default KDF for new user registrations is hardcoded in
src/db/models/user.rs:Argon2id is widely considered superior to PBKDF2 for password hashing because it is memory-hard, making it significantly more resistant to GPU-based brute-force attacks. Vaultwarden already fully supports Argon2id — users can switch to it in their account settings — but the server default remains PBKDF2.
For self-hosted instances (especially family or small-team deployments), most users will never change their KDF settings. Allowing the server admin to set Argon2id as the default ensures all new accounts start with the stronger KDF without requiring each user to manually change it.
Proposed Solution
Add four environment variables:
CLIENT_KDF_TYPEi320CLIENT_KDF_ITERATIONSi32600000CLIENT_KDF_MEMORYi3264CLIENT_KDF_PARALLELISMi324Backwards compatible: Default values produce identical behavior to the current hardcoded constants. Existing users are not affected.
Example usage
Files changed (~81 lines across 4 files)
src/config.rs— Config entries with validationsrc/db/models/user.rs— Replace hardcoded constants with config-backed functionssrc/api/core/accounts.rs— Use config for prelogin defaults (unknown email case).env.template— Document new variablesImplementation
I have a working, tested implementation and am happy to submit a PR if this is of interest.
Beta Was this translation helpful? Give feedback.
All reactions