Firewall & Network Hardening

Which Logship ports to expose, which to keep private, and firewall rules for public-facing servers.

Firewall & Network Hardening

Logship binds several sockets. Only the HTTP API and (optionally) the frontend host should ever be reachable from the public internet. Keep the cluster RPC and metrics ports on a private network. Cluster RPC is authenticated and encrypted unless Plaintext mode is configured; see Cluster transport security.

Start from a default-deny inbound policy and open only the ports below.

Ports

PortProtoComponentDefault bindPublic exposure
5000TCP + UDPBackend HTTP API & Web UIall interfacesYes — behind a TLS reverse proxy
8000TCPFrontend SPA host (fe-svelte)all interfacesOnly if serving the SPA directly
6000TCPDatabase cluster RPC (worker)all interfacesNo — private network / peers only
6002TCPBackend cluster RPC (worker)all interfacesNo — private network / peers only
6000/6002TCPCluster RPC (master)loopbackNo — loopback only, never off-host
49999UDPInternal metricsoutbound (egress)No — not an inbound listener

The API port serves HTTP/1.1, HTTP/2, and HTTP/3. HTTP/3 runs over QUIC, so 5000 must be opened for both TCP and UDP if you expose it directly or advertise HTTP/3 through the proxy.

Changing the ports

Every port above is configurable. Override the key in the referenced config section rather than assuming the default.

PortConfig keyReference
5000backend.listenPortDatabase → backend
8000Kestrel.Endpoints.Http.UrlFrontend → Http
6000database.endpoints.worker / database.endpoints.masterDatabase → endpoints
6002backend.endpoints.worker / backend.endpoints.masterDatabase → endpoints
49999agent.udpMetricsEndpointDatabase → agent

The cluster RPC endpoints (6000, 6002) take the bind address as well as the port: change the 0.0.0.0 in the worker endpoint to a private interface to stop binding on all interfaces.

Allow

  • TLS ingress (443/tcp, and 443/udp for HTTP/3). Terminate TLS at a reverse proxy and forward to the backend on 5000. Do not expose 5000 in plaintext to the internet.
  • 8000/tcp — only when the frontend host is served directly. Prefer fronting it with the same TLS proxy on 443.

Disallow

🚫 Never expose cluster RPC ports

The worker endpoints (6000, 6002) bind to 0.0.0.0 by default. With backend.cluster.mode set to Plaintext the transport has no authentication or encryption, and anyone who can reach it can read and write cluster data. In every mode, restrict the ports to peer node addresses on a private subnet, or bind them to a private interface in configuration.

  • 6000/tcp, 6002/tcp — block from the public internet. Allow only from known cluster peer IPs. Single-node deployments should block them entirely.
  • 49999/udp — the metrics socket is outbound only; nothing needs to reach it from outside the host. Block inbound.
  • Everything else — drop by default.

Reverse proxy pattern

For a public server, expose only the proxy and keep the backend on loopback or a private interface:

internet ──443/tcp+udp──▶ reverse proxy (TLS) ──▶ 127.0.0.1:5000 backend

The backend takes the client address from X-Forwarded-For only when the connection comes from loopback or an address in backend.trustedProxies, and walks back through every trusted hop. List the exact address of each proxy that is not on loopback; otherwise every client is seen as the proxy and shares its rate limits. Name a network (such as 10.1.0.0/16) only when every host in it is a trusted proxy: any host in a listed network can send X-Forwarded-For and pick the client address its requests are limited and audited as.

Password sign-in (POST /auth/token), identity provider and certificate sign-in starts, password reset and registration requests, and agent enrollment are rate limited per client, counting each IPv4 address and each IPv6 /64 as one client and limiting every IPv6 /48 to eight clients' worth of each of these limits (an IPv4-mapped or 64:ff9b::/96 NAT64 address counts as its IPv4 address, and requests with no known address share one client); password sign-in and every other password verification, reset and registration requests are limited per user name as well, and password reset and invitation completions per client (see tokens). Identity provider and certificate sign-in starts are limited separately, 10 a minute per client each. Starting to link an identity provider is limited per user, as many a minute as sign-in starts per client, and a user keeps at most three links in progress, a new one replacing the oldest. Sign-ins in progress are kept in pools of 2,000 records each, shared by every host: identity provider transactions, identity provider completions, certificate transactions, certificate completions and links. No pool's records count against another's. A full pool evicts the first-written record that never reached its provider, and only when none is left the first-written one in progress; a record's lifetime never moves it ahead of older ones.

  • Identity provider sign-ins. A flood of starts that never follow their redirect evicts only other starts that never followed theirs, so it never evicts a sign-in at its provider. One that follows every redirect must make 2,000 newer ones while a user is at its provider: at 10 starts a minute per client, a two-minute provider round trip takes 100 IPv4 addresses (or 13 IPv6 /48 networks, at eight clients' worth each) against one host.
  • Certificate sign-ins. A certificate sign-in is never redirected to a provider: it is in progress from its start until the browser presents its client certificate at the callback, normally within seconds. A flood of certificate starts evicts it only by making 2,000 newer starts in that time; for a sign-in that takes a minute, that is 200 IPv4 addresses (or 25 IPv6 /48 networks) against one host.
  • Completions. A completion is written only once a sign-in has succeeded at its provider, or with a valid client certificate, and lives a minute, so filling a completion pool takes 2,000 successful sign-ins a minute: 200 IPv4 addresses (or 25 IPv6 /48 networks) against one host whose every sign-in succeeds.
  • Links. A link is started only by a user who signed in within the last five minutes or re-entered its password, and the per-user limit of three applies before the pool's eviction, so evicting another user's link in progress takes about 667 freshly signed-in users, each following its redirects. This matters where identity providers or registration let anyone create a user.

Each figure is divided by the number of hosts behind the load balancer, since every host limits its clients separately. A network that can field that many addresses can delay sign-ins this way; block it at the proxy. Password verifications count refused attempts and, more generously, all attempts; each host also derives at most one password per two processors at a time by default (at least one; backend.passwordDerivations), queues a bounded number of requests behind those, and answers 503 past that.

These limits are kept by each host. Behind a load balancer that spreads requests over several hosts, a client or user name gets up to the limits on each host, so multiply them by the number of hosts. Every client limit, per minute or per 15 minutes, counts at most 100,000 clients exactly per window; clients new to a full window are counted in a fixed-size table that may overcount but never undercounts, so they stay limited. Because that table overcounts more as a flood grows, clients new to a full window get four times a per-minute limit's permits, so a flood must send about four times as many requests before it refuses a newly arriving client; the 15-minute sign-in and email-link client limits keep their permits.

{ "backend": { "trustedProxies": ["10.0.0.5", "10.0.0.6"] } }

Gate load-balancer health checks on GET /health/ready, which is anonymous — see Install → Health checks.

Example rules

Open the TLS port, keep cluster and metrics ports closed, and default-deny the rest.

ufw default deny incoming
ufw default allow outgoing
ufw allow 443/tcp
ufw allow 443/udp
ufw enable
💡 Restrict cluster ports to peers

When running a multi-node cluster, add explicit allow rules for peer addresses rather than opening the ports globally, e.g. ufw allow from 10.0.0.0/24 to any port 6000 proto tcp.