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:15] – 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 === | ||
- | |||
- | - Place PEM file in a server with access to other machines (like an ansible server) | ||
- | - Requires root access on all target machines | ||
- | - Run the following script for each machine | ||
- | |||
- | <code bash> | ||
- | ./ | ||
- | </ | ||
- | |||
- | <code bash installDebianCA> | ||
- | #!/bin/bash | ||
- | |||
- | # Check if the required parameters are provided | ||
- | if [ $# -ne 2 ]; then | ||
- | echo " | ||
- | echo " | ||
- | exit 1 | ||
- | fi | ||
- | |||
- | TARGET_MACHINE=$1 | ||
- | CA_CERT_PATH=$2 | ||
- | |||
- | # 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 | ||
- | echo " | ||
- | scp " | ||
- | |||
- | # Connect to the target machine and update CA certificates | ||
- | echo " | ||
- | ssh root@" | ||
- | echo " | ||
- | update-ca-certificates | ||
- | echo "CA certificates updated successfully." | ||
- | EOF | ||
- | |||
- | echo "CA certificate installation completed on $TARGET_MACHINE." | ||
- | </ | ||
==== RedHat Based ==== | ==== RedHat Based ==== | ||
- | === Manual === | ||
<code bash> | <code bash> | ||
cp pemfile / | cp pemfile / | ||
Line 177: | Line 131: | ||
</ | </ | ||
- | === Automated === | ||
- | 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> | + | ===== Automated for Unix ===== |
- | #!/bin/bash | + | |
- | # Check if the required parameters are provided | + | The following script is suitable for use from a centralized server which has root access via ssh to multiple Unix machines. This is written for something like an Ansible server. |
- | if [ $# -ne 2 ]; then | + | |
- | echo " | + | |
- | echo " | + | |
- | exit 1 | + | |
- | fi | + | |
- | TARGET_MACHINE=$1 | + | It will detect Debian and RedHat based Linux, and FreeBSD Unix. |
- | CA_CERT_PATH=$2 | + | |
- | # Check if the CA certificate | + | It will |
- | if [ ! -f " | + | - copy pem file to the /tmp directory on the target machine |
- | | + | - Attempt to detect the operating system type |
- | | + | |
- | fi | + | |
- | # Copy the CA certificate to the target machine | + | Called as |
- | echo " | + | <code bash> |
- | scp " | + | ./updateCALinux target |
- | + | ||
- | # Connect to the target machine and update CA certificates | + | |
- | echo " | + | |
- | ssh root@" | + | |
- | echo " | + | |
- | update-ca-trust | + | |
- | echo "CA certificates updated successfully." | + | |
- | EOF | + | |
- | + | ||
- | echo "CA certificate installation completed on $TARGET_MACHINE." | + | |
</ | </ | ||
- | ==== Automated for RedHat or Debian ==== | ||
<code bash updateCALinux> | <code bash updateCALinux> | ||
#!/bin/bash | #!/bin/bash | ||
Line 243: | Line 177: | ||
if [ -f / | if [ -f / | ||
echo " | echo " | ||
- | # Copy the CA certificate | + | # Install |
cp /tmp/ca.pem / | cp /tmp/ca.pem / | ||
- | # Update CA certificates | ||
update-ca-certificates | update-ca-certificates | ||
+ | | ||
elif [ -f / | elif [ -f / | ||
echo " | echo " | ||
- | # Copy the CA certificate | + | # Install |
cp /tmp/ca.pem / | cp /tmp/ca.pem / | ||
- | # Update CA certificates | ||
update-ca-trust | update-ca-trust | ||
+ | | ||
+ | elif [ " | ||
+ | echo " | ||
+ | # Install the CA certificate | ||
+ | cp /tmp/ca.pem / | ||
+ | c_rehash / | ||
+ | | ||
else | else | ||
echo " | echo " | ||
exit 1 | exit 1 | ||
fi | fi | ||
+ | |||
echo "CA certificates updated successfully." | echo "CA certificates updated successfully." | ||
EOF | EOF | ||
Line 264: | Line 205: | ||
</ | </ | ||
+ | ===== MacOS ===== | ||
+ | |||
+ | MacOS is based on FreeBSD and could likely be detected by the generic script under the previous section, but I'll show manual here. | ||
+ | |||
+ | ==== GUI ==== | ||
+ | |||
+ | - Open Finder, then navigate to Applications | Utilities | Keychain Access. | ||
+ | - 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 | ||
+ | |||
+ | |||
+ | ==== Command Line ==== | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <code sh> | ||
+ | sudo security add-trust-anchor -d -r trustAsRoot -k / | ||
+ | </ |
software/openssl/installca.1760912120.txt.gz · Last modified: 2025/10/19 17:15 by rodolico