open-vault/vault
John-Michael Faircloth c6e64f51b6
feature: multiplexing: handle error plugin shutdown (#14105)
* feat: DB plugin multiplexing (#13734)

* WIP: start from main and get a plugin runner from core

* move MultiplexedClient map to plugin catalog
- call sys.NewPluginClient from PluginFactory
- updates to getPluginClient
- thread through isMetadataMode

* use go-plugin ClientProtocol interface
- call sys.NewPluginClient from dbplugin.NewPluginClient

* move PluginSets to dbplugin package
- export dbplugin HandshakeConfig
- small refactor of PluginCatalog.getPluginClient

* add removeMultiplexedClient; clean up on Close()
- call client.Kill from plugin catalog
- set rpcClient when muxed client exists

* add ID to dbplugin.DatabasePluginClient struct

* only create one plugin process per plugin type

* update NewPluginClient to return connection ID to sdk
- wrap grpc.ClientConn so we can inject the ID into context
- get ID from context on grpc server

* add v6 multiplexing  protocol version

* WIP: backwards compat for db plugins

* Ensure locking on plugin catalog access

- Create public GetPluginClient method for plugin catalog
- rename postgres db plugin

* use the New constructor for db plugins

* grpc server: use write lock for Close and rlock for CRUD

* cleanup MultiplexedClients on Close

* remove TODO

* fix multiplexing regression with grpc server connection

* cleanup grpc server instances on close

* embed ClientProtocol in Multiplexer interface

* use PluginClientConfig arg to make NewPluginClient plugin type agnostic

* create a new plugin process for non-muxed plugins

* feat: plugin multiplexing: handle plugin client cleanup (#13896)

* use closure for plugin client cleanup

* log and return errors; add comments

* move rpcClient wrapping to core for ID injection

* refactor core plugin client and sdk

* remove unused ID method

* refactor and only wrap clientConn on multiplexed plugins

* rename structs and do not export types

* Slight refactor of system view interface

* Revert "Slight refactor of system view interface"

This reverts commit 73d420e5cd2f0415e000c5a9284ea72a58016dd6.

* Revert "Revert "Slight refactor of system view interface""

This reverts commit f75527008a1db06d04a23e04c3059674be8adb5f.

* only provide pluginRunner arg to the internal newPluginClient method

* embed ClientProtocol in pluginClient and name logger

* Add back MLock support

* remove enableMlock arg from setupPluginCatalog

* rename plugin util interface to PluginClient

Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>

* feature: multiplexing: fix unit tests (#14007)

* fix grpc_server tests and add coverage

* update run_config tests

* add happy path test case for grpc_server ID from context

* update test helpers

* feat: multiplexing: handle v5 plugin compiled with new sdk

* add mux supported flag and increase test coverage

* set multiplexingSupport field in plugin server

* remove multiplexingSupport field in sdk

* revert postgres to non-multiplexed

* add comments on grpc server fields

* use pointer receiver on grpc server methods

* add changelog

* use pointer for grpcserver instance

* Use a gRPC server to determine if a plugin should be multiplexed

* Apply suggestions from code review

Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>

* add lock to removePluginClient

* add multiplexingSupport field to externalPlugin struct

* do not send nil to grpc MultiplexingSupport

* check err before logging

* handle locking scenario for cleanupFunc

* allow ServeConfigMultiplex to dispense v5 plugin

* reposition structs, add err check and comments

* add comment on locking for cleanupExternalPlugin

* feature: multiplexing: handle error plugin shutdown

Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>
2022-02-17 14:32:31 -06:00
..
activity feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
cluster reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
diagnose reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
external_tests SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
quotas Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
replication Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
seal Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
tokens SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
acl.go Add HTTP PATCH support to KV (#12687) 2021-10-13 15:24:31 -04:00
acl_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
acl_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
activity_log.go VAULT-1564 report in-flight requests (#13024) 2021-12-08 17:34:42 -05:00
activity_log_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
activity_log_testing_util.go Port: add client ID to TWEs in activity log [vault-3136] (#12820) 2021-10-14 09:10:59 -07:00
activity_log_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
audit.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
audit_broker.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
audit_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
audited_headers.go vault: deprecate errwrap.Wrapf() (#11577) 2021-05-11 13:12:54 -04:00
audited_headers_test.go Fix some more error shadowing issues (#12990) 2021-11-01 11:43:00 -07:00
auth.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
auth_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
barrier.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
barrier_access.go Fix compile 2018-01-19 05:31:55 -05:00
barrier_aes_gcm.go Vault-3991 Code Scanning Alerts Changes (#13667) 2022-01-14 15:35:27 -08:00
barrier_aes_gcm_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
barrier_test.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
barrier_view.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
barrier_view_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
barrier_view_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
capabilities.go Adds ability to define an inline policy and internal metadata on tokens (#12682) 2021-10-07 10:36:22 -07:00
capabilities_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
cluster.go vault: deprecate errwrap.Wrapf() (#11577) 2021-05-11 13:12:54 -04:00
cluster_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
core.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
core_metrics.go VAULT-1564 report in-flight requests (#13024) 2021-12-08 17:34:42 -05:00
core_metrics_test.go [VAULT-3252] Disallow alias creation if entity/accessor combination exists (#12747) 2021-10-14 09:52:07 -07:00
core_test.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
core_util.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
core_util_common.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
cors.go Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
counters.go [VAULT-2852] deprecate req counters in oss (#12197) 2021-07-29 10:21:40 -07:00
counters_test.go [VAULT-2852] deprecate req counters in oss (#12197) 2021-07-29 10:21:40 -07:00
custom_response_headers.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
custom_response_headers_test.go Fix some linting errors (#12860) 2021-10-18 17:29:47 -07:00
deadlock.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
dynamic_system_view.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
dynamic_system_view_test.go core: set namespace within GeneratePasswordFromPolicy (#12635) 2021-09-27 09:08:07 -07:00
expiration.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
expiration_integ_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
expiration_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
expiration_testing_util_common.go [VAULT-1981] Add OSS changes (#11999) 2021-07-06 17:12:24 -05:00
expiration_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
generate_root.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
generate_root_recovery.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
generate_root_test.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
ha.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
ha_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
identity_lookup.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
identity_lookup_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
identity_store.go Attempt to address a data race issue within identity store - take 2 (#13476) 2021-12-22 09:51:13 -05:00
identity_store_aliases.go Support clearing an identity alias' custom_metadata (#13395) 2021-12-10 18:07:47 -05:00
identity_store_aliases_test.go Support clearing an identity alias' custom_metadata (#13395) 2021-12-10 18:07:47 -05:00
identity_store_entities.go Entities may have duplicate policies (#12812) 2021-10-22 19:28:31 -04:00
identity_store_entities_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
identity_store_group_aliases.go Refactor usages of Core in IdentityStore so they can be decoupled. (#12461) 2021-08-30 15:31:11 -04:00
identity_store_group_aliases_test.go Update group alias handling to better protect against namespace differences 2019-06-18 16:43:30 -04:00
identity_store_groups.go Refactor usages of Core in IdentityStore so they can be decoupled. (#12461) 2021-08-30 15:31:11 -04:00
identity_store_groups_test.go Fix use of identity/group endpoint to edit group by name (#10812) 2021-01-29 16:50:08 -06:00
identity_store_oidc.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
identity_store_oidc_provider.go identity/oidc: Adds proof key for code exchange (PKCE) support (#13917) 2022-02-15 12:02:22 -08:00
identity_store_oidc_provider_test.go identity/oidc: Adds proof key for code exchange (PKCE) support (#13917) 2022-02-15 12:02:22 -08:00
identity_store_oidc_provider_util.go identity/oidc: Adds proof key for code exchange (PKCE) support (#13917) 2022-02-15 12:02:22 -08:00
identity_store_oidc_test.go oidc: check for nil signing key on rotation (#13716) 2022-01-24 12:05:49 -06:00
identity_store_oidc_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
identity_store_oss.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
identity_store_schema.go Fix startup failures when aliases from a pre-1.9 vault version exist (#13169) 2021-11-16 14:56:34 -05:00
identity_store_structs.go Local aliases OSS patch (#12848) 2021-10-15 15:20:00 -04:00
identity_store_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
identity_store_upgrade.go Prevent entity alias creation when entity is in different NS than mount (#943) (#6886) 2019-06-14 12:53:00 -04:00
identity_store_util.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
init.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
init_test.go Shutdown Test Cores when Tests Complete (#10912) 2021-02-12 13:04:48 -07:00
keyring.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
keyring_test.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
lock.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
logical_cubbyhole.go vault: deprecate errwrap.Wrapf() (#11577) 2021-05-11 13:12:54 -04:00
logical_cubbyhole_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
logical_passthrough.go Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
logical_passthrough_test.go Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
logical_raw.go Enhance sys/raw to read and write values that cannot be encoded in json (#13537) 2022-01-20 07:52:53 -05:00
logical_system.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
logical_system_activity.go Port: Allow Routing to Partial Monthly Client Count From Namespaces (#13086) 2021-11-08 15:38:35 -08:00
logical_system_helpers.go OSS parts of sys/config/reload/license (#11695) 2021-06-03 10:30:30 -07:00
logical_system_integ_test.go fix fmt (#14062) 2022-02-14 18:06:02 -05:00
logical_system_paths.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
logical_system_pprof.go Add support for unauthenticated pprof access on a per-listener basis,… (#11324) 2021-04-19 14:30:59 -04:00
logical_system_quotas.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
logical_system_raft.go OSS parts of Autopilot in DR secondaries (#12014) 2021-07-08 12:30:01 -04:00
logical_system_test.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
logical_system_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
managed_key_registry.go Seal wrap storage entries of the ManagedKeyRegistry. (#13905) 2022-02-04 16:06:32 -05:00
mount.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
mount_test.go Revert "MFA (#14049)" (#14135) 2022-02-17 13:17:59 -07:00
mount_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
namespaces.go Refactor usages of Core in IdentityStore so they can be decoupled. (#12461) 2021-08-30 15:31:11 -04:00
namespaces_oss.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
password_policy_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
plugin_catalog.go feature: multiplexing: handle error plugin shutdown (#14105) 2022-02-17 14:32:31 -06:00
plugin_catalog_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
plugin_reload.go Add support to parameterize unauthenticated paths (#12668) 2021-10-13 11:51:20 -05:00
policy.go Add HTTP PATCH support to KV (#12687) 2021-10-13 15:24:31 -04:00
policy_store.go Adds ability to define an inline policy and internal metadata on tokens (#12682) 2021-10-07 10:36:22 -07:00
policy_store_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
policy_store_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
policy_test.go Add HTTP PATCH support to KV (#12687) 2021-10-13 15:24:31 -04:00
policy_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
raft.go Parallel retry join (#13606) 2022-01-17 10:33:03 -05:00
rekey.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
rekey_test.go Shutdown Test Cores when Tests Complete (#10912) 2021-02-12 13:04:48 -07:00
request_forwarding.go Fix a Deadlock on HA leadership transfer (#12691) 2021-10-04 13:55:15 -04:00
request_forwarding_rpc.go Remove another use gopsutil/host. (#13390) 2021-12-10 09:59:52 -05:00
request_forwarding_rpc_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
request_forwarding_service.pb.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
request_forwarding_service.proto Add "operator members" command to list nodes in the cluster. (#13292) 2021-11-30 14:49:58 -05:00
request_forwarding_service_grpc.pb.go Update protobuf & grpc libraries and protoc plugins (#12679) 2021-09-29 18:25:15 -07:00
request_handling.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
request_handling_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
request_handling_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
rollback.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
rollback_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
router.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
router_access.go The big one (#5346) 2018-09-17 23:03:00 -04:00
router_test.go Authenticate to "login" endpoint for non-existent mount path bug (#13162) 2021-11-22 17:06:59 -08:00
router_testing.go AWS upgrade role entries (#7025) 2019-07-05 16:55:40 -07:00
seal.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
seal_access.go Migrate built in auto seal to go-kms-wrapping (#8118) 2020-01-10 20:39:52 -05:00
seal_autoseal.go Fix a data race in the new autoseal health check (#13136) 2021-11-12 15:58:46 -06:00
seal_autoseal_test.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
seal_test.go Shamir seals now come in two varieties: legacy and new-style. (#7694) 2019-10-18 14:46:00 -04:00
seal_testing.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
seal_testing_util.go Rename master key to root key (#13324) 2021-12-06 17:12:20 -08:00
sealunwrapper.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
sealunwrapper_test.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
testing.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
testing_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
token_store.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
token_store_test.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
token_store_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
token_store_util_common.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
ui.go Customizing HTTP headers in the config file (#12485) 2021-10-13 11:06:33 -04:00
ui_test.go Fix UI custom header values (#10511) 2020-12-15 15:58:03 +01:00
util.go Removed unused methods 2017-01-03 12:51:35 -05:00
util_test.go Utility Enhancements 2016-04-05 20:32:59 -04:00
vault_version_time.go Port: add client ID to TWEs in activity log [vault-3136] (#12820) 2021-10-14 09:10:59 -07:00
version_store.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
version_store_test.go fix fmt (#14062) 2022-02-14 18:06:02 -05:00
wrapping.go SSCT Tokens Feature [OSS] (#14109) 2022-02-17 11:43:07 -08:00
wrapping_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00