copy_ca_root_cert

This script will copy the root certificate ca.crt of a certificate authority.

The following parameters are optional:

d

the directory ($PWD if not given) the root certificate should be copied to; will be created if it does not exit

y

assume "yes" as answer to all prompts and run non-interactively

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 -d ~/.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