Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Supporting ECC Certificates #190

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

frusdelion
Copy link

This pull request allows for the generation of both RSA and ECC CSRs, ECC being the new default.

This resolves #144

Copy link
Contributor

@munnerz munnerz left a comment

Choose a reason for hiding this comment

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

This looks great - thanks very much!

A couple of separate concerns I have with this:

  • What happens if a user wants some certificates to be ECC, and some RSA (for browser compatibility etc.). Right now we don't have the concept of a 'kube-lego class' - the closest we have is limiting kube-lego to only watch a single namespace

  • What happens if a user switches the key type after already having requested some certificates?

Can come up with an answer for what should happen in these cases? It'd also be great to have some test coverage for the second case.

default:
kl.legoKeySize = kubelego.EccKeySize
break
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do something here to detect invalid key sizes? Silently assuming defaults despite a user specifying otherwise could be dangerous.

case "521":
ks, err := strconv.ParseInt(keySize, 10, 0)
if err != nil {
kl.legoKeySize = kubelego.EccKeySize
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we return an error here instead of assuming defaults? Silently ignoring options can lead to confusion when debugging.

} else if keyType == kubelego.KeyTypeRsa {
ks, err := strconv.ParseInt(keySize, 10, 0)
if err != nil {
kl.legoKeySize = kubelego.RsaKeySize
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, can we return an error here instead of assuming defaults silently?

kl.legoKeyType = kubelego.KeyTypeEcc
break
default:
kl.legoKeyType = kubelego.KeyTypeEcc
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer not to change the default here, as I'm unsure how this would play with existing certificates.

README.md Outdated
@@ -115,6 +115,8 @@ Please note:
| `LEGO_LOG_LEVEL` | n | `info` | Set log level (`debug`, `info`, `warn` or `error`) |
| `LEGO_KUBE_ANNOTATION` | n | `kubernetes.io/tls-acme` | Set the ingress annotation used by this instance of kube-lego to get certificate for from Let's Encrypt. Allows you to run kube-lego against staging and production LE |
| `LEGO_WATCH_NAMESPACE` | n | `` | Namespace that kube-lego should watch for ingresses and services |
| `LEGO_KEY_TYPE` | n | `ecc` | Set your preferred private key type (`ecc`, `rsa`) to generate certificates with. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep rsa as the default here please

@frusdelion
Copy link
Author

frusdelion commented Jul 8, 2017

To answer the second case, the certificate will only be renewed when (1) the cert does not cover all domains, (2) it is expired or is going to expire sooner than the minimum validity setting.

Certificates provisioned before changing the key types will not trigger a certificate request.

See https://github.com/harborfront/kube-lego/blob/master/pkg/ingress/tls.go

@b
Copy link

b commented Jul 17, 2017

Anything going on with this? The functionality is quite useful.

@dgregoire
Copy link

@frusdelion still have interest in this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ECC Certificates
5 participants