List, backup, whitelist, and restore CA trust stores
Certificate-store edits can break HTTPS for browsers, package managers, and language runtimes. Treat every change as privileged.
cert-manage backup (and -app … when targeting an app) before any whitelist./etc or /usr CA paths.cert-manage list and cert-manage connect https://….Add -dry-run to backup or restore to see exactly which files would be written or copied, without touching the store.
Parent directory (created as needed):
| OS | Path |
|---|---|
| Linux, Windows | ~/.cert-manage/ |
| Darwin | ~/Library/cert-manage/ |
| Store | Layout under the parent |
|---|---|
| Linux platform | linux/<unix-timestamp>/ — mirror of the live CA directory (/usr/share/ca-certificates or Fedora anchors dir) |
| Darwin platform | darwin/<unix-timestamp>/login.keychain/<sha256>.crt — PEM exports of login-keychain certs |
| Java | java/cacerts-<unix-timestamp>.bck (filename taken from the keystore basename) |
| Chrome / Firefox (NSS) | chrome/<unix-timestamp>/ or firefox/<unix-timestamp>/ — full profile file set (see below) |
GetLatestBackup picks the lexicographically largest entry in that store’s folder (timestamped names sort correctly).
linuxStore.Restore does not delete the live CA directory before copying. It:
<ca.dir>.restore-tmp).<ca.dir>.restore-old (and prints that path).update-ca-certificates / update-ca-trust (via sudo unless already root).<ca.dir>.restore-failed and renames the aside directory back.If the swap rename itself fails after the live tree was moved aside, the previous directory is renamed back. A failed mirror leaves the live directory untouched.
Restore honors an explicit path (cert-manage restore -file … / the store where argument). Empty where uses the latest backup under ~/.cert-manage/linux/.
NSS backups for Chrome (Linux) and Firefox copy whichever members of the profile set exist:
| Style | Files |
|---|---|
cert9.db present |
cert9.db, key4.db, pkcs11.txt |
else cert8.db |
cert8.db, key3.db, secmod.db |
Restore from a directory copies that same set back into the live profile. Restore from a legacy single file copies onto cert9.db (or cert8.db if the backup basename contains cert8). Explicit -file / where is honored.
Backup copies the live cacerts file into ~/.cert-manage/java/ (or ~/Library/cert-manage/java/ on Darwin). Restore copies the chosen backup over the live keystore (SudoCopyFile when permissions require it). Explicit -file is honored.
where / -file argument is currently unused (always GetLatestBackup()).Platform Add, Backup, Remove, and Restore are unimplemented (return success with no work). Only list reads the machine certificate stores.