1916 Commits

Author SHA1 Message Date
Peter Wilson
89276a56b2
VAULT-6803: fix listener issue if using proxy_protocol_behavior with deny_unauthorized for untrusted upstream connections (#27589)
* timeout 'testListenerConnFn' waiting on the server connection after 3 secs

* return the invalid upstream error so the library knows not to stop listening/serving

* update go-proxyproto to use fork/tag

* test that fails before library and code update, but passes afterwards
2024-06-26 07:52:13 +00:00
Mike Palmiotto
93682b0547
Prepare CE changes for [census.Agent] SetMetadata (#27577) 2024-06-25 10:41:56 -04:00
Violet Hynes
3959722892
VAULT-28192 fix Agent and Proxy consuming large amounts of CPU for auto-auth self-healing (#27518)
* VAULT-28192 fix Agent and Proxy consuming large amounts of CPU for auto-auth self-healing

* Changelog

* Update changelog

* drain incoming if we get invalid token

---------

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
2024-06-19 10:23:51 -04:00
Thy Ton
28c2e94382
replace global vault handlers with newVaultHandlers() (#27515) 2024-06-18 15:17:40 +00:00
Jason O'Donnell
fe1f36a1dc
Add SIGUSR2 pprof to agent and proxy (#27510)
* Add SIGUSR2 pprof to agent

* changelog

* Update command/agent.go

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

* Update command/agent.go

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

* Add to proxy, update tests

* Fix path

* Changelog

* dry

* choose one error style

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-06-17 17:10:00 +00:00
Peter Wilson
b2ac030593
temp directory not used in a few places, switched to using testify require to clean up (#27512) 2024-06-17 10:53:31 +01:00
Peter Wilson
bf82dfeac8
lowercase first letter of error message (#27513) 2024-06-17 09:50:48 +00:00
Thy Ton
83111c010c
use BUILD_MINIMAL env to build minimal Vault with few storage options and plugins (#27394) 2024-06-12 16:53:49 +00:00
divyaac
f3eedc4aa2
Set default reporting start time to billing start date (#27379)
* Apply oss patch

* Added changelog
2024-06-06 10:13:04 -07:00
Luke Clifton
3e998a431f
Add option for not mounting the KV mount in --dev (#16974)
* Add option for not mounting the KV mount in --dev

* Fix whitespace I messed up during merge conflict resolution

* Feature -> Improvement

* Fix formatting for real

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-31 15:48:56 -04:00
Seena Fallah
5c275e7d88
agent: allow changing file ownership in file sink (#27123)
* agent: allow changing file ownership in file sink

Allow changing the ownership of the token file in file sink.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>

* Consistency: id -> ID

* Add changelog

* Remove empty line in changelog

* agent: add godoc for TestFileSinkMode_Ownership

Signed-off-by: Seena Fallah <seenafallah@gmail.com>

---------

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-30 15:11:37 -04:00
Violet Hynes
b41dcee3fa
VAULT-24050 Fix erroneous warning showing when -address is provided (#27265)
* VAULT-24050 Fix erroneous warning showing when -address is provided

* VAULT-24050 changelog
2024-05-30 09:48:06 -04:00
markafarrell
476b0d57c9
Add vault.agent.authenticated metric (#26570)
* add vault.agent.authenticated metric

fix metric name

* Update command/agentproxyshared/auth/auth.go

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-28 12:28:24 -04:00
Violet Hynes
44673ebba6
VAULT-25848 replace mholt/archiver with native go calls (#27228)
* VAULT-25848 update product code to remove mholt/archiver dependency

* VAULT-25848 replace tests, still WIP while I figure out if there's a bug caught by TestDebugCommand_PartialPermissions

* VAULT-25848 actually remove the dep

* VAULT-25848 add headers for directories, improve test

* Comment cleanup

* Typo

* Use %w

* Typo
2024-05-27 16:28:25 -04:00
John-Michael Faircloth
91f2b9f91d
remove deprecated centrify auth method (#27130)
* remove deprecated centrify auth method

* changelog
2024-05-20 17:49:47 +00:00
Luis (LT) Carbonell
33d93652d5
Store Cluster Name in Physical Storage (#26878)
* Store Cluster Name in Physical Storage

* Add changelog
2024-05-13 14:36:29 -04:00
Mike Palmiotto
3150c321cb
AOP: Make config reloadable (enterprise) (#26907)
CE stubs to support reloadable AOP config.
2024-05-09 17:14:39 -04:00
Kevin Schoonover
c0ea7b1a35
reload service registration configuration on SIGHUP (#17598)
* add reloading service configuration

* add changelog entry

* add tests

* fix typo

* check if config.ServiceRegistration is nil before signaling

* add changes for deregistering service on nil config with failing tests

* fix tests by decreasing reconcile_timeout + setting consul agent tokens

* fix races

* add comments in test

---------

Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>
2024-05-09 17:13:14 -04:00
Violet Hynes
b16b94a72a
VAULT-25341 Address issue where having no permissions to renew caused auto-auth to attempt to renew with no backoff (#26844)
* VAULT-25341 Address issue where having no permissions to renew caused Agent and Proxy auth to attempt to renew with no backoff

* Fiddle with go.mod changes that shouldn't have happened

* VAULT-25341 small cleanup and extra test

* VAULT-25341 backoff only in error case

* VAULT-25341 godocs

* VAULT-25342 changelog

* Update command/agent_test.go

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

* VAULT-25341 rename file audit

---------

Co-authored-by: divyaac <divya.chandrasekaran@hashicorp.com>
2024-05-09 11:12:42 -04:00
Steven Clark
259cfbf618
Add missing delegated_auth_accessors config field to /sys/mounts/<path> response (#26876)
* Add missing delegated_auth_accessors config field to /sys/mounts/<path> response

 - The field hadn't been properly populated in the JSON struct being returned
   through the API response, but had been properly set in the stored structs
   in the backend.
 - Add missing update to the command tune docs for the -delegated-auth-accessors
   option that existed
 - Add -delegated-auth-accessors to the secret enable vault command along with
   a docs update

* Add cl

* Fix documentation, using a comma separated list does not work

* Apply suggestions from code review

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

* Drop plural on doc update

---------

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2024-05-08 19:58:46 +00:00
Violet Hynes
f2b4ca4def
VAULT-24736 CE changes for static secret capability behaviour toggle (#26744) 2024-05-03 14:12:19 -04:00
Mike Palmiotto
fdc330e622
Add inmem_transactional storage option for tests (#26780)
This PR adds inmem_transactional to the map of available physical
backends for TestServerCommand. This is harmless, as tests need to opt
into the backend.

This is required to test AOP configuration on enterprise.
2024-05-02 12:43:55 +00:00
Josh Black
75b0418d51
Add ACME client counts to vault operator usage (#26525)
* Add ACME client counts to vault operator usage

* add changelog

* remove a few errors
2024-04-29 08:51:37 -07:00
Violet Hynes
514d6d7111
VAULT-25987 Fully deflake self-healing tests (#26646) 2024-04-25 11:08:22 -04:00
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