OPNexusdocs

Network access and TLS

The bundled Caddy proxy is the only service listening on the network (ports 80 and 443; port 80 redirects to HTTPS). Backend and frontend are bound to 127.0.0.1 only. Browser and API talk to the same host, so IP address and host name work equally well.

Certificates without DNS. The proxy issues certificates from its own internal CA, also for plain IP addresses. Download the root CA once from https://<address>/opnexus-ca.crt and import it into the browser or system (Firefox: Settings › Certificates › Authorities; Windows/macOS: install as a trusted root certification authority). Until then the browser shows a warning; the connection is encrypted nonetheless.

Verify the root CA before importing. Someone sitting between browser and server could slip in their own CA. Therefore compare the fingerprint on the server with that of the downloaded file before importing:

bash
# on the server
docker compose exec -T proxy cat /data/caddy/pki/authorities/local/root.crt \
  | openssl x509 -noout -fingerprint -sha256
# on the client, for the downloaded file
openssl x509 -in opnexus-root-ca.crt -noout -fingerprint -sha256

Import only if the SHA-256 fingerprints are identical, or distribute the CA through your company/MDM tooling.

Setting addresses. In the .env you enter all addresses under which OPNexus should be reachable:

bash
OPNEXUS_SITES=10.0.0.5, opnexus.lan     # all addresses (IP and/or names)
OPNEXUS_DEFAULT_SNI=10.0.0.5            # the primary one; browsers send no name for a plain IP
FRONTEND_ORIGIN=https://10.0.0.5,https://opnexus.lan
COOKIE_SECURE=true
TRUST_PROXY_HEADERS=true

Then docker compose up -d. A name without DNS needs an entry in the hosts file on the client. TRUST_PROXY_HEADERS=true may only be set if a proxy sits in front that sets X-Forwarded-For itself; the bundled proxy does. Otherwise any client could bypass the login lockout with a forged header.

One certificate for all addresses. The proxy issues one certificate that contains every address from OPNEXUS_SITES (and OPNEXUS_DEFAULT_SNI), signed by the same internal CA. A browser that opens a plain IP address sends no name, so a certificate per address would show the one of the default address for every address; with an HA pair the shared address (VIP) would then show a warning even with the CA imported. The certificate is valid for two years and renews itself 90 days before it expires (the proxy restarts for a moment). Changing OPNEXUS_SITES issues a new one at the next start of the proxy. The root CA does not change, so nothing has to be imported again. On an HA pair each node issues its own certificate for the VIP and its own address, from the CA that the sync keeps identical on both. OPNEXUS_WEB_CERT=internal in the .env brings back one certificate per address.

Your own certificate. For a certificate from your company CA, or one issued elsewhere (for example by Let's Encrypt on a different machine): in the web interface open Settings › Access › Web certificate (needs the updater service, see "One-click updates (optional)"), choose Install own certificate, paste or pick the certificate chain (PEM, leaf first) and the private key (PEM, without a passphrase) and press Check. The dialog shows what it found (subject, expiry, addresses, and which of your addresses the certificate does not cover); Install only becomes available for exactly what was checked. The proxy restarts for up to a minute; the page tells you when the certificate is active. A browser that does not trust the issuer shows a warning afterwards. Back to the internal certificate undoes it. The private key passes through OPNexus once and is stored only in the proxy's volume; it appears in no log and not in the audit trail. The same on the command line: put the two files on the server and run

bash
./opnexus cert install --cert fullchain.pem --key privkey.pem
./opnexus cert status        # source, addresses, expiry, fingerprint
./opnexus cert remove        # back to the certificate of the internal CA

cert install checks the files first (readable, the key belongs to the certificate, not expired, valid for which of your addresses), writes them into the proxy's volume, restarts the proxy and looks at what the proxy really serves. If it does not serve the new certificate, everything is rolled back and the previous state is restored. A certificate that is valid for only some of your addresses installs with a warning that names the others; one that is valid for none is refused. A custom certificate does not renew itself: run cert install again before it expires (cert status shows the days left). On an HA pair the primary hands the certificate and the setting to the standby with the regular sync (every 5 minutes, or at once with ./opnexus ha sync). The installation needs OPNexus 1.41 or newer (the command says so if the compose file is older). OPNEXUS_WEB_CERT=custom in the .env is what the command sets; if the files are missing or invalid at start the proxy falls back to the certificate of the internal CA and says why in docker compose logs proxy. On an HA pair the interface and the command work on the primary; the standby shows the certificate but leaves changes to the primary.

Back up: the key of the internal CA lives in the volume caddy_data. If it is lost, a new CA is created and all clients have to import it again.

Your own reverse proxy. Instead of the bundled proxy you can use your own (e.g. Caddy with a Let's Encrypt certificate). Backend (127.0.0.1:8100) and frontend (127.0.0.1:3100) then stay behind it:

opnexus.example.com {
    reverse_proxy /api/* localhost:8100
    reverse_proxy localhost:3100
}

In the .env: FRONTEND_ORIGIN=https://opnexus.example.com, COOKIE_SECURE=true, TRUST_PROXY_HEADERS=true.

Without TLS (only for trusted test networks). BIND_ADDRESS=0.0.0.0 in the .env publishes frontend (3100) and backend (8100) on the network, FRONTEND_ORIGIN=http://<ip>:3100 allows access. The session cookie then travels unencrypted over the network; this is not suitable for an untrusted network or the internet.