Commit Graph

891 Commits

Author SHA1 Message Date
Steven Clark
ce8094fb6c Add underlining support for the PKI Enterprise SCEP work (#29604) 2025-02-13 15:54:18 +00: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
Mike Palmiotto
6d5759ecb3 identity: Introduce ActivationFunc for managing feature state (#29467)
* identity: Ensure state is changed on activation

This PR introduces some changes to the way activation flags are
processed in Vault.

Rather than reaching into subsystems and modifying
state from the activationflags package, each plugin can now register its
own ActivationFunc. Updates to activation flags now trigger the the
feature's ActivationFunc, which can encapsulate the associated
subsystem state.

We include a few bugfixes and minor cosmetic changes, like updates to
log lines and godocs.

* Check for nil system backend

* Move deduplication activation to common file

* Add identity dedup activation log lines

* Make interface methods clearer

* Clean up some comments

* More cleanups

* fixup! More cleanups

* fixup! More cleanups
2025-01-31 12:25:07 -03:00
Steven Clark
9456671f04 Prepare code base for Go 1.24 update. (#29412)
* Fix "t.Fatal from a non-test goroutine" errors in cache_test.go

 - t.Fatal(f) should not be called within a Go routine based on it's documentation and only from the main test's thread.
 - In 1.24 this seems to cause build failures

* Address all "non-constant format string errors" from go vet

 - Within 1.24 these now cause test builds to fail

…" from go vet
2025-01-27 14:34:07 -05:00
Mike Palmiotto
9d80c4548f proto: bump protoc-gen-go to 1.36.3 (#29359) 2025-01-22 13:58:43 -05:00
Mike Palmiotto
f503f739de identity: Resolve conflicts with rename (#29356)
This PR introduces a new type of conflict resolution for duplicate
Entities and Groups. Renaming provides a way of preventing Vault from
entering case-sensitive mode, which is the current behavior for any kind
of duplicate.

Renames append the conflicting identity artifact's UUID to its name and
updates a metadata field to indicate the pre-existing artifact's UUID.

The feature is gated by the force-identity-deduplication activation flag.

In order to maintain consistent behavior between the reporting resolver
and the rename operation, we need to adjust the behavior of generated
reports. Previously, they intentionally preserved existing Group merge
determinism, wherein the last MemDB update would win and all others
would be renamed. This approach is more complicated for the rename
resolver, since we would need to update any duplicated entity in the
cache while inserting the new duplicate (resulting in two MemDB
operations). Though we can ensure atomic updates of the two identity
artifacts with transactions (which we could get for groups with a minor
adjustment, and we will get along with batching of Entity upserts on 
load), it's far simpler to just rename all but the first insert as proposed
in the current PR.

Since the feature is gated by an activation flag with appropriate 
warnings of potential changes via the reporting resolver, we opt
for simplicity over maintaining pre-existing behavior. We can revisit
this assumption later if we think alignment with existing behavior
outweighs any potential complexity in the rename operation.

Entity alias resolution is left alone as a destructive merge operation
to prevent a potentially high-impact change in existing behavior.
2025-01-15 14:24:49 -05:00
Bianca
896532ef89 Add state change logic to reload from storage -- activation flags (#29341) 2025-01-10 11:56:40 +00:00
Bianca
ab4e8da697 Port activation flags with dynamic registration (#29237) 2025-01-09 10:27:58 -03: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
miagilepner
4f32443722 fixes for flakes in raft removed tests (#29270)
* fixes for flakes in raft removed tests

* one more fix
2025-01-07 13:56:07 +01: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
Steven Clark
7d26c54350 Do not use static certificates for diagnose tests (#29122)
* Do not use static certificates for diagnose tests

* Fix operator command tests, move PKI CA creation code into testhelper lib

* Fix compilation error from refactoring
2024-12-09 14:03:16 +01:00
Scott Miller
86ba0dbdeb Use go-secure-stdlib's RSA key generator backed by a DRBG (#29020)
* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Add an ENV var to disable the DRBG in a pinch

* update go.mod

* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Add an ENV var to disable the DRBG in a pinch

* Use DRBG based RSA key generation everywhere

* update go.mod

* fix import

* Remove rsa2 alias, remove test code

* move cryptoutil/rsa.go to sdk

* move imports too

* remove makefile change

* rsa2->rsa

* more rsa2->rsa, remove test code

* fix some overzelous search/replace

* Update to a real tag

* changelog

* copyright

* work around copyright check

* work around copyright check pt2

* bunch of dupe imports

* missing import

* wrong license

* fix go.mod conflict

* missed a spot

* dupe import
2024-12-05 15:39:16 -06:00
Bruno Oliveira de Souza
a2c467cc22 VAULT-31409: trace postUnseal function (#28895)
* initial implementation of unseal trace

* close file if we fail to start the trace

didn't bother to check the error from traceFile.Close()

* use reloadable config instead of env var

* license

* remove leftover

* allow setting custom dir and remove new package

* bring back StartDebugTrace

after talking to Kuba it sounds like it's a good idea to try to move stuff out of core, so even if there's no immediate need for a generic debug trace function it's still fair to add it

* track postUnseal instead of unsealInternal

also some usability improvements from manual testing

* address PR comments

* address security review

there were concerns about using the /tmp directory because of permissions, or having a default dir at all, so now it's required to set a dir in order to generate the traces.

* add unit tests to StartDebugTrace

* move back to default dir

* document new parameters

* add tiny integration test

* avoid column in trace filename

sounds like it might be forbidden in Windows and possibly cause problems in some MacOS applications.

* address PR feedback

* add go doc to test

CI was complaining about missing comments on the new test function. It feels a bit silly to require this of tests but whatever XD

* fix tests
2024-11-26 15:04:34 -03:00
Violet Hynes
b20beaec66 VAULT-32507: CE Changes (#29004) 2024-11-25 14:08:15 -05:00
Violet Hynes
1196624670 CE Changes for Auth Method Usage Metrics (#28931)
* CE Changes for Auth Method Usage Metrics

* Import cycle weirdness

* Cleanup
2024-11-19 09:39:46 -05:00
divyaac
52ba156d47 Fix protoc issue (#28928) 2024-11-15 19:33:48 +00:00
Steven Clark
c3d5c1b3ec Update to Go 1.23.3 (#28920)
* Update to Go 1.23.3

 - Update to latest major version of Go 1.23.3 from 1.22.8.
 - Update github.com/sasha-s/go-deadlock to address deadlock timer
   issue we were seeing.
 - Fix one of our tests to only reset the member variable we change
   instead of the entire Opts parameter to avoid a data race during
   testing.

* Add workaround for MSSQL TLS certificate container issue
2024-11-15 13:32:09 -05:00
miagilepner
10bd15f956 VAULT-30877: Repopulate AWS static creds queue in initialize (#28775)
* populate rotation queue in initialize

* docs, changelog

* add t.Helper()
2024-11-04 09:32:14 -06:00
miagilepner
4439ee8798 Fix Windows chown error (#28748)
* noop for windows chown

* changelog
2024-10-22 14:57:26 +02: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
Scott Miller
6ad78c4102 Remove one more use of ScalarMult from CE (#28585)
* Remove one more use of ScalarMult from CE

* get param order right
2024-10-03 15:59:42 -05:00
Steven Clark
6acfc8e212 Add a core test logger to help capture the MSSQL container output (#28472)
* Add a core test logger to help capture the MSSQL container output

 - I believe the if t.Failed prevents the logging of the container
   logging as when executed the test isn't considered failed yet.
 - Use a test core logger so that we can capture the container output
   all the time and get it from the captured log files when the test
   fails

* bump image tag to 2022-latest

---------

Co-authored-by: JM Faircloth <jmfaircloth@hashicorp.com>
2024-09-23 13:57:21 -04:00
Steven Clark
13de053935 Do not shadown err within MSSQL test container intialization (#28468)
- Get better test failure error messages by not shadowing the errors
   when we are attempting to start the MSSQL docker container, so
   we can fail the tests with the proper error message that is occuring
   instead of mssqlhelper.go:60: Could not start docker MSSQL: %!s(<nil>)
2024-09-23 12:22:11 -04:00
crystalstall
8dee06f977 chore: fix some function names (#28251)
Signed-off-by: crystalstall <crystalruby@qq.com>
2024-09-04 09:38:52 -04:00
vinay-gopalan
ec9b675f70 Add OSS stub functions for Self-Managed Static Roles (#28199) 2024-08-29 10:01:01 -07:00
John-Michael Faircloth
3fcb1a67c5 database/postgres: add inline certificate authentication fields (#28024)
* add inline cert auth to postres db plugin

* handle both sslinline and new TLS plugin fields

* refactor PrepareTestContainerWithSSL

* add tests for postgres inline TLS fields

* changelog

* revert back to errwrap since the middleware sanitizing depends on it

* enable only setting sslrootcert
2024-08-09 14:20:19 -05:00
John-Michael Faircloth
899ebd4aff db/postgres: add feature flag protected sslinline configuration (#27871)
* adds sslinline option to postgres conn string
* for database secrets type postgres, inspects the connection string for sslinline and generates a tlsconfig from the connection string.

* support fallback hosts

* remove broken multihost test

* bootstrap container with cert material

* overwrite pg config and set key file perms

* add feature flag check

* add tests

* add license and comments

* test all ssl modes

* add test cases for dsn (key/value) connection strings

* add fallback test cases

* fix error formatting

* add test for multi-host when using pgx native conn url parsing

---------

Co-authored-by: Branden Horiuchi <Branden.Horiuchi@blackline.com>
2024-08-01 11:43:54 -05:00
idnandre
e26c246cbb chore: fix deprecated ioutil readall (#27823)
Signed-off-by: idnandre <andre@idntimes.com>
2024-07-30 09:18:24 -04:00
Violet Hynes
dbecbcec18 VAULT-27384 Fix faulty assignments and unchecked errors (#27810)
* VAULT-27384 Fix faulty assignments and unchecked errors

* Another missed error

* Small refactor
2024-07-22 16:53:02 -04:00
John-Michael Faircloth
d6a588b8d2 db: refactor postgres test helpers (#27811)
* db: refactor postgres test helpers

* fix references to refactored test helper

* fix references to refactored test helper

* fix failing test
2024-07-19 09:47:34 -05:00
Violet Hynes
f55cc0b384 Fix CE drift (#27697) 2024-07-04 18:46:14 +00: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
akshya96
01f78f59b1 Add auto-roll billing start date changes CE changes (#27656)
* add NormalizeToYear function and test

* add ent changelog

* test name typo
2024-07-02 10:59:52 -07:00
Marc Boudreau
8f26f19950 add retry logic in ldap.PrepareTestContainer (#27617) 2024-07-02 10:47:32 -04:00
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
Marc Boudreau
837a5fef88 Extract logic to select appropriate RWMutex implementation for stateLock (#27456)
* improve: extract logic to select either locking.DeadlockRWMutex or locking.SyncRWMutex out of CreateCore and into their own functions

* add copyright header for new files

* move new files to helper/locking package

* adjust names of helper functions moved to locking package
2024-06-13 10:21:55 -04:00
Marc Boudreau
30d287edeb capture docker logs if container creation failed (#27449) 2024-06-13 08:05:01 -04: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
Steven Clark
64316fa084 Fix PKCS7 parser failing to parse degenerated certificate messages (#27435)
* Fix PKCS7 parser failing to parse degenerated certificate messages

* Add cl
2024-06-11 12:57:54 -04:00
Steven Clark
d152de025d Pin generated proto files to 1.34.2 (#27438) 2024-06-11 12:29:45 -04:00
Marc Boudreau
47b7e9d303 capture container logs prior to removing container if the test is failed (#27332) 2024-06-04 11:30:42 -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
Victor Rodriguez
bfbc926f0a Add NewTestLoggerWithSuffix for tests that need multiple log files. (#26879) 2024-05-09 09:46:34 -04:00
Peter Wilson
ec1f261db9 NewTestCluster: default to enabling a 'discard' file audit device when none are configured (#26861)
* Removed unrequired noop audit factory declaration

* Default NewTestCluster to using file audit device (discard)
2024-05-07 16:49:20 +01:00
Mike Palmiotto
2d75711019 make proto 1.34.1 (#26856) 2024-05-07 14:33:18 +00:00
Peter Wilson
195fc8333d Updated comments (#26730) 2024-05-01 12:36:06 +01: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
Victor Rodriguez
e7ea297f8c Add new func RetryUntilAtCadenceWithHandler to testhelpers.go. (#26611)
* Add new func RetryUntilAtCadenceWithHandler to testhelpers.go.

* Correct godoc comment for RetryUntilAtCadenceWithHandles.

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>

---------

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2024-04-24 10:53:46 -04: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