Commit Graph

1563 Commits

Author SHA1 Message Date
hc-github-team-es-release-engineering
2766fa2297 [DO NOT MERGE UNTIL EOY] EOY license fixes 1.13.x (#24391) 2024-01-02 10:35:40 -08:00
hc-github-team-secure-vault-core
c029f6fb10 PKI: Do not set NextUpdate OCSP field when ocsp_expiry is 0 (#24192) (#24194)
* Do not set NextUpdate OCSP field when ocsp_expiry is 0

* Add cl

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-11-20 16:03:13 +00:00
hc-github-team-secure-vault-core
01df297336 backport of commit d0501db90f (#23744)
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-10-19 19:49:07 +00:00
hc-github-team-secure-vault-core
85014f9869 Fix Transit managed key fixes - OSS (#23676) (#23678)
- This is the OSS parts of the greater enterprise PR to address some
   issues with signing and encryption within Transit using managed keys.

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-10-16 20:31:20 +00:00
hc-github-team-secure-vault-core
c4a31dacf0 Backport of Clean up unused CRL entries when issuer is removed into release/1.13.x (#23029)
* backport of commit e2ff1f1c71 (#23030)

Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>

* backport of commit 293e8b8ac5 (#23045)

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

* Fix call of crlBuilder.rebuild

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-09-13 13:57:36 +00:00
Scott Miller
8abe3cd68b Reject supplied nonces for non-convergent encryption operations (#22852) (#22901)
* Reject supplied nonces for non-convergent encryption operations (#22852)

Backport to 1.13.x

* need http after all
2023-09-08 09:59:21 -05:00
hc-github-team-secure-vault-core
f64271918b backport of commit a70aaf24c0 (#22255)
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
2023-08-08 23:45:32 +00:00
Steven Clark
620dd76564 Address memory consumption from TestCertStorageMetrics (#22004) 2023-07-21 15:14:23 +00:00
Steven Clark
f75217ae7b Remove accidently committed merge failure file (#21858) 2023-07-14 13:34:51 +00:00
Steven Clark
98032aa8dd Add back paths to TestProperAuthing - take 2 (#21856)
- Since the backport's for the OpenAPI list haven't occurred yet, we need both the existing path and the new path for when they do get backported.
2023-07-14 13:02:20 +00:00
hc-github-team-secure-vault-core
0d4bd48079 Update TestProperAuthing test for backports (#21851)
Co-authored-by: Steve Clark <steven.clark@hashicorp.com>
2023-07-14 12:09:55 +00:00
hc-github-team-secure-vault-core
f1ad714c40 Backport of Add additional debug output to TestCertStorageMetrics into release/1.13.x (#21809)
* backport of commit 8d74143872

* Add missing strings import

---------

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-07-13 13:38:55 +00:00
hc-github-team-secure-vault-core
7c8408e6af backport of commit e29842e49e (#21711)
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-07-10 13:55:12 +00:00
hc-github-team-secure-vault-core
1333dfd96b backport of commit 7144523b83 (#21414)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-06-22 17:07:47 +00:00
hc-github-team-secure-vault-core
335623929b backport of commit 15aee2e0ba (#21397)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-06-21 21:07:15 +00:00
Alexander Scheel
2f634f7a11 Move OCSP/PKI interop test to PKI engine (#20273) (#21291)
This prevents SDK from having a circular import on the main Vault
package.

Manual backport due to import conflicts.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-06-15 20:26:46 +00:00
hc-github-team-secure-vault-core
5f9638050f Backport of Telemetry Metrics Configuration. into release/1.13.x (#21070)
* backport of commit 2dd4528ed8

* Add missing documentation on cert metrics (#21073)

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Kit Haines <khaines@mit.edu>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-06-13 18:55:45 +00:00
hc-github-team-secure-vault-core
d59a1ed3c4 backport of commit daf72aa427 (#20901)
Removed byok test; this is unfortunate as it was the strongest
exerciser of this, but sadly it doesn't exist in 1.13 and previous
versions.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-31 19:11:18 +00:00
hc-github-team-secure-vault-core
9ef24f6487 backport of commit 0ac2fa19aa (#20707)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-22 19:00:31 +00:00
hc-github-team-secure-vault-core
5e0cc29c11 pki: add subject key identifier to read key response (#20642) (#20658)
* pki: add subject key identifier to read key response

This will be helpful for the Terraform Vault Provider to detect
migration of pre-1.11 exported keys (from CA generation) into post-1.11
Vault.

* add changelog

* Update builtin/logical/pki/path_fetch_keys.go



* check for managed key first

* Validate the SKID matches on root CAs



* Validate SKID matches on int CAs



* Fix formatting of tests



---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: John-Michael Faircloth <fairclothjm@users.noreply.github.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-05-19 12:20:27 +00:00
hc-github-team-secure-vault-core
b7288016b6 backport of commit db5f416476 (#20649)
Co-authored-by: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com>
2023-05-18 12:42:56 +00:00
hc-github-team-secure-vault-core
05ceaaf858 backport of commit c1d83da9b3 (#20463)
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-05-02 15:11:46 +00:00
hc-github-team-secure-vault-core
d492ca7017 Fix reading issuer's enable_aia_url_templating value (#20354) (#20358)
* Add enable_aia_url_templating to read issuer

This field was elided from read issuer responses, though the value
otherwise persisted correctly.



* Add comprehensive test for patching issuers



* Add changelog entry



---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-04-26 17:52:28 +00:00
hc-github-team-secure-vault-core
d63cc54647 backport of commit 464b9de169 (#20344)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-04-25 16:59:09 +00:00
hc-github-team-secure-vault-core
73f821307e Minor follow-ups to #16865 (#20220) (#20222)
* Minor follow-ups to #16865

Fix PKI issuer upgrade logic when upgrading to 1.12 or later, to
actually turn off the issuer crl-signing usage when it intended to.

Fix minor typo in docs.

* changelog

Co-authored-by: Max Bowsher <maxbowsher@gmail.com>
2023-04-18 13:24:44 +00:00
hc-github-team-secure-vault-core
d7c9d2b3d4 backport of commit 249c472b5b (#20203)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-04-17 17:06:31 +00:00
hc-github-team-secure-vault-core
36559a79cd backport of commit 8fa560568a (#20178)
Co-authored-by: Kyle Schochenmaier <kschoche@gmail.com>
2023-04-14 17:52:01 +00:00
hc-github-team-secure-vault-core
3d84957788 backport of commit 5f8e67d8cd (#20090)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-04-11 18:31:06 +00:00
hc-github-team-secure-vault-core
5eae4ca14c backport of commit ee40ffc03f (#20074)
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-04-11 14:08:19 +00:00
hc-github-team-secure-vault-core
cf51afab56 Backport of Add tests for PKI endpoint authentication via OpenAPI into release/1.13.x (#19713)
* Split (un,)authenticated issuer fetch endpoints

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Allow unauthed per-issuer unified-crl access

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add tests to validate endpoint authentication status

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-03-23 16:53:14 +00:00
hc-github-team-secure-vault-core
c7e83ef3aa backport of commit 94a6dca9d6 (#19648)
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-03-20 21:41:13 +00:00
hc-github-team-secure-vault-core
0b01f09eed Forward PKI revocation requests received by standby nodes to active node (#19624) (#19630)
* Forward PKI revocation requests received by standby nodes to active node

 - A refactoring that occurred in 1.13 timeframe removed what was
   considered a specific check for standby nodes that wasn't required
   as a writes should be returning ErrReadOnly.
 - That sadly exposed a long standing bug where the errors from the
   storage layer were not being properly wrapped, hiding the ErrReadOnly
   coming from a write and failing the request.

* Add cl

* Add test for basic PKI operations against standby nodes

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2023-03-20 16:50:04 +00:00
Michael Dempsey
0bacc16233 Add default to allowed values for algorithm_signer (#17894)
* Add default to allowed values for algorithm_signer

* Add possible values for algorithm signer in ui
2023-02-09 13:03:53 -05:00
Steven Clark
afd9e82e9b Add a comment around why we are grabbing a lock to update an atomic boolean (#19087) 2023-02-09 09:12:37 -05:00
Steven Clark
05e742b4ee Revert URL encoding OCSP GET fix #18938 (#19037)
- This fix was incorrect as now the tests and program are double
   URL encoding the OCSP GET requests, so the base64 + characters
   when using Vault proper are becoming space characters.
2023-02-08 11:24:26 -05:00
Nick Cabatoff
192baa88db Make API not depend on SDK (#18962) 2023-02-06 09:41:56 -05:00
Steven Clark
576c12e2ec Use the unified CRL on local CRL paths if UnifiedCRLOnExistingPaths is set (#18989)
* Use the unified CRL on legacy CRL paths if UnifiedCRLOnExistingPaths is set

 - If the crl configuration option unified_crl_on_existing_paths is set
   to true along with the unified_crl feature, provide the unified crl
   on the existing CRL paths.
 - Added some test helpers to help debugging, they are being used by
   the ENT test that validates this feature.

* Rename method to shouldLocalPathsUseUnified
2023-02-03 14:38:36 -05:00
Alexander Scheel
780dcf1316 Use UTC for leaf exceeding CA's notAfter (#18984)
* Use UTC for leaf exceeding CA's notAfter

When generating a leaf which exceeds the CA's validity period, Vault's
error message was confusing as the leaf would use the server's time
zone, but the CA's notAfter date would use UTC. This could cause
user confusion as the leaf's expiry might look before the latter, due
to using different time zones. E.g.:

> cannot satisfy request, as TTL would result in notAfter
> 2023-03-06T16:41:09.757694-08:00 that is beyond the expiration of
> the CA certificate at 2023-03-07T00:29:52Z

Consistently use UTC for this instead.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-02-03 17:00:42 +00:00
Steven Clark
b5f04147cb Apply URL encoding/unencoding to OCSP Get requests (#18938)
* Apply URL encoding/unencoding to OCSP Get requests

 - Missed this during development and sadly the unit tests were written
   at a level that did not expose this issue originally, there are
   certain combinations of issuer cert + serial that lead to base64
   data containing a '/' which will lead to the OCSP handler not getting
   the full parameter.
 - Do as the spec says, this should be treated as url-encoded data.

* Add cl

* Add higher level PKI OCSP GET/POST tests

* Rename PKI ocsp files to path_ocsp to follow naming conventions

* make fmt
2023-02-01 11:03:43 -05:00
Alexander Scheel
e4766aa974 Allow cleanup ssh dynamic keys host keys (#18939)
* Add ability to clean up host keys for dynamic keys

This adds a new endpoint, tidy/dynamic-keys that removes any stale host
keys still present on the mount. This does not clean up any pending
dynamic key leases and will not remove these keys from systems with
authorized hosts entries created by Vault.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add documentation

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-02-01 15:09:16 +00:00
Steven Clark
d34a4b6a2a Refactor an ENT test helper back to OSS to wait for updated CRLs within PKI tests (#18933)
- We had two separate helpers that were very close, one only in ENT, so unify them here in OSS.
2023-02-01 08:47:26 -05:00
Steven Clark
f05c20ba42 PKI Unified CRL/OCSP apis should be ent only (#18913)
* PKI Unified CRL/OCSP apis should be ent only

 - Do not enable any of the unified crl/ocsp related apis on OSS.

* Rollback refactoring of pathFetchCRLViaCertPath

 - As pointed out in the PR, this method isn't actually being used at
   the moment with the <serial> handler, pathFetchValid, matching
   everything under the cert/XXXX path.

* Fix schema for ent/oss diff

 - Define the OSS vs ENT urls we want to see within the schema
   definition even if they aren't really going to be used in the end.
2023-02-01 08:35:14 -05:00
Nick Cabatoff
970ed07b04 Vault test cluster helper refactorings, mostly audit related (#18928)
* Move some test helper stuff from the vault package to a new helper/testhelpers/corehelpers package.  Consolidate on a single "noop audit" implementation.
2023-02-01 08:33:16 -05:00
Alexander Scheel
8e7f2076a2 Remove dynamic keys from SSH Secrets Engine (#18874)
* Remove dynamic keys from SSH Secrets Engine

This removes the functionality of Vault creating keys and adding them to
the authorized keys file on hosts.

This functionality has been deprecated since Vault version 0.7.2.

The preferred alternative is to use the SSH CA method, which also allows
key generation but places limits on TTL and doesn't require Vault reach
out to provision each key on the specified host, making it much more
secure.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Remove dynamic ssh references from documentation

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Remove dynamic key secret type entirely

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Clarify changelog language

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add removal notice to the website

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-01-31 16:02:22 -05:00
Steven Clark
6f0552c0e3 Address pki::TestAutoRebuild flakiness (#18903)
* Address pki::TestAutoRebuild flakiness

 - Wait for a CRL change before progressing to the next step after
   we change configuration. Prior to this we would be racing against
   the CRL reloading from the configuration change.
2023-01-30 21:38:38 +00:00
Matt Schultz
564357f1f9 Add some managed key build tags to support incoming enterprise feature work. (#18902) 2023-01-30 14:57:01 -06:00
Alexander Scheel
d39fef001d Fix race in tidy status with cert counting (#18899)
* Read total cert counts with atomic.LoadUint32(...)

When generating the tidy status, we read the values of two backend
atomics, b.certCount and b.revokedCertCount, without using the atomic
load operation. This resulted in a data race when the status was read
at the same time as an on-going tidy operation:

    WARNING: DATA RACE
    Write at 0x00c00c77680c by goroutine 90522:
      sync/atomic.AddInt32()
          /usr/local/go/src/runtime/race_amd64.s:281 +0xb
      sync/atomic.AddUint32()
          <autogenerated>:1 +0x1a
      github.com/hashicorp/vault/builtin/logical/pki.(*backend).tidyStatusIncRevokedCertCount()
          /home/circleci/go/src/github.com/hashicorp/vault/builtin/logical/pki/path_tidy.go:1236 +0x107
      github.com/hashicorp/vault/builtin/logical/pki.(*backend).doTidyRevocationStore()
          /home/circleci/go/src/github.com/hashicorp/vault/builtin/logical/pki/path_tidy.go:525 +0x1404
      github.com/hashicorp/vault/builtin/logical/pki.(*backend).startTidyOperation.func1.1()
          /home/circleci/go/src/github.com/hashicorp/vault/builtin/logical/pki/path_tidy.go:290 +0x1a4
      github.com/hashicorp/vault/builtin/logical/pki.(*backend).startTidyOperation.func1()
          /home/circleci/go/src/github.com/hashicorp/vault/builtin/logical/pki/path_tidy.go:342 +0x278

    Previous read at 0x00c00c77680c by goroutine 90528:
      reflect.Value.Uint()
          /usr/local/go/src/reflect/value.go:2584 +0x195
      encoding/json.uintEncoder()
          /usr/local/go/src/encoding/json/encode.go:562 +0x45
      encoding/json.ptrEncoder.encode()
          /usr/local/go/src/encoding/json/encode.go:944 +0x3c2
      encoding/json.ptrEncoder.encode-fm()
          <autogenerated>:1 +0x90
      encoding/json.(*encodeState).reflectValue()
          /usr/local/go/src/encoding/json/encode.go:359 +0x88
      encoding/json.interfaceEncoder()
          /usr/local/go/src/encoding/json/encode.go:715 +0x17b
      encoding/json.mapEncoder.encode()
          /usr/local/go/src/encoding/json/encode.go:813 +0x854
      ... more stack trace pointing into JSON encoding and http
      handler...

In particular, because the tidy status was directly reading the uint
value without resorting to the atomic side, the JSON serialization could
race with a later atomic update.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Also use atomic load in tests

Because no tidy operation is running here, it should be safe to read the
pointed value directly, but use the safer atomic.Load for consistency.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-01-30 14:13:40 -05:00
Rachel Culpepper
d228e62b51 Vault-11713: Add the ability for transit to use managed keys (#18844)
* add the ability for transit to use managed keys

* add fields for rotate

* reorganize managed keys for better error messaging

* add aad for managed keys

* change encrypting key interface

* fix import error

* fix fmt errors

* move managed key rotation to a separate function

* fix fmt issue

* fix import error

* fix go.mod issue

* fix go.mod

* remove extra rotate param

* fix locking issue in rotation

* fix errors in policy tests

* move managed key params to fit existing policy functions

* fix sign and verify

* fix policy tests

* fix test error
2023-01-27 13:39:58 -06:00
Steven Clark
78d11e57ff Add t.Helper() to various PKI test helper methods (#18881)
- This has been done to help diagnose errors in the future so that
   we get the callers in the trace's when we fail and not just the
   helper's trace output.
2023-01-27 17:29:11 +00:00
Alexander Scheel
70cb462e65 Allow unification of revocations on other clusters (#18873)
* Allow unification of revocations on other clusters

If a BYOC revocation occurred on cluster A, while the cert was initially
issued and stored on cluster B, we need to use the invalidation on the
unified entry to detect this: the revocation queues only work for
non-PoP, non-BYOC serial only revocations and thus this BYOC would be
immediately accepted on cluster A. By checking all other incoming
revocations for duplicates on a given cluster, we can ensure that
unified revocation is consistent across clusters.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Use time-of-use locking for global revocation processing

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-01-27 16:34:04 +00:00