Skip to content
Free test

Certificates and TLS

In development. Not available. Packages are not yet published for download.

Applies to: Reach 0.1.1, built from commit 08df4b0. There is no release.

Copied word for word from docs/install/tls.md in the private Reach repository, commit 08df4b0, 21 November 2026.

The guide: Reach server: certificates and trust

Reach is in development. Its packages are not published.

Reach serves the console and the agent API (what the Reach agent (the read-only program on each machine) calls) over HTTPS only. In this build there are two ways to give it a certificate (1 and 2 below); a reverse proxy (3) is not available in this build. Pick one when you run init.

What is proved and what is not#

Proved by the automated tests in this repository (go test ./... and go test -tags e2e ./e2e/): the files and fingerprints init produces, that the server certificate verifies against reach-ca.pem for the public host name, localhost and 127.0.0.1, that a client trusting only reach-ca.pem opens the console, that curl --cacert reach-ca.pem succeeds, that the sign-in page shows the fingerprint of the certificate actually served, that tls renew keeps the key, and that an agent given only the CA file (no pin) enrols and sends.

Not tested: installing the CA into the macOS, Windows or Rocky Linux trust stores, and any browser's behaviour after you do. The commands below are the standard ones for each system; run them on a test machine first.

1. Evaluation: the generated CA (default, --tls self-signed)#

reach-server init --tls self-signed makes a small local certificate authority and a server certificate signed by it:

  • the CA: ECDSA P-256, valid 10 years, named Reach evaluation CA for <your public host>. Its private key is <data>/tls/ca.key (mode 0600). Only init and reach-server tls renew read it; the running server never does. Keep it private and do not copy it to other machines.
  • the server certificate: ECDSA P-256, valid 397 days, covering the public URL's host plus localhost and 127.0.0.1.
  • <data>/tls/reach-ca.pem: the CA certificate. This one is meant to be handed out.

init prints the SHA-256 fingerprint of both certificates. The sign-in page also shows the server certificate's fingerprint, so if a browser still warns you, compare the two before you accept.

The CA is only for evaluation. It can sign for any name you give it, so install reach-ca.pem only on machines you control, and remove it when you finish evaluating.

Trust the CA so the console opens without a warning#

Copy reach-ca.pem to the machine whose browser you will use, then:

macOS (Chrome and Safari use the system keychain):

Shell
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/reach-ca.pem

To remove it: open Keychain Access, find "Reach evaluation CA for ...", delete it.

Windows (Chrome and Edge use the Windows store), in PowerShell run as administrator:

PowerShell
certutil -addstore -f Root C:\path\to\reach-ca.pem

To remove it: certutil -delstore Root "Reach evaluation CA for <your public host>".

Rocky Linux 9 (the same commands should work on compatible distributions such as RHEL 9, not tested):

Shell
sudo cp /path/to/reach-ca.pem /etc/pki/ca-trust/source/anchors/reach-ca.pem
sudo update-ca-trust

To remove it: delete that file and run sudo update-ca-trust again. Chrome on Linux keeps its own store (Settings, Privacy and security, Manage certificates, Authorities, Import).

Firefox on any system keeps its own store: Settings, Privacy and Security, View Certificates, Authorities, Import, then tick "Trust this CA to identify websites".

curl needs no installation: curl --cacert reach-ca.pem https://<host>:<port>/healthz.

Agents#

An agent does not need the CA. The enrolment token carries the SHA-256 of the server certificate's public key (the t pin), and an agent holding a token trusts exactly that key and nothing else. If you would rather have an agent verify the certificate chain, enrol it from a token without a pin and give it the CA with the environment variable REACH_AGENT_TLS_CA_FILE=/path/to/reach-ca.pem. With a pinned token (the default in this mode) the agent ignores the CA file: the pin is the whole check. The same setting can be written as tls_ca_file = "/path/to/reach-ca.pem" in agent.toml (see Install the agent); the environment variable overrides the file. Proved by an automated test with a certificate no one else trusts; not tried on any Windows or macOS machine.

Changing public_url and the tunnel#

The console accepts form posts (including sign-in) only from its own address, console_url if set, otherwise public_url. After public_url is changed to the server's network name, a sign-in through an SSH tunnel at https://localhost:8443 is refused with "Forbidden: the request did not come from this site." when the client is not a browser. A current browser at the tunnel address is accepted whatever public_url says, because it states that the request comes from the same site; the refusal is what a script, curl or any other client gets when it sends no such statement and its Origin is not public_url's (a proxy or browser extension that strips the header does the same). Finish every person's second step first. If it has happened: set public_url back to https://localhost:8443 and listen back to 127.0.0.1:8443, restart, finish every second step through the tunnel, then change both again (and run tls renew so the certificate covers the new name).

