Get a certificate with the CLI
One command gives a local app a trusted certificate. The CLI also keeps renewal simple.
Install the CLI
The CLI supports macOS, Linux, and Windows on amd64 and arm64.
Download a prebuilt binary from the GitHub releases page. Choose the archive for your operating system and architecture: .tar.gz for macOS or Linux, or .zip for Windows. Extract it and add the directory containing lancert (or lancert.exe on Windows) to your PATH.
On macOS or Linux, you can also install with Homebrew:
brew install lucor/tap/lancert
Or install it from source with Go:
go install go.lucor.dev/lancert-cli/cmd/lancert@latest
Get the certificate
Choose how to provide the address of your local app:
Run the CLI without an address to see supported addresses on active network interfaces and how to select one:
$ lancert Detected private IP addresses: 172.17.15.11 (utun4) 192.168.0.9 (en0) Choose the address where your application is reachable, then run: lancert <address>
Pass an RFC 1918 IPv4 address:
lancert 192.168.1.50
Pass a locally assigned IPv6 ULA in fd00::/8:
lancert fd12:3456:789a:1::25
On the first request, the CLI asks you to accept the certificate authority’s terms. It then prints the hostname and the paths to the certificate and private key.
Certificate issued. Hostname: quiet-otter.lancert.dev Certificate: /home/alice/.config/lancert/certs/quiet-otter.lancert.dev/fullchain.pem Private key: /home/alice/.config/lancert/certs/quiet-otter.lancert.dev/privkey.pem
The example paths above are for Linux. On Windows, the CLI stores its data under %AppData%\lancert; on macOS, under ~/Library/Application Support/lancert. Use the paths printed on your machine.
--acme-directory to select another ACME-compatible certificate authority.The certificate covers the assigned hostname and its wildcard. Your ACME account, certificate, and private key stay on your machine.
Configure your web server
Use the certificate and private key paths printed by the CLI in your web server configuration.
quiet-otter.lancert.dev, *.quiet-otter.lancert.dev {
tls /path/to/fullchain.pem /path/to/privkey.pem
reverse_proxy 127.0.0.1:3000
}Reload with caddy reload --force --config /path/to/Caddyfile.
server {
listen 443 ssl;
server_name quiet-otter.lancert.dev *.quiet-otter.lancert.dev;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
location / { proxy_pass http://127.0.0.1:3000; }
}Validate and reload with nginx -t && nginx -s reload.
tls:
certificates:
- certFile: /path/to/fullchain.pem
keyFile: /path/to/privkey.pemEnable providers.file.watch. After renewal, touch the watched dynamic configuration file to reload the certificate.
Renew the certificate
Schedule the CLI renewal command with cron or systemd on Linux, launchd on macOS, or Task Scheduler on Windows:
lancert renew
The CLI checks every locally managed certificate and renews those that are due.
Prefer another ACME client?
Use Lancert’s DNS service with Lego, Certbot, acme.sh, or another compatible client. Open the ACME client guide.