List, backup, allowlist, and restore CA trust stores
Certificate-store edits can break HTTPS for browsers, package managers, and language runtimes. Treat every change as privileged.
trustprune backup (and -app … when targeting an app) before any allowlist./etc or /usr CA paths.trustprune list and trustprune 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 | ~/.trustprune/ (legacy read-only fallback: ~/.cert-manage/) |
| Darwin | ~/Library/trustprune/ (legacy read-only fallback: ~/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. It always uses that fixed path, so an operator can find it even after a crash; restore prints the path only when a failure leaves <ca.dir>.restore-old in place.update-ca-certificates / update-ca-trust (via sudo unless already root).<ca.dir>.restore-failed and renames the aside directory back.<ca.dir>.restore-old (remaining contents may be incomplete).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 (trustprune restore -file … / the store where argument). Empty where uses the latest backup under ~/.trustprune/linux/ or the legacy ~/.cert-manage/linux/; the primary path wins for duplicate basenames.
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 |
nssStore.Restore does not copy profile files straight onto the live paths. It:
<profile>.restore-tmp).<profile>.restore-old/. It always uses that fixed path, so an operator can find it even after a crash; restore prints the path only when a failure leaves <profile>.restore-old/ in place..restore-old.A failed stage leaves the live profile files untouched. Restore from a legacy single file uses the same stage-then-swap path onto cert9.db (or cert8.db if the backup basename contains cert8). Explicit -file / where is honored.
Backup copies the live cacerts file into ~/.trustprune/java/ (or ~/Library/trustprune/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.