1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 11:12:06 +00:00

on/off vpn (#28)

This commit is contained in:
georgejhunt 2017-06-12 15:42:32 -07:00 committed by GitHub
parent 617dbde56f
commit 0d95567234
3 changed files with 40 additions and 0 deletions

View file

@ -46,6 +46,8 @@
- { src: 'xs-handle', dest: '/usr/bin/xs-handle', owner: "root" , mode: '0755' }
- { src: 'up_wan', dest: '/usr/lib/iiab/up_wan', owner: "root" , mode: '0755' }
- { src: 'start.j2', dest: '/usr/lib/iiab/start', owner: "root" , mode: '0755' }
- { src: 'iiab-remote-on', dest: '/usr/bin/iiab-remote-on', owner: "root" , mode: '0755' }
- { src: 'iiab-remote-off', dest: '/usr/bin/iiab-remote-off', owner: "root" , mode: '0755' }
- name: put up_wan in place for debian
template: src=up_wan dest=/usr/lib/iiab/up_wan

View file

@ -0,0 +1,19 @@
#!/bin/bash
# script to turn on openvpn
# do nothing if it is not installed
which openvpn
if [ $? -ne 0 ]; then
echo Cannot find the openvpn program.
exit 1
fi
systemctl disable openvpn@xscenet.service
systemctl stop openvpn@xscenet.service
sleep 5
ps -e|grep vpn
if [ $? -eq 0 ]; then
echo Openvpn failed to stop.
else
echo Successfully stopped and disabled Openvpn
fi

View file

@ -0,0 +1,19 @@
#!/bin/bash
# script to turn on openvpn
# do nothing if it is not installed
which openvpn
if [ $? -ne 0 ]; then
echo Cannot find the openvpn program.
exit 1
fi
systemctl enable openvpn@xscenet.service
systemctl start openvpn@xscenet.service
sleep 5
ping -c 2 10.8.0.1
if [ $? -eq 0 ]; then
echo Openvpn successfully started.
else
echo Openvpn failed to contact remote server.
fi