-
-
Save voxxit/6b4f0be3aa9ad6f49106 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# | |
# Downloads and installs the startssl CA certs into the global Java keystore | |
# on Alpine Linux. | |
# | |
# Check if JAVA_HOME is set | |
[ "$JAVA_HOME" = "" ] && echo "ERROR: JAVA_HOME must be set" && exit 1 | |
# Check if cacerts file is present | |
[ ! -f $JAVA_HOME/jre/lib/security/cacerts ] && echo "ERROR: Java cacerts not found in JAVA_HOME" && exit 1 | |
# Download the startssl certs | |
wget -q --continue http://www.startssl.com/certs/ca.crt | |
wget -q --continue http://www.startssl.com/certs/sub.class{1..4}.server.ca.crt | |
# Install certs into global keystore | |
cacerts=$JAVA_HOME/jre/lib/security/cacerts | |
keytool -import -trustcacerts -keystore $cacerts -storepass changeit -noprompt -alias startcom.ca -file ca.crt | |
for i in {1..4}; do | |
keytool -import -trustcacerts -keystore $cacerts -storepass changeit -noprompt \ | |
-alias startcom.ca.sub.class$i -file sub.class$i.server.ca.crt | |
done | |
# Remove downloaded certs | |
rm -f ca.crt sub.class{1..4}.server.ca.crt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment