I created a topic last week where I had issues upgrading to Traefik 2.2 (or 2.1). from 2.0. I worked out the problem was our config not allowing Traefik access to secrets. This config worked for us fine on 2.0 other than spamming the pod logs with errors relating to not being able to read secrets. However with 2.1 and 2.2 Traefik doesn't get as far as obtaining the Ingress resources used to configure itself unless I grant it permissions to list secrets. Since we don't use certificates for anything at the moment, I don't believe Traefik really needs to actually access secrets?
Anyhow, this got me thinking... The docs suggest creating a CusterRole that gives Traefik get, list and watch to secrets. Then attach that role to a service account for traefik using a ClusterRole binding.
Fair enough, but since the list verb actually gives the service account the ability to see the contents of the secrets it lists, I think i'm now giving that service account and therefore this instance of Traefik access to every single secret in Kubernetes?
Not a problem if Traefik is perfect. But what happens if an exploit was found in Traefik that somehow allowed an attacker to get those secrets? From my fairly simple cluster I have almost 100 secrets for things such as other service accounts, cloud credentials and application configs containing database passwords.
At that point I think an attacker could then potentially grab another service account token for a service account with more permissions that allow it to do who knows what? Create pods? Delete storage? Whatever it wants really. Which seems quite worrying.
I believe things could be limited somewhat by using a RoleBinding rather than a ClusterRole binding and restricting access to secrets in specific namespaces. However that then leads onto a slightly less serious version of the same problem. If (for arguments sake) I have a namespace called production in which I have a service that I create an Ingress for, my exploited Traefik ingress controller still has access to all of my production secrets. It might not now have access to quite so many, but still alot of potentially sensitive things.
I thought perhaps I had solved the problem by putting my ingress controllers into their own namespace. Then granting them access just to secrets in their own namespace. But no, because the Ingress resources still go into my production namespace, I have to give Traefik access to secrets in my production namespace.
It really feels like i'm missing something obvious here. I can't find a way to limit the access that Traefik needs to secrets.
I've looked for a way to limit access to specific secrets, but there's no way I can tell Traefik that.
I've looked for a way to somehow tell it to lookup secrets in a different namespace rather than the one that the Ingresses come from that it's looking for.
I've looked for a way to tell Traefik to not bother looking for secrets, since right now we're not using them anyway.
FWIW: We originally switched to Traefik from Nginx Ingress controllers for this exact reason. It seems we were just unlucky that v2.0 allowed it to kinda do what we wanted. But now we're back to the same situation. We also looked into a bunch of other options for ingress controllers. Most of which suffered from this same problem.
Is my understanding above correct?
If so, are there any plans to try to change this at all? Since if this is the case I can't understand how anyone could think they were safely using Traefik (or pretty much any of the other ingress controllers that exist today)?
If not, corrections to my understanding on how to deal with this are very welcome.
Thanks