copy_ca_root_cert

This script will copy the root certificate ca.crt of the certificate authority to the given directory ($PWD if not given).

The given directory will be created if it does not exit yet.

If the given directory is inside a Git working tree the script will offer to modify the .gitignore file:

WARNING: ca.crt is not ignored in '/Users/example/tmp/.gitignore'

Do you want me to modify your .gitignore file (Y/N)?

Related Script: git-cleanup

Usage

$ scripts/cert/copy_ca_root_cert.sh
$ scripts/cert/copy_ca_root_cert.sh ~/.local/secrets/certs/ca-root
$ stat -f '%A %N' ~/.local/secrets/certs/ca-root/ca.crt
600 /Users/example/.local/secrets/certs/ca-root/ca.crt
$ openssl x509 -issuer -noout -in ~/.local/secrets/certs/ca-root/ca.crt
issuer=CN=Easy-RSA CA (2024-08-05, example-host)

Prerequisites