Version: v1.10.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2022 License: Apache-2.0, MPL-2.0 Imports: 29 Imported by: 0




View Source
const MultiplexingCtxKey string = "multiplex_id"


View Source
var (
	// PluginMlockEnabled is the ENV name used to pass the configuration for
	// enabling mlock

	// PluginVaultVersionEnv is the ENV name used to pass the version of the
	// vault server to the plugin
	PluginVaultVersionEnv = "VAULT_VERSION"

	// PluginMetadataModeEnv is an ENV name used to disable TLS communication
	// to bootstrap mounting plugins.

	// PluginUnwrapTokenEnv is the ENV name used to pass unwrap tokens to the
	// plugin.
	PluginUnwrapTokenEnv = "VAULT_UNWRAP_TOKEN"

	// PluginCACertPEMEnv is an ENV name used for holding a CA PEM-encoded
	// string. Used for testing.
View Source
var File_sdk_helper_pluginutil_multiplexing_proto protoreflect.FileDescriptor
View Source
var PluginMultiplexing_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pluginutil.multiplexing.PluginMultiplexing",
	HandlerType: (*PluginMultiplexingServer)(nil),
	Methods: []grpc.MethodDesc{
			MethodName: "MultiplexingSupport",
			Handler:    _PluginMultiplexing_MultiplexingSupport_Handler,
	Streams:  []grpc.StreamDesc{},
	Metadata: "sdk/helper/pluginutil/multiplexing.proto",

PluginMultiplexing_ServiceDesc is the grpc.ServiceDesc for PluginMultiplexing service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)


func CtxCancelIfCanceled

func CtxCancelIfCanceled(f context.CancelFunc, ctxCanceler context.Context) chan struct{}

CtxCancelIfCanceled takes a context cancel func and a context. If the context is shutdown the cancelfunc is called. This is useful for merging two cancel functions.

func GRPCSupport

func GRPCSupport() bool

GRPCSupport defaults to returning true, unless VAULT_VERSION is missing or it fails to meet the version constraint.

func InMetadataMode

func InMetadataMode() bool

InMetadataMode returns true if the plugin calling this function is running in metadata mode.

func MultiplexingSupported

func MultiplexingSupported(ctx context.Context, cc grpc.ClientConnInterface) (bool, error)

func OptionallyEnableMlock

func OptionallyEnableMlock() error

OptionallyEnableMlock determines if mlock should be called, and if so enables mlock.

func RegisterPluginMultiplexingServer

func RegisterPluginMultiplexingServer(s grpc.ServiceRegistrar, srv PluginMultiplexingServer)


type LookRunnerUtil

type LookRunnerUtil interface {

LookRunnerUtil defines the functions for both Looker and Wrapper

type Looker

type Looker interface {
	LookupPlugin(context.Context, string, consts.PluginType) (*PluginRunner, error)

Looker defines the plugin Lookup function that looks into the plugin catalog for available plugins and returns a PluginRunner

type MultiplexingSupportRequest

type MultiplexingSupportRequest struct {
	// contains filtered or unexported fields

func (*MultiplexingSupportRequest) Descriptor deprecated

func (*MultiplexingSupportRequest) Descriptor() ([]byte, []int)

Deprecated: Use MultiplexingSupportRequest.ProtoReflect.Descriptor instead.

func (*MultiplexingSupportRequest) ProtoMessage

func (*MultiplexingSupportRequest) ProtoMessage()

func (*MultiplexingSupportRequest) ProtoReflect

func (*MultiplexingSupportRequest) Reset

func (x *MultiplexingSupportRequest) Reset()

func (*MultiplexingSupportRequest) String

func (x *MultiplexingSupportRequest) String() string

type MultiplexingSupportResponse

type MultiplexingSupportResponse struct {
	Supported bool `protobuf:"varint,1,opt,name=supported,proto3" json:"supported,omitempty"`
	// contains filtered or unexported fields

func (*MultiplexingSupportResponse) Descriptor deprecated

func (*MultiplexingSupportResponse) Descriptor() ([]byte, []int)

Deprecated: Use MultiplexingSupportResponse.ProtoReflect.Descriptor instead.

func (*MultiplexingSupportResponse) GetSupported

func (x *MultiplexingSupportResponse) GetSupported() bool

func (*MultiplexingSupportResponse) ProtoMessage

func (*MultiplexingSupportResponse) ProtoMessage()

func (*MultiplexingSupportResponse) ProtoReflect

func (*MultiplexingSupportResponse) Reset

func (x *MultiplexingSupportResponse) Reset()

func (*MultiplexingSupportResponse) String

func (x *MultiplexingSupportResponse) String() string

type PluginClient

type PluginClient interface {
	Conn() grpc.ClientConnInterface

type PluginClientConfig

type PluginClientConfig struct {
	Name            string
	PluginType      consts.PluginType
	PluginSets      map[int]plugin.PluginSet
	HandshakeConfig plugin.HandshakeConfig
	Logger          log.Logger
	IsMetadataMode  bool
	AutoMTLS        bool
	MLock           bool

type PluginMultiplexingClient

type PluginMultiplexingClient interface {
	MultiplexingSupport(ctx context.Context, in *MultiplexingSupportRequest, opts ...grpc.CallOption) (*MultiplexingSupportResponse, error)

PluginMultiplexingClient is the client API for PluginMultiplexing service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to

type PluginMultiplexingServer

type PluginMultiplexingServer interface {
	MultiplexingSupport(context.Context, *MultiplexingSupportRequest) (*MultiplexingSupportResponse, error)
	// contains filtered or unexported methods

PluginMultiplexingServer is the server API for PluginMultiplexing service. All implementations must embed UnimplementedPluginMultiplexingServer for forward compatibility

type PluginMultiplexingServerImpl

type PluginMultiplexingServerImpl struct {

	Supported bool

func (PluginMultiplexingServerImpl) MultiplexingSupport

type PluginRunner

type PluginRunner struct {
	Name           string                      `json:"name" structs:"name"`
	Type           consts.PluginType           `json:"type" structs:"type"`
	Command        string                      `json:"command" structs:"command"`
	Args           []string                    `json:"args" structs:"args"`
	Env            []string                    `json:"env" structs:"env"`
	Sha256         []byte                      `json:"sha256" structs:"sha256"`
	Builtin        bool                        `json:"builtin" structs:"builtin"`
	BuiltinFactory func() (interface{}, error) `json:"-" structs:"-"`

PluginRunner defines the metadata needed to run a plugin securely with go-plugin.

func (*PluginRunner) Run

func (r *PluginRunner) Run(ctx context.Context, wrapper RunnerUtil, pluginSets map[int]plugin.PluginSet, hs plugin.HandshakeConfig, env []string, logger log.Logger) (*plugin.Client, error)

Run takes a wrapper RunnerUtil instance along with the go-plugin parameters and returns a configured plugin.Client with TLS Configured and a wrapping token set on PluginUnwrapTokenEnv for plugin process consumption.

func (*PluginRunner) RunConfig

func (r *PluginRunner) RunConfig(ctx context.Context, opts ...RunOpt) (*plugin.Client, error)

func (*PluginRunner) RunMetadataMode

func (r *PluginRunner) RunMetadataMode(ctx context.Context, wrapper RunnerUtil, pluginSets map[int]plugin.PluginSet, hs plugin.HandshakeConfig, env []string, logger log.Logger) (*plugin.Client, error)

RunMetadataMode returns a configured plugin.Client that will dispense a plugin in metadata mode. The PluginMetadataModeEnv is passed in as part of the Cmd to plugin.Client, and consumed by the plugin process on api.VaultPluginTLSProvider.

type RunOpt

type RunOpt func(*runConfig)

func AutoMTLS

func AutoMTLS(autoMTLS bool) RunOpt

func Env

func Env(env ...string) RunOpt

func HandshakeConfig

func HandshakeConfig(hs plugin.HandshakeConfig) RunOpt

func Logger

func Logger(logger log.Logger) RunOpt

func MLock

func MLock(mlock bool) RunOpt

func MetadataMode

func MetadataMode(isMetadataMode bool) RunOpt

func PluginSets

func PluginSets(pluginSets map[int]plugin.PluginSet) RunOpt

func Runner

func Runner(wrapper RunnerUtil) RunOpt

type RunnerUtil

type RunnerUtil interface {
	NewPluginClient(ctx context.Context, config PluginClientConfig) (PluginClient, error)
	ResponseWrapData(ctx context.Context, data map[string]interface{}, ttl time.Duration, jwt bool) (*wrapping.ResponseWrapInfo, error)
	MlockEnabled() bool

RunnerUtil 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 response wrapped token. logical.SystemView implementations satisfy this interface.

type UnimplementedPluginMultiplexingServer

type UnimplementedPluginMultiplexingServer struct {

UnimplementedPluginMultiplexingServer must be embedded to have forward compatible implementations.

func (UnimplementedPluginMultiplexingServer) MultiplexingSupport

type UnsafePluginMultiplexingServer

type UnsafePluginMultiplexingServer interface {
	// contains filtered or unexported methods

UnsafePluginMultiplexingServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PluginMultiplexingServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL