smeserver-webapps-common/root/etc/e-smith/events/actions/webapps-update-crl

34 lines
815 B
Bash

#!/bin/bash
URL=$(/sbin/e-smith/db configuration getprop httpd-e-smith CrlUrl)
DOMAIN=$(/sbin/e-smith/db configuration get DomainName)
if [ "$URL" == "" ]; then
exit 0
fi
/usr/bin/wget $URL -O /tmp/httpcacrl.pem > /dev/null 2>&1
/usr/bin/openssl crl -inform PEM -in /tmp/httpcacrl.pem -text > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
/bin/mv -f /tmp/httpcacrl.pem /etc/pki/tls/crl/cacrl.pem > /dev/null 2>&1
else
cat > /tmp/httpcrlmail <<END
An error occured while updating the CRL for httpd-e-smith
because openssl didn't recognize the file as a valid CRL.
Below is the copy of the latest CRL downloaded from
$URL
END
cat /tmp/httpcacrl.pem >> /tmp/crlmail
mail -s 'CRL update failed' admin@$DOMAIN < /tmp/httpcrlmail
fi
rm -f /tmp/httpcacrl.pem
rm -f /tmp/httpcrlmail