lpm cert
Manage certificates for trusted local HTTPS with LPM CLI.
lpm cert manages the local certificate authority (CA) and project certificates that LPM CLI uses for local HTTPS.
For daily development, enable HTTPS in lpm.json and run lpm dev. Use lpm cert for manual setup and maintenance.
lpm cert <action> [flags]Quickstart with lpm.json
Add https: true to the lpm.json file next to package.json:
{
"$schema": "https://cli.lpm.dev/schemas/lpm.json",
"https": true
}Start the project:
lpm devLPM CLI creates a project certificate and serves the local site through trusted HTTPS. Your application continues to use plain HTTP behind LPM CLI.
On first use, an interactive terminal asks before it installs the local CA. You approve this step only once on each machine.
Use these commands to override the project configuration for one run:
lpm dev --no-https # disable HTTPS for this run
lpm dev --https # enable HTTPS for this run
lpm dev --https --yes # approve CA installation without a promptIf the CA is not trusted in a non-interactive shell, pass --yes:
lpm dev --yesYou can also install the CA during machine setup. Then the development run does not require trust consent:
lpm cert trust
lpm devUse a project hostname
Use proxy.host for one service with a friendly hostname:
{
"$schema": "https://cli.lpm.dev/schemas/lpm.json",
"proxy": {
"host": "app.localhost",
"port": 9443,
"httpRedirect": false
}
}lpm devLPM CLI prepares the certificate and registers the route. Open the URL that lpm dev prints.
If a project has multiple services, use services.<name>.host. Each service must have a different hostname.
The localhost name and names below .localhost do not need a hosts-file entry. Other local names can require a managed hosts-file entry.
See lpm proxy for proxy ports, multiple services, and hosts-file behavior.
Permit more DNS names
The cert block controls which DNS subtrees a project certificate can cover:
{
"https": true,
"cert": {
"extraPermittedDns": ["myapp.internal"],
"allowPublicDns": false
}
}extraPermittedDns does not add a browser hostname or a proxy route. It only permits LPM CLI to issue project certificates below that DNS subtree.
Add the actual browser hostname with proxy.host, services.<name>.host, or lpm cert generate --host.
Each entry must be a bare, multi-label hostname. Do not include a scheme, port, path, wildcard, or leading dot.
By default, LPM CLI accepts these local suffixes:
.local.test.localhost.internal.home.arpa
Public DNS names require an explicit opt-in:
{
"cert": {
"extraPermittedDns": ["staging.example.com"],
"allowPublicDns": true
}
}CAUTION: Enable
allowPublicDnsonly for DNS names that you control. This field increases the authority of your local CA.
Examples
lpm dev # use https from lpm.json
lpm cert status # show CA and project status
lpm cert trust # install the local CA
lpm cert generate # create the project certificate
lpm cert generate --host api.app.local # add a browser hostname
lpm cert rotate --keep-old-trusted 14 # rotate with a 14-day grace period
lpm cert rotate --project ../other-app # include another project
lpm cert reconcile --dry-run # preview rotation cleanup
lpm cert uninstall # remove the CA from the trust storeManual certificate commands
| Goal | Command |
|---|---|
| Show the root CA and current project | lpm cert status |
| Create and trust the root CA | lpm cert trust |
| Remove the root CA from the trust store | lpm cert uninstall |
| Create or renew the current project certificate | lpm cert generate |
| Replace the root CA and reissue project certificates | lpm cert rotate |
| Finish interrupted rotation or remove expired grace entries | lpm cert reconcile |
Show certificate status
Run the command from the project directory:
lpm cert statusThe output shows the root CA status and the current project certificate. It includes trust, expiry, hostnames, renewal status, and unsafe file permissions.
When fewer than 30 days remain, project certificate renewal starts. When fewer than 60 days remain, root CA warnings start.
Use JSON output in scripts:
lpm cert status --jsonThe JSON output includes CA data, project data, renewal status, and permission problems.
Repair unsafe permissions
On Unix systems, certificate directories must use mode 0700. Private key files must use mode 0600.
LPM CLI refuses to sign certificates with a group-readable or world-readable CA private key. Run status to get the exact repair command:
lpm cert statusRun the printed chmod command. Then repeat the command that failed.
Trust the root CA
Install the local CA before a non-interactive run. You can also install it before an interactive lpm dev run:
lpm cert trustIf the root CA does not exist, the command creates it. It stores the CA files in ~/.lpm/certs/ and installs the certificate into the system trust store.
You usually run this command once on each development machine.
Remove CA trust
Remove the CA from the system trust store:
lpm cert uninstallThis command keeps the CA files in ~/.lpm/certs/. You can trust the same CA again with lpm cert trust.
The on-disk CA certificate must exist during removal. LPM CLI uses its fingerprint to remove the correct trusted certificate.
Generate a project certificate
If another local tool needs the project certificate files, use generate:
lpm cert trust
lpm cert generateRun generate from the project directory. It reads the project lpm.json and writes these files:
<project>/.lpm/certs/cert.pem
<project>/.lpm/certs/key.pemDo not commit these certificate and private key files.
The default certificate names are localhost, 127.0.0.1, and ::1.
Add more Subject Alternative Names (SANs) by repeating --host:
lpm cert generate --host app.local --host api.app.localgenerate does not install an untrusted CA. If the CA is not trusted, run lpm cert trust first.
Rotate the root CA
If status reports that the root CA is near expiry, rotate it. If its private key is exposed, rotate the root CA immediately.
lpm cert rotateRotation changes the trust identity and reissues known project certificates. Active projects can fail certificate checks during the change.
Use a grace period to keep the old root trusted during a migration:
lpm cert rotate --keep-old-trusted 14The grace period can be at most 90 days. After the period expires, run lpm cert reconcile to remove the old trust entry.
Add project directories that LPM CLI must reissue:
lpm cert rotate --project ../web --project ../apiBy default, rotation skips project directories that no longer exist. If each project must be present, use --fail-on-missing:
lpm cert rotate --project ../web --fail-on-missingRepair interrupted rotation
Preview certificate cleanup before you change files or trust entries:
lpm cert reconcile --dry-runApply the cleanup:
lpm cert reconcileUse reconcile after an interrupted rotation or after a trust grace period expires. It also removes stale files from unfinished rotation work.
Platform trust stores
| Platform | Trust behavior |
|---|---|
| macOS | Installs the CA in the user login Keychain. It does not use sudo. |
| Linux | Copies the CA to /usr/local/share/ca-certificates/ and runs sudo update-ca-certificates. |
| Windows | Uses certutil to install the CA in the Root store. Windows can request elevation. |
| Other systems | Requires manual CA installation. |
LPM CLI identifies trusted certificates by fingerprint. It does not rely only on the certificate name.
Flags
| Flag | Action | Purpose |
|---|---|---|
--host <NAME> | generate | Add a SAN to the project certificate. Repeat the flag for more names. |
--project <DIR> | rotate | Reissue a certificate for another project directory. Repeat the flag for more projects. |
--keep-old-trusted <DAYS> | rotate | Keep the old root trusted for up to 90 days. |
--fail-on-missing | rotate | Fail instead of skipping a missing project directory. |
--dry-run | reconcile | Report cleanup without changing files or trust entries. |
--json | All actions | Print machine-readable output. This is a global flag. |
See also
lpm dev— run the project with local HTTPSlpm proxy— route friendly local hostnames- Local HTTPS — certificate model and file locations
lpm.json— HTTPS and certificate configuration