fixing recovery from x/golang/crypto panics

This commit is contained in:
Chris Hoffman 2017-07-27 21:00:31 -04:00
parent 935b6d7b5c
commit d404dfc494
1 changed files with 10 additions and 0 deletions

View File

@ -389,6 +389,16 @@ func (b *backend) calculateTTL(data *framework.FieldData, role *sshRole) (time.D
}
func (b *creationBundle) sign() (retCert *ssh.Certificate, retErr error) {
defer func() {
if r := recover(); r != nil {
errMsg, ok := r.(string)
if ok {
retCert = nil
retErr = errors.New(errMsg)
}
}
}()
serialNumber, err := certutil.GenerateSerialNumber()
if err != nil {
return nil, err