Remove vpn client keys

This commit is contained in:
Bob Mottram 2017-09-24 23:12:53 +01:00
parent 42a6706480
commit c432d69551
1 changed files with 10 additions and 1 deletions

View File

@ -36,6 +36,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=0
OPENVPN_SERVER_NAME="${PROJECT_NAME}-vpn"
OPENVPN_KEY_FILENAME='vpn.ovpn'
vpn_variables=(MY_EMAIL_ADDRESS
LOCAL_NETWORK_STATIC_IP_ADDRESS
@ -85,6 +86,14 @@ function remove_vpn {
fi
firewall_deny_forwarding
remove_completion_param install_vpn
# remove any client keys
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [ -f /home/$USERNAME/$OPENVPN_KEY_FILENAME ]; then
shred -zu /home/$USERNAME/$OPENVPN_KEY_FILENAME
fi
done
}
function create_user_vpn_key {
@ -112,7 +121,7 @@ y
exit 682523
fi
user_vpn_cert_file=/home/$username/vpn.ovpn
user_vpn_cert_file=/home/$username/$OPENVPN_KEY_FILENAME
cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf $user_vpn_cert_file
sed -i "s|remote .*|remote $DEFAULT_DOMAIN_NAME 1194|g" $user_vpn_cert_file