1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/openvpn/templates/iiab-remote-off

32 lines
949 B
Text
Raw Normal View History

2017-06-12 22:42:32 +00:00
#!/bin/bash
2018-09-05 19:33:42 +00:00
# /usr/bin/iiab-remote-off should fully turn off multiple remote support
# services like OpenVPN and others, to reduce risk of remote attacks.
2018-09-05 20:17:02 +00:00
echo -e '\nWARNING: To disable OpenVPN long-term, it'"'"'s recommended you:\n'
echo -e '1) Set this variable in /etc/iiab/local_vars.yml'
2018-09-05 20:17:02 +00:00
echo -e ' openvpn_enabled: False\n'
echo -e '2) Run:'
echo -e ' cd /opt/iiab/iiab'
echo -e ' sudo ./runrole openvpn\n'
# Do nothing if OpenVPN not installed
2017-06-12 22:42:32 +00:00
which openvpn
if [ $? -ne 0 ]; then
echo 'Cannot find the OpenVPN program (openvpn).'
2018-04-29 06:25:14 +00:00
exit 1
2017-06-12 22:42:32 +00:00
fi
2018-09-05 15:26:30 +00:00
systemctl disable openvpn
systemctl stop openvpn
2017-06-12 22:42:32 +00:00
sleep 5
2018-09-05 20:39:34 +00:00
ps -e | grep openvpn # 2018-09-05: "ps -e | grep vpn" no longer works (nor would "pgrep vpn") when invoked from iiab-vpn-off (as filename itself causes [multiple] "vpn" instances to appear in process list!)
2017-06-12 22:42:32 +00:00
if [ $? -eq 0 ]; then
2018-04-29 06:37:19 +00:00
echo OpenVPN failed to stop.
2017-06-12 22:42:32 +00:00
else
2018-04-29 06:37:19 +00:00
echo Successfully stopped and disabled OpenVPN.
2017-06-12 22:42:32 +00:00
fi