AxiomSearch

Wiki › Admin guide

Gateway and certificates

The gateway is a Caddy container that terminates TLS for every public port and decides which browsers reach the companion tools. This page covers its certificates, the firewall rules it needs, IP-only deployments with certificate pinning, and how the server learns each client's real address.

What the gateway does

The gateway (axiom-gateway) is configured by caddy/Caddyfile and caddy/.env. Every site in the Caddyfile answers on SITE_HOST:

  • 443 proxies the portal, the admin page and the API to axiom-server:8480.
  • 8480 proxies the desktop app's API to the same place, with flush_interval -1 so live updates (Server-Sent Events) reach the app as soon as they are written.
  • 8443, 8444 and 8445 proxy Uptime Kuma, Portainer and CyberChef. Before serving any request there, the gateway asks the server's /api/authz endpoint whether the browser holds a valid Axiom session. Without one, the browser is sent to the portal to sign in; with one but without access to that tool, it gets 403.
  • 80 redirects to HTTPS and answers Let's Encrypt challenges.

The hop from the gateway to the server also uses HTTPS, with the server's self-signed certificate, and the gateway verifies it: the server exports a public copy of the certificate into the small axiom-cert-export volume at every start and whenever the certificate changes, and the gateway trusts exactly that file. The gateway reads the file when it starts, so after the certificate changes — a new TLS_CERT pair, or a recreated data volume regenerating the self-signed one — restart the gateway (docker compose restart in the caddy folder). Until then it answers 502 with failed to verify certificate in its log: that refusal is the verification working. Keep the axiom-backend network to exactly the gateway and the server anyway.

Which accounts can reach each tool is set per account on the admin page, in the Tool access column under People → Users. Once set up, the Axiom session is the only sign-in for Uptime Kuma (its own login turned off), and Portainer signs accounts in through the Axiom server; see Single sign-on.

Let's Encrypt certificates

With a public DNS name in SITE_HOST and port 80 open to the internet, Caddy obtains a Let's Encrypt certificate for every site, including 8480, and renews it on its own. Nothing is copied to the server and nothing else needs scheduling.

  1. Point the DNS name at the host and open port 80 to everyone.
  2. Set SITE_HOST and ACME_EMAIL in caddy/.env.
  3. Recreate the gateway with docker compose up -d --force-recreate in the caddy folder, then watch docker logs -f axiom-gateway for certificate obtained successfully.
  4. From outside, check curl https://axiom.example.com:8480/api/health with no -k.

Issued certificates live in the gateway's axiom-caddy-data volume, which has a fixed name so they survive re-creates. Don't rename it.

Warning: Don't mount Caddy's certificate files into the server. Caddy writes them owned by root with mode 0600, and the server runs as UID 1000, so it can't read them. Renewal is the gateway's job alone.

Tip: Analysts should not pin the certificate in this mode. A pin matches one exact certificate, and Caddy replaces it at every renewal (roughly every 60 days), which would lock pinned analysts out. Analysts who pinned an older self-signed certificate click Forget under Settings → Team server → Collaboration server once.

If a renewal fails, Caddy keeps serving the old certificate and retries. Check docker logs axiom-gateway, and confirm port 80 is still open to the whole internet. An Uptime Kuma HTTPS monitor on https://axiom.example.com:8480/api/health with certificate checking on catches a failed renewal before analysts do.

Firewall guidance

Docker programs the host's packet filter directly, so ports it publishes bypass host firewalls such as ufw. Use your network or cloud provider's firewall as the real access control, and review its rules like any firewall configuration.

PortOpen to
80The whole internet (required permanently for Let's Encrypt renewals)
443, 8443, 8444, 8445, 8480Your corporate network ranges only
22 (SSH)Your administrators' ranges only

Close everything else. The tools and the server publish no host ports in the standard layout, so old rules for their internal ports can be removed.

IP-only deployments and pinning

Without a DNS name there is no publicly trusted certificate. In that layout the server publishes 8480 itself (see Deploying the server) and serves its own self-signed certificate, valid for 10 years and stored in the data volume. Each analyst checks its fingerprint once and pins it.

  1. Get the fingerprint from the bottom of the admin page's Overview, from docker logs axiom-server (the line "Certificate fingerprint (share with analysts)"), or from the tlsFingerprint field of /api/health.
  2. Send it to analysts over a channel an attacker can't alter, such as authenticated company chat or a phone call. Fingerprints aren't secret, but analysts will trust whatever you send.
  3. Each analyst enters https://203.0.113.10:8480 under Collaboration server, clicks Fetch certificate to verify & pin, compares the fingerprint, then clicks It matches — trust & pin and signs in.
Verifying the server certificate in AxiomSearch
Verifying the server certificate in AxiomSearch

A pin matches the exact certificate, so changing the host's address never breaks it, but replacing the certificate does. Analysts then click Forget and pin again. Deleting the data volume generates a new certificate, so it also forces every analyst to re-pin.

Fetching the certificate always connects directly. If analysts later reach the server through a TLS-inspecting proxy, the proxy re-signs the connection and the pin no longer matches; exempt the server from inspection. A pin taken through such a proxy is the proxy's certificate, not yours: Forget it and pin again from an uninspected network.

Certificates issued by your IT team

You can give the server a certificate from your own CA instead of the self-signed one: mount the files read-only and set TLS_CERT and TLS_KEY to their paths inside the container. This matters mostly when the server publishes 8480 itself; behind the gateway only Caddy sees the server's certificate, and it already verifies the self-signed default. The server checks the files at most once a minute and serves a renewed pair without a restart. A pair that doesn't load yet, such as a half-written renewal, leaves the current one in place until the next check. With a certificate analysts' machines already trust, they can skip pinning. Behind the gateway, keep the issuing chain in the certificate file (the exported copy carries every certificate in it, and the gateway needs the chain to verify), add tls_server_name with a name on the certificate to the Caddyfile's axiom_upstream snippet if the certificate doesn't name axiom-server, and restart the gateway after the pair changes.

X-Forwarded-For and client addresses

The sign-in lockout and the audit log work per client address. Behind the gateway, every connection comes from the gateway's own address, so the server reads the client's address from the X-Forwarded-For header that Caddy sets. Any client can write that header, so the server believes it only from trusted proxies listed in TRUST_PROXY_HEADERS:

  • The default, axiom-gateway, is the gateway's container name. The server looks it up on their shared network (axiom-backend) at startup and every 30 seconds, and trusts exactly the address it resolves to.
  • You can list several hostnames, IP addresses or CIDRs, separated by commas.
  • 0 trusts nobody. 1 trusts every peer, which is safe only when the server can't be reached except through the proxy.

If you rename the gateway container, update TRUST_PROXY_HEADERS to match. Otherwise the header is ignored, the server logs a line saying a request "carried X-Forwarded-For, which is ignored", and every analyst shares one lockout count. Outside clients can't spoof their address through the gateway: Caddy writes the header itself, and the server uses the last entry, the one the gateway added.