Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshTrafficPermission: prometheus listener doesn't allow traffic with allow-all policy #7412

Closed
lukidzi opened this issue Aug 1, 2023 · 2 comments · Fixed by #8172
Closed
Assignees
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@lukidzi
Copy link
Contributor

lukidzi commented Aug 1, 2023

What happened?

When kuma uses the default MeshTrafficPermission that allows all the traffic, changes for RBAC are not applied to the kuma:metrics:prometheus listener. In this case, traffic from the scraper cannot reach the services endpoint.

apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
  namespace: kuma-system
  name: allow-all
spec:
  targetRef:
    kind: Mesh
  from:
    - targetRef:
        kind: Mesh
      default:
        action: Allow

config_dump of rbac kuma:metrics:prometheus listener when using MeshTrafficPermission

        {
           "name": "envoy.filters.network.rbac",
           "typed_config": {
            "@type": "type.googleapis.com/envoy.extensions.filters.network.rbac.v3.RBAC",
            "rules": {},
            "stat_prefix": "kuma_metrics_prometheus."
           }
          },

When we switch to TrafficPermisson traffic works.

apiVersion: kuma.io/v1alpha1
kind: TrafficPermission
mesh: default
metadata:
  name: allow-all-traffic
spec:
  sources:
    - match:
        kuma.io/service: '*'
  destinations:
    - match:
        kuma.io/service: '*'

config_dump of rbac kuma:metrics:prometheus listener when using TrafficPermission

        {
           "name": "envoy.filters.network.rbac",
           "typed_config": {
            "@type": "type.googleapis.com/envoy.extensions.filters.network.rbac.v3.RBAC",
            "rules": {
             "policies": {
              "allow-all-traffic": {
               "permissions": [
                {
                 "any": true
                }
               ],
               "principals": [
                {
                 "any": true
                }
               ]
              }
             }
            },
            "stat_prefix": "kuma_metrics_prometheus."
           }
          },
@lukidzi lukidzi added triage/pending This issue will be looked at on the next triage meeting kind/bug A bug labels Aug 1, 2023
@lukidzi lukidzi changed the title MeshTrafficPermission: prometheus listener doesn't allow traffic with default policy MeshTrafficPermission: prometheus listener doesn't allow traffic with allow-all policy Aug 1, 2023
@jakubdyszkiewicz jakubdyszkiewicz added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Aug 7, 2023
@lukidzi
Copy link
Contributor Author

lukidzi commented Aug 8, 2023

We talked with @lobkovilya and concluded that it's not a quick fix to make it work. We use the DP object when building a rules view for the policies. That object doesn't have all inbounds that dataplane can have. E.g.: Prometheus, admin, probe. Because of this new policies cannot be applied to listeners that are not defined in a DP object. https://github.com/kumahq/kuma/blob/master/pkg/plugins/policies/core/matchers/dataplane.go#L194

as a workaround, we can use just to allow prometheus traffic and policies for the services we can define with MeshTrafficPermission

apiVersion: kuma.io/v1alpha1
kind: TrafficPermission
mesh: default
metadata:
  name: metrics-permissions
spec:
  sources:
    - match:
       kuma.io/service: "*"
  destinations:
    - match:
       kuma.io/service: dataplane-metrics

xref: #5708

@lahabana
Copy link
Contributor

How about simply ignoring "system" listeners (prometheus, admin, probe) when applying RBAC?
It might be imperfect but good enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants