Expose part of the Admin API
The Admin API is one gRPC and HTTP service on port 8444. Most of its
callers run inside your cluster or on an operator’s workstation, and only
one caller runs in a browser: the admin console, when a tenant
administrator works on a tenant. This page shows how to give that one
caller a public hostname that serves only the paths it uses, while every
other caller reaches the full API privately.
The rule: a path is either on the public allowlist or it is not reachable from the internet. There is no “public but authenticated” middle. The edge refuses the rest before any Authwise code runs.
Before you begin
Section titled “Before you begin”- An install on Kubernetes with the operator, as in
Install on Kubernetes. The Admin API is
the Service
authwise-apion port8444. - An edge that can match paths: a Gateway API implementation such as the GKE Gateway controller, or a reverse proxy in front of your ingress such as HAProxy or a cloud load balancer with path rules.
- Identity server 1.52 or later, which honours a forwarded host only for a hostname registered on the install.
- Operator 0.41.1 or later to have the operator render the allowlist itself with Gateway API, as the first option below.
Inventory the callers
Section titled “Inventory the callers”Before you touch the edge, list every caller of the Admin API, where it runs, and the paths it uses. This table decides everything else:
| Caller | Runs | Paths | Reaches the API |
|---|---|---|---|
| Admin console, tenant administrator | browser | /v1/tenants/TENANT_ID/… | publicly |
| A second install that checks access at this one | in the cluster | /v1/access:bulkCheck, /v1/tenants | privately |
| The audit server | in the cluster | tenant reads | privately |
awctl and the Terraform provider | a workstation | everything | privately, through a port-forward or a private hostname |
awtenant (the tenancy admin server, port 9443) | a workstation, with a client certificate | its own server | never routed |
Only the browser row is a candidate for the public hostname. If a browser caller ever needs a path outside one prefix, treat that as a finding about the console, not as a reason for a second prefix.
Choose the prefix
Section titled “Choose the prefix”Pick the shortest prefix that covers the browser row and nothing else. For
the console that is /v1/tenants/TENANT_ID/…, so the prefix is
/v1/tenants/. Two neighbours must stay private: the bare /v1/tenants,
which lists the caller’s tenants and is a server-to-server call, and
/v1/access:bulkCheck.
Whether a trailing slash keeps the bare path out depends on your edge:
- A string prefix, as in HAProxy’s path rules, matches characters.
/v1/tenants/doesn’t match/v1/tenants. - Gateway API
PathPrefixmatches whole path elements and ignores the trailing slash.PathPrefix /v1/tenants/also matches/v1/tenants, so add anExactrule for the bare path.Exacttakes precedence.
Write the reason for the prefix in a comment next to the rule. Whoever widens it later needs that reason.
Route the public hostname
Section titled “Route the public hostname”With Gateway API, rendered by the operator
Section titled “With Gateway API, rendered by the operator”Name the prefix on the API audience and let the operator write the routes.
paths restricts the audience’s hostnames to those prefixes; every other
path matches no rule and is refused at the edge. A prefix with a trailing
slash also gets an Exact rule for the bare path that forwards nowhere, so
/v1/tenants is refused as well. On GKE, gatewayTLSOptions names the
Certificate Manager certificate of each listener, and the operator renders a
HealthCheckPolicy per routed Service that checks the pod’s readiness path;
delete any policy you wrote by hand for those Services first.
spec: networking: gateway: create: className: gke-l7-regional-external-managed issuer: hosts: [ADMIN_HOST] gatewayTLSOptions: networking.gke.io/cert-manager-certs: ADMIN_CERT api: hosts: [API_HOST] gatewayTLSOptions: networking.gke.io/cert-manager-certs: API_CERT # The console's tenant pages, and nothing else on this hostname. paths: [/v1/tenants/] console: hosts: [CONSOLE_HOST] gatewayTLSOptions: networking.gke.io/cert-manager-certs: CONSOLE_CERTADMIN_CERT, API_CERT, and CONSOLE_CERT are Certificate Manager
certificate names in the Gateway’s region. paths is refused under
networking.ingress, which has no way to refuse the bare path. With a
Gateway the operator does not own (networking.gateway.ref), set
gateway.healthCheckPolicies: Enabled to get the health checks, and omit
gatewayTLSOptions, because the listeners belong to the Gateway’s owner.
With Gateway API, routes you write
Section titled “With Gateway API, routes you write”For an edge the operator cannot render for, leave networking.ingress and
networking.gateway unset in the AuthwiseIdentityServer, so the operator
renders no routes, and write the routes yourself. Keep networking.api.hosts
set: it registers the public hostname with the identity server, which
otherwise ignores the forwarded host. One HTTPRoute for the API hostname,
pinned to the HTTPS listener:
apiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata: name: api-tenants namespace: NAMESPACEspec: parentRefs: - name: GATEWAY_NAME sectionName: https hostnames: - "API_HOST" rules: # The console's tenant pages, and nothing else on this hostname. - matches: - path: {type: PathPrefix, value: /v1/tenants/} backendRefs: - name: authwise-api port: 8444 # PathPrefix ignores the trailing slash, so the bare path needs its own rule. - matches: - path: {type: Exact, value: /v1/tenants} filters: - type: RequestRedirect requestRedirect: hostname: ADMIN_HOST path: {type: ReplaceFullPath, replaceFullPath: /} statusCode: 302 # Everything else. Gateway API has no refusal filter, so redirect. - matches: - path: {type: PathPrefix, value: /} filters: - type: RequestRedirect requestRedirect: hostname: ADMIN_HOST path: {type: ReplaceFullPath, replaceFullPath: /} statusCode: 302Give the plain HTTP listener one route that redirects to HTTPS, and keep any catch-all route for custom domains separate: a route that names a hostname wins over one that doesn’t, so the catch-all never sees the API hostname.
With a proxy in front of the ingress
Section titled “With a proxy in front of the ingress”Keep the operator’s ingress as it is, with a plain / for every hostname,
and put the allowlist on the proxy that terminates TLS in front of it. In
HAProxy, for example, allow /v1/tenants/ on the API hostname and answer
403 for every other path. The proxy is then the whole path control, and
the ingress behind it stays simple.
Point every caller at the right endpoint
Section titled “Point every caller at the right endpoint”- The console gets the public hostname through its configuration,
https://API_HOST. - Workloads in the cluster use the Service,
authwise-api.NAMESPACE.svc:8444, in plaintext. Another Authwise install that checks access at this one sets that endpoint in its own custom resource. - Operators forward the Service port, as in
Reach the Admin API,
or use a hostname that resolves only on your private network. Either way,
awctland the Terraform provider never need the public hostname. - The tenancy admin server on port
9443has no route of any kind. Reach it with a port-forward and a client certificate.
Protect the public backend
Section titled “Protect the public backend”For the Service the public route names:
- Put your web application firewall and request logging on it. On GKE that
is a
GCPBackendPolicy. - Give the load balancer a health check that repeats the pod’s readiness
probe,
/healthon port8444. The load balancer doesn’t read the probe itself. The operator renders one on a GKE Gateway it creates; write it yourself for any other edge. - Set
trustedProxiesin the install’s configuration to the load balancer’s address ranges, so sign-in records and rate limits see the client’s address rather than the proxy’s. - Add an ingress network policy that admits the load balancer’s ranges to the API pods and denies everything else from outside the namespace.
Verify the split
Section titled “Verify the split”From outside the cluster, with no credential:
curl -si https://API_HOST/v1/tenants/t-01 | head -1curl -si https://API_HOST/v1/tenants | head -1curl -si https://API_HOST/v1/tenantsX | head -1curl -si https://API_HOST/v1/access:bulkCheck | head -1| Request | Expect |
|---|---|
/v1/tenants/t-01 | 401. The path is routed and the API asked for a credential. A path the API doesn’t serve answers 404 instead and proves nothing. |
/v1/tenants | 302 with the routes above, an error from the Gateway with the operator’s paths, 403 with a proxy. The bare path is refused. |
/v1/tenantsX | The same. A sibling that shares the string prefix is refused. |
/v1/access:bulkCheck | The same. |
From inside the cluster, the private endpoint answers the bare path. The
Service speaks HTTP/2 without TLS, so tell curl so:
curl -si --http2-prior-knowledge http://authwise-api.NAMESPACE.svc:8444/v1/tenants | head -1Expect 401. Then do the two product checks: a tenant administrator signs
in to the console and their tenant’s pages load, and an operator’s awctl
command succeeds against the private endpoint.
Widen the allowlist
Section titled “Widen the allowlist”Only when a browser caller adds a path outside the prefix. Then add the path to your inventory with its reason, add a second match rule rather than shortening the prefix to a parent, keep the refusal rule last, and run the verification again with the new path and with a sibling that must still be refused. If the new path is one that a workload or an operator also uses, stop: the console is reaching for a private API, and the fix belongs in the console.
What’s next
Section titled “What’s next”- Install on Kubernetes: the custom
resource this page’s
networkingsettings belong to. - Use your own domain: the catch-all route that the API hostname must never fall into.