Skip to content

Certificates

LoKO uses cfssl to generate a single shared certificate authority and per-environment wildcard TLS certificates for HTTPS development.

%% title: Certificate Trust Flow %%
graph TB
    cfssl[cfssl] -->|Creates once| CA["Global LoKO CA\n~/.loko/ca/"]
    CA -->|Installed into| System[System Trust Store]
    CA -->|Installed into| Docker["~/.docker/certs.d/"]
    cfssl -->|Signs per-env| Cert["Wildcard Certificate\n*.dev.me"]
    Cert -->|Used by| Traefik[Traefik Ingress]
    Browser[Browser] -->|HTTPS Request| Traefik
    Traefik -->|Presents Cert| Browser
    Browser -->|Trusts CA| System

    classDef toolStyle fill:#fb8c00,stroke:#e65100,color:#fff
    classDef caStyle fill:#d81b60,stroke:#880e4f,color:#fff
    classDef sysStyle fill:#546e7a,stroke:#37474f,color:#fff
    classDef certStyle fill:#00897b,stroke:#00695c,color:#fff
    classDef traefikStyle fill:#3949ab,stroke:#283593,color:#fff
    classDef browserStyle fill:#0288d1,stroke:#01579b,color:#fff

    class cfssl toolStyle
    class CA caStyle
    class System,Docker sysStyle
    class Cert certStyle
    class Traefik traefikStyle
    class Browser browserStyle

LoKO maintains a single global CA shared across all environments. This means:

  • System trust (macOS Keychain, Linux trust store, NSS/Firefox, Java cacerts) is installed once, not once per environment
  • You can run 100 environments with 100 different domains — each gets its own wildcard cert signed by the same trusted CA
  • The CA is valid for 10 years; per-environment wildcard certs are valid for 1 year
LocationContents
~/.loko/ca/loko-ca.pemGlobal CA certificate (shared)
~/.loko/ca/loko-ca-key.pemGlobal CA private key
~/.loko/environments/<env>/certs/<domain>.pemWildcard certificate
~/.loko/environments/<env>/certs/<domain>-key.pemWildcard private key
~/.docker/certs.d/<registry-host>/ca.crtDocker registry trust

Certificates are created automatically during environment creation:

Terminal window
loko env create

This command automatically:

  1. Creates the global LoKO CA if it does not exist yet (stored in ~/.loko/ca/)
  2. Installs the global CA into the host trust store (macOS Keychain, Linux trust store, NSS, Java)
  3. Configures Docker Desktop / Docker daemon to trust the CA for registry TLS
  4. Generates a wildcard certificate for your configured domain, signed by the global CA
  5. Configures Traefik to use the generated certificate

On subsequent environments, steps 1–3 are skipped since the CA already exists and is already trusted.

LoKO generates certificates covering:

  • *.dev.me
  • dev.me
  • *.pr.dev.me when GitOps preview environments are enabled
  • workload-specific wildcard domains such as *.garage.dev.me when required
Terminal window
loko certs ca status

Displays path, subject, expiry dates, and SHA-256 fingerprint of the global CA.

Useful when setting up on a new machine with an existing ~/.loko/ca/, or when trust was accidentally removed:

Terminal window
loko certs ca install

Reinstalls the global CA into all trust stores and Docker certs.d.

Terminal window
# Remove trust and delete CA files
loko certs ca remove
# Remove trust only, keep CA files
loko certs ca remove --keep-files

Removes the CA from all trust stores, cleans up ~/.docker/certs.d/ entries for all known environments, and (by default) deletes ~/.loko/ca/.

Terminal window
loko certs ca regenerate

Destroys the current CA, generates a fresh one, and reinstalls trust. All existing environment wildcard certs are invalidated — renew them afterwards:

Terminal window
loko certs renew
Terminal window
loko certs show

Displays the wildcard cert for the current environment: SANs, expiry, issuer, fingerprint.

Terminal window
loko certs renew

Regenerates the wildcard cert for the current environment using the existing global CA. Automatically updates the Kubernetes wildcard-tls secret and restarts Traefik.

LoKO installs the global CA into the System Keychain automatically.

Firefox uses its own NSS store. Install nss first:

Terminal window
brew install nss
loko certs ca install

If Firefox still warns:

  1. Confirm nss is installed
  2. Run loko certs ca install
  3. Restart Firefox fully

LoKO detects and installs the CA into the appropriate trust store:

DistroTrust command
Debian / Ubuntuupdate-ca-certificates
Fedora / RHEL / Rockyupdate-ca-trust
Archtrust extract-compat
openSUSEupdate-ca-certificates

For Firefox/NSS trust, install certutil:

Terminal window
# Debian/Ubuntu
sudo apt install libnss3-tools
# openSUSE
sudo zypper install mozilla-nss-tools

Then re-run:

Terminal window
loko certs ca install
Terminal window
# Show global CA
loko certs ca status
# Or directly with openssl
openssl x509 -in ~/.loko/ca/loko-ca.pem -noout -subject -issuer -dates
# Show env wildcard cert
loko certs show
# Test HTTPS
curl -v https://forgejo.dev.me
CertificateValidity
Global CA10 years
Wildcard (per-env)1 year

Check expiration:

Terminal window
# CA
openssl x509 -in ~/.loko/ca/loko-ca.pem -noout -dates
# Wildcard cert
openssl x509 -in ~/.loko/environments/dev-me/certs/dev.me.pem -noout -dates

Re-install CA trust:

Terminal window
loko certs ca install

Then verify:

Terminal window
openssl x509 -in ~/.loko/ca/loko-ca.pem -noout -subject
curl -v https://forgejo.dev.me
Get "https://cr.dev.me/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority

On macOS, Docker Desktop 4.x+ automatically trusts CAs installed in the macOS System Keychain — no ~/.docker/certs.d/ entry and no restart needed. LoKO installs the global CA into the System Keychain during loko certs ca install (or on first loko env create).

If pushes still fail after a fresh install, the Keychain installation may have been silently denied (sudo prompt dismissed). Re-run:

Terminal window
loko certs ca install

On Linux, LoKO writes to /etc/docker/certs.d/ — no daemon restart is needed.

Terminal window
ls -la ~/.loko/environments/dev-me/certs/
loko certs renew
Terminal window
loko certs show

If SANs are missing, renew:

Terminal window
loko certs renew
Terminal window
# macOS
brew install cfssl
# Linux — install from distro packages or Cloudflare cfssl releases

OS trust installation did not complete. Re-run:

Terminal window
loko certs ca install

The global CA private key is stored at:

~/.loko/ca/loko-ca-key.pem

Best practices:

  • Do not commit the CA key to version control
  • Do not share the CA key
  • Run loko certs ca regenerate if the key is compromised

LoKO certificates are:

  • Trusted locally when CA installation succeeds
  • Valid for your configured local development domains only
  • Not suitable for production use

Export the CA certificate (never the key) and import it on another machine:

Terminal window
# Export
cp ~/.loko/ca/loko-ca.pem ~/Desktop/loko-ca.pem
# On the other machine — import into trust store manually, or:
# Copy ~/.loko/ca/ and run:
loko certs ca install
FROM ubuntu:22.04
COPY loko-ca.pem /usr/local/share/ca-certificates/loko-ca.crt
RUN update-ca-certificates