Remove .ovpn on cert revoke or OpenVPN uninstall

This commit is contained in:
wmtech-1 2018-05-10 13:28:09 +02:00 • committed by GitHub
parent 0620cb1b2f
commit b6311f171f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,6 +130,8 @@ if [[ -e /etc/openvpn/server.conf ]]; then
rm -rf /etc/openvpn/crl.pem
cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem
chmod 644 /etc/openvpn/crl.pem
rm -rf $(find /home -maxdepth 2 | grep $CLIENT.ovpn) 2>/dev/null
rm -rf /root/$CLIENT.ovpn 2>/dev/null
echo ""
echo "Certificate for client $CLIENT revoked"
echo "Exiting..."
@ -186,6 +188,12 @@ if [[ -e /etc/openvpn/server.conf ]]; then
fi
fi
yum remove openvpn -y
OVPNS=$(ls /etc/openvpn/easy-rsa/pki/issued | awk -F "." {'print $1'})
for i in $OVPNS
do
rm $(find /home -maxdepth 2 | grep $i.ovpn) 2>/dev/null
rm /root/$i.ovpn 2>/dev/null
done
rm -rf /etc/openvpn
rm -rf /usr/share/doc/openvpn*
rm -rf /var/log/openvpn