Skip to content

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
  1. Get a certificate that covers the four hostnames, *.GATEWAY_HOST, and every custom domain a project will use.

  2. Save the chain as tls/cert.pem and the key as tls/key.pem in the installation directory.

  3. Set TLS_MODE=files in .env and 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.

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.

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:

Terminal window
./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.

In files mode the certificate is yours to renew before it expires.

  1. Replace tls/cert.pem and tls/key.pem with the renewed chain and key.

  2. 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.

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.

  • No certificate for a custom domain is issued in files mode; the one certificate you provide must cover it.
  • acme_http needs 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.
  • internal is 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.

Report a problem with this page