875 Commits

Author SHA1 Message Date
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
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
Peter Wilson
38a78697c2
move noop audit to audit package (#26448) 2024-04-16 19:09:11 +01:00
Peter Wilson
3dc16db87e
VAULT-24798: audit - improve error messages (#26312)
* audit: remove 'op' from error messages and do some clean up

* Allow early error checking to be concerned with vault/Core vs. audit
2024-04-11 09:09:32 +01:00
John-Michael Faircloth
f2b5290bc1
ldap/auth: add tests for login regressions (#26327)
* ldap/auth: add tests for login regressions

Add tests to cover the regressions reported in
- https://github.com/hashicorp/vault/issues/26171
- https://github.com/hashicorp/vault/issues/26183

* fix tests; update image tag
2024-04-10 17:39:30 +00:00
Peter Wilson
8a40d96b1b
IsEnterprise as const (#26313) 2024-04-09 13:14:02 +01:00
Peter Wilson
e0a905e8f8
VAULT-25710: Audit - enforce header formatter requirement in EntryFormatter (#26239)
* Check Enterprise unseal order for audit funcs, enforce header formatter in audit entry formatter node
* ApplyConfig return empty headers (but never nil) when nil/empty supplied
* Add NoopHeaderFormatter and remove builtin audit testHeaderFormatters
2024-04-03 10:53:34 +01:00
Christopher Swenson
a65d9133a1
database: Avoid race condition in connection creation (#26147)
When creating database connections, there is a race
condition when multiple goroutines try to create the
connection at the same time. This happens, for
example, on leadership changes in a cluster.

Normally, the extra database connections are cleaned
up when this is detected. However, some database
implementations, notably Postgres, do not seem to
clean up in a timely manner, and can leak in these
scenarios.

To fix this, we create a global lock when creating
database connections to prevent multiple connections
from being created at the same time.

We also clean up the logic at the end so that
if (somehow) we ended up creating an additional
connection, we use the existing one rather than
the new one. This by itself would solve our
problem long-term, however, would still involve
many transient database connections being created
and immediately killed on leadership changes.

It's not ideal to have a single global lock for
database connection creation. Some potential
alternatives:

* a map of locks from the connection name to the lock.
  The biggest downside is the we probably will want to
  garbage collect this map so that we don't have an
  unbounded number of locks.
* a small pool of locks, where we hash the connection
  names to pick the lock. Using such a pool generally
  is a good way to introduce deadlock, but since we
  will only use it in a specific case, and the purpose
  is to improve performance for concurrent connection
  creation, this is probably acceptable.

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
2024-03-26 16:58:07 +00:00
BiKangNing
f8ad26c89f
chore: fix function names (#26087)
Signed-off-by: depthlending <bikangning@outlook.com>
Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
2024-03-22 12:43:01 -04:00
Violet Hynes
0048a205ce
VAULT-20396 CE side changes for identity test-identified issue (#26072)
* VAULT-20396 CE side changes for identity test-identified issue

* Weird git stuff
2024-03-21 11:16:35 -04:00
Peter Wilson
dc1e0be0e5
helper/metricsutil: Update usage of expfmt (#25947)
* helper/metricsutil: Update usage of expfmt

The previous exposed constants are no longer exposed and we can use expfmt.Format instead.
https://github.com/prometheus/common/pull/576

* reodered imports

---------

Co-authored-by: Matthias Loibl <mail@matthiasloibl.com>
2024-03-14 10:13:45 +00:00
Ryan Cragun
981aeabab0
lint: fix proto delta and simports (#25825)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-03-07 18:10:51 +00:00
miagilepner
ac1347bdf7
VAULT-17555: Secret sync client metrics (#25713)
* add metrics for secret sync clients

* changelog

* remove enterprise tag from changelog

* fix test and make clearer what it's testing

* replace with underscores
2024-03-01 10:42:39 +01:00
Peter Wilson
67c16342d8
VAULT-24013: Audit regression attempting to recover from panic (#25605)
* Add Logger to BackendConfig

* EntryFormatter use logger and recover panics

* Added TODO to consider

* Add 'name' to entry formatter

* Add test for the panic

* Fix NoopAudit with update params

* emit counter metric even when 0

* Fix vault package tests

* changelog

* Remove old comment during test writing
2024-02-26 10:33:30 +00:00
Victor Rodriguez
633dae1a6a
Add event listerner to NoopAudit for audited request assertions. (#25507) 2024-02-19 12:15:57 -05:00
Nick Cabatoff
b5cbc8b986
Add replication.SetCorePerf to create a ReplicationSet using NewTestCluster (#25381) 2024-02-16 09:00:47 -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