kube-metrics-adapter icon indicating copy to clipboard operation
kube-metrics-adapter copied to clipboard

insecureSkipTLSVerify is insecure

Open dudicoco opened this issue 3 years ago • 5 comments

The insecureSkipTLSVerify: true flag is used within the deployment manifest: https://github.com/zalando-incubator/kube-metrics-adapter/blob/9da155554b4da7e4fd63a12ec6a6ef1e7a8a9980/docs/custom-metrics-apiservice.yaml#L11

According to the k8s api docs this should not be used: InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead. https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#apiservicespec-v1-apiregistration-k8s-io

Was insecureSkipTLSVerify: true added because the container generates its own self signed certificate, which cannot be validated by the api server? Can this be resolved somehow?

dudicoco avatar Jun 14 '21 14:06 dudicoco

@dudicoco I guess you can change it, but test it in a test cluster and we would be happy if you could report back, in case you can confirm it works or not.

szuecs avatar Jun 14 '21 17:06 szuecs

@szuecs per the docs, we must supply the CABundle to the configuration in order for that to work, and since kube-metrics-adapter is generating its certificates within its code, i'm not sure how can we supply the CABundle.

dudicoco avatar Jun 14 '21 18:06 dudicoco

Then it's a feature request, thanks for checking. If you want you can also file a pull request.

szuecs avatar Jun 15 '21 12:06 szuecs

@szuecs I wouldn't define it as a feature request but more as a security vulnerability.

dudicoco avatar Jun 15 '21 13:06 dudicoco

@dudicoco if you like. I think the position to successful exploit this vulnerability is an already so powerful position that you have at least dozens of possibilities to exploit the cluster. You can DoS the controller-manager with the "right" hpa for example.

szuecs avatar Jun 15 '21 17:06 szuecs