← All posts

Keeping access bounded between services

Suppose one of my applications gets compromised. I'd like that to be a problem with one application, rather than an invitation to explore everything else I run. And I don't need an attacker to make a mess: a mistaken permission or an accidentally exposed interface can do plenty on its own.

That's what the boundaries in Zebra, my Kubernetes cluster, are meant to help with.

That requires decisions at several points. I use public web routing for services that need it, private application access for management tools, and Kubernetes policies around workloads. Each solves a narrower problem than making the entire cluster secure.

Public and private requests

This sketch shows the intended web paths. Mail, direct network services, and deployment access have their own controls.

Internet -> public web router -> exposed application
                                 -> application login

Private client -> per-app access check
               -> private web router
               -> application login and permissions

Traefik supplies web routing. CrowdSec adds abuse decisions and selected application-security checks; rate limits reduce some automated traffic. Those checks have exceptions and different failure behaviour. A body-inspection exception for an upload is not equivalent to inspecting every byte, and an unavailable security service can leave a route serving without that inspection. I need to monitor that degraded protection as well as whether the application responds.

We also use NetBird as a family VPN to route through home when abroad, for things such as local news. That everyday use is distinct from permission to manage infrastructure. For private web services, NetBird provides per-application authorisation before forwarding to a private Traefik backend. Kubernetes network policy restricts which proxy components may reach that backend. It cannot identify each human behind an authorised proxy.

That distinction matters: granting devices direct access to the shared backend could let them bypass the per-application gate. I need to test a permitted client, a denied client, and attempted direct access. A successful login from my own laptop tests only one of those cases.

A recent backend migration included recorded allowed and denied client checks, including direct-backend attempts. That is useful evidence for those paths at that time, not proof that every later policy change or every application operation is safe. Some access policy remains managed outside Git and needs separate recovery and review.

What an application may reach

Kubernetes NetworkPolicy lets me select workloads and allow particular ingress and egress traffic. The setup uses default-deny policies with explicit allowances in many namespaces. Policies are additive: another allowance can broaden access, so reviewing one restrictive file in isolation is insufficient.

The Cilium networking layer also has a specific deny for application access to cloud instance metadata, with an infrastructure exception. That addresses a different threat: a workload reaching bootstrap information through a provider's metadata endpoint. It does not make every internal address safe.

Admission rules constrain privileged containers and host access, while tenant rules restrict deployment choices such as hostnames, scheduling, and storage. These checks help stop an application deployment becoming access to the underlying machine. Privileged infrastructure and build exceptions remain and deserve a separate assessment; a policy with exceptions is not universal isolation.

The tenant design applies these boundaries to a small circle of family and friends. Quotas contain resource use, permissions contain changes, and network rules contain reachability. Shared kernels, storage, and administrators remain shared dependencies.

Who can change the boundaries

An identity allowed to deploy platform configuration can change the controls themselves. That makes the delivery path part of the security design:

Source change -> validation and signing in CI
                -> published deployment artifact
                -> Flux verifies signature
                -> Kubernetes applies configuration

The platform source now configures Cosign verification in Flux. This checks that the artifact was signed by a trusted key. It does not review its meaning or verify every application image independently. Because signing happens in continuous integration (CI), compromise of that trusted publication path remains consequential. Independent hardware approval for every deployment would be a different design.

For a few applications, you may be better off with a simpler host and fewer things exposed. If you do add these layers, try the awkward questions: can a client get somewhere it shouldn't, what can an application reach after that, and who can change the rules? That's how I connect the configuration back to the threats I'm actually worried about.

← Back to the notebook