2017-06-12 22:42:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-09-05 19:13:38 +00:00
|
|
|
# /usr/bin/iiab-remote-on should turn on multiple remote support services like
|
|
|
|
# OpenVPN and others, for remote support, so they work even after reboot.
|
|
|
|
|
2019-05-12 04:29:15 +00:00
|
|
|
echo -e "\n\n\e[44m CONSIDER RUNNING 'iiab-support' INSTEAD \e[0m\n\n"
|
|
|
|
|
|
|
|
echo -e 'WARNING: To enable OpenVPN long-term, it'"'"'s recommended you:\n'
|
2018-09-05 19:56:22 +00:00
|
|
|
|
|
|
|
echo -e '1) Set these variables in /etc/local/local_vars.yml'
|
|
|
|
echo -e ' openvpn_install: True'
|
2019-05-12 04:29:15 +00:00
|
|
|
echo -e ' openvpn_enabled: True'
|
|
|
|
echo -e ' openvpn_handle: <descriptive-name-for-your-machine>\n'
|
2018-09-05 19:56:22 +00:00
|
|
|
|
|
|
|
echo -e '2) Run:'
|
|
|
|
echo -e ' cd /opt/iiab/iiab'
|
|
|
|
echo -e ' sudo ./runrole openvpn\n'
|
|
|
|
|
2018-09-05 19:13:38 +00:00
|
|
|
# Do nothing if OpenVPN not installed
|
2017-06-12 22:42:32 +00:00
|
|
|
which openvpn
|
|
|
|
if [ $? -ne 0 ]; then
|
2018-09-05 19:13:38 +00:00
|
|
|
echo 'Cannot find the OpenVPN program (openvpn).'
|
2018-04-29 06:24:41 +00:00
|
|
|
exit 1
|
2017-06-12 22:42:32 +00:00
|
|
|
fi
|
2018-09-05 19:13:38 +00:00
|
|
|
|
2018-09-05 15:26:58 +00:00
|
|
|
systemctl enable openvpn
|
|
|
|
systemctl start openvpn
|
2017-06-12 22:42:32 +00:00
|
|
|
|
|
|
|
sleep 5
|
2018-08-15 19:43:02 +00:00
|
|
|
ping -c 2 {{ openvpn_server_virtual_ip }} # 10.8.0.1
|
2017-06-12 22:42:32 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2018-04-29 06:38:00 +00:00
|
|
|
echo OpenVPN successfully started.
|
2017-06-12 22:42:32 +00:00
|
|
|
else
|
2018-04-29 06:38:00 +00:00
|
|
|
echo OpenVPN failed to contact remote server.
|
2017-06-12 22:42:32 +00:00
|
|
|
fi
|