Commit Graph
156 Commits
Author SHA1 Message Date
Michael Gaffney 9354a4ebcf refactor(scheduler): Add statusThreshold parameter to job.Run
The scheduler monitors running jobs to make sure they are not hung. If
the status of a running job does not change after a duration (the
interruptThreshold in the scheduler), the scheduler kills the job. This
change passes the scheduler's interruptThreshold to the job when it
calls Run() on the job.
2024-10-25 10:25:51 -04:00
David Bond 61c1544446 Fix panic in credential renewal job (#5116)
This commit modifies the credential renewal job to handle a case where the `renewLease` method can
return `nil, nil`. Currently, a panic is caused by usage of the `renewedCred` variable in this scenario.

This commit adds a nil check and returns an error if the `renewedCred` variable is returned as `nil`.

Signed-off-by: David Bond <davidsbond93@gmail.com>
2024-09-18 17:46:12 +01:00
Jim 28b465e4b8 refact: to use go-dbw CreateItems, DeleteItems (#4974)
* refact: to use go-dbw CreateItems, DeleteItems

Latest version of go-dbw updated the signature of
CreateItems(...) and DeleteItems(...) on a happy
note this latest version of go-dbw actually does
batch inserts and updates for this functions.

* all: regenerate protos with new protoc-gen-go version
2024-08-01 11:18:53 -04:00
Louis Ruch 2e6edb843d feat(vault): Add headers to client interface 2024-04-11 09:08:49 -07:00
Louis Ruch 0cfca44cf5 fix(vault): Fixes credential_vault_credential_private view
The worker_filter column was dropped from the
credential_vault_credential_private view in the
56/02_add_data_key_foreign_key_references.up.sql migration.
Any credential renewal/revocations that relied on the worker filter
would not successfully renew.
2024-04-11 09:08:49 -07:00
Louis Ruch c376d06355 feat: Add support for correlationId 2024-04-11 09:08:45 -07:00
Michael Li d74d667716 test(credential): Potential fix for race condition (#4587)
* test(credential): Potential fix for race condition

* test: Additional instances
2024-04-04 15:24:19 -04:00
Jeff Mitchell 4542eef22b Add templating coalesce function (#4492) 2024-03-15 10:33:10 -04:00
Jeff Mitchell 19b19d6756 Comment out parallel statements causing test failures (#4528)
It hasn't been investigated why this is happening (getting a number of
403 errors) but for now removing parallel fixes it.
2024-03-13 21:12:26 -04:00
Jeff Mitchell 9408b2b299 Add some more fixes caught by race detector (#4488) 2024-03-07 14:46:10 -05:00
Michael Li 9eb608feeb chore: Update protobuf to 1.33 (#4485)
Release: https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.33.0
CVE: https://nvd.nist.gov/vuln/detail/CVE-2024-24786
2024-03-06 14:53:06 -05:00
Jeff MitchellandDamian Debkowski 014a5a7aae Vet/race fixes (#4421)
This addresses all found vet/race fixes in community edition.

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-02-21 16:32:26 -05:00
Jeff MitchellandDamian Debkowski 35cef97bd4 Linter fixes PR 3 (#4415)
* Linter fixes

* fix(bsr): update test to register TEST protocol once

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-02-16 08:30:16 -05:00
Jeff Mitchell 4068829509 Merge pull request #4401 from hashicorp/jefferai-linter-fixes
Fix linter warnings, parts 1 and 2
2024-02-14 17:55:41 -05:00
Jeff Mitchell 49803e653c Linter fixes numero 2 (#4408) 2024-02-14 17:14:31 -05:00
Jeff Mitchell 25bce9e8ff Fix linter warnings 2024-02-13 15:50:11 -05:00
Jim 3af259ff69 chore: update deps (#4394)
* chore: update deps

* tests: update sqlmock tests for breaking chg

* tests (handlers): sort grants in checkEqualGrants(...)

sort the expected and got grants in
checkEqualGrants(...) to make the test more
deterministic.

* tests (asciicast): update backspace enc in TestEventMarshal(...)
2024-02-13 10:50:06 -05:00
Johan Brandhorst-Satzkorn d9c6de4e8b deps: update runc dependency (#4349)
Fixes GHSA-xr7r-f8xq-vfvv
2024-02-01 13:19:24 -08:00
Michael Li 25dff3322a test: Randomize docker network name (#4306)
We were observing TestAuthorizeSession_Errors failing in CI due to it complaining that a docker network with name TestAuthorizeSession_Errors already exists. Looking deeper, it turns out that internal/daemon/controller/handlers/targets/tcp and internal/daemon/controller/handlers/targets/ssh both have a test with that same name, and for some reason, they often run on top of each other, causing one of the tests to fail to create a docker network.

To prevent any conflicts with tests that have the same name, this commit randomizes the network name that is created.
2024-01-29 09:49:57 -05:00
Jim 6a37c93d77 fix: properly handle rows.Err() (#4261)
* fix (auth): properly handle rows.Err()

* fix (auth/ldap): properly handle rows.Err()

* fix (auth/oidc): properly handle rows.Err()

* fix (auth/password): properly handle rows.Err()

* fix (authtoken): properly handle rows.Err()

* fix (credential): properly handle rows.Err()

* fix (credential/static): properly handle rows.Err()

* fix (credential/vault): properly handle rows.Err()

* fix (db): properly handle rows.Err()

* fix (db/schema): properly handle rows.Err()

* fix (db/migrations): properly handle rows.Err()

* fix (host): properly handle rows.Err()

* fix (host/plugin): properly handle rows.Err()

* fix (host/static): properly handle rows.Err()

* fix (iam): properly handle rows.Err()

* fix (kms): properly handle rows.Err()

* fix (oplog): properly handle rows.Err()

* fix (pagination/purge): properly handle rows.Err()

* fix (plugin): properly handle rows.Err()

* fix (job/scheduler): properly handle rows.Err()

* fix (server): properly handle rows.Err()

* fix (session): properly handle rows.Err()

* fix (target): properly handle rows.Err()
2024-01-22 14:03:40 -05:00
Jeff Mitchell 9332179a01 Remove the deprecated old KMS worker auth mechanism (#3935)
This has been superceded by the nodeenrollment-based KMS worker auth
mechanism. This commit only removes the ability to connect with this
mechanism; some upgrade logic will remain intact for a bit and
can be removed later.
2024-01-12 11:58:12 -05:00
Johan Brandhorst-Satzkorn 1303f7c363 Fix linter warnings (#4219) 2024-01-05 07:43:22 -08:00
Johan Brandhorst-Satzkorn 6238a533b0 internal/credential: sort public_id descending
The previous sort would run the risk of missing items which
collide on update or create times because of the compound
comparison using strictly less than for both the timestamp
and the public_id. Sorting both descending avoids thi issue.
2024-01-05 07:43:21 -08:00
Johan Brandhorst-Satzkorn 5ef1a39727 internal/credential: use simpler query arg 2024-01-05 07:43:21 -08:00
Johan Brandhorst-Satzkorn 12403d49ad internal/credential: validate token resource type 2024-01-05 07:43:21 -08:00
Johan Brandhorst-Satzkorn 7190042f8e internal/credential: 🤦 2024-01-05 07:43:21 -08:00
Johan Brandhorst-Satzkorn a7ebb7a3ef internal/credential: add store pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 3197ab763f internal/credential/static: add store pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 7efb43ac03 internal/credential/vault: add store pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn dc0b8cfc62 internal/credential: fix some test typos 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 48e8d454a4 internal/credential: use correct resource in tests (#4128) 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn c6e80dbe32 internal/credential: add library pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 1337a57674 internal/credential/vault: add pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn a9e0d6693d internal/credential/static: simplify list parsing (#4112)
Using a struct for the list parsing simplifies the
logic and makes the mapping between the result and
the Go type safer.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 6b2f5fe29f internal/credential: fix comment (#4106) 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 9f6ac602ee internal/handlers: add credential pagination support 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn fa898fe87b internal/credential: add pagination service functions
The new service functions are used for various stages of pagination.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn e0092999de internal/credential/static: add pagination support
Refactors ListCredentials and adds the new ListCredentialsRefresh
method to the Repository, supporting pagination
of credentials. Also adds the EstimateCount and
ListDeletedCredentialIds methods used during
pagination.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn a470f4c0c3 internal/credential: add pagination options
The new options are used in future commits for paginating list results.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 0d39456418 internal/boundary: add GetResourceType to Resource
The resource type method is used to automatically
create refresh tokens from a resource when that
resource is the last item returned in a page.

This also renames the iam domain ResourceType method
to GetResourceType to align with the new method.
2024-01-05 07:43:19 -08:00
Jeff Mitchell 263660a7cb Add support for templating key_id (#4215) 2024-01-04 21:19:36 -05:00
b6df5693b5 Add generic read/update/delete commands (#3992)
* Add generic read/update/delete commands

This adds three generic commands that use the resource prefix to
determine the subcommand to run and pass through args over to that
subcommand. Since this occurs very early on and to avoid loading
essentially every internal resource package, I moved subtype definitions
to globals.

This replaces #3967

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

* De-duplicate Subtype code (#4031)

Co-authored-by: Timothy Messier <tim.messier@gmail.com>

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Timothy Messier <tim.messier@gmail.com>
2023-11-15 19:55:46 -05:00
Michael Gaffney d638378d57 fix(vault): Set the Vault TLS client options if specified
Two Vault client settings were not being properly used when constructing
a Vault client.

The `TLS Skip Verify` setting was only being set if a `CA Cert` was also
configured. This fix sets the `TLS Skip Verify` when configured
regardless of other settings. Closes #3961.

The `TLS Server Name` setting was never being set. Bad programmers. This
fix now sets it on the Vault client if the Vault Credential Store has
been configured to use a value for this setting. Closes #3962.
2023-11-02 16:13:41 -04:00
Jeff Mitchell a9e372930d Revert 0bf60996c5 (#3990)
Post-merge some issues were discovered with the ways typing is used for
proto reflection. This will be reworked without moving the subtypes
around.
2023-11-02 16:03:47 -04:00
Jeff MitchellandJohan Brandhorst-Satzkorn 0bf60996c5 Add generic read/update/delete commands (#3967)
* Add generic read/update/delete commands

This adds three generic commands that use the resource prefix to
determine the subcommand to run and pass through args over to that
subcommand. Since this occurs very early on and to avoid loading
essentially every internal resource package, I moved subtype definitions
to globals.

* Update main.go

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

* Update changelog and remove another deprecated command

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-11-01 16:24:16 -04:00
Johan Brandhorst-Satzkorn 6081b6c58d internal/credential: simplify TestObject test helper (#3899)
The TestObject test helper previously returned an error,
but it's easier to have it perform the error check itself,
as it conventionally done with test helpers.
2023-10-30 11:03:04 -07:00
dani c89777de41 Expose Valid Principals for Vault SSH Signed Certs (#3791)
* allow additional valid principals when creating vault ssh signed cert cred lib

* add additional_valid_principals field to credential libraries documentation page
2023-10-24 12:44:51 -04:00
Jeff Mitchell eb20b80c71 Migrate some credential bits around (#3864) 2023-10-18 17:48:44 -04:00
Johan Brandhorst-Satzkorn 2e0587bff0 credential: fix lint errors (#3746)
The existing pattern was subject to a bug whereby a lock
value was copied every time the value was passed around.
This was happening because of the use of an embedded
protobuf type. To avoid copying a mutex, use a pointer
type in the embedding.

Also fixes a few linter warnings complaining about the use
of unkeyed literals.
2023-09-19 09:17:42 -07:00
Irena Rindos 9733a250fa refact(event): move observability/event to event (#3704) 2023-09-12 08:15:34 -04:00