Closed joshuagrisham-karolinska closed 1 year ago
Hello @joshuagrisham-karolinska
I am asuming that you are describing admission webhook tls configuration, am I right ?
Hi @eshepelyuk well, half yes and half no..
Much of what happens with the TLS certs is in the webhookconfiguration.yaml template of the Helm Chart, even though it is not strictly just webhook stuff.
What I am talking about here is the server certificate for the OPA Server service itself. Specifically what gets picked up here as tls.crt
and tls.key
: https://github.com/open-policy-agent/kube-mgmt/blob/f23b3b0e3d3bea25eee6dd2b107f864ad432dadd/charts/opa-kube-mgmt/templates/deployment.yaml#L115-L118
This is pointing to some files mounted in via a secret here: https://github.com/open-policy-agent/kube-mgmt/blob/f23b3b0e3d3bea25eee6dd2b107f864ad432dadd/charts/opa-kube-mgmt/templates/deployment.yaml#L229-L233
And this secret is generated in 3 different ways from what I can see (and this is where we get back to webhookconfiguration.yaml) ...
genCA
and then putting them into a static secret which is then used (so the certs are created are completely new, dynamic, and isolated, only created once at essentially "deploy" time), see: https://github.com/open-policy-agent/kube-mgmt/blob/f23b3b0e3d3bea25eee6dd2b107f864ad432dadd/charts/opa-kube-mgmt/templates/webhookconfiguration.yaml#L135-L141The problem with both # 1 and # 3 is that now it is difficult to have a trust relationship between this service and all of our other services -- this is a brand new certificate issuer we have never seen before and we will have to jump through hoops in order to try to automate some kind of flow that all of our other services can trust this? It feels a lot cleaner if we can actually control this part.
And # 2 is potentially a way out of this problem, but now we are dealing with a static string that we must write into the values file either by somehow setting or injecting it at deploy-time or checking our private certificates in full into Github, etc? Also not super easy to work with unfortunately.
So that leads me to this specifically issue report -- it would be amazing if we could instead either just point the config to our own existing Cert-Manager Issuer (via the issuerRef of the Certificate resource) or that we could just create our own Secret on the side, however we want (e.g. we can use Cert-Manager to generate the Secret, or something else entirely like HashiCorp Vault to manage certificates and then create them as Secrets which could be used here instead?)
Make more sense, I hope? 😸
Hi, yes i is much clearer now.
So my 5 cents. I came as a maintainer of this chart last year and I tried not to change much, but I consider that TLS interception by a pod itself is kind of of a antipattern because violation of separation of concern principle.
TLS interception should be handled
Although OPA has TLS interception posibility - its more for standalone cases when running outside k8s, in k8s it must be disabled imo.
SO my take on this issue is that TLS interception for OPA container should be removed from this chart.
@joshuagrisham-karolinska any feedback on this ?
When using the
opa-kube-mgmt
Helm Chart version 8.1.1 it is not possible to configure it to use an existingIssuer
orClusterIssuer
(instead what I see is that the template is creating its own self-signed issuer if you turn oncertManager.enabled
).We would rather either
Certificate
resource is created where we can specify theissuerRef
using values (and that a new issuer is not created), orca.crt
,tls.crt
, andtls.key
(basically that was generated by Cert-Manager or has the same keys)With # 1 there are still some limitations on the Certificate that is generated (for example if we wanted specific attributes in the certificate? etc), # 2 gives more flexibility but there is risk with the CN etc just like is written in the comments if you supply your own text-based certificate to
.CA
,.cert
, etc values.