open-vault/sdk/logical
John-Michael Faircloth 1cf74e1179
feature: multiplexing support for database plugins (#14033)
* 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

Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>
2022-02-17 08:50:33 -06:00
..
audit.go Allow plugins to submit audit requests/responses via extended SystemView (#6777) 2019-05-22 18:52:53 -04:00
auth.go Tokenhelper v2 (#6662) 2019-06-14 10:17:04 -04:00
connection.go Add remote_port in the audit logs when it is available (#12790) 2022-01-26 15:47:15 -08:00
controlgroup.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
error.go backport error changes from ent PR (#12926) 2021-10-26 10:11:24 -06:00
identity.pb.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
identity.proto Local aliases OSS patch (#12848) 2021-10-15 15:20:00 -04:00
lease.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
lease_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
logical.go Improve code comments on logical.Paths object (#14080) 2022-02-15 11:00:48 -08:00
logical_storage.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
managed_key.go OSS of the managed key consumer pattern (#13940) 2022-02-07 15:01:42 -06:00
plugin.pb.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
plugin.proto Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
request.go reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
response.go VAULT-1564 report in-flight requests (#13024) 2021-12-08 17:34:42 -05:00
response_util.go remove nil response to 404 translation for PatchOperation (#13167) 2021-11-23 13:57:22 -05:00
response_util_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
secret.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
storage.go Exit ScanView if context has been cancelled (#7419) 2019-09-04 09:18:19 -04:00
storage_inmem.go Add user configurable password policies available to secret engines (#8637) 2020-05-27 12:28:00 -06:00
storage_inmem_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
storage_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
storage_view.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
system_view.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
testing.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
token.go VAULT-1564 report in-flight requests (#13024) 2021-12-08 17:34:42 -05:00
token_test.go VAULT-1564 report in-flight requests (#13024) 2021-12-08 17:34:42 -05:00
translate_response.go Return num_uses during authentication (#12791) 2022-01-25 18:59:53 -08:00