Repository navigation
Conversation
Explain when TLS builds use OpenSSL 3's configured private random generator, Update the fallback behavior, and add the returned error when the provider cant supply random bytes. Part of valkey-io#530 Signed-off-by: Dragos Andriciuc <andriciucdragos@protonmail.com>
Contributor
Author
|
Hello @MarkAtwood, thank you for your work in valkey-io/valkey#4339, I updated the ACL GENPASS topic, would appreciate a review to ensure I understood the mechanism behind it correctly. 🙏 |
zuiderkwast
reviewed
Dec 4, 2026
Comment on lines
9
to
+29
| By default (if /dev/urandom is available) the password is strong and | ||
| can be used for other uses in the context of an application, for | ||
| instance in order to create unique session identifiers or other kind of | ||
| unguessable and not colliding IDs. The password generation is also very cheap | ||
| because we don't really ask /dev/urandom for bits at every execution. At | ||
| startup Valkey creates a seed using /dev/urandom, then it will use SHA256 | ||
| in counter mode, with HMAC-SHA256(seed,counter) as primitive, in order to | ||
| create more random bytes as needed. This means that the application developer | ||
| should be feel free to abuse `ACL GENPASS` to create as many secure | ||
| pseudorandom strings as needed. | ||
|
|
||
| Starting with Valkey 9.2, when Valkey is built with TLS support | ||
| (`BUILD_TLS=yes`) against OpenSSL 3.0 or newer, `ACL GENPASS` doesn't use the | ||
| bundled generator described above. It draws its bytes from OpenSSL's private | ||
| random generator, using the provider selected in `openssl.cnf`. This lets | ||
| deployments that require secrets from a specific validated cryptographic module | ||
| use `ACL GENPASS`. Valkey has no setting for this: the choice of provider is | ||
| made entirely in the OpenSSL configuration. If the provider can't supply random | ||
| bytes, the command returns an error instead of falling back to the bundled | ||
| generator. Builds without TLS, builds against OpenSSL older than 3.0 or | ||
| LibreSSL, and builds with `BUILD_TLS=module` keep using the bundled generator. |
Contributor
There was a problem hiding this comment.
I think we should turn this around and explain the OpenSSL 3 way first and the old way as a fallback.
Member
There was a problem hiding this comment.
The first paragraph still says the password comes from /dev/urandom, which is wrong on OpenSSL 3 TLS builds. The reorder fixes that.
madolson
reviewed
Dec 5, 2026
madolson
left a comment
Member
There was a problem hiding this comment.
Spellcheck is failing on OpenSSL's and LibreSSL. Add them to wordlist, or reword to "the OpenSSL private random generator".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explain when TLS builds use OpenSSL 3's configured private random generator,
Update the fallback behavior, and add the returned error when the provider cant supply random bytes.
Part of #530