Commit Graph

407 Commits

Author SHA1 Message Date
Mike Palmiotto
b54ac98a0b
Move Request Limiter to enterprise (#25615) 2024-02-27 16:24:06 -05:00
Mike Palmiotto
7ad778541e
Disable Request Limiter by default (#25442)
This PR flips the logic for the Request Limiter, setting it to default
disabled.

We allow users to turn on the global Request Limiter, but leave the
Listener configuration as a "disable per Listener".
2024-02-16 17:50:18 -05:00
Christopher Swenson
8f6dfaaf67
Interface for event subscription plugins; SQS plugin (#24352)
Initial version of an internal plugin interface for event subscription plugins,
and an AWS SQS plugin as an example.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2024-02-05 13:17:07 -08:00
Scott Miller
f0e7f114a1
Avoid unnecessary rewraps, CE side (#25144)
* Avoid unnecessary rewraps, CE side

* sealRewrap is only available ENT side

* update stub

* update stub, again
2024-01-31 17:27:52 -06:00
Tom Proctor
6e111d92fe
Support setting plugin TMPDIR in config as well as env (#24978) 2024-01-30 13:10:23 +00: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
5933768ca5
Request Limiter reloadable config (#25095)
This commit introduces a new reloadable stanza to the server config to allow disabling the Request Limiter.
2024-01-26 15:01:47 -05:00
claire bontempo
2c19bbe145
Consistently refer to Key Value secrets engine as KV (#24529)
* VAULT-21427 change ui references from K/V to KV

* references in docs/

* website json data

* go command errors

* replace Key/Value with Key Value

* add changelog

* update test

* update secret list header badge

* two more test updates
2023-12-14 11:28:58 -08:00
Hamid Ghaf
57b6b74283
release log gate if disable-gated-logs flag is set (#24280)
* release log gate if disable-gated-logs flag is set

* CL

* Update changelog/24280.txt

Co-authored-by: Josh Black <raskchanky@gmail.com>

---------

Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
Co-authored-by: Josh Black <raskchanky@gmail.com>
2023-12-11 08:08:48 -08:00
Victor Rodriguez
128152ee28
Update recovery mode guard to account for migrating away from Shamir (#24443)
It is not sufficient to check that function setSeal in server.go does not return
an "unwrap seal". For migrations away from a Shamir seal, NewCore constructor
sets up an unwrap seal by calling method adjustForSealMigration.

Factor out new method checkForSealMigration out of adjustForSealMigration so
that NewCore can verify that there won't be a migration when returning early due
to running in recovery mode.
2023-12-08 21:25:52 +00:00
Tom Proctor
a4180c193b
Refactor plugin catalog and plugin runtime catalog into their own package (#24403)
* Refactor plugin catalog into its own package
* Fix some unnecessarily slow tests due to accidentally running multiple plugin processes
* Clean up MakeTestPluginDir helper
* Move getBackendVersion tests to plugin catalog package
* Use corehelpers.MakeTestPlugin consistently
* Fix semgrep failure: check for nil value from logical.Storage
2023-12-07 12:36:17 +00:00
Victor Rodriguez
8a46bee768
Fix recovery mode check for seal migration configuration. (#24398)
With the introduction of the Seal High Availability feature, the presence of
multiple seals in configuration does not necessarily mean that the configuration
entails a seal migration.

Instead of checking for multiple seals, check for the presence on an "unwrap"
seal, which is only used for seal migrations.
2023-12-06 16:37:48 -05:00
Christopher Swenson
6ed8b88f5f
Switch from mitchellh/cli to hashicorp/cli (#24239)
@mitchellh suggested we fork `cli` and switch to that.

Since we primarily use the interfaces in `cli`, and the new
fork has not changed those, this is (mostly) a drop-in replacement.

A small fix will be necessary for Vault Enterprise, I believe.
2023-12-04 11:05:02 -08:00
Peter Wilson
06b9325bb9
fix -log-file so that it uses the correct name and only adds timestamps on rotation (#24297)
* fix -log-file so that it uses the correct name and only adds timestamps on rotation

* added some tests for naming/rotation

* changelog

* revert to previous way of getting created time

* remove unused stat

* comment shuffle

* Update changelog/24297.txt

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>

* Update website/content/docs/agent-and-proxy/agent/index.mdx

Update 'agent' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/agent-and-proxy/proxy/index.mdx

Update 'proxy' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/server.mdx

Update 'server' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* fix typos

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2023-12-01 11:30:34 +00:00
Rachel Culpepper
638522ebac
Vault-18638: add seal reload on SIGHUP (#23571)
* reload seals on SIGHUP

* add lock in SetSeals

* move lock

* use stubmaker and change wrapper finalize call

* change finalize logic so that old seals will be finalized after new seals are configured

* add changelog

* run make fmt

* fix fmt

* fix panic when reloading seals errors out
2023-11-30 15:08:13 -06:00
Scott Miller
78d756acdb
Provide a more reasonable error message for disabled Shamir seals (#24275) 2023-11-28 18:03:24 +00:00
Scott Miller
913481fb1f
OSS fixes (#24200) 2023-11-21 10:25:01 -06:00
Divya Pola
117118e2bd
Add error checking when creating seal.Access object (#24181) 2023-11-17 19:28:24 +00:00
Hamid Ghaf
9d3617e567
Revert "Automatically track subloggers in allLoggers (#22038)" (#23986)
This reverts commit 4c8cc87794.
2023-11-03 11:08:01 -07:00
Jason O'Donnell
29d8929824
api/seal-status: fix deadlock when namespace is set on seal-status calls (#23861)
* api/seal-status: fix deadlock when namespace is set on seal-status calls

* changelog
2023-10-27 09:59:50 -04:00
Victor Rodriguez
40e9fcde49
Remove the Seal HA beta feature flag (#23820) 2023-10-27 09:13:06 -04:00
davidadeleon
8b15e7d216
Revert "Implement user lockout log (#23140)" (#23741)
This reverts commit 92fcfda8ad.
2023-10-20 11:21:18 -04:00
Nick Cabatoff
67d743e273
Step 3 of part 3 of removing ent init hooks: call stubs instead of var func hooks. (#23646) 2023-10-13 13:36:15 -04:00
John-Michael Faircloth
71067d291f
remove unused param from entEnableFourClusterDev (#23647) 2023-10-13 10:19:26 -05:00
Jason O'Donnell
7872338ec1
command/server: fix bug with sigusr2 where pprof files were not closed (#23636)
* command/server: fix bug with sigusr2 where pprof files were not closed

* changelog
2023-10-12 18:29:23 +00:00
Peter Wilson
813c786032
Listeners: Redaction only for TCP (#23592)
* redaction should only work for TCP listeners, also fix bug that allowed custom response headers for unix listeners

* fix failing test

* updates from PR feedback
2023-10-11 12:38:05 -04:00
davidadeleon
92fcfda8ad
Implement user lockout log (#23140)
* implement user lockout logger

* formatting

* make user lockout log interval configurable

* create func to get locked user count, and fix potential deadlock

* fix test

* fix test

* add changelog
2023-10-06 15:58:42 -04:00
Peter Wilson
e5432b0577
VAULT-19863: Per-listener redaction settings (#23534)
* add redaction config settings to listener

* sys seal redaction + test modification for default handler properties

* build date should be redacted by 'redact_version' too

* sys-health redaction + test fiddling

* sys-leader redaction

* added changelog

* Lots of places need ListenerConfig

* Renamed options to something more specific for now

* tests for listener config options

* changelog updated

* updates based on PR comments

* updates based on PR comments - removed unrequired test case field

* fixes for docker tests and potentially server dev mode related flags
2023-10-06 17:39:02 +01:00
Nick Cabatoff
5bf40c6e2d
Remove old hooks and start calling new ones. (#23550) 2023-10-06 12:16:19 -04:00
Nick Cabatoff
7e249707c1
Start process of replacing init-style ent hooks with stubmaker. (#23545) 2023-10-06 09:52:50 -04:00
Steven Clark
3958bd0484
Restore seal startup behavior when not in multi-seal mode (#23229)
- Only enable the warning mode for seals being unavailable when
   multiple exist when running within multi-seal mode.
 - This addresses a panic that occurs when a legacy style
   migration is attempted and the non-disabled seal is unavailable.
2023-09-21 16:22:26 -04:00
divyaac
fe7f56b3a9
Added chroot namespace to listener config printing (#23205) 2023-09-21 12:07:51 -07:00
Steven Clark
bc42d56c7a
Seal-HA: Match multiple seals using name/type only (#23203)
* Match multiple seals using name/type only

 - This fix addresses an issue that changing any seal configuration in an existing seal stanza such as the Vault token would cause negate the seal matching.
 - If this was the only seal that was previously used or slight tweaks happened to all the seals Vault would fail to start with an error of

 "must have at least one seal in common with the old generation."

 - Also add a little more output to the validation error messages about
   the current seal and configured seal information to help in
   diagnosing errors in the future

* Tweak formatting and text on method doc

* Update comment around forcing a seal rewrap
2023-09-20 16:51:52 -04:00
Scott Miller
c08b645d8f
Unseal HA changes, CE side (#23192)
* Unseal HA changes, CE side

* Transit wrapper update
2023-09-20 10:58:12 -05:00
Chris Capurso
5a83838f1d
ensure -log-level is added to core config (#23017) 2023-09-12 16:01:21 -04:00
Amund Tenstad
8b26ac03a5
fix: cli arg doc (#22847)
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2023-09-11 13:03:06 +00:00
Christopher Swenson
7f7907d3a0
events: Enable by default, disable flag (#22815)
The flag `events.alpha1` will no longer do anything, but we keep it
to prevent breaking users who have it in their configurations or
startup flags, or if it is referenced in other code.
2023-09-07 18:27:14 +00:00
Divya Pola
dcb7083260
Validate seal generation info only if beta flag is enabled (#22741) 2023-09-05 13:13:43 -05:00
Victor Rodriguez
5dc85c58c1
Protect SealWrapper health fields (#22740)
* Create accessors for SealWrapper fields protecteb by the lock.

* Use NewSealWrapper constructor to create all seal wrappers.
2023-09-01 14:38:11 -04:00
Divya Pola
5481fd2cef
Set partiallyWrappedPaths to false in operator_diagnose test (#22724)
* Fix failure in operator_diagnose test

* Fix a typo

* make fmt fix

---------

Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
2023-09-01 07:57:28 -05:00
Ellie
bd36e66ea6
Add config value that gives users options to skip calculating role for each lease (#22651)
* Add config value that gives users options to skip calculating role for each lease

* add changelog

* change name

* add config for testing

* Update changelog/22651.txt

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>

* update tests, docs and reorder logic in conditional

* fix comment

* update comment

* fix comment again

* Update comments and change if order

* change comment again

* add other comment

* fix tests

* add documentation

* edit docs

* Update http/util.go

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* Update vault/core.go

* Update vault/core.go

* update var name

* udpate docs

* Update vault/request_handling.go

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* 1 more docs change

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
2023-09-01 07:01:41 -05:00
Tom Proctor
87649219ff
Add -dev-tls-san flag (#22657)
* Add -dev-tls-san flag

This is helpful when wanting to set up a dev server with TLS in Kubernetes
and any other situations where the dev server may not be the same machine
as the Vault client (e.g. in combination with some /etc/hosts entries)

* Automatically add (best-effort only) -dev-listen-address host to extraSANs
2023-08-31 23:31:42 +01:00
Divya Pola
cdf6bf0669
Add checks to see if current seal generation is in middle of rewrapping (#22692)
* Add checks to see if current seal generation is in middle of rewrapping

* Check for rewrap flag only if thr previous configuration is not shamir
2023-08-31 14:32:22 -05:00
Victor Rodriguez
caec65a7a5
Rename SealInfo to SealWrapper. (#22689) 2023-08-31 11:27:36 -04:00
Victor Rodriguez
a96a1a7346
When not in seal HA, do not use Rewrapped flag to trigger a seal re-wrap on start up. (#22668) 2023-08-30 16:02:32 -04:00
Victor Rodriguez
7ed7bddde3
Fix JSON serialization of SealGenerationInfo. (#22611) 2023-08-29 13:56:19 -04:00
Divya Pola
e600d43690
Add safety logic for rejecting seal configuration changes (#22582)
* Fix clone method and add new validation for same gen

* Add safety logic for rejecting seal configuration changes

* Remove ent build req for test file
2023-08-28 11:58:16 -05:00
Victor Rodriguez
d8c6d28ec7
Add vault community changes for the Seal HA project. (#22515)
* Seal HA: Use new SealWrappedValue type to abstract seal wrapped values

Introduce SealWrappedValue to abstract seal wrapped values.

Make SealWrappedValue capable of marshalling into a BlobInfo, when there is
plaintext or a single encryption, or to a custom serialization consisting of a
header, length and a marshalled MultiWrapValue protobuf.

* Vault-13769: Support configuring and using multiple seals for unsealing

* Make sealWrapBackend start using multiple seals

* Make seal.Access no longer implement wrapping.Wrapper.

Instead, add the Encrypt and Decrypt methods to the Access interface.

* Make raft snapshot system use funcs SealWrapValue + UnsealWrapValue.

Move the snapshot.Sealer implementation to the vault package to
avoid circular imports.

* Update sealWrapBackend to use multiple seals for encryption.

Use all the encryption wrappers when storing seal wrapped values.

Try do decrypt using the highest priority wrapper, but try all
combinations of encrypted values and wrappers if necessary.

* Allow the use of multiple seals for entropy augmentation

Add seal_name variable in entropy stanza
Add new MultiSourcer to accommodate the new entropy augmentation behavior.

* Individually health check each wrapper, and add a sys/seal-backend-status endpoint.

* Address a race, and also a failed test mock that I didn't catch

* Track partial wrapping failures...

... where one or more but not all access.Encrypts fail for a given write.
Note these failures by adding a time ordered UUID storage entry containing
the path in a special subdirectory of root storage. Adds a callback
pattern to accomplish this, with certain high value writes like initial
barrier key storage not allowing a partial failure. The followup work
would be to detect return to health and iterate through these storage
entries, rewrapping.

* Add new data structure to track seal config generation (#4492)

* Add new data structure to track seal config generation

* Remove import cycle

* Fix undefined variable errors

* update comment

* Update setSeal response

* Fix setSealResponse in operator_diagnose

* Scope the wrapper health check locks individually (#4491)

* Refactor setSeal function in server.go. (#4505)

Refactor setSeal function in server.go.

* Decouple CreateSecureRandomReaderFunc from seal package.

Instead of using a list of seal.SealInfo structs, make
CreateSecureRandomReaderFunc use a list of new EntropySourcerInfo structs. This
brakes the denpency of package configutil on the seal package.

* Move SealGenerationInfo tracking to the seal Access.

* Move SealGenerationInfo tracking to the seal Access.

The SealGenerationInfo is now kept track by a Seal's Access instead of by the
Config object. The access implementation now records the correct generation
number on seal wrapped values.

* Only store and read SealGenerationInfo if VAULT_ENABLE_SEAL_HA_BETA is true.

* Add MultiWrapValue protobuf message

MultiWrapValue can be used to keep track of different encryptions of a value.
---------

Co-authored-by: Victor Rodriguez <vrizo@hashicorp.com>

* Use generation to determine if a seal wrapped value is up-to-date. (#4542)

* Add logging to seal Access implementation.

* Seal HA buf format run (#4561)

* Run buf format.

* Add buf.lock to ensure go-kms-wrapping module is imported.

* Vault-18958: Add unit tests for config checks

* Add safety logic for seal configuration changes

* Revert "Add safety logic for seal configuration changes"

This reverts commit 7fec48035a5cf274e5a4d98901716d08d766ce90.

* changes and tests for checking seal config

* add ent tests

* remove check for empty name and add type into test cases

* add error message for empty name

* fix no seals test

---------

Co-authored-by: divyapola5 <divya@hashicorp.com>

* Handle migrations between single-wrapper and multi-wrapper autoSeals

* Extract method SetPhysicalSealConfig.

* Extract function physicalSealConfig.

The extracted function is the only code now reading SealConfig entries from
storage.

* Extract function setPhysicalSealConfig.

The extracted function is the only code now writing SealConfig entries from
storage (except for migration from the old recovery config path).

* Move SealConfig to new file vault/seal_config.go.

* Add SealConfigType quasy-enumeration.

SealConfigType is to serve as the typed values for field SealConfig.Type.

* Rename Seal.RecoveryType to RecoverySealConfigType.

Make RecoverySealConfigType  return a SealConfigType instead of a string.

* Rename Seal.BarrierType to BarrierSealConfigType.

Make BarrierSealConfigType return a SealConfigType.

Remove seal.SealType (really a two-step rename to SealConfigType).

* Add Seal methods ClearBarrierConfig and ClearRecoveryConfig.

* Handle autoseal <-> multiseal migrations.

While going between single-wrapper and multiple-wrapper autoseals are not
migrations that require an unwrap seal (such as going from shamir to autoseal),
the stored "barrier" SealConfig needs to be updated in these cases.

Specifically, the value of SealConfg.Type is "multiseal" for autoSeals that have
more than one wrapper; on the other hand, for autoseals with a single wrapper,
SealConfig.Type is the type of the wrapper.

* Remove error return value from NewAutoSeal constructor.

* Automatically rewrap partially seal wrapped values on an interval

* Add in rewrapping of partially wrapped values on an interval, regardless of seal health/status.

* Don't set SealGenerationInfo Rewrapped flag in the partial rewrap call.

* Unexport the SealGenerationInfo's Rewrapped field, add a mutex to it for thread safe access, and add accessor methods for it.

* Add a success callback to the manual seal rewrap process that updates the SealGenerationInfo's rewrapped field. This is done via a callback to avoid an import cycle in the SealRewrap code.

* Fix a failing seal wrap backend test which was broken by the unexporting of SealGenerationInfo's Rewrapped field.

* Nil check the seal rewrap success callback before calling it.

* Change SealGenerationInfo rewrapped parameter to an atomic.Bool rather than a sync.RWMutex for simplicity and performance.

* Add nil check for SealAccess before updating SealGenerationInfo rewrapped status during seal rewrap call.

* Update partial rewrap check interval from 10 seconds to 1 minute.

* Update a reference to SealGenerationInfo Rewrapped field to use new getter method.

* Fix up some data raciness in partial rewrapping.

* Account for possibly nil storage entry when retrieving partially wrapped value.

* Allow multi-wrapper autoSeals to include disabled seal wrappers.

* Restore propagation of wrapper configuration errors by setSeal.

Function setSeal is meant to propagate non KeyNotFound errors returned by calls
to configutil.ConfigureWrapper.

* Remove unused Access methods SetConfig and Type.

* Allow multi-wrapper autoSeals to include disabled seal wrappers.

Make it possible for an autoSeal that uses multiple wrappers to include disabled
wrappers that can be used to decrypt entries, but are skipped for encryption.
e an unwrapSeal when there are disabled seals.

* Fix bug with not providing name (#4580)

* add suffix to name defaults

* add comment

* only change name for disabled seal

* Only attempt to rewrap partial values when all seals are healthy.

* Only attempt to rewrap partial values when all seals are healthy.

* Change logging level from info to debug for notice about rewrap skipping based on seal health.

* Remove stale TODOs and commented out code.

---------

Co-authored-by: rculpepper <rculpepper@hashicorp.com>
Co-authored-by: Larroyo <95649169+DeLuci@users.noreply.github.com>
Co-authored-by: Scott G. Miller <smiller@hashicorp.com>
Co-authored-by: Divya Pola <87338962+divyapola5@users.noreply.github.com>
Co-authored-by: Matt Schultz <matt.schultz@hashicorp.com>
Co-authored-by: divyapola5 <divya@hashicorp.com>
Co-authored-by: Rachel Culpepper <84159930+rculpepper@users.noreply.github.com>
2023-08-24 11:40:01 -04:00
hashicorp-copywrite[bot]
0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Max Bowsher
ba215dbc12
Major overhaul of vault operator generate-root CLI help (#18520)
* Major overhaul of `vault operator generate-root` CLI help

Resolves #15252

A major overhaul of the `vault operator generate-root` CLI help to
surface the fact that it is actually six separate commands in one,
rather than requiring users to independently deduce this mental model
themselves.

In the process of doing so, also standardize some terminology:

* Fix places which used the phrase "operational token" instead of
  "operation token" to be consistent with the prevailing terminology.

* Fix places which used the phrase "recovery operation token" instead of
  "recovery token" to be consistent with the prevailing terminology.

This PR currently focusses on the CLI help, but following review and
feedback, I assume I'll need to replicate many of the same changes in
website/content/docs/commands/operator/generate-root.mdx as well.

* Fix some tab characters which should have been spaces

* Update command/operator_generate_root.go

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2023-08-10 20:26:20 +00:00