Remove .ovpn on cert revoke or OpenVPN uninstall (#178)

This commit is contained in:
cezar97 2018-04-10 11:06:19 +02:00 committed by Angristan
parent 853683b0b3
commit 61d89e3ba2
1 changed files with 8 additions and 0 deletions

View File

@ -146,6 +146,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..."
@ -188,6 +190,12 @@ if [[ -e /etc/openvpn/server.conf ]]; then
else
yum remove openvpn -y
fi
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*
echo ""