Skip to main content
Version: 2.25.0

Network policies

Each Glasswall Halo service chart installs a Kubernetes NetworkPolicy that lets only the expected Halo services connect to it. If an attacker takes control of a pod in your cluster, the policies block that pod from reaching the internal APIs of Halo services that do not expect its connections.

The cdrplatform-rabbitmq, cdrplatform-mongodb and squid-proxy charts do not install a policy.

The policies control inbound connections only. They do not restrict the connections Halo makes to other services.

Turn on network policy enforcement​

Kubernetes accepts NetworkPolicy objects on every cluster, but only a cluster with a network policy engine enforces them. Without one, Halo installs and runs as normal and the policies have no effect. We recommend turning enforcement on.

  • AKS: run az aks update --resource-group <rgp> --name <aksname> --network-policy calico. On an existing cluster this reimages every node, so pods restart.
  • EKS: set enableNetworkPolicy in the Amazon VPC CNI add-on configuration, with VPC CNI 1.14 or later: aws eks update-addon --cluster-name <eksname> --addon-name vpc-cni --configuration-values '{"enableNetworkPolicy":"true"}'. Only the aws-node pods restart.
  • GKE: run gcloud container clusters update <gkename> --update-addons=NetworkPolicy=ENABLED, then gcloud container clusters update <gkename> --enable-network-policy. The second command recreates the node pools. A cluster created with GKE Dataplane V2 enforces policies already.
  • OKE: OKE needs a separate policy engine. With VCN-Native Pod Networking, install Calico alongside it. With flannel, replace flannel with Calico, which affects only new nodes. See Oracle's Installing Calico and setting up network policies.
  • OpenShift, and clusters running Calico or Cilium, enforce policies already.
  • Halo OVA: the appliance's RKE2 cluster enforces policies already, so the OVA needs no change.

What the policies admit​

  • Each Halo service admits only the Halo services that call it, matched by their app.kubernetes.io/name label. ICAP server pods are the exception: they carry only app: icap-server, so a rule that admits ICAP as a caller must match that label.
  • The portal (cdrplatform-portal), its backend (cdrplatform-portal-access), the Halo API (cdrplatform-api-access) and Storage Monitor admit the ingress controller. So do cdrplatform-sync-api, cdrplatform-policy-api and cdrplatform-license-management when you turn on their Ingress. By default the controller is any pod labeled app.kubernetes.io/name: ingress-nginx or app.kubernetes.io/name: rke2-ingress-nginx, in any namespace.
  • The ICAP server admits every source on its ICAP ports.
  • The kubelet's health checks reach every pod from the node, so they need no rule.

Change or extend the policies​

Each chart reads its policy from the networkPolicy key in its values. Put your changes in a values file and apply it to each chart you change. For example, for the portal:

helm upgrade cdrplatform-portal cdrplatform-portal -n cdrplatform --reset-then-reuse-values -f network-policy-values.yaml

Use --reset-then-reuse-values (Helm 3.14 or later). It keeps your other settings and takes the chart's current list of allowed callers. Do not use --reuse-values: it keeps the caller list stored in the release, so it misses callers that a newer chart adds, and a release installed before Halo v2.25.0 has no caller list at all.

If you use a different ingress controller, set its pod labels and namespace on the cdrplatform-api-access, cdrplatform-portal-access, cdrplatform-portal and cdrplatform-storage-monitor charts, and on any of cdrplatform-sync-api, cdrplatform-policy-api and cdrplatform-license-management whose Ingress you turn on. For Traefik running in a traefik namespace:

networkPolicy:
ingressController:
namespace: traefik
from:
- app.kubernetes.io/name: traefik

To admit another caller, such as a metrics scraper in a monitoring namespace, add a rule to networkPolicy.extraIngress. The rule uses the standard NetworkPolicy ingress rule format:

networkPolicy:
extraIngress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
ports:
- port: http

To turn off a chart's policy, set networkPolicy.enabled=false in the values file, or add --set networkPolicy.enabled=false to the helm upgrade command.

Check the policies work​

Start a pod with no Halo labels in the Halo namespace and call a Halo service from it. Use any image from your registry that contains curl:

kubectl run np-check -n cdrplatform --rm -i --restart=Never --image=<image with curl> -- \
curl -s -o /dev/null --max-time 5 -w '%{http_code}\n' http://policy-api:8080/

With enforcement on, the call times out: curl prints 000 and exits with code 28. If it prints any other status code, the connection got through and the cluster is not enforcing the policies.