Created
November 22, 2017 14:28
-
-
Save LukeDefeo/f4463ffeff4629183f94326deed75169 to your computer and use it in GitHub Desktop.
Extracts all certificates from the mac os certificate store / key chain and imports them into the key chain of your Java installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#this script should pull all root CAs from the mac os keychain and add them to the jre's keystore | |
#Comes with absolutely no warranty and all the usual disclaimers | |
mkdir temp-extract | |
cd temp-extract | |
keystore=$JAVA_HOME/jre/lib/security/cacerts | |
echo "making backup of keystore $keystore to ~/keystore.backup" | |
set -e -o pipefail | |
cp $keystore ~/keystore.backup | |
security find-certificate -a -p | split -p "-----BEGIN CERTIFICATE-----" | |
set +e | |
for f in *; | |
do | |
echo "importing cert $f " | |
keytool -importcert -noprompt -keystore ${keystore} -storepass changeit -alias $f -file $f; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment