Restrict concurrent password hashes (#5437)

* internal/auth/password: add resizable pool

The resizable pool wraps the permit pool with a mutex
to allow it to be resized at runtime.

* internal/auth/password: add concurrency limit

The default concurrency limit is 1, and it can be
set using the SetHashingPermits function.

* internal/cmd/config: allow configuring hashing limits

The new concurrent_password_hash_workers configuration
value can be used to loosen the constraints on the
userpass auth method hashing operation.

* internal/cmd: set password hashing constraints

Sets the password hashing concurrency constraints on
startup and config reload.

* CHANGELOG: add notice about password concurrency limit
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2025-01-22 13:31:42 -08:00
1 parent aad833fe09
commit 40cb9f5c9e
11 files changed
+457 -10

No files matched your search

+2 -1
View File
@@ -63,7 +63,7 @@ require (
github.com/posener/complete v1.2.3
github.com/prometheus/client_golang v1.18.0
github.com/ryanuber/go-glob v1.0.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/zalando/go-keyring v0.2.3
go.uber.org/atomic v1.11.0
golang.org/x/crypto v0.31.0
@@ -93,6 +93,7 @@ require (
github.com/hashicorp/dbassert v0.0.0-20231012105025-1bc1bd88e22b
github.com/hashicorp/go-kms-wrapping/extras/kms/v2 v2.0.0-20241126174344-f3b1a41a15fd
github.com/hashicorp/go-rate v0.0.0-20231204194614-cc8d401f70ab
github.com/hashicorp/go-secure-stdlib/permitpool v1.0.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/nodeenrollment v0.2.13
github.com/jackc/pgx/v5 v5.6.0