186 Commits

Author SHA1 Message Date
Vault Automation
ae0e5e160f
[VAULT-38601] Modify response to MFA enforced requests to enable TOTP self-enrollment (#8723) (#8746)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2025-08-20 20:22:00 +00:00
miagilepner
bcd584af20
VAULT-37630: CE changes for recover as a copy policy handling (#31472)
* CE changes for recover as a copy policy

* make proto
2025-08-12 10:29:22 +02:00
kpcraig
8f522a2bca
add ce side code and stubs for rotation manager
* add ce side code and stubs

* add changelog

* style refactor

* try to use APIPath as mount point instead of request field

* fix linter

* return a response struct instead of a pure timestamp

* add issue time to response

* add ttl to GetRotationInformation response

* rename field for clarity

* update ttl to just seconds

* rename next and last rotation time field; describe what they are

* rename function

* catch up to ent PR

* fix patch merge mistake
2025-07-15 12:48:00 -04:00
Ellie
23e04c2409
Add MetricsReporter interface so that databaseBackend's can share their connection counts with CensusManager (#31269)
* add interface and impl

* add tests

* fix comments

* Update builtin/logical/database/backend.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-14 14:52:55 -05:00
Violet Hynes
7684ac9eab
VAULT-36562 CE changes (#31054)
* VAULT-36563 CE side

* CE changes

* Go mod changes

* I'm dumb
2025-06-20 15:16:40 -04:00
helenfufu
146c032600
CE changes for plugin download (#30927)
* ce changes for https://github.com/hashicorp/vault-enterprise/pull/8193

* lower case enterprise only errors

---------

Co-authored-by: Ben Ash <bash@hashicorp.com>
2025-06-10 10:31:24 -04:00
miagilepner
6212f0986e
VAULT-35080: Snapshot storage routing (#30635)
* add storage router and test case

* add tests

* fix typo
2025-05-15 17:13:02 +02:00
Violet Hynes
26c337e9ee
VAULT-35396 CE changes for SDK observation update (#30626)
* VAULT-35396 CE changes for SDK observation update

* Make proto
2025-05-15 09:46:03 -04:00
miagilepner
1c37b94d65
VAULT-35079: Scaffolding for recover operations on backends (#30556)
* allow snapshot read, recover operation, snapshot ID in request

* lint and add comment
2025-05-09 11:48:20 +01:00
Violet Hynes
664dfbe838
VAULT-35384 Add new telemetry metrics for HTTP response status codes (#30354)
* VAULT-35384 Add new telemetry metrics for HTTP status codes

* VAULT-35384 Add new telemetry metrics for HTTP status codes

* Changelog

* Changelog

* Typo

* Missed metrics

* VAULT-35384 sys/health
2025-05-06 10:15:19 -04:00
davidadeleon
6741773b0f
update vault auth submodules to api/v1.16.0 (#29548)
* update vault auth submodules to api/v1.16.0

* update go.mod

* make proto

---------

Co-authored-by: davidadeleon <ddeleon@hashicorp.com>
2025-02-11 07:28:45 -08:00
Thy Ton
5dc9dea8ed
add EntStaticSystemView to StaticSystemView and its ce stubs (#29516) 2025-02-06 08:32:14 -08:00
vinay-gopalan
838a38443f
Update Rotation Manager OSS Stubs and SDK methods (#29401) 2025-01-28 14:24:44 -06:00
Mike Palmiotto
9d80c4548f
proto: bump protoc-gen-go to 1.36.3 (#29359) 2025-01-22 13:58:43 -05:00
Ryan Cragun
357b2949e3
protobuf: rebuild protos with protobuf 1.36.2 (#29318)
* protobuf: rebuild protos with protobuf 1.36.2
* format: please buf formatter

Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-01-08 21:35:04 +00:00
vinay-gopalan
27bd3e9535
Add SDK helpers and Core stubs for plugins to communicate with Enterprise Rotation Manager (#29273)
Co-authored-by: Robert <17119716+robmonte@users.noreply.github.com>
Co-authored-by: John-Michael Faircloth <fairclothjm@users.noreply.github.com>
2025-01-07 22:22:45 +00:00
Ryan Cragun
f730d31bc6
protobuf: rebuild protos with protobuf 1.36 (#29229)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-01-03 14:19:00 -07:00
Michael Blaum
ca203c21d0
use const for in relation to vault eventing metadata (#29130)
* use const for  in relation to vault eventing metadata

* update comments

* fix comment lengths
2024-12-11 17:34:38 -05:00
helenfufu
c27a54a99c
add vault build date to system view plugin env VAULT-32676 (#29082)
---------

Co-authored-by: Thy Ton <maithytonn@gmail.com>
2024-12-10 14:30:21 -08:00
Steven Clark
9bf3d115fc
Add an option to allow cert-auth to return metadata about client cert that fails login (#29044)
* Add an option to allow cert-auth to return metadata about client certs that fail login

* Add cl

* Update SPDX header for sdk/logical/response_test.go
2024-11-29 10:22:09 -05:00
divyaac
52ba156d47
Fix protoc issue (#28928) 2024-11-15 19:33:48 +00:00
Ryan Cragun
b6145bc3bb
protobuf: rebuild protos with protobuf 1.35.1 (main) (#28617)
* protobuf: rebuild protos with protobuf 1.35.1
* protobuf: unpin protoc-gen-go-grpc on main

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-10-07 14:54:51 -06:00
Violet Hynes
fd884ad1a0
Removal of go-testing-interface (CE changes) (#27578)
* Removal of go-testing-interface CE changes

* CE only fine

* Changelog

* Changelog
2024-07-04 11:09:41 -04:00
Steven Clark
d152de025d
Pin generated proto files to 1.34.2 (#27438) 2024-06-11 12:29:45 -04:00
Ryan Cragun
1c4aa5369e
proto: rebuild with the latest protoc-gen-go (#27331)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-06-03 12:02:02 -06:00
Mike Palmiotto
080780b497
Add a TraceID for forwarded request tracing (#26939) 2024-05-10 17:04:01 +00:00
Mike Palmiotto
9c61738c63
Wrap overloaded errors from the WAL backend (#26928)
This PR adds the CE plumbing to expose underyling ErrOverloaded errors.
The wrapper allows the HTTP layer to correctly assign 503 status codes
in responses.
2024-05-10 09:43:39 -04:00
Mike Palmiotto
2d75711019
make proto 1.34.1 (#26856) 2024-05-07 14:33:18 +00:00
Mike Palmiotto
d4a046820d
AOP: Add NeverDrop request priority (enterprise) (#26745)
This PR introduces the CE plumbing for a new high WritePriority, meant
to bypass rejection from the AOP write controller. We attach this
priority to any request on a sudo path, such that administrators can
still perform necessary operations during an overload.
2024-05-01 15:45:34 -04:00
Mike Palmiotto
c5fac98d2d
AOP: Force reject header (enterprise) (#26702)
This PR introduces the CE plumbing for a new HTTP header, called
X-Vault-AOP-Force-Reject, which will force any associated request to
reject storage writes as if Vault were overloaded.

This flag is intended to test end-to-end functionality of write
rejection in Vault. This is specifically useful for testing 503 -
Service Unavailable HTTP response codes during load shedding.
2024-05-01 14:11:24 -04:00
Ryan Cragun
5d763ac052
proto: rebuild with the latest protoc-gen-go (#26698)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-04-30 13:05:49 -06:00
Christopher Swenson
961bf20bdb
Use enumer to generate String() methods for most enums (#25705)
We have many hand-written String() methods (and similar) for enums.
These require more maintenance and are more error-prone than using
automatically generated methods. In addition, the auto-generated
versions can be more efficient.

Here, we switch to using https://github.com/loggerhead/enumer, itself
a fork of https://github.com/diegostamigni/enumer, no longer maintained,
and a fork of the mostly standard tool
https://pkg.go.dev/golang.org/x/tools/cmd/stringer.
We use this fork of enumer for Go 1.20+ compatibility and because
we require the `-transform` flag to be able to generate
constants that match our current code base.

Some enums were not targeted for this change:
2024-04-17 11:14:14 -07:00
divyaac
74abae6f01
Added Invalid Token Error Message that will be returned for bad tokens (#25953)
Edited changelog

Added dummy policy to CE file to make tests pass

Added changelog
2024-03-14 11:15:20 -07:00
suchsoon
f86e3d4a68
remove repetitive words (#25860)
Signed-off-by: suchsoon <silverjadebeauty@gmail.com>
2024-03-13 18:44:54 +00:00
Ryan Cragun
981aeabab0
lint: fix proto delta and simports (#25825)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-03-07 18:10:51 +00:00
Marc Boudreau
c37978395f
fix VAULT-24372 (#25639)
* fix VAULT-24372

* use redaction settings in context to redact values in sys/leader

* add tests to check redaction in GetLeaderStatus and GetSealStatus

* add ENT badge to sys/config/ui/custom-messages api-docs page in ToC

* remove unrelated change to website ToC
2024-02-28 14:34:55 -05:00
Mike Palmiotto
b54ac98a0b
Move Request Limiter to enterprise (#25615) 2024-02-27 16:24:06 -05:00
Josh Black
fa13dbd381
add gosimport to make fmt and run it (#25383)
* add gosimport to make fmt and run it

* move installation to tools.sh

* correct weird spacing issue

* Update Makefile

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* fix a weird issue

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2024-02-13 14:07:02 -08:00
Christopher Swenson
55d2dfb3d0
database: Emit event notifications (#24718)
Including for failures to write credentials and failure to rotate.
2024-02-05 10:30:00 -08:00
Mike Palmiotto
e4a11ae7cd
Request Limiter Reload tests (#25126)
This PR introduces a new testonly endpoint for introspecting the
RequestLimiter state. It makes use of the endpoint to verify that changes to
the request_limiter config are honored across reload.

In the future, we may choose to make the sys/internal/request-limiter/status
endpoint available in normal binaries, but this is an expedient way to expose
the status for testing without having to rush the design.

In order to re-use as much of the existing command package utility funcionality
as possible without introducing sprawling code changes, I introduced a new
server_util.go and exported some fields via accessors.

The tests shook out a couple of bugs (including a deadlock and lack of
locking around the core limiterRegistry state).
2024-02-01 09:11:08 -05:00
Mike Palmiotto
12f69a8ce5
Request Limiter listener config opt-out (#25098)
This commit introduces a new listener config option to allow disabling the request limiter per-listener.
2024-01-26 15:24:32 -05:00
Mike Palmiotto
43be9fc18a
Request Limiter (#25093)
This commit introduces two new adaptive concurrency limiters in Vault,
which should handle overloading of the server during periods of
untenable request rate. The limiter adjusts the number of allowable
in-flight requests based on latency measurements performed across the
request duration. This approach allows us to reject entire requests
prior to doing any work and prevents clients from exceeding server
capacity.

The limiters intentionally target two separate vectors that have been
proven to lead to server over-utilization.

- Back pressure from the storage backend, resulting in bufferbloat in
  the WAL system. (enterprise)
- Back pressure from CPU over-utilization via PKI issue requests
  (specifically for RSA keys), resulting in failed heartbeats.

Storage constraints can be accounted for by limiting logical requests
according to their http.Method. We only limit requests with write-based
methods, since these will result in storage Puts and exhibit the
aforementioned bufferbloat.

CPU constraints are accounted for using the same underlying library and
technique; however, they require special treatment. The maximum number
of concurrent pki/issue requests found in testing (again, specifically
for RSA keys) is far lower than the minimum tolerable write request
rate. Without separate limiting, we would artificially impose limits on
tolerable request rates for non-PKI requests. To specifically target PKI
issue requests, we add a new PathsSpecial field, called limited,
allowing backends to specify a list of paths which should get
special-case request limiting.

For the sake of code cleanliness and future extensibility, we introduce
the concept of a LimiterRegistry. The registry proposed in this PR has
two entries, corresponding with the two vectors above. Each Limiter
entry has its own corresponding maximum and minimum concurrency,
allowing them to react to latency deviation independently and handle
high volumes of requests to targeted bottlenecks (CPU and storage).

In both cases, utilization will be effectively throttled before Vault
reaches any degraded state. The resulting 503 - Service Unavailable is a
retryable HTTP response code, which can be handled to gracefully retry
and eventually succeed. Clients should handle this by retrying with
jitter and exponential backoff. This is done within Vault's API, using
the go-retryablehttp library.

Limiter testing was performed via benchmarks of mixed workloads and
across a deployment of agent pods with great success.
2024-01-26 14:26:21 -05:00
Tom Proctor
af27ab3524
Add version pinning to plugin catalog (#24960)
Adds the ability to pin a version for a specific plugin type + name to enable an easier plugin upgrade UX. After pinning and reloading, that version should be the only version in use.

No HTTP API implementation yet for managing pins, so no user-facing effects yet.
2024-01-26 17:21:43 +00:00
Steven Clark
34030cc2e3
CE changes to support ENT EST cross cluster well-known registrations (#25039) 2024-01-24 14:19:14 -05:00
Austin Gebauer
d90c7e8ab5
systemview: adds method for plugins to generate identity tokens (#24929)
* systemview: adds method for plugins to generate identity tokens

* change test name and godoc

* adds changelog

* make proto to include comment
2024-01-18 11:01:14 -08:00
Peter Wilson
a928c372b8
Audit: LogInput.Request Cloning update (#24885)
* use already existing Clone method for Request (and add extra fields that need manually setting)
2024-01-16 16:57:21 +00:00
Steven Clark
a6058c7b7b
Copy the Connection reference within LogInput Clone() (#24843)
- As TestInteg_KMIP_Audit showed, the x509.Certificate's
   big.Int SerialNumber is mangled when we do a deep clone
   of the LogInput's Request TLSConnection object.
 - As the tls.ConnectionState does not have a Clone itself and
   we don't modify this field, it should be safe to just grab
   the existing reference into the cloned version.
2024-01-12 13:58:28 -05:00
Peter Wilson
31baa89f75
audit: entry_formatter update to ensure no race detection issues (#24811)
* audit: entry_formatter update to ensure no race detection issues
* in progress with looking at a clone method for LogInput
* Tidy up LogInput Clone method
* less memory allocation
* fix hmac key clone
2024-01-12 14:47:29 +00:00
Ryan Cragun
9a10689ca3
[QT-645] Restructure dev tools (#24559)
We're on a quest to reduce our pipeline execution time to both enhance
our developer productivity but also to reduce the overall cost of the CI
pipeline. The strategy we use here reduces workflow execution time and
network I/O cost by reducing our module cache size and using binary
external tools when possible. We no longer download modules and build
many of the external tools thousands of times a day.

Our previous process of installing internal and external developer tools
was scattered and inconsistent. Some tools were installed via `go
generate -tags tools ./tools/...`,
others via various `make` targets, and some only in Github Actions
workflows. This process led to some undesirable side effects:
  * The modules of some dev and test tools were included with those
    of the Vault project. This leads to us having to manage our own
    Go modules with those of external tools. Prior to Go 1.16 this
    was the recommended way to handle external tools, but now
    `go install tool@version` is the recommended way to handle
    external tools that need to be build from source as it supports
    specific versions but does not modify the go.mod.
  * Due to Github cache constraints we combine our build and test Go
    module caches together, but having our developer tools as deps in
    our module results in a larger cache which is downloaded on every
    build and test workflow runner. Removing the external tools that were
    included in our go.mod reduced the expanded module cache by size
    by ~300MB, thus saving time and network I/O costs when downloading
    the module cache.
  * Not all of our developer tools were included in our modules. Some were
    being installed with `go install` or `go run`, so they didn't take
    advantage of a single module cache. This resulted in us downloading
    Go modules on every CI and Build runner in order to build our
    external tools.
  * Building our developer tools from source in CI is slow. Where possible
    we can prefer to use pre-built binaries in CI workflows. No more
    module download or tool compiles if we can avoid them.

I've refactored how we define internal and external build tools
in our Makefile and added several new targets to handle both building
the developer tools locally for development and verifying that they are
available. This allows for an easy developer bootstrap while also
supporting installation of many of the external developer tools from
pre-build binaries in CI. This reduces our network IO and run time
across nearly all of our actions runners.

While working on this I caught and resolved a few unrelated issue:
* Both our Go and Proto format checks we're being run incorrectly. In
  CI they we're writing changes but not failing if changes were
  detected. The Go was less of a problem as we have git hooks that
  are intended to enforce formatting, however we drifted over time.
* Our Git hooks couldn't handle removing a Go file without failing. I
  moved the diff check into the new Go helper and updated it to handle
  removing files.
* I combined a few separate scripts and into helpers and added a few
  new capabilities.
* I refactored how we install Go modules to make it easier to download
  and tidy all of the projects go.mod's.
* Refactor our internal and external tool installation and verification
  into a tools.sh helper.
* Combined more complex Go verification into `scripts/go-helper.sh` and
  utilize it in the `Makefile` and git commit hooks.
* Add `Makefile` targets for executing our various tools.sh helpers.
* Update our existing `make` targets to use new tool targets.
* Normalize our various scripts and targets output to have a consistent
  output format.
* In CI, install many of our external dependencies as binaries wherever
  possible. When not possible we'll build them from scratch but not mess
  with the shared module cache.
* [QT-641] Remove our external build tools from our project Go modules.
* [QT-641] Remove extraneous `go list`'s from our `set-up-to` composite
  action.
* Fix formatting and regen our protos

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-01-09 17:50:46 +00:00
hc-github-team-es-release-engineering
366db10cf2
[DO NOT MERGE UNTIL EOY] update year in LICENSE and copywrite files (#24368) 2024-01-02 13:22:15 -08:00