TLS on the MySQL Port
Give the MySQL port on 3309 a certificate of your own, so clients can verify they reach DBTrail and not something in the middle.
Needs DBTrail 0.131.0 or newer.
With nothing set
The port offers TLS to every client that asks for it, with a certificate
DBTrail makes up when it starts. The mysql client asks by default, so its
rows travel encrypted, and --ssl-mode=REQUIRED connects too.
What no client can do is verify that certificate: --ssl-mode=VERIFY_CA and
VERIFY_IDENTITY are refused. So a client cannot tell the port from
something in the middle that pretends to be it.
A certificate of your own
Give the router a certificate and its key, both PEM files, with
BINTRAIL_ROUTER_TLS_CERT and BINTRAIL_ROUTER_TLS_KEY (or --tls-cert and
--tls-key). A client that trusts the CA that signed it can then verify it:
mysql -h db-copy.example.com -P 3309 -u shop -p \
--ssl-mode=VERIFY_IDENTITY --ssl-ca=/path/to/ca.pemWith Docker Compose, put the two files in a tls folder next to
docker-compose.yml and add a docker-compose.override.yml beside it:
services:
router:
environment:
BINTRAIL_ROUTER_TLS_CERT: /etc/bintrail/tls/port-cert.pem
BINTRAIL_ROUTER_TLS_KEY: /etc/bintrail/tls/port-key.pem
volumes:
- ./tls:/etc/bintrail/tls:rothen docker compose up -d router. The key must be readable by the user the
router runs as: uid 999 in the image, bintrail in the Linux packages.
- Both or neither. One without the other, a file that is missing, one that is not PEM, or a key that does not match the certificate: the router does not start, and says which file. It never goes back to the made-up certificate on its own.
- A
fullchain.pemworks. RSA and ECDSA keys work. A key with a passphrase does not. - The port offers TLS, it does not require it. A client that asks for no
encryption is answered in clear text, as before. What keeps a client
encrypted is its own
--ssl-mode=REQUIREDor stricter. - Renewing. The files are read when the router starts: after renewing,
docker compose restart router. Capture keeps running. An expired certificate is still served, with a warning in the router's log. - The router's first lines say which certificate it offers, and until when.
To reach the port from other machines, also open it: the "Reach the port from other machines" note of Production.