Choose a TLS mode
Before you begin
- You need
- Shell access to the host, as a user who may use Docker
The edge serves every hostname of the installation over HTTPS. TLS_MODE in .env decides where its certificates come from:
TLS_MODE |
Certificates | Choose it when |
|---|---|---|
files |
Yours: a certificate chain and key you provide, usually a wildcard from your own CA. Nothing is issued | The installation is internal, or your organisation issues its certificates |
acme_http |
From a public CA, one per hostname, issued and renewed by the edge | The hosts are reachable from the internet on ports 80 and 443 |
internal |
From the edge’s own local CA | You are evaluating MockHub and can make the clients trust that CA |
Your own certificate: files
Section titled “Your own certificate: files”-
Get a certificate that covers the four hostnames,
*.GATEWAY_HOST, and every custom domain a project will use. -
Save the chain as
tls/cert.pemand the key astls/key.pemin the installation directory. -
Set
TLS_MODE=filesin.envand run./mockhub install.
install refuses a pair whose key is not the certificate’s, that has expired, or that does not cover the four hostnames and *.GATEWAY_HOST. A custom domain the certificate does not cover fails its TLS handshake, because nothing is issued for it: extend the certificate before a project uses the domain.
The edge runs as its own user, not as you, and reads the key through the group of tls/. install, restore, upgrade and tls reload set tls/ to 0750 and each file in it to 0640 in that group, so only you and the edge can read the key. The group is your own unless you give tls/ another one, such as a group created for the purpose, with chgrp.
A public CA: acme_http
Section titled “A public CA: acme_http”Set TLS_MODE=acme_http and run ./mockhub install. The hosts must be reachable from the internet on ports 80 and 443, because the CA checks each hostname through them. The UI and documentation hosts get their certificates at start. The API host, the gateway host and each project’s own host, custom domains included, get theirs at their first visit, so the first request to each takes a few seconds longer.
The edge’s own CA: internal
Section titled “The edge’s own CA: internal”Set TLS_MODE=internal and run ./mockhub install. The edge issues every certificate from its own local CA, which no browser or client trusts until you add its root to them. Copy the root out of the edge:
./mockhub compose cp edge:/data/caddy/pki/authorities/local/root.crt .Then add root.crt to the trust store of each machine and client that calls the installation, including those running the CLI and the applications calling mocks.
Renew the certificate
Section titled “Renew the certificate”In files mode the certificate is yours to renew before it expires.
-
Replace
tls/cert.pemandtls/key.pemwith the renewed chain and key. -
Run
./mockhub tls reload.
The command checks the new pair as install does, gives the files the group of tls/ so that the edge can read them however they were copied in, then has the running edge load it, with no restart and no dropped connection, and confirms the edge presents it for the API host. It ends with the certificate’s expiry date. A pair that fails a check is refused before the edge is touched, and the edge keeps serving the previous certificate. In acme_http and internal the edge renews its own certificates, and the command refuses.
Change the mode
Section titled “Change the mode”Set the new TLS_MODE in .env, add tls/cert.pem and tls/key.pem first for files, and run ./mockhub install again. It checks that the release’s edge supports the mode and that its configuration is valid before anything starts.
Limits
Section titled “Limits”- No certificate for a custom domain is issued in
filesmode; the one certificate you provide must cover it. acme_httpneeds the internet both ways: the CA must reach the host, and the host must reach the CA. There is no DNS-based issuance, so wildcard certificates are not issued in this mode.internalis for evaluations: every client must trust its root. Backups carry the edge’s certificates and keys in the recovery kit, so a restore keeps the same CA.