├── ARCHIVE └── vpnkillswitch │ ├── run.sh │ └── service.sh ├── README.md ├── aquosserver ├── aquosserver └── pyserial-scripts │ └── service_menu.py ├── openvpn_pia ├── README.md ├── install.sh └── uninstall.sh ├── urserver ├── README.md └── urserver.sh └── vpnkillswitch.sh /ARCHIVE/vpnkillswitch/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to ensure VPN is running with kill switch 4 | 5 | restartVPN() 6 | { 7 | echo "Restarting VPN..." 8 | 9 | # Stop deluge-daemon 10 | # service deluge-daemon stop 11 | 12 | iptables -F 13 | service openvpn restart 14 | sleep 5 15 | 16 | echo "Reconfiguring kill switch..." 17 | 18 | # Get WAN IP 19 | WAN_IP=$(wget -q -O - http://ipecho.net/plain) 20 | 21 | # Configure IPTable rules 22 | iptables -t nat -F 23 | iptables -t nat -X 24 | iptables -t mangle -F 25 | iptables -t mangle -X 26 | iptables -A INPUT -i lo -j ACCEPT 27 | iptables -A OUTPUT -o lo -j ACCEPT 28 | iptables -A OUTPUT -d 255.255.255.255 -j ACCEPT 29 | iptables -A INPUT -s 255.255.255.255 -j ACCEPT 30 | iptables -A INPUT -s 10.0.0.0/16 -d 10.0.0.0/16 -j ACCEPT 31 | iptables -A OUTPUT -s 10.0.0.0/16 -d 10.0.0.0/16 -j ACCEPT 32 | iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT 33 | iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT 34 | iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE 35 | iptables -A OUTPUT -o eth0 ! -d $WAN_IP -j DROP 36 | 37 | # Start deluge-daemon 38 | # service deluge-daemon start 39 | } 40 | 41 | VPN=$(service openvpn status) 42 | PING=$(ping -c 1 google.com) 43 | 44 | while [ true ] 45 | do 46 | 47 | VPN=$(service openvpn status) 48 | PING=$(ping -c 1 google.com) 49 | WAN_IP=$(wget -q -O - http://ipecho.net/plain) 50 | IPT=$(iptables -L) 51 | 52 | if [[ "$VPN" == *"is running"* ]] 53 | then 54 | echo "VPN is running" 55 | if [[ "$PING" == *"1 received"* ]] 56 | then 57 | echo "Internet OK" 58 | if [[ "$IPT" == *"$WAN_IP"* ]] 59 | then 60 | echo "IPTables OK" 61 | else 62 | echo "IPTables not configured properly" 63 | restartVPN 64 | fi 65 | else 66 | echo "Internet down... Need to restart VPN" 67 | restartVPN 68 | fi 69 | else 70 | echo "VPN is NOT running" 71 | restartVPN 72 | fi 73 | sleep 30 74 | done 75 | -------------------------------------------------------------------------------- /ARCHIVE/vpnkillswitch/service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: vpnkillswitch 4 | # Required-Start: $local_fs $network $named $time $syslog $ALL 5 | # Required-Stop: $local_fs $network $named $time $syslog $ALL 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: vpnkillswitch 9 | ### END INIT INFO 10 | 11 | SCRIPT=/usr/vpnkillswitch/run.sh 12 | RUNAS=root 13 | NAME=vpnkillswitch 14 | 15 | PIDFILE=/var/run/$NAME.pid 16 | LOGFILE=/var/log/$NAME.log 17 | 18 | start() { 19 | if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then 20 | echo 'Service already running' >&2 21 | return 1 22 | fi 23 | echo 'Starting service…' >&2 24 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 25 | su -c "$CMD" $RUNAS > "$PIDFILE" 26 | echo 'Service started' >&2 27 | } 28 | 29 | stop() { 30 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 31 | echo 'Service not running' >&2 32 | return 1 33 | fi 34 | echo 'Stopping service…' >&2 35 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 36 | echo 'Service stopped' >&2 37 | } 38 | 39 | uninstall() { 40 | echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " 41 | local SURE 42 | read SURE 43 | if [ "$SURE" = "yes" ]; then 44 | stop 45 | rm -f "$PIDFILE" 46 | echo "Notice: log file was not removed: '$LOGFILE'" >&2 47 | update-rc.d -f remove 48 | rm -fv "$0" 49 | fi 50 | } 51 | 52 | status() { 53 | printf "%-50s" "Checking $NAME..." 54 | if [ -f $PIDFILE ]; then 55 | PID=$(cat $PIDFILE) 56 | if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then 57 | printf "%s\n" "The process appears to be dead but pidfile still exists" 58 | else 59 | echo "Running, the PID is $PID" 60 | fi 61 | else 62 | printf "%s\n" "Service not running" 63 | fi 64 | } 65 | 66 | 67 | case "$1" in 68 | start) 69 | start 70 | ;; 71 | stop) 72 | stop 73 | ;; 74 | status) 75 | status 76 | ;; 77 | uninstall) 78 | uninstall 79 | ;; 80 | restart) 81 | stop 82 | start 83 | ;; 84 | *) 85 | echo "Usage: $0 {start|stop|status|restart|uninstall}" 86 | esac 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### VPNKillSwitch 2 | 3 | VPNKillSwitch is a script that can be run on a schedule using cron (see below for my implementation). It determines if (1) OpenVPN client is still connected, (2) if an internet connection is active, and (3) if the IPTables firewall rules are configured properly such that if VPN connection is lost, no data is sent or received. If any of the 3 tests fails, then the script will attempt to reconnect the client to the VPN and reconfigure the IPTables firewall rules. 4 | 5 | The Wiki provides better instructions on the aforementioned configuration. 6 | 7 | ### Running Script with Cron 8 | 9 | In Debian 8.x edit the crontab file with the following command: `nano /etc/crontab` 10 | 11 | Add the following line to the end of the file: 12 | 13 | `*/1 * * * * root /usr/vpnkillswitch/vpnkillswitch.sh` 14 | 15 | Change the path of `vpnkillswitch.sh` as needed. 16 | 17 | This will run the script once every minute. 18 | -------------------------------------------------------------------------------- /aquosserver/aquosserver: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: AquosServer 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: Start AquosServer 9 | ### END INIT INFO 10 | 11 | SCRIPT=/usr/local/scripts/aquosserver/aquosserver.pl 12 | RUNAS=pi 13 | NAME=aquosserver 14 | 15 | PIDFILE=/var/run/$NAME.pid 16 | LOGFILE=/var/log/$NAME.log 17 | 18 | start() { 19 | if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then 20 | echo 'Service already running' >&2 21 | return 1 22 | fi 23 | echo 'Starting service…' >&2 24 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 25 | su -c "$CMD" $RUNAS > "$PIDFILE" 26 | echo 'Service started' >&2 27 | } 28 | 29 | stop() { 30 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 31 | echo 'Service not running' >&2 32 | return 1 33 | fi 34 | echo 'Stopping service…' >&2 35 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 36 | echo 'Service stopped' >&2 37 | } 38 | 39 | uninstall() { 40 | echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " 41 | local SURE 42 | read SURE 43 | if [ "$SURE" = "yes" ]; then 44 | stop 45 | rm -f "$PIDFILE" 46 | echo "Notice: log file was not removed: '$LOGFILE'" >&2 47 | update-rc.d -f remove 48 | rm -fv "$0" 49 | fi 50 | } 51 | 52 | status() { 53 | printf "%-50s" "Checking $NAME..." 54 | if [ -f $PIDFILE ]; then 55 | PID=$(cat $PIDFILE) 56 | if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then 57 | printf "%s\n" "The process appears to be dead but pidfile still exists" 58 | else 59 | echo "Running, the PID is $PID" 60 | fi 61 | else 62 | printf "%s\n" "Service not running" 63 | fi 64 | } 65 | 66 | 67 | case "$1" in 68 | start) 69 | start 70 | ;; 71 | stop) 72 | stop 73 | ;; 74 | status) 75 | status 76 | ;; 77 | uninstall) 78 | uninstall 79 | ;; 80 | restart) 81 | stop 82 | start 83 | ;; 84 | *) 85 | echo "Usage: $0 {start|stop|status|restart|uninstall}" 86 | esac 87 | -------------------------------------------------------------------------------- /aquosserver/pyserial-scripts/service_menu.py: -------------------------------------------------------------------------------- 1 | import serial 2 | import time 3 | 4 | ser = serial.Serial( 5 | port='/dev/ttyUSB0', 6 | baudrate=9600, 7 | parity=serial.PARITY_NONE, 8 | stopbits=serial.STOPBITS_ONE, 9 | bytesize=serial.EIGHTBITS 10 | ) 11 | 12 | ser.close() 13 | ser.open() 14 | ser.isOpen() 15 | 16 | SERVICE_MENU = "\x10000\x00000010\x10\x01\x40" 17 | # SERVICE_MENU = "\x0000\x006d\x0000\x0020\x000a\x0047\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x0047\x000a\x001e\x000a\x0047\x000a\x001e\x000a\x068b\x000a\x0047\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x001e\x000a\x0047\x000a\x0047\x000a\x0047\x000a\x0047\x000a\x0047\x000a\x0047\x000a\x001e\x000a\x0047\x000a\x001e\x000a\x0047\x000a\x068b" 18 | # SERVICE_MENU = "\x00\x00\x18\x00\xD3\x03\x00\x84\x03\x9C\x00\x84\x01\x8C\x00\x84\x55\x14\x90\x01\x11\x11\x11\x11\x10\x10\x12\r" 19 | # SERVICE_MENU = "00 00 18 00 D3 03 00 84 03 9C 00 84 01 8C 00 84 55 14 90 01 11 11 11 11 10 10 12" 20 | # SERVICE_MENU = "\x00\x00\x20\x00\xD3\x03\x00\x84\x03\x9C\x00\x84\x01\x8C\x00\x84\x55\x14\xA0\x01\x11\x11\x11\x11\x10\x10\x12\x01\x11\x10\x00\x00\x01\x01\x02\r" 21 | # SERVICE_MENU = "00 00 20 00 D3 03 00 84 03 9C 00 84 01 8C 00 84 55 14 A0 01 11 11 11 11 10 10 12 01 11 10 00 00 01 01 02" 22 | 23 | POWER_OFF = "\x10001\x11010010\x10\x11\x1\x4B" 24 | # POWER_OFF = "\x0000\x006D\x0000\x0020\x000A\x0046\x000A\x001E\x000A\x001E\x000A\x001E\x000A\x0046\x000A\x0046\x000A\x0046\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x0679\x000A\x0046\x000A\x001E\x000A\x001E\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x0046\x000A\x0046\x000A\x001E\x000A\x0046\x000A\x001E\x000A\x0046\x000A\x0679" 25 | 26 | ser.write(SERVICE_MENU) 27 | # ser.write(SERVICE_MENU.decode('hex')+'\r\n') 28 | REPLY = ser.read(1) 29 | print(REPLY) 30 | ser.close() 31 | -------------------------------------------------------------------------------- /openvpn_pia/README.md: -------------------------------------------------------------------------------- 1 | ### README 2 | 3 | * These scripts are intended to automate the OpenVPN installation process using Private Internet Access (PIA) as the VPN provider: 4 | * Install OpenVPN 5 | * Download/apply PIA config files 6 | * Setup PIA DNS servers (to prevent ISP DNS leaks) 7 | * Install VPNKillSwitch service 8 | 9 | ### TODO 10 | 11 | * Scripts still need heavy debugging and error-checking. 12 | * At this point I don't recommend the script. Check the wiki for manual instructions. 13 | -------------------------------------------------------------------------------- /openvpn_pia/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script will install OpenVPN and 4 | # configure it for Private Internet Access VPN, 5 | # including DNS leak prevention and kill switch. 6 | 7 | # This script is intended for Raspberry Pi 8 | # running Raspbian Wheezy. 9 | 10 | # However, this script is for my own personal use 11 | # only and therefore I offer no warranties. 12 | 13 | # This script needs to be run with sudo. 14 | # ex. sudo ./install.sh 15 | 16 | # Update packages 17 | apt-get update 18 | apt-get upgrade 19 | apt-get dist-upgrade 20 | 21 | # Install OpenVPN 22 | CHECK_VPN=$(dpkg -s openvpn) 23 | if [[ $CHECK_VPN != *"Status: install ok"* ]]; then 24 | apt-get install openvpn 25 | fi 26 | 27 | # Download PIA OpenVPN config files 28 | mkdir /etc/openvpn/pia 29 | wget -P /etc/openvpn/pia https://www.privateinternetaccess.com/openvpn/openvpn.zip 30 | CHECK_UNZIP=$(dpkg -s unzip) 31 | if [[ $CHECK_UNZIP != *"Status: install ok"* ]]; then 32 | apt-get install unzip 33 | fi 34 | unzip /etc/openvpn/pia/openvpn.zip -d /etc/openvpn/pia 35 | 36 | # Choose PIA server 37 | cd /etc/openvpn/pia 38 | echo "" 39 | echo "Available servers:" 40 | for f in *.ovpn 41 | do 42 | echo "${f%%.*}" 43 | done 44 | echo "" 45 | echo "Enter name of your desired PIA server from list above:" 46 | read SERVER 47 | cp "$SERVER.ovpn" /etc/openvpn/"$SERVER.conf" 48 | 49 | # Enter PIA credentials and save to file "login.info" 50 | echo "" 51 | echo "Enter PIA login:" 52 | read LOGIN 53 | echo "Enter PIA password:" 54 | read PASSWORD 55 | cd /etc/openvpn 56 | if ls login.info > /dev/null 2>&1; then 57 | rm login.info # if login.info exists, then delete it 58 | fi 59 | echo $LOGIN >> login.info 60 | echo $PASSWORD >> login.info 61 | chmod 400 login.info 62 | 63 | # Add "login.info" to server config file 64 | sed -i 's/auth-user-pass/auth-user-pass login.info/g' "$SERVER.conf" 65 | 66 | # Tell OpenVPN to autostart 67 | echo "AUTOSTART=\"$SERVER\"" >> /etc/default/openvpn 68 | 69 | # Add PIA DNS servers to DHCP config (DNS leak protection) 70 | # This assumes you do not have resolvconf 71 | cp /etc/dhcp/dhclient.conf /etc/dhcp/dhclient.old 72 | echo "supersede domain-name-servers 209.222.18.222, 209.222.18.218;" >> /etc/dhcp/dhclient.conf 73 | echo "supersede domain-search \"127.0.0.1\";" >> /etc/dhcp/dhclient.conf 74 | echo "supersede domain-name \"127.0.0.1\";" >> /etc/dhcp/dhclient.conf 75 | 76 | # Download vpnkillswitch and install as service 77 | mkdir /usr/vpnkillswitch 78 | wget -P /usr/vpnkillswitch https://raw.githubusercontent.com/qbwaggle/rpi_scripts/master/openvpn_pia/service.sh 79 | wget -P /usr/vpnkillswitch https://raw.githubusercontent.com/qbwaggle/rpi_scripts/master/openvpn_pia/run.sh 80 | chmod 755 /usr/vpnkillswitch/*.sh 81 | cp /usr/vpnkillswitch/service.sh /etc/init.d/vpnkillswitch 82 | update-rc.d vpnkillswitch defaults 83 | 84 | echo "" 85 | echo "Please reboot using \"sudo reboot\" now." 86 | -------------------------------------------------------------------------------- /openvpn_pia/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script will UNINSTALL OpenVPN 4 | # and the vpnkillswitch service 5 | 6 | # Stop the services 7 | service openvpn stop 8 | service vpnkillswitch stop 9 | 10 | # Remove OpenVPN and configuration files 11 | apt-get purge openvpn 12 | 13 | # Remove vpnkillswitch from init scripts 14 | service vpnkillswitch uninstall 15 | 16 | # Clean-up files 17 | rm /etc/init.d/vpnkillswitch 18 | rm -r /usr/vpnkillswitch 19 | rm -r /etc/openvpn/pia 20 | -------------------------------------------------------------------------------- /urserver/README.md: -------------------------------------------------------------------------------- 1 | #### Start Unified Remote server on startup with this service. 2 | 3 | ##### To download & install urserver: 4 | ``` 5 | sudo wget http://www.unifiedremote.com/static/builds/server/linux-rpi/420/urserver-3.2.4.420.deb 6 | sudo dpkg -i urserver-3.2.4.420.deb 7 | ``` 8 | 9 | ##### To start urserver at boot: 10 | ``` 11 | wget http://raw.githubusercontent.com/qbwaggle/rpi_scripts/master/urserver/urserver.sh 12 | chmod 755 urserver.sh 13 | cp urserver.sh /etc/init.d/urserver 14 | update-rc.d urserver defaults 15 | ``` 16 | -------------------------------------------------------------------------------- /urserver/urserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: Unified Remote server 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: Service to start Unified Remote server at boot 9 | ### END INIT INFO 10 | 11 | SCRIPT=/opt/urserver/urserver-start 12 | RUNAS=root 13 | NAME=urserver 14 | 15 | PIDFILE=/var/run/$NAME.pid 16 | LOGFILE=/var/log/$NAME.log 17 | 18 | start() { 19 | if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then 20 | echo 'Service already running' >&2 21 | return 1 22 | fi 23 | echo 'Starting service…' >&2 24 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 25 | su -c "$CMD" $RUNAS > "$PIDFILE" 26 | echo 'Service started' >&2 27 | } 28 | 29 | stop() { 30 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 31 | echo 'Service not running' >&2 32 | return 1 33 | fi 34 | echo 'Stopping service…' >&2 35 | # kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 36 | ./opt/urserver/urserver-stop 37 | echo 'Service stopped' >&2 38 | } 39 | 40 | uninstall() { 41 | echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " 42 | local SURE 43 | read SURE 44 | if [ "$SURE" = "yes" ]; then 45 | stop 46 | rm -f "$PIDFILE" 47 | echo "Notice: log file was not removed: '$LOGFILE'" >&2 48 | update-rc.d -f remove 49 | rm -fv "$0" 50 | fi 51 | } 52 | 53 | status() { 54 | printf "%-50s" "Checking $NAME..." 55 | if [ -f $PIDFILE ]; then 56 | PID=$(cat $PIDFILE) 57 | if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then 58 | printf "%s\n" "The process appears to be dead but pidfile still exists" 59 | else 60 | echo "Running, the PID is $PID" 61 | fi 62 | else 63 | printf "%s\n" "Service not running" 64 | fi 65 | } 66 | 67 | 68 | case "$1" in 69 | start) 70 | start 71 | ;; 72 | stop) 73 | stop 74 | ;; 75 | status) 76 | status 77 | ;; 78 | uninstall) 79 | uninstall 80 | ;; 81 | restart) 82 | stop 83 | start 84 | ;; 85 | *) 86 | echo "Usage: $0 {start|stop|status|restart|uninstall}" 87 | esac 88 | -------------------------------------------------------------------------------- /vpnkillswitch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to ensure VPN is running with kill switch functionality 4 | 5 | DEBUG_MODE=true 6 | DEBUG_PATH=/usr/vpnkillswitch/log.txt 7 | 8 | restartVPN() 9 | { 10 | if [ "$DEBUG_MODE" = true ] ; then echo "Stopping Deluge..." >> $DEBUG_PATH ; fi 11 | pkill deluged 12 | 13 | if [ "$DEBUG_MODE" = true ] ; then echo "Restarting VPN..." >> $DEBUG_PATH ; fi 14 | iptables -F 15 | service openvpn restart 16 | sleep 5 17 | 18 | if [ "$DEBUG_MODE" = true ] ; then echo "Reconfiguring kill switch..." >> $DEBUG_PATH ; fi 19 | # Get WAN IP 20 | WAN_IP=$(wget -q -O - http://ipecho.net/plain) 21 | 22 | # Configure IPTable rules 23 | # Change eth0 to wlan0 (or whatever network interface is being used) for wireless 24 | iptables -t nat -F 25 | iptables -t nat -X 26 | iptables -t mangle -F 27 | iptables -t mangle -X 28 | iptables -A INPUT -i lo -j ACCEPT 29 | iptables -A OUTPUT -o lo -j ACCEPT 30 | iptables -A OUTPUT -d 255.255.255.255 -j ACCEPT 31 | iptables -A INPUT -s 255.255.255.255 -j ACCEPT 32 | iptables -A INPUT -s 10.0.0.0/16 -d 10.0.0.0/16 -j ACCEPT 33 | iptables -A OUTPUT -s 10.0.0.0/16 -d 10.0.0.0/16 -j ACCEPT 34 | iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT 35 | iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT 36 | iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE 37 | iptables -A OUTPUT -o eth0 ! -d $WAN_IP -j DROP 38 | 39 | if [ "$DEBUG_MODE" = true ] ; then echo "Starting Deluge..." >> $DEBUG_PATH ; fi 40 | deluged 41 | } 42 | 43 | VPN=$(service openvpn status) 44 | PING=$(ping -c 1 google.com) 45 | WAN_IP=$(wget -q -O - http://ipecho.net/plain) 46 | IPT=$(iptables -L) 47 | 48 | if [ "$DEBUG_MODE" = true ] ; then date >> $DEBUG_PATH ; fi 49 | 50 | if [[ "$VPN" == *"is running"* ]] 51 | then 52 | if [ "$DEBUG_MODE" = true ] ; then echo "VPN is running" >> $DEBUG_PATH ; fi 53 | if [[ "$PING" == *"1 received"* ]] 54 | then 55 | if [ "$DEBUG_MODE" = true ] ; then echo "Internet OK" >> $DEBUG_PATH ; fi 56 | if [[ "$IPT" == *"$WAN_IP"* ]] 57 | then 58 | if [ "$DEBUG_MODE" = true ] ; then echo "IPTables OK" >> $DEBUG_PATH ; fi 59 | else 60 | if [ "$DEBUG_MODE" = true ] ; then echo "IPTables not configured properly" >> $DEBUG_PATH ; fi 61 | restartVPN 62 | fi 63 | else 64 | if [ "$DEBUG_MODE" = true ] ; then echo "Internet down... Need to restart VPN" >> $DEBUG_PATH ; fi 65 | restartVPN 66 | fi 67 | else 68 | if [ "$DEBUG_MODE" = true ] ; then echo "VPN is NOT running" >> $DEBUG_PATH ; fi 69 | restartVPN 70 | fi 71 | --------------------------------------------------------------------------------