Commit Graph

1801 Commits

Author SHA1 Message Date
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
Violet Hynes
363557d045
VAULT-19232 Add static secret capability manager to Vault Proxy (#23677)
* VAULT-19232 static secret capability manager so far

* VAULT-19232 mostly finish renewal job logic

* VAULT-19232 some clean up, tests, etc

* VAULT-19232 integrate capability manager with proxy, add E2E test

* VAULT-19232 boltdb stuff

* VAULT-19232 finishing touches

* VAULT-19232 typo

* VAULT-19232 add capabilities index cachememdb tests

* Remove erroneous "the"

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-10-25 16:43:24 -04:00
modrake
eca4b4d801
Relplat 897 copywrite fixes for mutliple licenses (#23722) 2023-10-20 08:40:43 -07:00
davidadeleon
8b15e7d216
Revert "Implement user lockout log (#23140)" (#23741)
This reverts commit 92fcfda8ad.
2023-10-20 11:21:18 -04:00
Nick Cabatoff
34ba7acdb8
Start using entAddExtPlugins instead of the init hook addExternalPlugins (#23665)
This causes the registry to now contain ent plugins on ent; previously it did not, though that appears to have been the intention. I believe this is because of the order in which inits were run.

Having changed this, various tests broke that were relying on the incorrect behaviour. Several tests were changed to rely less on opaque counts of expected plugins, instead they're now using explicit comparison by name.
2023-10-17 09:46:54 -04:00
Violet Hynes
d88c06ecaa
VAULT-19255 - Add event based static secret cache updater to Vault Proxy (#23560)
* VAULT-19255 first pass at structure for event updater

* VAULT-19255 some more work, committign before rebase

* VAULT-19255 Mostly finish event updating scaffolding

* VAULT-19255 some additional coverage, clean-up, etc

* VAULT-19255 some clean-up

* VAULT-19255 fix tests

* VAULT-19255 more WIP event system integration

* VAULT-19255 More WIP

* VAULT-19255 more discovery

* VAULT-19255 add new test, some clean up

* VAULT-19255 fix bug, extra clean-up

* VAULT-19255 fix bugs, and clean up

* VAULT-19255 clean imports, add more godocs

* VAULT-19255 add config for test

* VAULT-19255 typo

* VAULT-19255 don't do the kv refactor in this PR

* VAULT-19255 update docs

* VAULT-19255 PR feedback

* VAULT-19255 More specific error messages
2023-10-16 10:14:36 -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
Scott Miller
42a484c6ce
Correct the post-unseal meaning of the seal status type (#23022)
* Correct the post-unseal meaning of the seal status type

And at the same time add a RecoverySealType to the response which preserves the old meaning.
Updated the CLI to display both when relevant.

* changelog

* no longer needed

* Don't need this field either, which fixes unit tests

* fix unit tests
2023-10-09 12:53:13 -05: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
Violet Hynes
1e132479f0
VAULT-19233 Second part of caching static secrets work (#23177)
* VAULT-19237 Add mount_type to secret response

* VAULT-19237 changelog

* VAULT-19237 make MountType generic

* VAULT-19237 clean up comment

* VAULT-19237 update changelog

* VAULT-19237 update test, remove mounttype from wrapped responses

* VAULT-19237 fix a lot of tests

* VAULT-19237 standby test

* ensure -log-level is added to core config (#23017)

* Feature/document tls servername (#22714)

* Add Raft TLS Helm examples

Co-authored-by: Pascal Reeb <pascal.reeb@adfinis.com>
---------

* Clean up unused CRL entries when issuer is removed (#23007)

* Clean up unused CRL entries when issuer is removed

When a issuer is removed, the space utilized by its CRL was not freed,
both from the CRL config mapping issuer IDs to CRL IDs and from the
CRL storage entry. We thus implement a two step cleanup, wherein
orphaned CRL IDs are removed from the config and any remaining full
CRL entries are removed from disk.

This relates to a Consul<->Vault interop issue (#22980), wherein Consul
creates a new issuer on every leadership election, causing this config
to grow. Deleting issuers manually does not entirely solve this problem
as the config does not fully reclaim space used in this entry.

Notably, an observation that when deleting issuers, the CRL was rebuilt
on secondary clusters (due to the invalidation not caring about type of
the operation); for consistency and to clean up the unified CRLs, we
also need to run the rebuild on the active primary cluster that deleted
the issuer as well.

This approach does allow cleanup on existing impacted clusters by simply
rebuilding the CRL.

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add test case on CRL removal

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>

* UI: Handle control group error on SSH (#23025)

* Handle control group error on SSH

* Add changelog

* Fix enterprise failure of TestCRLIssuerRemoval (#23038)

This fixes the enterprise failure of the test
 ```
  === FAIL: builtin/logical/pki TestCRLIssuerRemoval (0.00s)
     crl_test.go:1456:
         	Error Trace:	/home/runner/actions-runner/_work/vault-enterprise/vault-enterprise/builtin/logical/pki/crl_test.go:1456
         	Error:      	Received unexpected error:
         	            	Global, cross-cluster revocation queue cannot be enabled when auto rebuilding is disabled as the local cluster may not have the certificate entry!
         	Test:       	TestCRLIssuerRemoval
         	Messages:   	failed enabling unified CRLs on enterprise

 ```

* fix LDAP auto auth changelog (#23027)

* VAULT-19233 First part of caching static secrets work

* VAULT-19233 update godoc

* VAULT-19233 invalidate cache on non-GET

* VAULT-19233 add locking to proxy cache writes

* VAULT-19233 add caching of capabilities map, and some additional test coverage

* VAULT-19233 Additional testing

* VAULT-19233 namespaces for cache ids

* VAULT-19233 cache-clear testing and implementation

* VAULT-19233 adjust format, add more tests

* VAULT-19233 some more docs

* VAULT-19233 Add RLock holding for map access

* VAULT-19233 PR comments

* VAULT-19233 Different table for capabilities indexes

* VAULT-19233 keep unique for request path

* VAULT-19233 passthrough for non-v1 requests

* VAULT-19233 some renames/PR comment updates

* VAULT-19233 remove type from capabilities index

* VAULT-19233 remove obsolete capabilities

* VAULT-19233 remove erroneous capabilities

* VAULT-19233 woops, missed a test

* VAULT-19233 typo

* VAULT-19233 add custom error for cachememdb

* VAULT-19233 fix cachememdb test

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
Co-authored-by: Andreas Gruhler <andreas.gruhler@adfinis.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
2023-10-06 14:44:43 -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
Peter Wilson
0309c9e032
Config: Listener parsing clean-up (#23502)
* Updated test for go-sockaddr template

* Rename test

* Tried to break up listener config parsing and add tests
2023-10-05 16:12:31 +01:00
Violet Hynes
20c1f54906
Add support for true/false string literals for agent injector (#22996)
* Add support for true/false string literals for agent injector

* Add extra test

* Changelog

* parseutil

* Godocs
2023-09-27 10:46:44 -04:00
Violet Hynes
54c84decfd
VAULT-19233 First part of caching static secrets work (#23054)
* VAULT-19233 First part of caching static secrets work

* VAULT-19233 update godoc

* VAULT-19233 invalidate cache on non-GET

* VAULT-19233 add locking to proxy cache writes

* VAULT-19233 update locking, future-proof

* VAULT-19233 fix mutex

* VAULT-19233 Use ParseSecret
2023-09-22 10:57:38 -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
4389ee438d
Provide a better error message around initializing with multiple seals (#23210)
* Provide a better error message around initializing with multiple seals

 - Specifically callout during cluster initialization or initial beta
   seal migration that we can only have a single seal enabled with the
following error message:

   `Initializing a cluster or enabling multi-seal on an existing cluster must occur with a single seal before adding additional seals`

 - Handle the use case that we have multiple seals configured, but
   some are disabled, leaving a single enabled seal. This is the legacy
   seal migratation case that works without the BETA flag set, so should
   work with it set as well.

* Update the expected error messages within seal tests

* Remove support for old style migration configurations in multi-seal
2023-09-21 12:32:44 -04: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
Hamid Ghaf
d5f4243c9e
fix: Fail in goroutine after tests have completed (#23158)
* fix panic: Fail in goroutine after TestProxy_Config_ReloadTls has completed

* fix proxy test

* feedback

* track the command output code and stdout/err
2023-09-19 08:40:10 -07:00
Christopher Swenson
500cf21d0d
events: Update docs for beta release (#23036)
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2023-09-13 14:18:18 -07:00
Chris Capurso
5a83838f1d
ensure -log-level is added to core config (#23017) 2023-09-12 16:01:21 -04:00
Daniel Huckins
d1e1abd2c7
VAULT-19681 allow users to specify files for agent child process stdout/stderr (#22812)
* allow users to specify files for child process stdout/stderr

* added changelog

* check if exec config is nil

* fix test

* first attempt at a test

* revise test

* passing test

* added failing test

* Apply suggestions from code review

Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com>

* code review suggestions

* always close log files

* refactor to use real files

* hopefully fixed tests

* add back bool gates so we don't close global stdout/stderr

* compare to os.Stdout/os.Stderr

* remove unused

---------

Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com>
2023-09-12 13:54:37 -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
f8ad2da680
agent: Fail fast if agent doesn't start (#22937)
If the agent fails to start, for example when a port conflict occurs,
we want the test to fail fast, rather than continuing until the test
times out.

If this 5-second timeout occurs waiting for the agent to start up,
then the it does not make logical sense to continue the test. So,
we use `t.Fatalf` to trigger the failure.
2023-09-08 12:50:33 -07:00
Thy Ton
12b9e5dd36
add CLI commands for plugin runtime VAULT-18181 (#22819)
---------

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-09-08 10:11:48 -07:00
Thy Ton
f96ecf3800
add oci_image and runtime to VersionedPlugin (#22866)
---------

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-09-07 13:42:47 -07:00
Christopher Swenson
022469da45
events: WebSocket subscriptions support go-bexpr expressions (#22835)
Subscribing to events through a WebSocket now support boolean
expressions to filter only the events wanted based on the fields

* `event_type`
* `operation`
* `source_plugin_mount`
* `data_path`
* `namespace`

Example expressions:

These can be passed to `vault events subscribe`, e.g.,:
* `event_type == abc`
* `source_plugin_mount == secret/`
* `event_type != def and operation != write`

```sh
vault events subscribe -filter='source_plugin_mount == secret/' 'kv*'
```

The docs for the `vault events subscribe` command and API endpoint
will be coming shortly in a different PR, and will include a better
specification for these expressions, similar to (or linking to)
https://developer.hashicorp.com/boundary/docs/concepts/filtering
2023-09-07 20:11:53 +00:00
Kuba Wieczorek
3130e8ba94
[VAULT-1324] Fix the CLI failing to return wrapping information for KV PUT and PATCH operations when format is set to 'table' (#22818) 2023-09-07 20:43:57 +01: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
Thy Ton
953f6cd818
Vault 18538 reference runtime on plugin register (#22744)
---------

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-09-06 23:37:10 -07:00
Divya Pola
dcb7083260
Validate seal generation info only if beta flag is enabled (#22741) 2023-09-05 13:13:43 -05:00
Steven Clark
a7c2b15f4e
Improve transit import command error handling (#22755)
- Doubtful this will ever happen in real life
 - We would nil panic if the public_key field was not present in the
   wrapping key response
 - Also trap a casting error if the public key was not an RSA public key
2023-09-05 10:04:37 -04: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
Tom Proctor
07e76196ba
Support running plugins in isolated containers (#22712)
Implements running plugins in containers to give them some degree
of isolation from the main Vault process and other plugins. It only
supports running on Linux initially, where it is easiest to manage unix
socket communication across the container boundary.

Additionally

* Adds -env arg to vault plugin register.
* Don't return env from 'vault plugin info'

Historically it's been omitted, and it could conceivably have secret information in
it, so if we want to return it in the response, it should probably only be via explicit
opt-in. Skipping for now though as it's not the main purpose of the commit.
2023-09-01 17:55:17 +00:00
Peter Wilson
3eba73892b
Eventbus related refactoring (#22732)
* refactored test to try and see if we can solve flakey test errors

* refactored code for readability

* don't defer in a for loop
2023-09-01 17:00:37 +00: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
Austin Gebauer
1acd0c6d24
Adds adjustment factor for assertions in auth enable tests (#22679)
* Adds adjustment factor for assertions in auth enable tests

* format comment
2023-08-30 15:51:49 -07: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
Austin Gebauer
d24adad7dd
Lifts login handlers map to a variable (#22624) 2023-08-29 15:28:35 -07:00