-
-
Notifications
You must be signed in to change notification settings - Fork 96
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 custom CA certificates
This adds the capability to add custom CA certificates for Java truststore. Fixes: #293
- Loading branch information
Showing
78 changed files
with
971 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
|
||
# RHEL-based images already include a routine to update a java truststore from the system CA bundle within | ||
# `update-ca-trust`. All we need to do is to link the system CA bundle to the java truststore. | ||
|
||
cp -a /certificates/* /usr/share/pki/ca-trust-source/anchors/ | ||
update-ca-trust | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
ln -sf /etc/pki/ca-trust/extracted/java/cacerts "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
|
||
# RHEL-based images already include a routine to update a java truststore from the system CA bundle within | ||
# `update-ca-trust`. All we need to do is to link the system CA bundle to the java truststore. | ||
|
||
cp -a /certificates/* /usr/share/pki/ca-trust-source/anchors/ | ||
update-ca-trust | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
ln -sf /etc/pki/ca-trust/extracted/java/cacerts "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
|
||
# RHEL-based images already include a routine to update a java truststore from the system CA bundle within | ||
# `update-ca-trust`. All we need to do is to link the system CA bundle to the java truststore. | ||
|
||
cp -a /certificates/* /usr/share/pki/ca-trust-source/anchors/ | ||
update-ca-trust | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
ln -sf /etc/pki/ca-trust/extracted/java/cacerts "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
|
||
# RHEL-based images already include a routine to update a java truststore from the system CA bundle within | ||
# `update-ca-trust`. All we need to do is to link the system CA bundle to the java truststore. | ||
|
||
cp -a /certificates/* /usr/share/pki/ca-trust-source/anchors/ | ||
update-ca-trust | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
ln -sf /etc/pki/ca-trust/extracted/java/cacerts "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
if [ -n "$USE_SYSTEM_CA_CERTS" ]; then | ||
# OpenJDK images used to create a hook for `update-ca-certificates`. Since we are using an entrypoint anyway, we | ||
# might as well just generate the truststore and skip the hooks. | ||
|
||
cp -a /certificates/* /usr/local/share/ca-certificates/ | ||
update-ca-certificates | ||
|
||
CACERT=$JAVA_HOME/lib/security/cacerts | ||
|
||
# JDK8 puts its JRE in a subdirectory | ||
if [ -f "$JAVA_HOME/jre/lib/security/cacerts" ]; then | ||
CACERT=$JAVA_HOME/jre/lib/security/cacerts | ||
fi | ||
|
||
trust extract --overwrite --format=java-cacerts --filter=ca-anchors --purpose=server-auth "$CACERT" | ||
fi | ||
|
||
exec "$@" |
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
Oops, something went wrong.