WIP A PBKDF2 implementation for internal database password hashing #12232
+33
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This implements PBKDF2 password hash storage for internal authentication. The only built-in hash algorithms available for storing passwords are SHA256 and SHA512, which, while salted with a 32-bit random salt, are not secure for password storage. If an attacker gains access to the hashes stored in RabbitMQ, it would be fairly trivial to crack the salted passwords stored in RabbitMQ.
This change implements PBKDF2 HMAC-SHA512 using
crypto:pbkdf2_hmac/5
, using the OWASP-recommended iteration count of 210,000. (This OTP method is available since Erlang 24, so it should be available for all currently supported and future versions of RabbitMQ.) The scheme is recorded as_v1
so that future increases to the iteration count can be increased without breaking changes or having to store extra data for the user.This is more secure against stolen hashes, though decreases performance for evaluating passwords. This means that new AMQP connections, API calls and Management UI sessions will all be more expensive. If merged, the documentation should clearly state this performance impact of using this algorithm, perhaps recommending not to use this algorithm for users that access the Management UI. Since this does not change the default password hash, and will require importing user definitions to apply to a RabbitMQ instance, this can be considered advanced usage.
Fixes #3350.
Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply.You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.md
documentFurther Comments