1892 Commits

Author SHA1 Message Date
Violet Hynes
fa61a060b4
VAULT-25987 de-flake Test_NoAutoAuthSelfHealing_BadPolicy (#26547)
* VAULT-25987 de-flake Test_NoAutoAuthSelfHealing_BadPolicy

* Send token to outputchannel too

* Remove initial sink checks
2024-04-19 15:11:30 -04:00
Christopher Swenson
1e36019f1c
Remove SQS plugin (#26524)
To be moved to Enterprise.

The paths and plugin itself were not activated.
2024-04-18 20:50:11 +00:00
Peter Wilson
17c6cd1a2e
fix race test (#26500) 2024-04-18 17:43:07 +00:00
Peter Wilson
8bee54c89d
VAULT-24452: audit refactor (#26460)
* Refactor audit code into audit package
* remove builtin/audit
* removed unrequired files
2024-04-18 08:25:04 +01: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
Theron Voran
6df779f1ba
agent: allow setting auto-auth and vault.namespace separately (#26427)
The new vault.namespace config option seems to always be overridden by
the auto-auth namespace, so add an extra check to allow them to be set
separately.

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-04-15 21:05:38 +00:00
Nick Cabatoff
2560beea8e
CE part of https://github.com/hashicorp/vault-enterprise/pull/4269 (#26406) 2024-04-15 20:08:57 +00:00
Peter Wilson
1dc07efb41
Agent: helper func tweak (#26394)
* tweaked makeTempFile

* removed defer removes for makeTempFile .. files
2024-04-12 18:36:43 +00:00
Violet Hynes
204c748ce7
VAULT-23742 Fix issue with use_auto_auth_token being always on (#26391)
* VAULT-23742 Fix issue with use_auto_auth_token being always on

* Test improvements from review
2024-04-12 13:51:53 -04:00
Steven Clark
bd5f61aae1
During a seal reload through SIGHUP, only write updated seal barrier on an active node (#26381)
* During a seal reload through SIGHUP, do not write updated seal barrier on non-active nodes

* Add cl
2024-04-12 08:51:44 -04:00
divyaac
e5fc11227d
Fix TestProxy_Cache_EventSystemUpdatesCacheKVV2 (#26352)
* Fix TestProxy_Cache_EventSystemUpdatesCacheKVV2

* Edited tests, and added a new bool

* Edited tests

* Edited comment

* Rename argument in handler method

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-04-11 10:17:04 -04:00
Peter Wilson
fc7b3232e3
Update Test_NoAutoAuthSelfHealing_BadPolicy (#26323) 2024-04-09 20:02:58 +00:00
divyaac
fcef8adfb0
Auto Auth Healing for Proxy (#26307)
* Auto Auth Healing for Proxy

* Edited changelog

* Fix failing tests and small comment change

* Readded check because proxy cache is initialized with inmem sink
2024-04-09 12:35:39 -07:00
Violet Hynes
c858c286cb
Attempt to address TestAutoAuthSelfHealing_TokenFileAuth_SinkOutput flakiness (#26318)
* Attempt to address TestAutoAuthSelfHealing_TokenFileAuth_SinkOutput flakiness

* Address test flakiness
2024-04-09 10:08:15 -04:00
Jason N
e9cb557ef1
Add support for forwarded Tls-Client-Cert (#17272)
* Add support for x_forwarded_for_client_cert_header

* add changelog entry

* add tests for a badly and properly formatted certs

* both conditions should be true

* handle case where r.TLS is nil

* prepend client_certs to PeerCertificates list

* Add support for x_forwarded_for_client_cert_header

* add changelog entry

* add tests for a badly and properly formatted certs

* both conditions should be true

* handle case where r.TLS is nil

* prepend client_certs to PeerCertificates list

* add option for decoders to handle different proxies

* Add support for x_forwarded_for_client_cert_header

* add changelog entry

* add tests for a badly and properly formatted certs

* both conditions should be true

* handle case where r.TLS is nil

* prepend client_certs to PeerCertificates list

* add option for decoders to handle different proxies

* fix tests

* fix typo

---------

Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Scott Miller <smiller@hashicorp.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-04-05 11:22:46 -05:00
Peter Wilson
5c6b8f7b3e
Agent: Improve TestAutoAuthSelfHealing_TokenFileAuth_SinkOutput (#26286)
* Improve TestAutoAuthSelfHealing_TokenFileAuth_SinkOutput to make it more robust in race test

* Tweak the sensitivity on waiting for template re-renders after triggering
2024-04-05 14:21:44 +01:00
Jason O'Donnell
39499e6fba
cli: fixed HOME not set error (#26243)
* cli: fixed HOME not set error

* changelog

* changelog but better

* Slightly better error handling
2024-04-02 18:24:40 -04:00
Victor Rodriguez
ae31138aea
Only reload seal config when enable_multiseal is set, or is being disabled (#26166)
Fix reloading of seal configuration when a node gains leadership.

Verify that the in-memory seal generation information is stale and only reload
seal configuration when that is the case.

When reloading seal configuration, only do it when enable_multiseal is currently
set to true, or the new configuration is attempting to set it to true.
2024-03-27 13:57:46 -04:00
divyaac
6cac3b3bf5
Agent Auto Auth Self Healing for Templates (#26172)
* Agent Auto Auth Self Healing for Templates

* Added changelog

* Edited go.sum

* Edit changelog wording
2024-03-27 10:06:45 -07:00
Violet Hynes
2a33300003
VAULT-20403 fix incorrectly deferred resource closure in debug command (#26167)
* VAULT-20403 fix incorrectly deferred resource closure in debug command

* VAULT-20403 changelog
2024-03-27 11:15:17 -04:00
Peter Wilson
54e19c50d5
Audit: remove any race to read headers (#26155)
* adjust code to prevent any data race in reading audited headers

* header tests

* Comment improvement

* make fmt 'fix' for unrelated file
2024-03-26 09:22:13 -04:00
Rachel Culpepper
f7301bc5fa
add check for enable_multiseal with sighup (#26105) 2024-03-22 11:21:32 -05:00
Victor Rodriguez
b112eb9877
Reload seals if necessary when a node gains leadership. (#26098)
As part of the process of becoming a leader node, check to see if the seal
configuration needs to be reloaded. Reloading may be necessary if the seal
generation information computed during start up is outdated. For example, a new
node that has just joined the cluster will have incorrect seal generation
information in memory, even if it has the correct seal configuration, since it
did not have access to the stored seal generation information.
2024-03-22 15:51:42 +00:00
Scott Miller
c6da02962d
Add a configuration flag for enabling multiseal (Seal HA), CE side (#25908)
* Add a configuration flag for enabling multiseal (Seal HA), CE side

* imports

* no quotes

* get rid of dep on ent config

* Abstract enableMultiSeal for a build time switch

* license headers

* wip

* gate physical seal gen fetch by a param

* docs tweak, remove core flag

* updates from the ent pr

* update stub

* update test fixtures for enable_multiseal

* use accessor

* add a test fixture for non-multiseal diagnose

* remove debugging crtuch

* Do handle phys seal gen info even if multiseal is off, in order to facilitate enable/disable safeties

* more enabled flag handling

* Accept seal gen info if we were previously disabled, and persist it

* update unit test

* Validation happens postUnseal, so this test is invalid

* Dont continue setting conf if seal loading fails during SIGHUP

* Update website/content/docs/configuration/seal/seal-ha.mdx

Thanks, that does sound much clearer

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>

* use validation if previous gen was enabled

* unit test update

* stub SetMultisealEnabled

* bring over more changes from ent

* this was an unfix

---------

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
2024-03-22 14:23:05 +00:00
Tom Proctor
02b6f8ec9b
Add test data file to fix ent-only unit test (#25782) 2024-03-05 13:27:26 +00:00
Violet Hynes
1c0d71a58e
Fix lock issue for Agent and Proxy (#25771) 2024-03-04 19:48:46 +00:00
Tom Proctor
9ed00822ea
Move CLI token helper to api module (#25744)
* Move command/config + command/token to api/cliconfig + api/tokenhelper
* Remove unused functions and unused import
* Simplify and inline function copied from SDK
* Delete unused duplicated/forwarding config implementation from command package
* Delete unused code, unexport API surface that's only used internally to the package
* Fix up license headers
* Add changelog
* Tweak .gitignore to track hcl files in testdata/ folders
2024-03-04 18:29:20 +00:00
miagilepner
e3d8a4d202
VAULT-24556: add secret syncs to vault operator usage output (#25751)
* add secret syncs to vault operator usage

* changelog

* unexport

* add godoc for test and remove t.Run invocation

* move test to separate package

* update comment
2024-03-04 12:48:52 +00:00
Mike Palmiotto
c546f597d5
remove _ from server info (#25748) 2024-03-01 11:50:11 -05:00
Jason O'Donnell
be0061509b
command/server: remove env var requirement for sigusr2 pprof output (#25391)
* command/server: remove env var requirement for sigusr2 pprof output

* changelog
2024-02-29 10:35:40 -05:00
Mike Palmiotto
b54ac98a0b
Move Request Limiter to enterprise (#25615) 2024-02-27 16:24:06 -05:00
Violet Hynes
fbfe661a08
VAULT-24386 better erroring for Proxy static secret caching for CE (#25661) 2024-02-27 10:47:31 -05:00
Kevin Schoonover
19aeaa57a6
add support for 'LeaseRenewalThreshold' in vault agent (#25212)
* add support for 'LeaseRenewalThreshold' in vault agent

* allow LeaseRenewalThreshold to be nil

* address review comments

* Add changelog

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-02-26 15:49:31 -05:00
Violet Hynes
ccc2e1b391
VAULT-24386 CE change portion of moving proxy static secret caching to enterprise (#25641) 2024-02-26 19:41:27 +00:00
Christopher Swenson
1fff35052b
Don't load SQS events backend by default (for now) (#25522)
This is not going to be enabled in 1.16, so we can
remove it from the default list of backends.

This removes about 600 KB of dead code from the
binary.

We can add this back in when the rest of the
event plugin endpoints are merged.
2024-02-21 10:20:44 -08:00
divyaac
3132592c19
Added exponential backoff (#25497)
* Applied Patch

* Added changelog

* Edited changelog

* Added constants to be shared

* Edited changelog verbage

* Removed copy and paste error

* Moved the constants

* Fixed static checks
2024-02-20 11:42:59 -08: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
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
Violet Hynes
a1cb18b2c2
VAULT-528 Fix Vault Agent being unable to render secrets with delete_version_after set. (#25387)
* VAULT-528 add test reproducing the failure that should pass after the fix

* VAULT-528 Upgrade consul-template to version with the fix

* VAULT-528 changelog
2024-02-13 14:49:35 -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
Mike Palmiotto
d75b5ed912
Initialize license in command_testonly for enterprise (#25175) 2024-02-01 19:03:29 +00:00
Kit Haines
99c74f5c80
Base Binary Cert and CSR Parse functions. (#24958)
* Base Binary Cert and CSR Parse functions.

* Add otherSANS parsing.

* Notate what doesn't exist on a CSR.

* Fix otherSans call err-checking and add basic-constriants to CSR

* Move BasicConstraint parsing to be optionally set.

* Refactored to use existing ParseBasicConstraintsExtension.

* Add handling for the ChangeSubjectName ext on CSR that is needed for EST

* Remove ChangeSubjectName - it's an attribute, not an extension, and there is no clean way to parse it, so pair down for now.

* Make these public methods, so they can be used in vault.

* Add unit tests for certutil.ParseCertificateToCreationParameters.

Also add unit tests for certutil.ParseCertificateToFields.

* Cleanup TestParseCertificate.

* Add unit tests for certutil.ParseCsrToCreationParameters and ParseCsrToFields.

* Fix return values for  "add_basic_constraints" in certutil.ParseCsrToFields.

Add a test for parsing CSRs where "add_basic_constraints" is false.

* Clear up some todos.

* Add a test for certutil.ParseCertificateToCreationParameters for non-CA cert.

* Tweak TestParseCertificate/full_non_CA_cert.

* Basics of three remaining fields - keyUsage; extKeyUsage; PolicyIdentifiers

* Fix tests and err handling

* Add unit tests for policy_identifiers; ext_key_usage_oids; key_usage

* Add test on ext_key_usage_oids

* Remove duplicate usages elsewhere.

* Add error handling to csr-checks.

* Remove extranames on returned types.

* Remove useless function.

---------

Co-authored-by: Victor Rodriguez <vrizo@hashicorp.com>
2024-02-01 10:03:43 -05: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
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
Violet Hynes
1cb960d0f7
Fix data race with readable paths in our tests (#25127)
* Fix data race with readable paths in our tests

* Actually fix the issue
2024-01-30 14:33:06 +00:00
Tom Proctor
6e111d92fe
Support setting plugin TMPDIR in config as well as env (#24978) 2024-01-30 13:10:23 +00:00
akshya96
3b357e2314
manual reporting cli oss changes (#25109) 2024-01-26 13:00:38 -08: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
indjb
b87318b35e
Apply default MaxConnsPerHost in agent even if template_config block is missing (#24989) 2024-01-24 12:56:05 -05:00