Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support disabling private key reuse in certificate renewal #10103

Open
2 tasks done
OrkhanAlikhanov opened this issue Aug 31, 2023 · 9 comments
Open
2 tasks done

Support disabling private key reuse in certificate renewal #10103

OrkhanAlikhanov opened this issue Aug 31, 2023 · 9 comments
Assignees
Labels
area/acme kind/proposal a proposal that needs to be discussed.

Comments

@OrkhanAlikhanov
Copy link

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you expect to see?

We are getting urn:ietf:params:acme:error:badCSR :: Encountered errors validating CSR; errors=[CSR_PUBLIC_KEY_REUSE_NOT_ALLOWED] error while traefik tries to renew certs. Basically acme provider refuses to do renewal due to key reuse. Looking at the code, it seems like there is no option to avoid that:

renewedCert, err := client.Certificate.Renew(certificate.Resource{
Domain: cert.Domain.Main,
PrivateKey: cert.Key,
Certificate: cert.Certificate.Certificate,
}, true, ocspMustStaple, p.PreferredChain)

I think there should be an option to control this.

@nmengin
Copy link
Contributor

nmengin commented Sep 4, 2023

Hello @OrkhanAlikhanov,

Thanks for reaching out.

Could you provide a minimal reproducible case (for instance, full Kubernetes manifest to reproduce the issue)?
In the meantime, if any community member can help us find verified steps to reproduce, we would love the help.

@OrkhanAlikhanov
Copy link
Author

Thanks! This is actually not a bug but a feature request. I believe there should be a way to control private key reuse. Similar feature was implemented in caddyserver/certmagic#237 recently.

cc: @ldez

@ldez
Copy link
Member

ldez commented Sep 4, 2023

even if it's not a bug, I'm interested in a more detailed use case when the error occurs.

@OrkhanAlikhanov
Copy link
Author

Company's internal ACME declines renewing the certificate as traefik uses the same private key for the getting the new certificate.

@ldez
Copy link
Member

ldez commented Sep 4, 2023

what is the interest of not reusing private keys if you are using an internal ACME implementation?

@OrkhanAlikhanov
Copy link
Author

Well the internal ACME implementation is out of our team's control. I guess as a security precaution they don't allow private key reuse.

@ldez
Copy link
Member

ldez commented Sep 4, 2023

I don't understand the security advantages when using an internal ACME server 🤔

In all cases, it's something related to lego and not really to traefik itself.

@OrkhanAlikhanov
Copy link
Author

Just to add to the discussion:

cert-manager.io has rotationPolicy setting. From their docs:

Some issuers, like the built-in Venafi issuer, may disallow re-using private keys. If this is the case, you must explicitly configure the rotationPolicy: Always setting for each of your Certificate objects accordingly.

@OrkhanAlikhanov
Copy link
Author

I don't understand the security advantages when using an internal ACME server 🤔

@ldez It turned out that ACME server also issues public facing certificates, so it makes sense to prevent private key reuse from our ACME team's perspective.

In all cases, it's something related to lego and not really to traefik itself.

@ldez I didn't understand how it's related to lego, from the code I see that traefik instructs lego to renew the certificate using its old private key and lego just attempts that. Shouldn't we update traefik so that it does not reuse old private key when renewing? Just like cert-manager.io's rotationPolicy setting.

I've returned back to this issue because every quarter, I manually remove old certificates from acme.json and restart traefik so that it issues certificates again without reusing private keys.

@ldez ldez self-assigned this Dec 18, 2023
@kevinpollet kevinpollet added kind/proposal a proposal that needs to be discussed. and removed status/0-needs-triage labels Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/acme kind/proposal a proposal that needs to be discussed.
Projects
None yet
Development

No branches or pull requests

5 participants