Security

Network exposure

Every port Raft DB opens, who may reach it by default, and how to expose it safely given that nothing is encrypted.

The ports#

PortProgramDefaultWhat travels
addr (7480)raftdb-server127.0.0.1 for the single profile; 0.0.0.0 for primary and replicaThe binary protocol, HTTP/JSON API, the Studio, and replication (a follower connects here with Follow). Credentials, tokens and data in clear text.
Same number, UDPraftdb-serverOff (udp)Datagrams authenticated with an HMAC-SHA-256 tag per datagram, keyed with a session secret; not encrypted.
listen (3307)raftdb-mysql127.0.0.1:3307The MySQL protocol. The login proof does not send the password; statements and data are in clear text unless TLS is configured (ssl_cert, ssl_key, ssl_mode: see TLS and encryption).
status_portraftdb-watchOff; when on, 127.0.0.1 onlyThe status JSON.
Peer port (in cluster_peers)raftdb-watchOffWatcher-to-watcher messages, authenticated with cluster_secret (HMAC), not encrypted.
Webhook and error-report endpointsraftdb-watch, all programsOffPlain http://: the event or report as JSON, optionally with a bearer token in clear.

Rules#

  1. Leave everything on loopback unless a client on another machine needs it. raftdb-server and raftdb-mysql bind loopback by default; do not change listen = 0.0.0.0:... casually (an example in this manual uses it to show the syntax).
  2. A machine that serves the network (primary or replica profile, or addr = 0.0.0.0:7480) must be reachable only from a private network and, if the path is not yours end to end, through a tunnel. The profile's own init file says so: "listens on the network: reach it only through a tunnel until TLS exists". https-addr encrypts only the HTTP API; the binary protocol on addr and replication stay in clear text, so the tunnel advice stands for them.
  3. Firewall every port to the addresses that need it: application servers to listen; followers and watchers to addr; watchers to each other's peer ports.
  4. Put the SQL front-end and the server on one machine (the embed mode): then the only port clients reach is listen, and addr can stay on loopback. Use two processes on two machines only through a tunnel.
  5. Do not publish the Studio on the Internet. It is served by the server's port and its login travels in clear text.
  6. Do not use open (no login) on a machine other people can reach.
  7. cors lists origins whose pages may call the API from a browser; it never replaces the login. * must not be used on an open server: any website could then reach it. allow-remote-servers weakens the Studio page's protection against data leaving through injected script; enable it only where the Studio is the only page served.

Tunnels#

The project's own multi-site tests reach servers on other hosts through an SSH tunnel to loopback. An example for a client on another machine:

ssh -N -L 3307:127.0.0.1:3307 user@dbhost
mysql -h 127.0.0.1 -P 3307 -u app -p

For node-to-node traffic (replication, watcher peers) a private network or a WireGuard mesh does the same job. A tunnel gives confidentiality and server authentication; Raft DB still does the user authentication on top.

Who can reach what, at a glance#

If an attacker can reach...They can try...
listen of raftdb-mysqlGuess MySQL passwords (no delay or lockout). Read traffic on the path.
addr of raftdb-serverGuess account passwords (250 ms per failure); read traffic on the path; with a leaked token or password, administer the server.
The replication streamRead all replicated data (it is the log). A follower needs an account that can read (replicator is read-only).
A watcher peer portWithout cluster_secret, nothing (messages need a valid tag); with it, decide who is primary.
status_portNothing: loopback only.

See also#