Check for error creating signers.

This commit is contained in:
Mariano Cano 2019-08-01 18:15:04 -07:00
parent 004ea12212
commit 390aecca0b

View file

@ -87,7 +87,12 @@ func (a *Authority) SignSSH(key ssh.PublicKey, opts provisioner.SSHOptions, sign
code: http.StatusNotImplemented, code: http.StatusNotImplemented,
} }
} }
signer, err = ssh.NewSignerFromSigner(a.sshCAUserCertSignKey) if signer, err = ssh.NewSignerFromSigner(a.sshCAUserCertSignKey); err != nil {
return nil, &apiError{
err: errors.Wrap(err, "signSSH: error creating signer"),
code: http.StatusInternalServerError,
}
}
case ssh.HostCert: case ssh.HostCert:
if a.sshCAHostCertSignKey == nil { if a.sshCAHostCertSignKey == nil {
return nil, &apiError{ return nil, &apiError{
@ -95,7 +100,12 @@ func (a *Authority) SignSSH(key ssh.PublicKey, opts provisioner.SSHOptions, sign
code: http.StatusNotImplemented, code: http.StatusNotImplemented,
} }
} }
signer, err = ssh.NewSignerFromSigner(a.sshCAHostCertSignKey) if signer, err = ssh.NewSignerFromSigner(a.sshCAHostCertSignKey); err != nil {
return nil, &apiError{
err: errors.Wrap(err, "signSSH: error creating signer"),
code: http.StatusInternalServerError,
}
}
default: default:
return nil, &apiError{ return nil, &apiError{
err: errors.Errorf("unexpected ssh certificate type: %d", cert.CertType), err: errors.Errorf("unexpected ssh certificate type: %d", cert.CertType),