kube-rbac-proxy icon indicating copy to clipboard operation
kube-rbac-proxy copied to clipboard

Mix of static authorizer and subjectaccessreviews config deactivates the static authorizer

Open raptorsun opened this issue 3 years ago • 2 comments

When putting both static authorizer and normal configs using subjectaccessreviews together in the config file, the part of static authorizer is not taken into account.

Here is an example. I would like to config kube-rbac-proxy to allow both using a bearer token and using a static authorizer to get access to the service behind its proxy.

  • For the path "/metrics", I want to use the static authorizer to check the access, using only TLS certificates.
  • For the other API calls, I would like to leave them to other authorizer schemes. I assume a request will be granted access when either authorizer gives authorization.

I have tried 2 configs but neither of them allows both use cases:

  1. This allows query /metrics using certificates, but blocks call to other API
    "authorization":
      "static":
      - "path": "/metrics"
        "resourceRequest": false
        "user":
          "name": "system:serviceaccount:openshift-monitoring:prometheus-k8s"
        "verb": "get"
  1. This allows query other API using bearer tokens, blocks querying /metrics using certificates
    "authorization":
      "resourceAttributes":
        "apiGroup": "monitoring.coreos.com"
        "namespace": "{{ .Value }}"
        "resource": "prometheusrules"
      "rewrites":
        "byQueryParameter":
          "name": "namespace"
      "static":
      - "path": "/metrics"
        "resourceRequest": false
        "user":
          "name": "system:serviceaccount:openshift-monitoring:prometheus-k8s" 
        "verb": "get"

raptorsun avatar Sep 24 '21 20:09 raptorsun

cc @ibihim can you take a look?

s-urbaniak avatar Sep 28 '21 12:09 s-urbaniak

I will try to do so next week. Thanks for the pointer

ibihim avatar Sep 28 '21 18:09 ibihim