Security

Hardening checklist

A checklist of concrete steps to reduce the risk of a Raft DB installation, given that it has no TLS and no audit log.

Every item below is something the software supports today. Items that need features Raft DB does not have are in the last section, so you know what you cannot do.

Network#

  • raftdb-server and raftdb-mysql listen on loopback unless a remote client needs them.
  • If a port serves the network, a firewall limits it to the machines that need it, and the path is a private network or a tunnel.
  • The SQL front-end runs in the same process as the server (embed), so the server's port stays on loopback.
  • The watcher's status_port is left on loopback (it cannot be anything else).
  • udp is off unless you measured a need for it.
  • cors is empty, or lists exact origins; never * on a server that is not open and never on an open one.
  • allow-remote-servers is off.
  • The Studio is not reachable from the Internet.

Accounts#

  • No open. No account whose password is in a document or a script you shared.
  • admin.password is read-only for its owner; nobody else can read the data directory.
  • Applications use readwrite (or readonly) accounts, limited with @DATABASE, never admin and never the shared token.
  • The watcher uses its own account; probe_write = false and readonly if you want it unable to write.
  • The SQL front-end's raftdb_user has a long random password used nowhere else.
  • MySQL accounts for applications are made with CREATE USER and limited with GRANT to their own database; bootstrap administrators are few, and their passwords are long.
  • Passwords in mysql.conf contain no #; the file is readable only by the service user.
  • Settings files with passwords are not world-readable; passwords are not on command lines (they show in the process list).
  • Every node of a cluster has the same user lines (accounts are not replicated), and the control account has a password no application knows.

Processes and files#

  • Each process runs as its own unprivileged user. install-service makes the user raftdb and a sandboxed unit.
  • The data directory is owned by that user and has no access for others.
  • Only one server runs per data directory.
  • The watcher may run exactly one privileged command (systemctl restart raftdb through sudoers), and its cleanup_command never touches the data directory.
  • Error reports stay local (RAFTDB_ERROR_REPORT_URL and _COMMAND unset), or are sent to an endpoint you control through a script that uses HTTPS.
  • RAFTDB_MYSQL_TRACE is off (it logs statements with their passwords).

Data#

  • Disks are encrypted, if the data requires it.
  • Backups are made, copied elsewhere and restore-tested; they are protected like the data (Backup and recovery).
  • The watcher is running and its notifications reach a person.

Application side#

  • Parameters are sent as prepared-statement parameters: a value cannot change a statement's structure.
  • The application does not rely on SELECT ... FOR UPDATE, LOCK TABLES or an isolation level: only the per-table claim of writing transactions is enforced.
  • Connection strings turn TLS off explicitly (so a driver does not fail or fall back unexpectedly) and go through a tunnel when the network is not private.

What you cannot do yet#

WishWhy not
Encrypt client or node trafficNo TLS (TLS and encryption).
Lock an account after failed logins; slow down MySQL password guessingNo lockout, no delay on the MySQL side. Limit who can reach the port.
Audit who ran whatNo audit log.
Expire passwords, require strong passwords, rotate without a restart (server accounts)Not built.
Use roles, row-level security, routine privilegesRefused (roles, routine privileges) or not present.
Restrict by client certificateREQUIRE X509 is refused.
Replicate accountsNot built; every node needs the same settings.
Encrypt data at rest in the databaseUse the operating system.

See also#