More wrapped errors - PKI, SSH, Transit (#19631)

* Add missing wrapped errors in PKI

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add missing wrapped errors in SSH

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add missing wrapped errors in Transit

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This commit is contained in:
Alexander Scheel 2023-03-20 12:00:49 -04:00 committed by GitHub
parent 2217731266
commit 411705d723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -1080,7 +1080,7 @@ func writeSpecificRevocationDeltaWALs(sc *storageContext, hyphenSerial string, c
var walInfo deltaWALInfo
walEntry, err := logical.StorageEntryJSON(pathPrefix+hyphenSerial, walInfo)
if err != nil {
return fmt.Errorf("unable to create delta CRL WAL entry")
return fmt.Errorf("unable to create delta CRL WAL entry: %w", err)
}
if err = sc.Storage.Put(sc.Context, walEntry); err != nil {
@ -1093,7 +1093,7 @@ func writeSpecificRevocationDeltaWALs(sc *storageContext, hyphenSerial string, c
lastRevSerial := lastWALInfo{Serial: colonSerial}
lastWALEntry, err := logical.StorageEntryJSON(pathPrefix+deltaWALLastRevokedSerialName, lastRevSerial)
if err != nil {
return fmt.Errorf("unable to create last delta CRL WAL entry")
return fmt.Errorf("unable to create last delta CRL WAL entry: %w", err)
}
if err = sc.Storage.Put(sc.Context, lastWALEntry); err != nil {
return fmt.Errorf("error saving last delta CRL WAL entry: %w", err)

View File

@ -1428,7 +1428,7 @@ func (sc *storageContext) fetchRevocationInfo(serial string) (*revocationInfo, e
if revEntry != nil {
err = revEntry.DecodeJSON(&revInfo)
if err != nil {
return nil, fmt.Errorf("error decoding existing revocation info")
return nil, fmt.Errorf("error decoding existing revocation info: %w", err)
}
}

View File

@ -501,7 +501,7 @@ func (b *creationBundle) sign() (retCert *ssh.Certificate, retErr error) {
// prepare certificate for signing
nonce := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, nonce); err != nil {
return nil, fmt.Errorf("failed to generate signed SSH key: error generating random nonce")
return nil, fmt.Errorf("failed to generate signed SSH key: error generating random nonce: %w", err)
}
certificate := &ssh.Certificate{
Serial: serialNumber.Uint64(),

View File

@ -365,7 +365,7 @@ func (b *backend) pathPolicyRead(ctx context.Context, req *logical.Request, d *f
}
derived, err := p.GetKey(context, ver, 32)
if err != nil {
return nil, fmt.Errorf("failed to derive key to return public component")
return nil, fmt.Errorf("failed to derive key to return public component: %w", err)
}
pubKey := ed25519.PrivateKey(derived).Public().(ed25519.PublicKey)
key.PublicKey = base64.StdEncoding.EncodeToString(pubKey)