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#
| Port | Program | Default | What travels |
|---|---|---|---|
addr (7480) | raftdb-server | 127.0.0.1 for the single profile; 0.0.0.0 for primary and replica | The binary protocol, HTTP/JSON API, the Studio, and replication (a follower connects here with Follow). Credentials, tokens and data in clear text. |
| Same number, UDP | raftdb-server | Off (udp) | Datagrams authenticated with an HMAC-SHA-256 tag per datagram, keyed with a session secret; not encrypted. |
listen (3307) | raftdb-mysql | 127.0.0.1:3307 | The 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_port | raftdb-watch | Off; when on, 127.0.0.1 only | The status JSON. |
Peer port (in cluster_peers) | raftdb-watch | Off | Watcher-to-watcher messages, authenticated with cluster_secret (HMAC), not encrypted. |
| Webhook and error-report endpoints | raftdb-watch, all programs | Off | Plain http://: the event or report as JSON, optionally with a bearer token in clear. |
Rules#
- Leave everything on loopback unless a client on another machine needs it.
raftdb-serverandraftdb-mysqlbind loopback by default; do not changelisten = 0.0.0.0:...casually (an example in this manual uses it to show the syntax). - A machine that serves the network (
primaryorreplicaprofile, oraddr = 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 owninitfile says so: "listens on the network: reach it only through a tunnel until TLS exists".https-addrencrypts only the HTTP API; the binary protocol onaddrand replication stay in clear text, so the tunnel advice stands for them. - Firewall every port to the addresses that need it: application servers to
listen; followers and watchers toaddr; watchers to each other's peer ports. - Put the SQL front-end and the server on one machine (the
embedmode): then the only port clients reach islisten, andaddrcan stay on loopback. Use two processes on two machines only through a tunnel. - Do not publish the Studio on the Internet. It is served by the server's port and its login travels in clear text.
- Do not use
open(no login) on a machine other people can reach. corslists 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-serversweakens 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 -pFor 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-mysql | Guess MySQL passwords (no delay or lockout). Read traffic on the path. |
addr of raftdb-server | Guess account passwords (250 ms per failure); read traffic on the path; with a leaked token or password, administer the server. |
| The replication stream | Read all replicated data (it is the log). A follower needs an account that can read (replicator is read-only). |
| A watcher peer port | Without cluster_secret, nothing (messages need a valid tag); with it, decide who is primary. |
status_port | Nothing: loopback only. |