diff --git a/builtin/logical/database/dbplugin/client.go b/builtin/logical/database/dbplugin/client.go index 8cfc3aad00..0c095f8910 100644 --- a/builtin/logical/database/dbplugin/client.go +++ b/builtin/logical/database/dbplugin/client.go @@ -29,7 +29,7 @@ func (dc *DatabasePluginClient) Close() error { // newPluginClient returns a databaseRPCClient with a connection to a running // plugin. The client is wrapped in a DatabasePluginClient object to ensure the // plugin is killed on call of Close(). -func newPluginClient(sys pluginutil.Wrapper, pluginRunner *pluginutil.PluginRunner) (Database, error) { +func newPluginClient(sys pluginutil.RunnerUtil, pluginRunner *pluginutil.PluginRunner) (Database, error) { // pluginMap is the map of plugins we can dispense. var pluginMap = map[string]plugin.Plugin{ "database": new(DatabasePlugin), diff --git a/builtin/logical/database/dbplugin/plugin.go b/builtin/logical/database/dbplugin/plugin.go index 21812423c1..941f7aa04d 100644 --- a/builtin/logical/database/dbplugin/plugin.go +++ b/builtin/logical/database/dbplugin/plugin.go @@ -31,7 +31,7 @@ type Statements struct { // PluginFactory is used to build plugin database types. It wraps the database // object in a logging and metrics middleware. -func PluginFactory(pluginName string, sys pluginutil.LookWrapper, logger log.Logger) (Database, error) { +func PluginFactory(pluginName string, sys pluginutil.LookRunnerUtil, logger log.Logger) (Database, error) { // Look for plugin in the plugin catalog pluginRunner, err := sys.LookupPlugin(pluginName) if err != nil { diff --git a/helper/pluginutil/runner.go b/helper/pluginutil/runner.go index 6a8df73855..0617f76245 100644 --- a/helper/pluginutil/runner.go +++ b/helper/pluginutil/runner.go @@ -19,15 +19,15 @@ type Looker interface { // Wrapper interface defines the functions needed by the runner to wrap the // metadata needed to run a plugin process. This includes looking up Mlock // configuration and wrapping data in a respose wrapped token. -type Wrapper interface { +type RunnerUtil interface { ResponseWrapData(data map[string]interface{}, ttl time.Duration, jwt bool) (*wrapping.ResponseWrapInfo, error) MlockEnabled() bool } // LookWrapper defines the functions for both Looker and Wrapper -type LookWrapper interface { +type LookRunnerUtil interface { Looker - Wrapper + RunnerUtil } // PluginRunner defines the metadata needed to run a plugin securely with @@ -43,7 +43,7 @@ type PluginRunner struct { // Run takes a wrapper instance, and the go-plugin paramaters and executes a // plugin. -func (r *PluginRunner) Run(wrapper Wrapper, pluginMap map[string]plugin.Plugin, hs plugin.HandshakeConfig, env []string) (*plugin.Client, error) { +func (r *PluginRunner) Run(wrapper RunnerUtil, pluginMap map[string]plugin.Plugin, hs plugin.HandshakeConfig, env []string) (*plugin.Client, error) { // Get a CA TLS Certificate certBytes, key, err := GenerateCert() if err != nil { diff --git a/helper/pluginutil/tls.go b/helper/pluginutil/tls.go index ee0c54d89d..05804a33bb 100644 --- a/helper/pluginutil/tls.go +++ b/helper/pluginutil/tls.go @@ -97,7 +97,7 @@ func CreateClientTLSConfig(certBytes []byte, key *ecdsa.PrivateKey) (*tls.Config // WrapServerConfig is used to create a server certificate and private key, then // wrap them in an unwrap token for later retrieval by the plugin. -func WrapServerConfig(sys Wrapper, certBytes []byte, key *ecdsa.PrivateKey) (string, error) { +func WrapServerConfig(sys RunnerUtil, certBytes []byte, key *ecdsa.PrivateKey) (string, error) { rawKey, err := x509.MarshalECPrivateKey(key) if err != nil { return "", err