> For the complete documentation index, see [llms.txt](https://www.health-samurai.io/docs/interbox/llms.txt).
> Use it to discover all available pages before guessing URLs.

---
# Private ingress and TLS

A login on the application does not make the application public-facing. For a real deployment, put it behind an internal ingress with TLS. If your organisation already runs a login gate, put that in front as well. This page describes that setup. [Securing dashboard access](dashboard-access.md) covers the built-in sign-in, and [Testing locally with k3d](../deploy/local-k3d.md) rehearses this setup on a laptop.

## The pieces

- **Ingress controller** (e.g. `ingress-nginx`, or a cloud one like AGIC;
  `ingress-nginx` was archived in March 2026 and gets no more fixes, so prefer
  a maintained controller such as AGIC): the
  cluster's reverse proxy. It routes your hostname to the dashboard Service and
  terminates TLS. For a private dashboard, run it behind an **internal** load
  balancer so it has no public IP.
- **cert-manager**: obtains and renews the TLS certificate into a Secret. An
  **Issuer/ClusterIssuer** decides *who signs* the cert.
- **oauth2-proxy**: the login gate. It redirects a request with no valid session
  to log in, then sets a cookie. It speaks OIDC.
- **An OIDC identity provider**: the system that authenticates the user
  (Entra ID / Azure AD, Okta, Google, Keycloak, …). oauth2-proxy trusts it.

None of these ship with the Interbox chart. They are **cluster infrastructure
you install once** and reuse across apps.

## How a request flows through such a proxy

```text
Browser → ingress (terminates TLS)
        → ingress asks oauth2-proxy "is this user logged in?"
            → no session → 302 redirect to the identity provider's login
            → user logs in → back to oauth2-proxy → sets a session cookie
        → ingress now allows the request → Interbox dashboard
```

## The chart values that wire it

The chart's `ingress` values wire all of this, with no chart edit:

```yaml
ingress:
  enabled: true
  className: <your-internal-ingress-class>       # a controller behind an internal LB
  host: interbox.internal.example
  tls:
    - hosts: [interbox.internal.example]
      secretName: interbox-tls
  annotations:
    # TLS: cert-manager issues + renews into the secret above
    cert-manager.io/cluster-issuer: <your-issuer>
    # SSO: nginx asks oauth2-proxy before serving; no session -> redirect to login
    nginx.ingress.kubernetes.io/auth-url: "http://oauth2-proxy.<ns>.svc.cluster.local:4180/oauth2/auth"
    nginx.ingress.kubernetes.io/auth-signin: "https://interbox.internal.example/oauth2/start?rd=$escaped_request_uri"
```

The two `nginx.ingress.kubernetes.io/auth-*` annotations work only on ingress-nginx. Another
controller ignores them and needs its own way to call oauth2-proxy; without one, the
dashboard has TLS and no login gate.

The exact value keys live in the
[chart README](https://github.com/HealthSamurai/helm-charts/tree/main/interbox).
This page covers the surrounding setup.

## TLS: choosing a certificate issuer

TLS terminates at the ingress. cert-manager fills the `interbox-tls` secret, and
how it does so depends on where the host's DNS lives:

- **Public DNS zone:** use cert-manager **ACME DNS-01** (e.g. the Azure DNS /
  Route53 / Cloud DNS solver). It works even when the host resolves to a
  *private* IP, because DNS-01 only writes a TXT record and needs no inbound
  reachability.
- **Private-only DNS:** ACME/Let's Encrypt **cannot** validate it, because it
  resolves public DNS. Use an **internal CA** issuer instead: your org PKI, a
  cert-manager `ca` ClusterIssuer, or a Key Vault / secrets-manager cert.
- **Bring your own cert:** skip cert-manager. Run `kubectl create secret tls
  interbox-tls --cert=… --key=…` and reference the secret in `ingress.tls`.

> A common mistake is pointing an internal-only host at Let's Encrypt HTTP-01.
> It never validates. For an internal host, use DNS-01 (public zone) or an
> internal CA.

## The proxy's own identity provider

oauth2-proxy needs an OIDC provider. In production that is your IdP, e.g. **Entra
ID (Azure AD)**. Register an application, set its redirect URI to
`https://<host>/oauth2/callback`, and give oauth2-proxy the issuer URL, client ID
and client secret. Any OIDC provider works the same way.

Interbox has no built-in RBAC, so **who may sign in is the whole access
control**. You can scope it at Interbox's own allow-rules, at the identity
provider, or at a proxy in front. Interbox records every sign-in, refusal,
sign-out and revocation as a structured log line. A proxy in front has its own
log, and you should keep the two together.
