Skip to content

step ca renew fails when existing certificate doesn't have clientAuth extended attribute #566

Open
@frebib

Description

@frebib

Subject of the issue

Issuing an immediately attempting to renew the certificate causes the following error

frebib@:~$ STEPPATH=/tmp/step step ca certificate $HOSTNAME /tmp/step/$HOSTNAME.crt /tmp/step/$HOSTNAME.key --token $TOKEN
✔ CA: https://<snip>/1.0/sign
✔ Certificate: /tmp/step/<snip>.crt
✔ Private Key: /tmp/step/<snip>.key
frebib@:~$ STEPPATH=/tmp/step step ca renew /tmp/step/$HOSTNAME.crt /tmp/step/$HOSTNAME.key
error renewing certificate: client.Renew; client POST https://<snip>/renew failed: Post "https://<snip>/renew": remote error: tls: bad certificate

step-ca logs:

2021/10/17 11:52:29 /usr/local/go/src/net/http/server.go:3157: http: TLS handshake error from <snip>: tls: failed to verify client certificate: x509: certificate specifies an incompatible key usage

I'm using a "pretty much default" JWK provisioner, but with this template, which I notably removed clientAuth from:

{
    "subject": {{ toJson .Subject }},
    "sans": {{ toJson .SANs }},
{{- if typeIs "*rsa.PublicKey" .Insecure.CR.PublicKey }}
    "keyUsage": ["keyEncipherment", "digitalSignature"],
{{- else }}
    "keyUsage": ["digitalSignature"],
{{- end }}
    "extKeyUsage": ["serverAuth"]
}

I expect that this is "that's just how it works" and my lack of understanding of some of the nuances of x509. It would probably make sense to spit out a client warning/error, though.

Your environment

  • OS - Debian
  • Version - Whatever the latest is at time of writing (0.7.5?)

Steps to reproduce

See above

Expected behaviour

Either a warning, or the certificate renews without problem

Actual behaviour

Non-descript error on the client side, slightly more information in the server logs. Certificate is not renewed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions