Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions internal/rotate_est.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,20 @@ func verifyNewCert(curCert, newCert *x509.Certificate) error {
if !bytes.Equal(curCert.RawSubject, newCert.RawSubject) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github does not allow you to comment on commit messages. However, the commit needs a couple things:

  • A Signed-off-by
  • A description of the change. Your PR header is good - you could just use that content in the commit message

Our security engineer is on holiday this week. When he gets back, we'll have him take a close look.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon my commit etiquette. Fixed! :)
Let's wait for the security engineer then, thanks!

return errors.New("New cert's subject does not match current cert's")
}
foundDigitalSig := false

foundDigitalSig := newCert.KeyUsage & x509.KeyUsageDigitalSignature != 0
foundClientAuth := false
for _, ext := range newCert.Extensions {
if !foundDigitalSig && ext.Id.Equal(oidKeyUsage) {
foundDigitalSig = bytes.Equal(ext.Value, asn1DigitalSignature)
} else if !foundClientAuth && ext.Id.Equal(oidExtendedKeyUsage) {
foundClientAuth = bytes.Equal(ext.Value, asn1TlsWebClientAuth)

for _, eku := range newCert.ExtKeyUsage {
if eku == x509.ExtKeyUsageClientAuth {
foundClientAuth = true
break
}
}

if foundDigitalSig && foundClientAuth {
return nil
}

return errors.New("Missing required extensions for Digital Signature and/or TLS Web Client Authentication")
}