Add support for using CA certs for upstream ssh connection (#210)
This commit is contained in:
parent
36f03e7a74
commit
13fcc8c0a8
12 changed files with 473 additions and 250 deletions
|
|
@ -332,6 +332,24 @@ func (g *GrpcPlugin) createUpstream(conn ssh.ConnMetadata, challengeCtx ssh.Chal
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if caPublicKeyByte := a.GetCaPublicKey(); caPublicKeyByte != nil {
|
||||
caPublicKey, _, _, _, err := ssh.ParseAuthorizedKey(caPublicKeyByte)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
caCertificate, ok := caPublicKey.(*ssh.Certificate)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Failed to convert the caPublicKey to an ssh.Certificate")
|
||||
}
|
||||
|
||||
private, err = ssh.NewCertSigner(caCertificate, private)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
config.Auth = append(config.Auth, ssh.PublicKeys(private))
|
||||
auth = append(auth, "privatekey")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue