kolla/docker/base/copy_cacerts.sh
Viktor Michalek 79d857f9e7 Custom CA certificates installation mechanism
Change-Id: I0fd596d93a0e575a391250d4bed261ad370a3664
2019-10-12 15:36:27 +00:00

28 lines
991 B
Bash

#!/bin/bash
# Copy custom CA certificates to system trusted CA certificates folder
# and run CA update utility
# Remove old certificates
rm -f /usr/local/share/ca-certificates/kolla-customca-* \
/etc/pki/ca-trust/source/anchors/kolla-customca-*
if [[ -d /var/lib/kolla/config_files/ca-certificates ]] && \
[[ ! -z "$(ls -A /var/lib/kolla/config_files/ca-certificates/)" ]]; then
if [[ -e /etc/debian_version ]]; then
# Debian, Ubuntu
for cert in /var/lib/kolla/config_files/ca-certificates/*; do
file=$(basename "$cert")
cp $cert "/usr/local/share/ca-certificates/kolla-customca-$file"
done
update-ca-certificates
elif [[ -e /etc/redhat-release ]]; then
# CentOS, RHEL
for cert in /var/lib/kolla/config_files/ca-certificates/*; do
file=$(basename "$cert")
cp $cert "/etc/pki/ca-trust/source/anchors/kolla-customca-$file"
done
update-ca-trust
fi
fi