-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple custom CA certificates to be trusted * Initial commit * Factor out cert updates. Handles multiple certs * Removed extra brace * Uses system trust store unless custom keystore is given. The system keystore now holds the CA certs that are passed to CUSTOM_CERT_URL in Dockerfile. * Only used for intermediate development. Unused now. * Undoing changes to config_ssl as it is for server ssl cert * OPTIONAL_CERT_ARG unneeded in this image * Update for minor shell optimizations. * Add quotes to prevent unnecessary internal operations * $@ -> $* * Update for minor shell optimizations. * Add quotes to prevent unnecessary internal operations * $@ -> $*
- Loading branch information
Showing
4 changed files
with
67 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# All arguments are treated as certificates | ||
CUSTOM_CRT_URL="$*" | ||
|
||
if [ -z "${CUSTOM_CRT_URL}" ] ; then | ||
echo "No custom certs passed. Nothing to update" | ||
exit 0 | ||
fi | ||
|
||
for cert in $CUSTOM_CRT_URL | ||
do | ||
echo Downloading "$cert" | ||
name=$(echo "$cert" | rev | cut -f1 -d"/" | rev | cut -f1 -d'.') || exit 1 | ||
wget -O "/usr/local/share/ca-certificates/custom-${name}.crt" "$cert" || exit 1 | ||
done | ||
|
||
update-ca-certificates || exit 1 | ||
|
||
for cert in $CUSTOM_CRT_URL | ||
do | ||
echo Importing "$cert" | ||
name=$(echo "$cert" | rev | cut -f1 -d"/" | rev | cut -f1 -d'.') || exit 1 | ||
keytool -import -alias "custom_${name}" -file "/usr/local/share/ca-certificates/custom-${name}.crt" -cacerts -storepass changeit -noprompt || exit 1 | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# All arguments are treated as certificates | ||
CUSTOM_CRT_URL="$*" | ||
|
||
if [ -z "${CUSTOM_CRT_URL}" ] ; then | ||
echo "No custom certs passed. Nothing to update" | ||
exit 0 | ||
fi | ||
|
||
for cert in $CUSTOM_CRT_URL | ||
do | ||
echo Downloading "$cert" | ||
name=$(echo "$cert" | rev | cut -f1 -d"/" | rev | cut -f1 -d'.') | ||
curl -sS -o "/etc/pki/ca-trust/source/anchors/custom-${name}.crt" "$cert" || exit 1 | ||
done | ||
|
||
update-ca-trust || exit 1 | ||
|
||
for cert in $CUSTOM_CRT_URL | ||
do | ||
echo Importing "$cert" | ||
name=$(echo "$cert" | rev | cut -f1 -d"/" | rev | cut -f1 -d'.') | ||
keytool -import -alias "custom_${name}" -file "/etc/pki/ca-trust/source/anchors/custom-${name}.crt" -cacerts -storepass changeit -noprompt || exit 1 | ||
done |