You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim #235
Certificate and Secret created. I expected the ingress-shim would create and Ingress for the /.well-known/acme/ path. And since that ingress has no auth, the ACME validation would succeed. I get this behavior with k-c-m because the nginx-ingress config scoops off and redirects all /.well-known/acme/ requests to k-c-m, before they hit the per-ingress config.
I think this problem comes up because cert-manager is modifying the existing Ingress (with auth) rather than creating an Ingress of it own for the /.well-known/acme/ path (without any auth).
How to reproduce it (as minimally and precisely as possible):
Reacted by Tobias Bradtke, André Bauer, xanonid, Andres Montalban, Charles Holbrow, Jodok Batlogg, Fraser Savage, Ali Shahbour, Quentin Jaccarino, Tim Schwalbe and 5 more
I think this might be a little hairier due to the existence of many ingress controllers with various featuresets.
I know of at least one ingress controller which does not merge ingress rules with the same host (the nginxinc one).
How ingresses are merged is implementation dependent as well, so e.g. nginx might do the right tihng and apply auth to one, but not the other, but it would also be unsurprising if a similar ingress applied auth to both if it had merged them for having the same host.
I worry that the only way to handle this well with how ingress controllers currently behave is to do one of:
Have ingress specific logic for differences like this
Only support a ingress controllers which are common and behave well with whatever cert-manager chooses to do, even if some others don't
Entirely punt this to the user/ingress side of it, requiring user+ingress to be able to 'whitelist' the well-known path.
I think all of those options are somewhat reasonable. 2 seems like the best for a number of reasons, but if we're going with it, we should probably explicitly document the behaviour we expect and the ingress controllers we know work.
That being said, I don't entirely like changing behaviour of cert-manager, which should be generic, to work around an nginx-ingress-controller-specific quirk, so 3 seems a little more idealistically pretty.
I'm curious, could you make this work with 3 now by simply creating two ingress objects with the same host yourself, one with the auth annotations, and the other with the tls annotation and an arbitrary path/service which can be public (e.g. /.well-known/placeholder -> 'default-backend' or such?)
It's also worth noting you can make cert-manager create a new ingress
resource instead of modifying an existing one by setting the 'ingressClass'
field instead of 'ingress' (see:
https://github.com/jetstack/cert-manager/blob/master/pkg/apis/certmanager/v1alpha1/types.go#L258)
on your Certificate resource.
This is not the default behaviour of the ingress shim however - the shim
itself does not actually solve acme challenges, instead it just creates
Certificate resources for any ingress resource it finds that specify the
appropriate annotations. We could expose some way to switch this behaviour,
either:
1. on a per ingress basis, with some kind of new annotation on the ingress
resource
2. as a CLI flag specified to ingress-shim (so all or nothing, potentially
more limiting in multi ingress controller clusters)
On Sun, 7 Jan 2018 at 00:49, Euan Kemp ***@***.***> wrote:
I think this might be a little hairier due to the existence of many
ingress controllers with various featuresets.
I know of at least one ingress controller which does not merge ingress
rules with the same host (the nginxinc one
<https://github.com/nginxinc/kubernetes-ingress/blob/9eda8362/docs/nginx-ingress-controllers.md#the-key-differences>
).
How ingresses are merged is implementation dependent as well, so e.g.
nginx might do the right tihng and apply auth to one, but not the other,
but it would also be unsurprising if a similar ingress applied auth to both
if it had merged them for having the same host.
I worry that the only way to handle this well with how ingress controllers
currently behave is to do one of:
1. Have ingress specific logic for differences like this
2. Only support a ingress controllers which are common and behave well
with whatever cert-manager chooses to do, even if some others don't
3. Entirely punt this to the user/ingress side of it, requiring
user+ingress to be able to 'whitelist' the well-known path.
I think all of those options are somewhat reasonable. 2 seems like the
best for a number of reasons, but if we're going with it, we should
probably explicitly document the behaviour we expect and the ingress
controllers we know work.
That being said, I don't entirely like changing behaviour of cert-manager,
which should be generic, to work around an
nginx-ingress-controller-specific quirk, so 3 seems a little more
idealistically pretty.
I'm curious, could you make this work with 3 now by simply creating two
ingress objects with the same host yourself, one with the auth headers, and
the other with the tls annotation and an arbitrary path/service which can
be public (e.g. /.well-known/placeholder -> 'default-backend' or such?)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#235 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMbP0c4rSdT73LM71U6RfEd5O64eMB2ks5tIBSCgaJpZM4RVfZR>
.
Reacted by Aaron Roydhouse, Lars Solberg, Marten Bornmann, Laurent Demailly and Quentin Jaccarino
Both strategies - new Ingress or patch the existing Ingress - seem clean and valid to me. I am certainly not suggesting one is wrong or always preferred.
@munnerz an Ingress annotation to choose which 'strategy' sounds excellent, with the user being able to choose which strategy (new Ingress or patch existing Ingress) best fits the behavior of their ingress controller, without cert-manager having to pay attention or care which ingress controller implementation is being used.
I agree the CLI flag would be a bit limiting if cert-manager aims to be a global cluster service, as multiple different ingress controller implementations are likely running in the same cluster for different application requirements.
@euank I think this is option '4' :-) Don't try to accommodate ingress controller foibles, punt that by letting the user control cert-manager's behavior.
@munnerz thanks for the tip about ingressClass vs ingress, that's already great control of the strategy used. I'll try it out.
@munnerz that ingressClass / ingress strategy choice in Certificate resources is awesome! I realize that with that option I can issue certificates via http01 validation before even deploying the application or its Ingress. That's something I could only do with dns01 validation before.
An Ingress annotation equivalent to that strategy choice would still be very convenient. Especially for helm deployments, where most charts offer to inject Ingress annotations, but don't (yet :-) have an option to create cert-manager Certificate resources.
@euank@munnerz I can also confirm it works with authenticated apps under nginx-ingress, where you deploy the app with an authenticated Ingress first, then create the Certificate with ingressClass and http01. The authentication is correctly not applied to the Ingress+path that cert-manager creates, and the certificate is validated an issues, whilst the app remains authenticated. That's good news for renewals too.
So if the Ingress strategy annotation is added, you could deploy a typical helm chart, using its Ingress annotation setting, to deploy an authenticated HTTPS application.
changed the title [-]https01 is defeated by Ingress auth, cert-manager should create own Ingress[/-][+]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress[/+]on Jan 7, 2018
changed the title [-]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress[/-][+]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/+]on Jan 8, 2018
changed the title [-]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/-][+]http01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/+]on Jan 8, 2018
So it seems this issue specifically only effects people that do not want to manually configure their Certificate resources and instead use ingress-shim functionality to enable TLS on ingresses.
This again boils down to the issue of differences in ingress implementations. An annotation is a nice and easy escape hatch, and given the current default behaviour works on 'vanilla' ingresses for all ingress controllers (afaik), I think it'd be an acceptable addition.
We can pluck the ingress class value from the ingress itself, unless there's some use case for allowing a different class to be used? I'd rather not overcomplicate the API surface and make it harder to use if we can avoid it.
True. Creating a Certificate resource is the way to do this with cert-manager. The annotation comes in a different section of the documentation under 'hacks we support to make it easy for people to adopt cert-manager' 😄
These annotations allow users to e.g. deploy a stable Helm chart without forking and modifying your own version to add Certificates. Or else organizing a separate chart or deployment for the Certificate.
Also, when using nginx-ingress-controller with enabled ssl-redirect, we got http response 308 for /.well-known/acme/ urls and renewing certificates functionality doesn't work.
kube-lego managed to avoid this as you would explicitly configure the 'nginx ingress controller' as an option that worked cluster-wide. This means that we'd always create additional Ingress resources and not expose the choice (without changing CLI flags on kube-lego).
As mentioned before, an annotation to switch this behaviour would work well, but overloading annotations and pushing all this understanding onto end-users is painful.
What we need to decide to do something here:
Do we set ingressClass or ingress by default?
Set ingress by default (what we do today): works for all kinds of ingress controller, including renewal, so long as additional annotations (e.g. auth) are not specified.
Set ingressClass by default: works only for nginx-like ingress controllers out of the box, and the user will then be forced to provide an additional annotation (eg certmanager.k8s.io/acme-http01-strategy: "in-place" or certmanager.k8s.io/edit-in-place) when using an ingress controller like GCE.
Whichever we choose, we need to ensure it is well documented. Having to understand so much about what is going on under the hood defeats the point of the abstractions we're trying to create, and eventually only serves to frustrate users (as they get to the point they understand the whole flow, and now they can't force cert-manager to do exactly what they want).
We need to also bare in mind that these annotations may be used for issuers other than ACME too (e.g. CA based issuer, and the upcoming Vault issuer). These issuers won't respect or have any need for this annotation, so this really is ACME specific.
Keen to hear thoughts on this, and I'm happy to integrate a solution.
The clean abstraction only exists in an annotation-free environment (know any? 😄 ). As soon as we have any behavior annotations:
cert-manager has to be cloud-provider and/or ingress controller aware, before it can automatically do the right thing, and/or
cert-manager needs enough manual control over strategy and annotations, so that users who understand under-the-hood can tell cert-manager the correct strategy.
If we want to spare users the need to understand what they are doing, we have to build in cloud-provider and annotation-aware auto-magical behaviors, to see what cloud-provider, ingress controller, and annotation that user has decided to use, and pick the cert-manager strategy to navigate that.
And then the power users are going to want to be able to turn that auto-magical behavior off and specify exactly the strategy and annotations they want.
In my mind, cert-manager creating and deleting its own Ingress resource for validation is always the better/clean default as opposed to modifying another application's Ingress. Where it can be avoided, I'd rather keep a clean separation between cert-manager and the applications' resources.
So I personally would default to creating an Ingress. I would include the kubernetes.io/ingress.class because is pretty much blessed now it has been promoted to the stable 'kubernetes.io' namespace. I would let power users add whatever additional annotations to the Ingress they think helpful.
The for the automatical behaviour, if cert-manager detects a problem environment, like GCE, or the nginxinc ingress controller (hard I guess?). It could log and switch to modifying Ingresses by default. I see these environments as edge cases, where the Ingress model doesn't work as intended.
Specifically specifying either ingressClass or ingress is going to lock the behavior and override the default. But we could try to detect and log when the user has painted themselves into a corner. It could be enough to give them a bunch of ideas or a help-page URL in the log message whenever the validation pre-check fail.
@monotek I don't think that is true at all, rather you've suddenly a whole lot of choices and power that kube-lego never gave you. We do need good documentation and a good helm chart to make the migration and the learning curve for the new capabilities easy for people.
kube-lego only supports one issuer, one issuing protocol, one ingress controller, and one validation strategy. If that is all you need, and it works, then you're golden. If not, you're screwed. cert-manager supports multiple issuers (of multiple types), multiple protocols, multiple ingress controllers, and multiple validation strategies. Coming from kube-lego this is a bunch choices you just didn't even have before.
What I think is the problem is how to help migrating users so they don't have to think about these new choices if they are just replacing kube-lego. I think we need to improve with the helm chart to have a default install that emulates the kube-lego simplicity and makes those choices for you, defaulting to (only) way kube-lego works, e.g. creates a default ClusterIssuer for Let's Encrypt using 'http01'.
Reacted by r-divakaran-hrs, Laurent Demailly, Tuan Anh Tran, Jan Brun Rasmussen, Ilya Sotkov, Pieter Lange, Andrey Polovov and Dmitry Kirilyuk
We're running into the ingress-shim issue as well. We can manually create the certificate resource with the ingressClass: nginx spec without issue, but would like to use the ingress-shim. Is there currently a way to implement this via adding ingress-shim annotation(s) to specify NGINX as the ingress controller (Helm deploy)?
I am also running into this issue coming from kube-lego. Adding an option / annotation to make ingress-shim create the certificates with ingressClass: nginx would be awesome!
kubernetes dashboard with user authorithation need annotation
nginx.ingress.kubernetes.io/secure-backends: "true"
so acme request send to cert-pod via https...
Hi @munnerz
Is someone working on adding support for ingress annotations that switches the ingress-shim behavior ?
So that we don't need to manually create/maintain Certificate Resources
Hi, I created a certificate with the ingress-shim and edited the certificate afterwards to ingressClass: nginx. Should this work and renew the certificate with basic-auth enabled?
nginx-ingress 0.13.0 introduced no-auth-locations option with default value /.well-known/acme-challenge, so now it's possible and very easy to use nginx-ingress with basic auth + cert-manager with ingress-shim.
More details are here kubernetes/ingress-nginx#2243
Activity
euank commentedon Jan 7, 2018
I think this might be a little hairier due to the existence of many ingress controllers with various featuresets.
I know of at least one ingress controller which does not merge ingress rules with the same host (the nginxinc one).
How ingresses are merged is implementation dependent as well, so e.g. nginx might do the right tihng and apply auth to one, but not the other, but it would also be unsurprising if a similar ingress applied auth to both if it had merged them for having the same host.
I worry that the only way to handle this well with how ingress controllers currently behave is to do one of:
I think all of those options are somewhat reasonable. 2 seems like the best for a number of reasons, but if we're going with it, we should probably explicitly document the behaviour we expect and the ingress controllers we know work.
That being said, I don't entirely like changing behaviour of cert-manager, which should be generic, to work around an nginx-ingress-controller-specific quirk, so 3 seems a little more idealistically pretty.
I'm curious, could you make this work with 3 now by simply creating two ingress objects with the same host yourself, one with the auth annotations, and the other with the tls annotation and an arbitrary path/service which can be public (e.g.
/.well-known/placeholder-> 'default-backend' or such?)munnerz commentedon Jan 7, 2018
whereisaaron commentedon Jan 7, 2018
Thanks for the discussion @euank @munnerz.
Both strategies - new Ingress or patch the existing Ingress - seem clean and valid to me. I am certainly not suggesting one is wrong or always preferred.
@munnerz an Ingress annotation to choose which 'strategy' sounds excellent, with the user being able to choose which strategy (new Ingress or patch existing Ingress) best fits the behavior of their ingress controller, without
cert-managerhaving to pay attention or care which ingress controller implementation is being used.I agree the CLI flag would be a bit limiting if
cert-manageraims to be a global cluster service, as multiple different ingress controller implementations are likely running in the same cluster for different application requirements.@euank I think this is option '4' :-) Don't try to accommodate ingress controller foibles, punt that by letting the user control
cert-manager's behavior.@munnerz thanks for the tip about
ingressClassvsingress, that's already great control of the strategy used. I'll try it out.whereisaaron commentedon Jan 7, 2018
@munnerz that
ingressClass/ingressstrategy choice in Certificate resources is awesome! I realize that with that option I can issue certificates via http01 validation before even deploying the application or its Ingress. That's something I could only do with dns01 validation before.An Ingress annotation equivalent to that strategy choice would still be very convenient. Especially for helm deployments, where most charts offer to inject Ingress annotations, but don't (yet :-) have an option to create
cert-managerCertificate resources.@euank @munnerz I can also confirm it works with authenticated apps under
nginx-ingress, where you deploy the app with an authenticated Ingress first, then create the Certificate withingressClassandhttp01. The authentication is correctly not applied to the Ingress+path thatcert-managercreates, and the certificate is validated an issues, whilst the app remains authenticated. That's good news for renewals too.So if the Ingress strategy annotation is added, you could deploy a typical helm chart, using its Ingress annotation setting, to deploy an authenticated HTTPS application.
[-]https01 is defeated by Ingress auth, cert-manager should create own Ingress[/-][+]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress[/+][-]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress[/-][+]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/+][-]https01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/-][+]http01 is defeated by Ingress auth, cert-manager should have option to create own Ingress when using ingress-shim[/+]munnerz commentedon Jan 8, 2018
So it seems this issue specifically only effects people that do not want to manually configure their Certificate resources and instead use ingress-shim functionality to enable TLS on ingresses.
This again boils down to the issue of differences in ingress implementations. An annotation is a nice and easy escape hatch, and given the current default behaviour works on 'vanilla' ingresses for all ingress controllers (afaik), I think it'd be an acceptable addition.
We can pluck the ingress class value from the ingress itself, unless there's some use case for allowing a different class to be used? I'd rather not overcomplicate the API surface and make it harder to use if we can avoid it.
whereisaaron commentedon Jan 8, 2018
True. Creating a Certificate resource is the way to do this with
cert-manager. The annotation comes in a different section of the documentation under 'hacks we support to make it easy for people to adoptcert-manager' 😄These annotations allow users to e.g. deploy a stable Helm chart without forking and modifying your own version to add Certificates. Or else organizing a separate chart or deployment for the Certificate.
argusua commentedon Feb 16, 2018
Also, when using nginx-ingress-controller with enabled ssl-redirect, we got http response 308 for /.well-known/acme/ urls and renewing certificates functionality doesn't work.
monotek commentedon Feb 22, 2018
Just run into exactly the same problem.
Imho this is a bug and not a feature.
In Kube-Lego this was not a problem.
munnerz commentedon Feb 22, 2018
kube-lego managed to avoid this as you would explicitly configure the 'nginx ingress controller' as an option that worked cluster-wide. This means that we'd always create additional Ingress resources and not expose the choice (without changing CLI flags on kube-lego).
As mentioned before, an annotation to switch this behaviour would work well, but overloading annotations and pushing all this understanding onto end-users is painful.
What we need to decide to do something here:
ingressClassoringressby default?ingressby default (what we do today): works for all kinds of ingress controller, including renewal, so long as additional annotations (e.g. auth) are not specified.ingressClassby default: works only for nginx-like ingress controllers out of the box, and the user will then be forced to provide an additional annotation (egcertmanager.k8s.io/acme-http01-strategy: "in-place"orcertmanager.k8s.io/edit-in-place) when using an ingress controller like GCE.Whichever we choose, we need to ensure it is well documented. Having to understand so much about what is going on under the hood defeats the point of the abstractions we're trying to create, and eventually only serves to frustrate users (as they get to the point they understand the whole flow, and now they can't force cert-manager to do exactly what they want).
We need to also bare in mind that these annotations may be used for issuers other than ACME too (e.g. CA based issuer, and the upcoming Vault issuer). These issuers won't respect or have any need for this annotation, so this really is ACME specific.
Keen to hear thoughts on this, and I'm happy to integrate a solution.
whereisaaron commentedon Feb 22, 2018
The clean abstraction only exists in an annotation-free environment (know any? 😄 ). As soon as we have any behavior annotations:
cert-managerhas to be cloud-provider and/or ingress controller aware, before it can automatically do the right thing, and/orcert-managerneeds enough manual control over strategy and annotations, so that users who understand under-the-hood can tellcert-managerthe correct strategy.If we want to spare users the need to understand what they are doing, we have to build in cloud-provider and annotation-aware auto-magical behaviors, to see what cloud-provider, ingress controller, and annotation that user has decided to use, and pick the
cert-managerstrategy to navigate that.And then the power users are going to want to be able to turn that auto-magical behavior off and specify exactly the strategy and annotations they want.
whereisaaron commentedon Feb 22, 2018
In my mind,
cert-managercreating and deleting its own Ingress resource for validation is always the better/clean default as opposed to modifying another application's Ingress. Where it can be avoided, I'd rather keep a clean separation betweencert-managerand the applications' resources.So I personally would default to creating an Ingress. I would include the
kubernetes.io/ingress.classbecause is pretty much blessed now it has been promoted to the stable 'kubernetes.io' namespace. I would let power users add whatever additional annotations to the Ingress they think helpful.The for the automatical behaviour, if
cert-managerdetects a problem environment, like GCE, or thenginxincingress controller (hard I guess?). It could log and switch to modifying Ingresses by default. I see these environments as edge cases, where the Ingress model doesn't work as intended.Specifically specifying either
ingressClassoringressis going to lock the behavior and override the default. But we could try to detect and log when the user has painted themselves into a corner. It could be enough to give them a bunch of ideas or a help-page URL in the log message whenever the validation pre-check fail.13 remaining items
whereisaaron commentedon Feb 24, 2018
@monotek I don't think that is true at all, rather you've suddenly a whole lot of choices and power that
kube-legonever gave you. We do need good documentation and a good helm chart to make the migration and the learning curve for the new capabilities easy for people.kube-legoonly supports one issuer, one issuing protocol, one ingress controller, and one validation strategy. If that is all you need, and it works, then you're golden. If not, you're screwed.cert-managersupports multiple issuers (of multiple types), multiple protocols, multiple ingress controllers, and multiple validation strategies. Coming fromkube-legothis is a bunch choices you just didn't even have before.What I think is the problem is how to help migrating users so they don't have to think about these new choices if they are just replacing
kube-lego. I think we need to improve with the helm chart to have a default install that emulates thekube-legosimplicity and makes those choices for you, defaulting to (only) waykube-legoworks, e.g. creates a default ClusterIssuer for Let's Encrypt using 'http01'.tuananh commentedon Mar 12, 2018
I think that would be awesome. There are probably many
kube-legousers coming here.eseliger commentedon Mar 20, 2018
did you guys already decide on a way to handle this issue? would be down to help on the implementation as we really need this 🙂
tankovich commentedon Mar 20, 2018
We're running into the
ingress-shimissue as well. We can manually create the certificate resource with theingressClass: nginxspec without issue, but would like to use theingress-shim. Is there currently a way to implement this via adding ingress-shim annotation(s) to specify NGINX as the ingress controller (Helm deploy)?smelchior commentedon Mar 26, 2018
I am also running into this issue coming from kube-lego. Adding an option / annotation to make
ingress-shimcreate the certificates withingressClass: nginxwould be awesome!LuckySB commentedon Mar 29, 2018
kubernetes dashboard with user authorithation need annotation
nginx.ingress.kubernetes.io/secure-backends: "true"
so acme request send to cert-pod via https...
i create certifcate by hand:
Justkant commentedon Apr 4, 2018
Hi @munnerz
Is someone working on adding support for ingress annotations that switches the ingress-shim behavior ?
So that we don't need to manually create/maintain Certificate Resources
munnerz commentedon Apr 4, 2018
@Justkant not currently as far as I am aware. My time is completely pre-occupied trying to get ready for acmev2, Vault and the upcoming 0.3 release.
This would be a great first contribution from anyone looking to get involved 😄
Justkant commentedon Apr 4, 2018
Ok, I try to look at what I can do.
I'm not a golang dev but we learn everyday by trying 😄
Tim-Schwalbe commentedon Apr 12, 2018
Hi, I created a certificate with the ingress-shim and edited the certificate afterwards to ingressClass: nginx. Should this work and renew the certificate with basic-auth enabled?
Jokero commentedon Apr 18, 2018
nginx-ingress 0.13.0 introduced
no-auth-locationsoption with default value/.well-known/acme-challenge, so now it's possible and very easy to use nginx-ingress with basic auth + cert-manager with ingress-shim.More details are here kubernetes/ingress-nginx#2243
monotek commentedon Apr 19, 2018
Imho this can be closed.
Works for me with nginx-ingress 0.13.0 image :-)
Justkant commentedon Apr 19, 2018
IMHO We should wait for #493 to be merge
munnerz commentedon Jun 5, 2018
Closing as we've now got this option (and it is default in v0.3!) 🎉