Skip to content

Document ACL GENPASS using OpenSSL provider behavior - #581

Open
Andriciuc wants to merge 1 commit into
valkey-io:mainfrom
Andriciuc:update-acl-genpass-with-raw-tls-rando
Open

Andriciuc wants to merge 1 commit into
valkey-io:mainfrom
Andriciuc:update-acl-genpass-with-raw-tls-rando

Conversation

@Andriciuc

Copy link
Copy Markdown
Contributor

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

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>
@Andriciuc Andriciuc self-assigned this Dec 4, 2026
@Andriciuc Andriciuc added the documentation Improvements or additions to documentation label Dec 4, 2026
@Andriciuc

Andriciuc commented Dec 4, 2026 •

Copy link
Copy Markdown
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. 🙏

Comment thread commands/acl-genpass.md
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should turn this around and explain the OpenSSL 3 way first and the old way as a fallback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first paragraph still says the password comes from /dev/urandom, which is wrong on OpenSSL 3 TLS builds. The reorder fixes that.

@madolson madolson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spellcheck is failing on OpenSSL's and LibreSSL. Add them to wordlist, or reword to "the OpenSSL private random generator".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants