Skip to content

Commit

Permalink
Make sure _all_ certificates are imported.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Aug 29, 2024
1 parent 80d1285 commit 7a5ab02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ WORKDIR $CATALINA_BASE
# - file: used by mediatools, generally useful

COPY eu-central-1-bundle.pem /tmp
COPY importcerts.sh /tmp

RUN keytool -list -cacerts > /tmp/cacerts.before && \
keytool -noprompt -trustcacerts -cacerts -importcert -alias "eu_central" -file /tmp/eu-central-1-bundle.pem && \
keytool -list -cacerts > /tmp/cacerts.after
bash -e /tmp/importcerts.sh && \
keytool -list -cacerts > /tmp/cacerts.after

# conf/Catalina/localhost Otherwise 'Unable to create directory for deployment: [/usr/local/catalina-base/conf/Catalina/localhost]'
RUN set -eux && \
Expand Down
7 changes: 7 additions & 0 deletions importcerts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


CERTS=$(grep 'END CERTIFICATE' /tmp/eu-central-1-bundle.pem | wc -l) ;
for N in $(seq 0 $(($CERTS - 1))); do
cat /tmp/eu-central-1-bundle.pem | awk "n==$N { print }; /END CERTIFICATE/ { n++ }" |
keytool -noprompt -trustcacerts -cacerts -importcert -alias "eu_central-$N"
done;

0 comments on commit 7a5ab02

Please sign in to comment.