Skip to content

Websocket support in layer 7 NetworkPolicy #11672

@cortopy

Description

@cortopy

Proposal / RFE

Is your feature request related to a problem?

Even though websockets are Layer 7, Cilium doesn't seem to support them in Network Policies.

Furthermore, if http rules are present, they interfere with the evaluation of requests to websockets in a way that all wss traffic gets dropped.

Ideally, I would expect CIlium to support the following:

  • ignores websockets in L7 evaluation (the bare minimum if full support is not possible)
  • applies http rules to websockets too so that can traffic can be forwarded
  • there is some kind of wss ruleset in addition to http and kafka

Describe the solution you'd like

I have a CiliumNetworkPolicy like this

spec:
  endpointSelector:
    matchLabels:
      app: foo
  ingress:
    - fromEndpoints:
      - matchLabels:
          k8s:io.kubernetes.pod.namespace: contour
          k8s:app: envoy
      toPorts:
      - ports:
        - port: "8080"
          protocol: TCP
        rules:
          http:
            - headers:
                - X-Forwarded-For: <my-ip>

for an application which uses websockets. The goal of this policy is to only allow private addresses to access the app.

My problem is that this app has an endpoint which is a websocket. When this policy is deployed, I can see that all http traffic gets through. However for the websocket endpoint I experience the following:

  • cilium monitor shows all the http requests, but is totally silent for websocket
  • requests to the websocket endpoint get a 403 response (which is not logged anywhere i can see)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.area/proxyImpacts proxy components, including DNS, Kafka, Envoy and/or XDS servers.help-wantedPlease volunteer for this by adding yourself as an assignee!kind/community-reportThis was reported by a user in the Cilium community, eg via Slack.kind/featureThis introduces new functionality.pinnedThese issues are not marked stale by our issue bot.sig/policyImpacts whether traffic is allowed or denied based on user-defined policies.

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions