Commit Graph

715 Commits

Author SHA1 Message Date
kpcraig
dc81de7ec8 Easy go-jose updates (the codeless[ish] ones) (#28140) 2024-08-21 14:25:07 -04:00
gkoutsou
255db7aab1 Add ENVs using NewTestDockerCluster (#27457)
* Add ENVs using NewTestDockerCluster

Currently NewTestDockerCluster had no means for setting any
environment variables. This makes it tricky to create test
for functionality that require thems, like having to set
AWS environment variables.

DockerClusterOptions now exposes an option to pass extra
enviroment variables to the containers, which are appended
to the existing ones.

* adding changelog

* added test case for setting env variables to containers

* fix changelog typo; env name

* Update changelog/27457.txt

Co-authored-by: akshya96 <87045294+akshya96@users.noreply.github.com>

* adding the missing copyright

---------

Co-authored-by: akshya96 <87045294+akshya96@users.noreply.github.com>
2024-08-16 13:18:47 -07:00
akshya96
9e4bc33d5e bumping versions for grpc and docker/docker (#28071)
* bumping versions for grpc and docker/docker

* go get github.com/docker/docker@v25.0.6 && go mod tidy

* updating to 25.0.6 in sdk

* updating grpc in sdk
2024-08-14 14:24:15 -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
Peter Wilson
1af9819744 add iptables (#28031) 2024-08-08 11:59:26 +00: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
Steven Clark
7049424c16 Allow SignCert callers to override CSR signature checks (#27914)
- We are leveraging this new feature flag to ignore the CSR's
   signature as we are constructing a CSR based on the information
   from a CMPv2 message.
2024-07-30 12:20:10 -04:00
idnandre
e26c246cbb chore: fix deprecated ioutil readall (#27823)
Signed-off-by: idnandre <andre@idntimes.com>
2024-07-30 09:18:24 -04:00
Peter Wilson
815a0759f7 Update go.mod and sdk/go.mod to Go 1.22 (#27771)
* Update go.mod and sdk/go.mod to Go 1.22

* manually bump the import and re-go-mod-tidy
2024-07-15 09:24:53 +01:00
Steven Clark
054f5b182a Return the proper serial number in OCSP verification errors (#27696)
* Return the proper serial number in OCSP verification errors

 - We returned the issuer's certificate number instead of the serial
   number of the actual certificate we validated from an OCSP request.

 - The problematic serial number within the error are never shown
   currently in Vault. The only user of this library is cert-auth
   which swallows errors around revoked certificates and returns
   a boolean false instead of the actual error message.

* Add cl

* Use previously formatted serial in error msg
2024-07-09 09:03:34 -04: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
Violet Hynes
62e6b062f0 VAULT-28422 SDK upversion for go-retryablehttp (#27612) 2024-06-26 11:25:55 -04:00
AvivGuiser
3372a9b4db secrets/database: Add usePrivateIP field for cloudsql postgresql instances (#26828)
* add usePrivateIP params to determine if to use private ip dial option

Signed-off-by: aviv guiser <avivguiser@gmail.com>

* fix the connection_producer.go in mysql plugin

Signed-off-by: aviv guiser <avivguiser@gmail.com>

* Update sdk/database/helper/connutil/sql.go

Co-authored-by: Robert <17119716+robmonte@users.noreply.github.com>

---------

Signed-off-by: aviv guiser <avivguiser@gmail.com>
Signed-off-by: AvivGuiser <aviv.guiser@placer.ai>
Co-authored-by: Robert <17119716+robmonte@users.noreply.github.com>
2024-06-25 14:17:13 -05:00
Mike Palmiotto
027888be73 sdk: Bump grpc version to 1.64.0 (#27532) 2024-06-18 15:41:45 -04:00
Steven Clark
d152de025d Pin generated proto files to 1.34.2 (#27438) 2024-06-11 12:29:45 -04:00
Ryan Cragun
1c4aa5369e proto: rebuild with the latest protoc-gen-go (#27331)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-06-03 12:02:02 -06:00
Rémi Lapeyre
f8eb0154d4 Fix case handling in policyutil.EquivalentPolicies() (#16484)
The previous logic would consider not normalize casing before comparing
the policy names which meant that a token associated to a policy with
an uppercase could not be renewed for the following auth methods:

  - AppID
  - Cert
  - GitHub
  - LDAP
  - Okta
  - Radius
  - Userpass

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-31 09:58:03 -04:00
Rachel Culpepper
0b02c5d56c Fix ed25519 key type in ca_util (#27093)
* fix ed25519 key type

* add changelog

* fix other case and add tests

* add other test

* add headers
2024-05-22 09:27:45 -05:00
Steven Clark
e9f9e7d7f0 Do not generate HMAC keys for CMAC keys on calls to Upgrade (#27156)
* Do not generate HMAC keys for CMAC keys on calls to Upgrade

 - Missed during the initial development of the Transit CMAC feature,
   on initial key creation we did not generate HMAC keys when the key
   type was CMAC. The call to the policy's Upgrade function though
   would treat this key as requiring an upgrade and add one back.
 - Fix this by adding an HMACSupported argument and verifying
   on upgrade for HMAC creation that the key type supports HMAC
 - Add generic test that verifies we aren't changing a key type iota
   value, string it defined and the proper operation of HMACSupported
   and CMACSupported functions

* Add warning to test variable
2024-05-21 16:12:01 +00:00
Violet Hynes
7ac5358185 VAULT-26300 update golang/net to 0.25.0 in sdk (#27041) 2024-05-15 11:30:00 -04:00
Peter Wilson
4fbe7d9665 updated protobuf dependency to v1.34.1 in main go.mod and sdk/go.mod (#27030) 2024-05-15 09:36:50 -04:00
Peter Wilson
f89531759d SDK: updated github.com/jackc/pgx/v4 dependency to 4.18.3 (#27005) 2024-05-14 14:04:52 +01:00
Violet Hynes
b5d3c213bb Update docker to v25.0.5+incompatible (#26953)
* Update docker to v26.1.2+incompatible

* go mod tidy

* Some docker updates

* Update to 25.0.5 instead

* Fix go.mod weirdness
2024-05-13 11:34:17 -04:00
Mike Palmiotto
080780b497 Add a TraceID for forwarded request tracing (#26939) 2024-05-10 17:04:01 +00:00
Mike Palmiotto
9c61738c63 Wrap overloaded errors from the WAL backend (#26928)
This PR adds the CE plumbing to expose underyling ErrOverloaded errors.
The wrapper allows the HTTP layer to correctly assign 503 status codes
in responses.
2024-05-10 09:43:39 -04:00
Mike Palmiotto
2d75711019 make proto 1.34.1 (#26856) 2024-05-07 14:33:18 +00:00
Mike Palmiotto
d4a046820d AOP: Add NeverDrop request priority (enterprise) (#26745)
This PR introduces the CE plumbing for a new high WritePriority, meant
to bypass rejection from the AOP write controller. We attach this
priority to any request on a sudo path, such that administrators can
still perform necessary operations during an overload.
2024-05-01 15:45:34 -04:00
Mike Palmiotto
c5fac98d2d AOP: Force reject header (enterprise) (#26702)
This PR introduces the CE plumbing for a new HTTP header, called
X-Vault-AOP-Force-Reject, which will force any associated request to
reject storage writes as if Vault were overloaded.

This flag is intended to test end-to-end functionality of write
rejection in Vault. This is specifically useful for testing 503 -
Service Unavailable HTTP response codes during load shedding.
2024-05-01 14:11:24 -04: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
Paul Banks
c839854483 Overload error support for Adaptive Overload Protection (Enterprise) (#26688)
* Overload error support for Enterprise

* Remove TODO comment
2024-04-29 22:11:23 +01:00
miagilepner
46cd5bbf32 VAULT-24582: Refactor precomputed query worker to support ACME regeneration (#26364)
* refactor and add tests

* fix write options

* forgot that this endpoint was testonly

* refactor the refactor

* fix test failures and rename variable
2024-04-29 14:28:37 +02:00
Violet Hynes
b896dc1610 VAULT-24437 Address OpenAPI endpoint ignoring redact_version listener parameter (#26607)
* VAULT-24437 Address OpenAPI endpoint ignoring redact_version listener parameter

* VAULT-24437 changelog

* VAULT-24437 changelog mistake
2024-04-24 12:16:55 -04:00
Rachel Culpepper
d2aad917bb vault-24958: add cmac key types for import and export (#26610)
* add cmac key types to export

* set rsa public key and add cmac key types for wrapping

* add cmac types to import and export

* add cmac export key type

* fix import key type

* add cmac to policy import

* add enterprise checks

* fix imports
2024-04-24 08:13:19 -05:00
Steven Clark
ff500ca1c3 Add Transit CMAC stubs in CE (#26552) 2024-04-22 13:19:04 -04:00
Rachel Culpepper
9ebcbf6a0c vault-24597: add key types and key creation for CMAC (#25967)
* add key types for cmac for transit key creation

* add test for key creation

* fix test logic and add cases

* fix logic for hmac

* add go doc

* fix key size and add check for HMAC key
2024-04-19 09:39:59 -05:00
Violet Hynes
85ed817034 VAULT-20405 chunk decompression to prevent loading full decompressed data into memory at once (#26464)
* VAULT-20405 chunk decompression to prevent loading full decompressed data into memory at once

* Add changelog
2024-04-18 10:13:56 -04: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
John-Michael Faircloth
1ee302dfcd plugin/wif: support external plugins (#26384)
* plugin/wif: support external plugins

* changelog
2024-04-12 21:16:26 +00:00
John-Michael Faircloth
b01edee904 sdk: prepare for release (#26348)
* sdk: prepare for release

* remove toolchain
2024-04-11 09:50:58 -05: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
Luis (LT) Carbonell
751ebeb065 add deadlock detection in barrier and sealwrap (#26198)
* add deadlock detection in barrier and sealwrap
2024-04-09 14:56:57 +00:00
John-Michael Faircloth
7d575bf979 auth/ldap: fix login errors (#26200)
* auth/ldap: fix login errors

This fixes 2 ldap auth login errors

* Missing entity alias attribute value
  * Vault relies on case insensitive user attribute keys for mapping user
    attributes to entity alias metadata. This sets the appropriate
    configs in the cap library.

* ldap group search anonymous bind regression
  * Anonymous group searches can be rejected by some LDAP servers if
    they contain a userDN. This sets the configs in the cap library to
    specify unauthenticated binds for anonymous group searches should
    exclude a DN.

Closes https://github.com/hashicorp/vault/issues/26171
Closes https://github.com/hashicorp/vault/issues/26183

* changelog

* go mod tidy

* go get cap/ldap@latest and go mod tidy
2024-03-28 13:45:43 -05:00
Paul Banks
c605d1a846 Plumbing to support mount table path registration (#26176) 2024-03-27 13:25:31 +00:00
Violet Hynes
da00addcb6 VAULT-20396 Add limit of 100,000 to string templates (#26110)
* VAULT-20396 Add size limit to sdk string templates

* VAULT-20396 wording changes

* VAULT-20396 changelog
2024-03-25 10:04:12 -04: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
Steven Clark
2fe676e75b Validate OCSP response is signed by expected issuer (#26091)
* Validate OCSP response is signed by expected issuer and serial number matches request

 - There was a bug in the OCSP response signature logic, it properly
   verified but kept around the ocspRes object around so we ignored
   the errors found and passed the response object back up the stack.
 - Now extract the verification logic into a dedicated function, if
   it returns an error, blank the ocspRes response as we can't trust it.
 - Address an issue that the OCSP requests from multiple servers were
   clobbering each others responses as the index loop variable was not
   properly captured.
 - Add a missing validation that the response was for the serial number
    we requested

* Add cl
2024-03-22 09:28:02 -04:00
Paul Banks
3a2a922b26 Raft config refactor for mount entry size limit (#25992)
* CE parts for mount-namespace entry limit

* Remove redundant code from refactor

* Add doc comment note about ent-only use of interface

* Add CHANGELOG
2024-03-19 17:28:23 +00:00
Steven Clark
6fca34eace Proceed with cert auth login attempts if ocsp_fail_open is true and servers are unreachable (#25982) 2024-03-19 10:39:37 -04:00
Steven Clark
5785191067 Support OCSP responses without NextUpdate field set (#25912)
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message
2024-03-18 18:12:37 -04:00
Steven Clark
94d42235cf Address OCSP client caching issue (#25986)
* Address OCSP client caching issue

 - The OCSP cache built into the client that is used by cert-auth
   would cache the responses but when pulling out a cached value the
   response wasn't validating properly and was then thrown away.

 - The issue was around a confusion of the client's internal status
   vs the Go SDK OCSP status integer values.

 - Add a test that validates the cache is now used

* Add cl

* Fix PKI test failing now due to the OCSP cache working

 - Remove the previous lookup before revocation as now the OCSP
   cache works so we don't see the new revocation as we are actually
   leveraging the cache
2024-03-18 19:11:14 +00:00