43 lines
1.6 KiB
Bash
Executable file
43 lines
1.6 KiB
Bash
Executable file
#! /bin/bash
|
|
set -e
|
|
QUAYPATH=${QUAYPATH:-"."}
|
|
QUAYCONF=${QUAYCONF:-"$QUAYPATH/conf/stack"}
|
|
QUAYCONFIG=${QUAYCONFIG:-"$QUAYCONF/stack"}
|
|
|
|
cd ${QUAYDIR:-"/quay-registry"}
|
|
|
|
# Add the custom LDAP certificate
|
|
if [ -e $QUAYCONFIG/ldap.crt ]
|
|
then
|
|
cp $QUAYCONFIG/ldap.crt /usr/local/share/ca-certificates/ldap.crt
|
|
fi
|
|
|
|
# Add extra trusted certificates (as a directory)
|
|
if [ -d $QUAYCONFIG/extra_ca_certs ]; then
|
|
if test "$(ls -A "$QUAYCONFIG/extra_ca_certs")"; then
|
|
echo "Installing extra certificates found in $QUAYCONFIG/extra_ca_certs directory"
|
|
cp $QUAYCONFIG/extra_ca_certs/* /usr/local/share/ca-certificates/
|
|
cat $QUAYCONFIG/extra_ca_certs/* >> venv/lib/python2.7/site-packages/requests/cacert.pem
|
|
cat $QUAYCONFIG/extra_ca_certs/* >> venv/lib/python2.7/site-packages/certifi/cacert.pem
|
|
fi
|
|
fi
|
|
|
|
# Add extra trusted certificates (as a file)
|
|
if [ -f $QUAYCONFIG/extra_ca_certs ]; then
|
|
echo "Installing extra certificates found in $QUAYCONFIG/extra_ca_certs file"
|
|
csplit -z -f /usr/local/share/ca-certificates/extra-ca- $QUAYCONFIG/extra_ca_certs '/-----BEGIN CERTIFICATE-----/' '{*}'
|
|
cat $QUAYCONFIG/extra_ca_certs >> venv/lib/python2.7/site-packages/requests/cacert.pem
|
|
cat $QUAYCONFIG/extra_ca_certs >> venv/lib/python2.7/site-packages/certifi/cacert.pem
|
|
fi
|
|
|
|
# Add extra trusted certificates (prefixed)
|
|
for f in $(find $QUAYCONFIG/ -maxdepth 1 -type f -name "extra_ca*")
|
|
do
|
|
echo "Installing extra cert $f"
|
|
cp "$f" /usr/local/share/ca-certificates/
|
|
cat "$f" >> venv/lib/python2.7/site-packages/requests/cacert.pem
|
|
cat "$f" >> venv/lib/python2.7/site-packages/certifi/cacert.pem
|
|
done
|
|
|
|
# Update all CA certificates.
|
|
update-ca-certificates
|