add remote signer api and e2e test of it (#320)
This commit is contained in:
parent
d8b345eeb7
commit
82ac6a5fff
3 changed files with 72 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/tg123/remotesigner/grpcsigner"
|
||||
"github.com/tg123/sshpiper/libplugin/ioconn"
|
||||
"google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
|
|
@ -60,6 +61,8 @@ type SshPiperPluginConfig struct {
|
|||
PipeStartCallback func(conn ConnMetadata)
|
||||
|
||||
PipeErrorCallback func(conn ConnMetadata, err error)
|
||||
|
||||
GrpcRemoteSignerFactory grpcsigner.SignerFactory
|
||||
}
|
||||
|
||||
type SshPiperPlugin interface {
|
||||
|
|
@ -99,6 +102,14 @@ func NewFromGrpc(config SshPiperPluginConfig, grpc *grpc.Server, listener net.Li
|
|||
|
||||
RegisterSshPiperPluginServer(s.grpc, s)
|
||||
|
||||
if config.GrpcRemoteSignerFactory != nil {
|
||||
gs, err := grpcsigner.NewSignerServer(config.GrpcRemoteSignerFactory)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grpcsigner.RegisterSignerServer(s.grpc, gs)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue