software:openssl:installca
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:openssl:installca [2025/10/19 17:12] – rodolico | software:openssl:installca [2025/10/19 18:38] (current) – rodolico | ||
---|---|---|---|
Line 119: | Line 119: | ||
==== Debian derivatives ==== | ==== Debian derivatives ==== | ||
- | === Manual === | + | <code bash> |
- | + | ||
- | <code bash installDebianCA> | + | |
sudo cp ca.pem / | sudo cp ca.pem / | ||
sudo update-ca-certificates | sudo update-ca-certificates | ||
</ | </ | ||
- | === Automated === | ||
- | | + | ==== RedHat Based ==== |
- | - Requires root access on all target machines | + | <code bash> |
- | - Run the following script for each machine | + | cp pemfile /etc/pki/ca-trust/ |
+ | update-ca-trust | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Automated for Unix ===== | ||
+ | |||
+ | The following script is suitable for use from a centralized | ||
+ | It will detect Debian and RedHat based Linux, and FreeBSD Unix. | ||
+ | |||
+ | It will | ||
+ | - copy pem file to the /tmp directory on the target machine | ||
+ | - Attempt to detect the operating system type | ||
+ | - If successful, copy pem to appropriate directory and run udpate command | ||
+ | - Otherwise, give an error message | ||
+ | |||
+ | Called as | ||
<code bash> | <code bash> | ||
- | ./installDebianCA targetMachine | + | ./updateCALinux target /local/path/to/ca.pem |
</ | </ | ||
- | <code bash installDebianCA> | + | <code bash updateCALinux> |
#!/bin/bash | #!/bin/bash | ||
Line 157: | Line 170: | ||
# Copy the CA certificate to the target machine | # Copy the CA certificate to the target machine | ||
echo " | echo " | ||
- | scp " | + | scp " |
- | # Connect to the target machine and update CA certificates | + | # Connect to the target machine and determine the OS |
- | echo " | + | |
ssh root@" | ssh root@" | ||
- | echo "Updating | + | |
- | update-ca-certificates | + | if [ -f / |
+ | | ||
+ | # Install the CA certificate | ||
+ | cp /tmp/ca.pem / | ||
+ | update-ca-certificates | ||
+ | |||
+ | elif [ -f / | ||
+ | echo " | ||
+ | # Install the CA certificate | ||
+ | cp /tmp/ca.pem / | ||
+ | | ||
+ | |||
+ | elif [ " | ||
+ | echo " | ||
+ | # Install the CA certificate | ||
+ | cp /tmp/ca.pem / | ||
+ | c_rehash / | ||
+ | |||
+ | else | ||
+ | echo " | ||
+ | exit 1 | ||
+ | fi | ||
echo "CA certificates updated successfully." | echo "CA certificates updated successfully." | ||
EOF | EOF | ||
echo "CA certificate installation completed on $TARGET_MACHINE." | echo "CA certificate installation completed on $TARGET_MACHINE." | ||
- | </ | ||
- | ==== RedHat Based ==== | ||
- | === Manual === | ||
- | <code bash> | ||
- | cp pemfile / | ||
- | update-ca-trust | ||
</ | </ | ||
- | === Automated | + | ===== MacOS ===== |
- | The same script as Debian, but the temporary path to store and the command to update known CA's is different. Here is the full script. | + | |
- | <code bash updateRedHatCA> | + | MacOS is based on FreeBSD and could likely be detected by the generic script under the previous section, but I'll show manual here. |
- | #!/bin/bash | + | |
- | # Check if the required parameters are provided | + | ==== GUI ==== |
- | if [ $# -ne 2 ]; then | + | |
- | echo " | + | |
- | echo " | + | |
- | exit 1 | + | |
- | fi | + | |
- | TARGET_MACHINE=$1 | + | - Open Finder, then navigate to Applications | Utilities | Keychain Access. |
- | CA_CERT_PATH=$2 | + | - Open File | Import Items |
+ | - Find your certificate and select Open | ||
+ | - Choose which keychain to import it to | ||
+ | - System - Available to all users | ||
+ | - login - Available only to the current user | ||
+ | - Locate the new Cert in the keychain and double click to open it | ||
+ | - Expand the **Trust** section | ||
+ | - Change //When using this certificate// | ||
+ | - Close and save, answering yes to all questions | ||
- | # Check if the CA certificate file exists locally | ||
- | if [ ! -f " | ||
- | echo "CA certificate not found at $CA_CERT_PATH" | ||
- | exit 1 | ||
- | fi | ||
- | # Copy the CA certificate to the target machine | + | ==== Command Line ==== |
- | echo " | + | |
- | scp " | + | |
- | # Connect to the target machine and update CA certificates | + | To install rapidly, simply open Terminal (Finder | Applications | Utilities | Terminal ) and issue the following command. You'll need to make sure you know where the PEM file is. |
- | echo " | + | |
- | ssh root@" | + | |
- | echo " | + | |
- | update-ca-trust | + | |
- | echo "CA certificates updated successfully." | + | |
- | EOF | + | |
- | echo "CA certificate installation completed on $TARGET_MACHINE." | + | <code sh> |
+ | sudo security add-trust-anchor -d -r trustAsRoot -k / | ||
</ | </ |
software/openssl/installca.1760911957.txt.gz · Last modified: 2025/10/19 17:12 by rodolico