Renewing#

The server certificate lasts 397 days. Renew it with:

Shell
sudo -u reach-server /usr/bin/reach-server tls renew --config /etc/reach-server/server.toml

then restart reach-server. The renewed certificate is signed by the same CA and keeps the same key, so reach-ca.pem, issued tokens and enrolled agents keep working; only the fingerprint on the sign-in page changes. A server made before this CA existed has no CA key; it renews its own self-signed certificate at start-up as before, and tls renew does the same by hand.

2. Your own certificate (--tls files)#

Use a certificate your organisation already issues for the host name. On the packaged (RPM) install, put the two files in /etc/reach-server/tls/, owned by root and readable by the reach-server group, then run init as in the install guide with --tls files:

Shell
sudo install -d -o root -g reach-server -m 0750 /etc/reach-server/tls
sudo install -o root -g reach-server -m 0644 /path/to/fullchain.pem /etc/reach-server/tls/server.pem
sudo install -o root -g reach-server -m 0640 /path/to/private-key.pem /etc/reach-server/tls/server.key
cd /
sudo -u reach-server /usr/bin/reach-server init \
  --dir /var/lib/reach-server \
  --public-url https://reach.example.co.za:8443 \
  --listen 127.0.0.1:8443 \
  --tls files --cert-file /etc/reach-server/tls/server.pem --key-file /etc/reach-server/tls/server.key
sudo install -o root -g reach-server -m 0640 /var/lib/reach-server/server.toml /etc/reach-server/server.toml
sudo rm /var/lib/reach-server/server.toml

Why there and so: the service runs as reach-server with ProtectHome=yes and PrivateTmp=yes, so it cannot see files under /home or /tmp; /etc stays readable under ProtectSystem=strict. Root owns the files so the service account cannot change them; only the reach-server group can read the key. install (or cp) gives the new files the SELinux label of /etc/reach-server; mv keeps the label of where they came from, so if you moved them, run sudo restorecon -R /etc/reach-server. The certificate file holds the server certificate followed by any intermediate certificates. These steps follow the code and the service unit; they have not yet been run with a real organisation's certificate.

init checks that the two files load as a pair. No CA is created and the sign-in page shows no fingerprint, because browsers and agents verify the certificate through the normal trust store. Tokens carry no pin, so agents use the operating system's trust store; if your certificate comes from a private authority, give agents its certificate with REACH_AGENT_TLS_CA_FILE. Renew the certificate the way you issued it, copy the new files over the old ones with the same install commands, and restart reach-server; tls renew refuses in this mode.

The first sign-in with your own certificate. The certificate covers your server's name, not localhost, and the setup link that init prints points at public_url (links made later with reach-server setup-link point at console_url when you have set one). Either:

  • open the server to the network straight away (set listen to the address you want, for example 0.0.0.0:8443, open the firewall port, start the server) and open the setup link from your own computer at once. A server with no users yet may listen on the network: the setup link is the only way in, it works once and for 60 minutes, and you set up the second step before any page opens. Or
  • keep listen on 127.0.0.1:8443, open an SSH tunnel from your computer (ssh -L 8443:127.0.0.1:8443 <you>@<server>), and on your computer point the server's name at 127.0.0.1 for the moment (one line in /etc/hosts, or C:\Windows\System32\drivers\etc\hosts on Windows: 127.0.0.1 reach.example.co.za). The browser then reaches the tunnel under the certificate's name. Remove the line afterwards.

Switching a server made with --tls self-signed to your own certificate. Put the files in /etc/reach-server/tls/ as above, then in /etc/reach-server/server.toml set, under [tls], mode = "files", cert_file = "/etc/reach-server/tls/server.pem" and key_file = "/etc/reach-server/tls/server.key", and restart. Agents enrolled with the self-signed server's tokens pin that server's key, so every enrolled agent stops reaching the server: issue new tokens and run reach-agent enrol --force on each machine (agents). Do it before you enrol a fleet. Not yet run on a test server.

3. Behind your own reverse proxy (not available in this build)#

Not available in this build. The server refuses tls.mode = "proxy" with the message "tls.mode proxy is not available in this version of Reach" (a reverse proxy is planned, not built), so use way 1 or 2.

Do not put a proxy or a port forwarder in front of the server on the same machine. The server tells a local sign-in from a remote one by the address the connection comes from, and it refuses a password for an account with no two-step sign-in from any address that is not loopback. A proxy or forwarder on the same host makes every connection look local, so that protection stops working. (Reverse proxies are not supported in this build; see users and sign-in.)