#/bin/bash

yum -y install ca-certificates openssl && yum clean all
update-ca-trust force-enable

. /etc/os-release
if   [ "$ID" = "centos" ]; then
	CADIR="/etcpki/ca-trus-source/anchors"
elif [ "$ID" = "ubuntu" ]; then
	CADIR="/usr/local/share/ca-certificates"
else
	echo "$0: ERROR: UNKNOWN OS '$ID'"
	exit 1
fi

mkdir -p $CADIR

if [ "$CA" ]; then
	echo "Add certificate to trusted CA from ENV.CA"
	echo "$CA" > $CADIR/ca.crt
	openssl x509 -in $CADIR/ca.crt -noout -subject -dates
fi
for crt in $(ls -1 /*crt); do
	echo "Add certificate to trusted CA from file '$crt'"
	openssl x509 -in $crt -noout -subject -dates
	cp $crt $CADIR/
done
update-ca-certificates

exit 0
#/bin/bash

yum -y install ca-certificates openssl && yum clean all
update-ca-trust force-enable

. /etc/os-release
if   [ "$ID" = "centos" ]; then
	CADIR="/etcpki/ca-trus-source/anchors"
elif [ "$ID" = "ubuntu" ]; then
	CADIR="/usr/local/share/ca-certificates"
else
	echo "$0: ERROR: UNKNOWN OS '$ID'"
	exit 1
fi

mkdir -p $CADIR

if [ "$CA" ]; then
	echo "Add certificate to trusted CA from ENV.CA"
	echo "$CA" > $CADIR/ca.crt
	openssl x509 -in $CADIR/ca.crt -noout -subject -dates
fi
for crt in ls -1 /*crt; do
	echo "Add certificate to trusted CA from file '$crt'"
	openssl x509 -in $crt -noout -subject -dates
	cp $crt $CADIR/
done
update-ca-certificates

exit 0
--- 
+++ 
@@ -20,7 +20,7 @@
 	echo "$CA" > $CADIR/ca.crt
 	openssl x509 -in $CADIR/ca.crt -noout -subject -dates
 fi
-for crt in $(ls -1 /*crt); do
+for crt in ls -1 /*crt; do
 	echo "Add certificate to trusted CA from file '$crt'"
 	openssl x509 -in $crt -noout -subject -dates
 	cp $crt $CADIR/
Add certificate to trusted CA
