2785 Commits

Author SHA1 Message Date
divyaac
52ba156d47
Fix protoc issue (#28928) 2024-11-15 19:33:48 +00:00
Steven Clark
95a16dbafe
PKI: Add a new leaf_not_after_behavior value to force erroring in all circumstances (#28907)
* PKI: Add a new leaf_not_after_behavior value to force erroring in all circumstances

 - We introduce a new value called `always_enforce_err` for the existing
   leaf_not_after_behavior on a PKI issuer. The new value will force we
   error out all requests that have a TTL beyond the issuer's NotAfter value.

 - This will apply to leaf certificates issued through the API as did err,
   but now to CA issuance and ACME requests for which we previously changed
   the err configuration to truncate.

* Add cl

* Update UI test

* Fix changelog type
2024-11-15 11:59:54 -05:00
Steven Clark
0adf2664b6
secrets/ssh: Return the allow_empty_principals field in read api (#28901)
* secrets/ssh: Return the allow_empty_principals field in read api

 - Return the new field in the read response api and add a test case
   that will catch these errors in the future of adding a field to
   the ssh role and not returning it in the read api response

* Add cl
2024-11-13 12:49:51 -05:00
Steven Clark
68413ad058
Pull versioned golang images in Zlint testsuite to avoid pulling with latest (#28855)
* Pull versioned golang images in Zlint testsuite to avoid pulling with latest

 - Leverage the versioned golang images which should be more static avoiding
   issues we somtimes encounter pulling latest images from our docker mirror.
 - We use the golang runtime version to avoid having to update this test
   continuously.

* Fallback to latest if the version tag isn't a release tag
2024-11-07 14:04:45 -05:00
Steven Clark
2e4a30f914
Fail sign/verify apis when Ed25519ph/ctx arguments are provided on CE (#28838) 2024-11-06 12:23:14 -05:00
Steven Clark
752bb08664
Transit: fix race in the key update api (#28839)
- The key update API would release the lock a little too early
   after it persisted the update so the reference could be updated
   when it was preparing the response to the caller across updates
   and/or key rotations
 - The storage updates were okay, just the response back to the caller
   of the update might see a mixture of different updates
2024-11-05 14:41:09 -05:00
Victor Rodriguez
c855f6e982
Fix bug setting PKI issuer enable_aia_url_templating to be set to false (#28832)
Fix bug setting PKI issuer enable_aia_url_templating to be set to false.
2024-11-04 20:51:01 +00:00
Victor Rodriguez
d99ade20be
Add PKI issuer config fields to enable check disablement parameters (#28826)
Add PKI issuer config fields to enable check disablement parameters.

Add the following new configuration fields for issuers:
  * allow_disable_critical_extension_checks
  * allow_disable_path_length_checks
  * allow_disable_name_checks
  * allow_disable_name_constraint_checks
2024-11-04 11:46:55 -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
Steven Clark
e489631e87
Transit: Allow ENT only arguments for sign/verify. Add docs for new Ed25519 signature types (#28821) 2024-11-01 12:57:52 -04:00
Steven Clark
bce085bd3f
Fix issue building urls with IPv6 IPs for ACME http-01 challenges (#28718)
* Fix ACME http-01 challenges for IPv6 IPs

 - We weren't properly encapsulating the IPv6 IP within the url provided
   to the http client with [].

* Add cl

* Cleanup a test println
2024-10-16 14:26:44 -04:00
Rachel Culpepper
9795c05d97
add error info to internal error (#28714) 2024-10-15 17:16:57 +00:00
Scott Miller
a0af792437
Adds ACME specific error types to errors returned by challenge validation functions. (#28678)
* wip

* Change test expectation

* changelog

* remove ultimately unnecessary changes

* adjust unit test again
2024-10-15 17:13:13 +00:00
Scott Miller
004dfc49f8
Add a max_crl_size parameter to CRL config (#28654)
* wip

* Unit test the CRL limit, wire up config

* Bigger error

* API docs

* wording

* max_crl_entries, + ignore 0 or < -1 values to the config endpoint

* changelog

* rename field in docs

* Update website/content/api-docs/secret/pki/index.mdx

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

* Update website/content/api-docs/secret/pki/index.mdx

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

---------

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2024-10-09 21:38:55 +00:00
Scott Miller
3c0656e4c4
Update marcellanz/transit_pkcs1v15 RSA encryption support (#25486)
* [transit-pkcs1v15] transit support for the pkcs1v15 padding scheme – without UI tests (yet).

* [transit-pkcs1v15] renamed padding_scheme parameter in transit documentation.

* [transit-pkcs1v15] add changelog file.

* [transit-pkcs1v15] remove the algorithm path as padding_scheme is chosen by parameter.

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update ui/app/templates/components/transit-key-action/datakey.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update website/content/api-docs/secret/transit.mdx

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

* Update website/content/api-docs/secret/transit.mdx

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

* Update website/content/api-docs/secret/transit.mdx

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

* Add warnings to PKCS1v1.5 usage

* Update transit

* Update transit, including separating encrypt/decrypt paddings for rewrap

* Clean up factory use in the presence of padding

* address review feedback

* remove defaults

* lint

* more lint

* Some fixes for UI issues

 - Fix padding scheme dropdown console error by adding values
   to the transit-key-actions.hbs
 - Populate both padding scheme drop down menus within rewrap,
   not just the one padding_scheme
 - Do not submit a padding_scheme value through POST for non-rsa keys

* Fix Transit rewrap API to use decrypt_padding_scheme, encrypt_padding_scheme

 - Map the appropriate API fields for the RSA padding scheme to the
   batch items within the rewrap API
 - Add the ability to create RSA keys within the encrypt API endpoint
 - Add test case for rewrap api that leverages the padding_scheme fields

* Fix code linting issues

* simply padding scheme enum

* Apply suggestions from code review

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Fix padding_scheme processing on data key api

 - The data key api was using the incorrect parameter name for
   the padding scheme
 - Enforce that padding_scheme is only used on RSA keys, we
   are punting on supporting it for managed keys at the moment.

* Add tests for parsePaddingSchemeArg

* Add missing copywrite headers

* Some small UI fixes

* Add missing param to datakey in api-docs

* Do not send padding_scheme for non-RSA key types within UI

* add UI tests for transit key actions form

---------

Co-authored-by: Marcel Lanz <marcellanz@n-1.ch>
Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
Co-authored-by: Steve Clark <steven.clark@hashicorp.com>
Co-authored-by: claire bontempo <cbontempo@hashicorp.com>
2024-10-09 09:30:14 -05: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
Steven Clark
0687353788
Cleanup some duplication in the PKI tidy response field definitions (#28614) 2024-10-07 16:20:57 -04:00
Guillermo Barroso
aeca0cdee6
secrets/aws: add sts_region parameter to root config (#22726)
* Set region parameter to be used for STS only on AWS secrets engine

* Add changelog

* Fix formatting

* region fix when not setting iam_endpoint or sts_endpoint

* Add 'sts_region' parameter for AWS secrets engine.

* Update TestBackend_PathConfigRoot for aws secrets

* Update changelog entry

---------

Co-authored-by: Robert <17119716+robmonte@users.noreply.github.com>
2024-10-04 18:33:09 +00:00
Steven Clark
7efc1af5d0
Do not acquire a read lock twice on tidyStatusLock during tidy-status api call. (#28556) 2024-10-02 08:58:05 -04:00
Steven Clark
32d09a72f8
Update PKI tests to leverage the tidy-status test helper (#28531)
- I have a suspicion the for loop with the timer can be infinite loops
   in certain circumstances. Instead leverage the normal test helpers
   for fetching tidy status
2024-10-01 14:22:15 -04:00
Steven Clark
2db2a9fb5d
PKI: Track last time auto tidy was run across restarts (#28488)
* Track the last PKI auto-tidy time ran for use across nodes

 - If the interval time for auto-tidy is longer then say a regularly
   scheduled restart of Vault, auto-tidy is never run. This is due to
   the time of the last run of tidy is only kept in memory and
   initialized on startup to the current time
 - Store the last run of any tidy, to maintain previous behavior, to
   a cluster local file, which is read in/initialized upon a mount
   initialization.

* Add auto-tidy configuration fields for backing off at startup

* Add new auto-tidy fields to UI

* Update api docs for auto-tidy

* Add cl

* Update field description text

* Apply Claire's suggestions from code review

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Implementing PR feedback from the UI team

* remove explicit defaults and types so we retrieve from backend, decouple enabling auto tidy from duration, move params to auto settings section

---------

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Co-authored-by: claire bontempo <cbontempo@hashicorp.com>
2024-09-26 09:47:11 -04:00
Luis (LT) Carbonell
b861d8b03f
Fix Issue with Lost Timezone in Metadata for Database Secret Engines (#28509)
* Set cron schedule location after pulling from storage

* Add changelog
2024-09-25 18:40:50 -04:00
Kit Haines
5da8750a93
Split the Key_Usage Field into separate fields (#28500)
* Split the Key_Usage Field into separate fields - one for the Cert
Endpoints (Sign-intermediate/Generate Root) the other for the CSR
Endpoint (intermediate generate).  These have different defaults,
and descriptions.

* Fix schema test.
2024-09-24 15:35:24 -04:00
Scott Miller
12f03b073a
Make reception of an empty valid principals configurable based on a role flag. (#28466)
* Make reception of an empty valid principals configurable based on a role flag.

Adds allow_empty_principals, which if true allows valid_principals on credential generation calls
to be empty.

* changelog

* Allow empty principals on unrelated unit test

* whitespace
2024-09-23 17:20:11 -05:00
Luis (LT) Carbonell
7c1a83422b
Improve Error Handling for Missing Credentials in AppRole and UserPass (#28441)
* Return invalid credentials for missing login parameters (400 vs 500)

* Add changelog

* Update test
2024-09-23 10:55:20 -04:00
Rachel Culpepper
978b3aee52
add ce changes and documentation for tidying cmpv2 nonce store (#28362)
* add ce changes and documentation for tidying cmpv2 nonce store

* add build tag

* fix test failures

* fix backend test
2024-09-12 11:32:51 -05:00
JMGoldsmith
cc38383732
VAULT-30694 Adding a check for nil values returned by the queue (#28330)
* adding a check for nil values returned by the queue

* adding changelog

* changing to be more idiomatic

* fixing error message to be a bit more clear

* reverting change to error handling

* Update builtin/logical/aws/path_static_roles.go

Co-authored-by: John-Michael Faircloth <fairclothjm@users.noreply.github.com>

---------

Co-authored-by: John-Michael Faircloth <fairclothjm@users.noreply.github.com>
2024-09-12 17:26:46 +02:00
Scott Miller
cda20e39b1
Ferry ocsp_ca_certificates over the OCSP ValidationConf (#28309)
* Ferry ocsp_ca_certificates over the OCSP ValidationConf

* changelog

* First check issuer, then check extraCAS

* Use the correct cert when the signature validation from issuer succeeds

* Validate via extraCas in the cert missing case as well

* dedupe logic

* remove CA test
2024-09-11 09:57:27 -05:00
Steven Clark
789f9b7821
Add missing revocation storage lock on RevokeCert refactoring (#28259)
* Add missing revocation storage lock on RevokeCert refactoring

* Refactor internal PKI revocation API

 - Process the odd logical.Response/error returns internally to make
   the returns better consumable from other users.
 - Leverage the GetConfigWithUpdate to fetch the current CRL config, otherwise we can use older or nil configs.
2024-09-03 17:18:30 -04:00
Kit Haines
edf6851eb4
Key Usage Enablement for Ent-Feature CMPv2 (#28237)
* Key Usage Enablement for Ent-Feature CMPv2
2024-08-30 17:05:20 +00:00
vinay-gopalan
b6015de314
add oss check on tests (#28226) 2024-08-29 20:05:54 +00:00
vinay-gopalan
ec9b675f70
Add OSS stub functions for Self-Managed Static Roles (#28199) 2024-08-29 10:01:01 -07:00
Scott Miller
747b395da5
Revocation RevokerFactory interface, CE changes (#28203) 2024-08-27 21:35:11 +00:00
Steven Clark
5d4ea2f4fa
Add retry logic to building zlint test container (#28167)
- Sometimes we are failing to pull the zlint tagged version from
   GitHub when building up the test containers. Add a simple retry
   around the container building step to see if this resolves the
   issue.
2024-08-23 08:33:21 -04:00
davidadeleon
fe44e55943
VAULT-29784: Skip connection verification on DB config read (#28139)
* skip connection verification on config read

* ensure appropriate default on config update call that results in a creation

* changelog

* leave verify_connection in config read response

* update test to handle output of verify_connection parameter

* fix remaining tests
2024-08-21 16:43:37 -04:00
kpcraig
dc81de7ec8
Easy go-jose updates (the codeless[ish] ones) (#28140) 2024-08-21 14:25:07 -04:00
John-Michael Faircloth
1b1f22192a
postgres: sanitize private_key from READ config endpoint (#28070) 2024-08-13 13:29:57 -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
Steven Clark
1d476381c2
Add new GetSignerFromKeyEntry method for ent usage (#27961) 2024-08-05 09:18:27 -04:00
Steven Clark
37513e0bd0
Pin PKI test suite to zlint v3.6.2 (#27964)
- Avoid this error for now

zlint_test.go:149: got unexpected error from test e_subj_orgunit_in_ca_cert: map[details:The OU attribute in the Subject is prohibited in Root and TLS CA certificates result:error]
2024-08-05 13:10:50 +00:00
Scott Miller
2d1f692d1e
Increase cert auth role cache max size (#27942) 2024-08-01 13:08:44 -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
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
Scott Miller
d75aee21b8
Improve trusted cert loading in Certificate Auth (#27902)
* Improve trusted cert loading in Certificate Auth

Currently, cert auth has a cache of certName->trusted certificate data.  This cache is updated lazily on login.  In highly concurrent situations, several logins
of the same cert or more likely, logins not specifying role name may happen simulataneously.  In the status quo, each results in going to storage, fetching the role data
(or all roles!), unmarshalling, and certificate parsing.

This change puts a lock matrix in front of the cache miss scenario, so only one of the logins will load and process the role data.  In addition, we treat
the absent role name specially, caching it separately so that it cannot be flushed by eviction on the role cache.

* changelog

* cleanup
2024-07-29 21:16:08 +00:00
kpcraig
32fdae08d6
pass nil function for auth/aws when no externalID supplied (#27858) 2024-07-26 14:55:04 -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
Steven Clark
2d7a3fba99
PKI: Refactor common role path policy code into common area (#27759) 2024-07-11 13:22:33 -04: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