Skip to content

Commit

Permalink
Clone the certificate in case we need to look at it later.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed Aug 25, 2021
1 parent 568fce2 commit 833d28c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/sshRenew.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package api

import (
"crypto/x509"
"net/http"
"time"

Expand Down Expand Up @@ -85,7 +86,11 @@ func (h *caHandler) renewIdentityCertificate(r *http.Request, notBefore, notAfte
return nil, nil
}

cert := r.TLS.PeerCertificates[0]
// Clone the certificate as we can modify it.
cert, err := x509.ParseCertificate(r.TLS.PeerCertificates[0].Raw)
if err != nil {
return nil, errors.Wrap(err, "error parsing client certificate")
}

// Enforce the cert to match another certificate, for example an ssh
// certificate.
Expand Down

0 comments on commit 833d28c

Please sign in to comment.