smeserver-openvpn-routed/root/etc/e-smith/events/actions/openvpn-routed-update-crl
Daniel Berteaud e201d0a9b0 FIrst commit
2013-05-24 15:38:55 +02:00

29 lines
752 B
Bash

#!/bin/bash
URL=$(/sbin/e-smith/db configuration getprop openvpn-routed CrlUrl)
DOMAIN=$(/sbin/e-smith/db configuration get DomainName)
/usr/bin/wget $URL -O /tmp/cacrl.pem > /dev/null 2>&1
/usr/bin/openssl crl -inform PEM -in /tmp/cacrl.pem -text > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
/bin/mv -f /tmp/cacrl.pem /etc/openvpn/routed/pub/cacrl.pem > /dev/null 2>&1
else
cat > /tmp/crlmail <<END
An error occured while updating the CRL for OpenVPN-Bridge
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/cacrl.pem >> /tmp/crlmail
mail -s 'CRL update failed' admin@$DOMAIN < /tmp/crlmail
fi
rm -f /tmp/cacrl.pem
rm -f /tmp/crlmail