diff --git a/logical/plugin/grpc_backend_client.go b/logical/plugin/grpc_backend_client.go index 305ee102e2e1..60ef182803a8 100644 --- a/logical/plugin/grpc_backend_client.go +++ b/logical/plugin/grpc_backend_client.go @@ -3,6 +3,7 @@ package plugin import ( "context" "errors" + "math" "sync/atomic" "google.golang.org/grpc" @@ -195,6 +196,9 @@ func (b *backendGRPCPluginClient) Setup(ctx context.Context, config *logical.Bac // Register the server in this closure. serverFunc := func(opts []grpc.ServerOption) *grpc.Server { + opts = append(opts, grpc.MaxRecvMsgSize(math.MaxInt32)) + opts = append(opts, grpc.MaxSendMsgSize(math.MaxInt32)) + s := grpc.NewServer(opts...) pb.RegisterSystemViewServer(s, sysView) pb.RegisterStorageServer(s, storage) diff --git a/logical/plugin/serve.go b/logical/plugin/serve.go index d7dc867b41f8..9dd57f8d7aab 100644 --- a/logical/plugin/serve.go +++ b/logical/plugin/serve.go @@ -2,8 +2,11 @@ package plugin import ( "crypto/tls" + "math" "os" + "google.golang.org/grpc" + log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/helper/pluginutil" @@ -54,7 +57,11 @@ func Serve(opts *ServeOpts) error { Logger: logger, // A non-nil value here enables gRPC serving for this plugin... - GRPCServer: plugin.DefaultGRPCServer, + GRPCServer: func(opts []grpc.ServerOption) *grpc.Server { + opts = append(opts, grpc.MaxRecvMsgSize(math.MaxInt32)) + opts = append(opts, grpc.MaxSendMsgSize(math.MaxInt32)) + return plugin.DefaultGRPCServer(opts) + }, } if !pluginutil.GRPCSupport() {