Security Guide¶
This guide summarizes security-related settings and best practices when deploying Nexus GSLB.
Principles
- Secure by default: HTTPS health checks verify TLS by default; GitOps requires signed commits when enabled.
- Least privilege: limit credentials and subject permissions to the minimum required.
- Defense in depth: mTLS for NATS, signed GitOps config, and restricted runtime privileges.
1) HTTP/HTTPS health checks
- Default behavior: when health.http.tls: true, TLS certificates are verified.
- Only set health.http.insecureSkipVerify: true for lab/testing or when using self-signed certs and you fully understand the risk.
- Prefer using proper certificates (internal CA or public CA) and correct http.host to match the cert.
Example (secure):
health:
type: http
port: 443
checkinterval: 10s
timeout: 2s
http:
path: "/healthz"
expectedstatus: 200
tls: true
insecureSkipVerify: false
2) GitOps signing and access
- gitops.requireSignature: true enforces signature verification on the latest commit checked out.
- gitops.allowedSigners restricts accepted signatures to a set of GPG key fingerprints.
- Deploy key: provide a read-only SSH key at gitops.auth.sshKeyPath; permissions should be 0600 and owned by the service user.
- Trust model: ensure the signer keys are trusted on hosts or rely on allowedSigners allowlist.
3) NATS and JetStream
- Use TLS with server authentication at minimum; prefer mTLS (client cert auth) or NATS accounts with JWT.
- Restrict subjects and KV permissions to the cluster namespace: gslb.<cluster>.*.
- Rotate client certificates and credentials regularly. Plan for CA rotation.
- Monitor gslbd_state_nats_connected and set alerts on disconnect.
4) Runtime privileges
- Binding to high ports (≥1024) avoids root. Default DNS port is 5353; if you must use port 53, either:
- run as root (not preferred), or
- grant cap_net_bind_service to the binary: setcap 'cap_net_bind_service=+ep' /usr/local/bin/gslbd and run as non-root.
- Limit file system permissions for /etc/gslb and any private keys.
5) Secrets and licensing
- Provide license secrets via environment variables when possible:
- GSLB_LICENSE_SECRET
- GSLB_LICENSE_KEY
- Use environment management in systemd (Environment=) or container secrets.
6) Supply chain and binaries - Build from source in a controlled CI/CD or use signed release artifacts (future work). - Pin container base images and scan them for vulnerabilities.
7) Logging and PII - Logs contain operational info (e.g., commit SHAs, signer fingerprints) but not sensitive payloads. Avoid logging credentials.
0) Authentication and user accounts
- Set GSLB_API_KEY (32-byte hex, openssl rand -hex 32) in the systemd EnvironmentFile before exposing the API. Without it, the daemon runs in dev mode — requests from localhost are treated as system admin, and every non-loopback caller is rejected with 401 (see section 12).
- Set GSLB_SECRET_KEY (also 32-byte hex) before enrolling any TOTP devices. The daemon will refuse to start if TOTP users exist and the key is absent.
- Store both values in /etc/gslb/env with chmod 600, owned by the service user. Reference it from the systemd unit with EnvironmentFile=/etc/gslb/env.
- Create named user accounts (tenant_admin, operator, viewer) instead of sharing the system API key. The system key is a break-glass credential, not a day-to-day login.
- Treat GSLB_API_KEY as a root password: rotate it if it is ever exposed, and restrict who knows it.
- Keep bcryptCost at 12 or higher in production.
See [Authentication & User Management(Authentication.md) for full setup instructions.
Checklist
- TLS verified for HTTPS health checks (no
insecureSkipVerifyin prod) - GitOps enabled with
requireSignature: trueandallowedSignersconfigured - NATS uses TLS/mTLS; subjects restricted
- Non-root run or capability for port 53; secure file permissions
- License secrets provided via env/secrets manager
-
GSLB_API_KEYset; named user accounts created; system key not used for day-to-day access -
GSLB_SECRET_KEYset before enrolling TOTP devices - EnvironmentFile has
chmod 600and is owned by the service user -
health.allowScriptChecksleft off unless every health-check author is trusted -
health.webhookAllowedHostslists only the internal hosts webhook checks must reach -
api.trustedProxiesset when the API runs behind a reverse proxy (and empty when not)
8) DNSSEC Nexus GSLB signs DNS responses online using ECDSA P-256 (algorithm 13). KSK signs the DNSKEY RRset; ZSK signs all other RRsets.
Signing is per zone: dnssec.zone below is signed from configured PEM files,
and any delegated domain with dnssecEnabled is signed with keys the cluster
generates for it and keeps in the shared NATS KV bucket (gslbctl domains set
<zone> --dnssec). No zone is ever signed with another zone's keys. See
Delegated Domains.
Key generation (only needed for the configured dnssec.zone — a per-zone
enable generates its own):
# KSK
openssl ecparam -name prime256v1 -genkey -noout | \
openssl pkcs8 -topk8 -nocrypt -out /etc/gslb/ksk.pem
# ZSK
openssl ecparam -name prime256v1 -genkey -noout | \
openssl pkcs8 -topk8 -nocrypt -out /etc/gslb/zsk.pem
chmod 640 /etc/gslb/ksk.pem /etc/gslb/zsk.pem
chown root:gslbd /etc/gslb/ksk.pem /etc/gslb/zsk.pem
Configuration:
dnssec:
enabled: true
zone: "example.com."
ksk:
pemFile: "/etc/gslb/ksk.pem"
expiryDate: "2027-01-01"
zsk:
pemFile: "/etc/gslb/zsk.pem"
expiryDate: "2026-07-01"
signatureValidityDays: 7
Alternatively load keys from environment variables:
Key rotation (online, no restart — the cluster double-signs through the window):
gslbctl dnssec zsk rotate [--zone example.com.] # omit --pem to have the server generate the key
# wait signatureValidityDays so cached RRSIGs expire, then:
gslbctl dnssec zsk commit [--zone example.com.]
gslbctl dnssec ksk rotate [--zone example.com.]
gslbctl dnssec rollover [--zone example.com.] # shows the staging DS
# publish that DS at the registrar, wait a TTL, then:
gslbctl dnssec ksk commit [--zone example.com.]
--zone acts on the configured dnssec.zone. Monitor
gslbd_dnssec_key_days_remaining and alert before expiry.
DS record export:
9) Health-check safety (script and webhook checks) Health checks can execute code or make outbound requests from the node, so both kinds are hardened by default.
-
Script checks (
Even when enabled, a script check may only be created via the API by a system administrator — never a tenant/operator key. Prefer atype: script) run arbitrary commands as thegslbduser on every node and are disabled by default. Enable them only if you trust every operator who can create a health check:webhookcheck to run custom logic off-node. -
Webhook checks (
Public destinations remain allowed; entries override the deny list for those ranges only. The same list and rules apply to alert-channel URLs (webhook, Slack, Teams, PagerDuty, OpsGenie). See [Health Checks(../reference/HealthChecks.md) for details.type: webhook) makegslbdrequest a URL you supply. To prevent Server-Side Request Forgery (SSRF) they may target public addresses only by default — loopback, link-local (including the cloud metadata IP169.254.169.254), private/ULA, and CGNAT ranges are blocked. This is enforced both when the check is created and at request time on the resolved address (defeating DNS rebinding; redirects are not followed). To allow a specific internal host, list its CIDR/IP:
10) API behind a reverse proxy
If gslbd's API sits behind a reverse proxy (Caddy, nginx, a load balancer), set
api.trustedProxies to the proxy's CIDR(s). The real client IP is then read from
X-Forwarded-For (rightmost entry that is not itself a trusted proxy) for
requests originating from those sources; otherwise the connection address is used
and X-Forwarded-For is ignored (so it cannot be spoofed by direct clients).
11) WebSocket authentication
The live-event WebSocket endpoint (/api/v1/ws) is gated by a short-lived JWT
signed with GSLB_WS_SECRET, falling back to GSLB_API_KEY. When neither is set
(dev mode) the daemon generates a random per-process secret and logs a warning —
it never signs tokens with a shipped constant. Setting GSLB_API_KEY in
production (section 0) covers this automatically.
12) Dev mode is loopback-only
With no GSLB_API_KEY set the daemon runs in dev mode, where API callers get a
system-admin context without authenticating. That context is granted only to
connections whose source address is loopback (127.0.0.0/8, ::1), read from the
connection itself — X-Forwarded-For cannot widen it. A keyless daemon bound to
0.0.0.0 therefore answers 401 to everything off-box and logs a startup error.
The escape hatch, for throwaway labs only:
Setting it logs a loud error on every start. Never use it on a reachable network: setGSLB_API_KEY instead.
Checklist
-
api.insecureDevnot set (or the host is genuinely disposable)
NSEC3: denial-of-existence records are generated on-the-fly per RFC 5155 §7.1. No static NSEC3 chain is maintained.