Author Topic: [SOLVED] Prevent "normal" traffic if VPN disconnects ?  (Read 2605 times)

adrianTNT

  • Guest
on: February 18, 2015, 04:14:44 PM
Is there a way to prevent normal traffic if the VPN connection stops for any reason?
Now it seems to continue normally if the VPN connection stops.
« Last Edit: April 06, 2015, 10:01:58 PM by ZEROF »



ZEROF

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • Pen Tester
Reply #1 on: February 18, 2015, 08:53:20 PM
Hi,

You will need to set iptables rules or write some bash script to check if openvpn is up or not, then kill network manager if not connected to VPN.

Something like: http://forums.debian.net/viewtopic.php?f=10&t=108381#p517286
« Last Edit: February 18, 2015, 10:55:12 PM by ZEROF »


Don't ask, read : http://wiki.backbox.org
or just run sudo rm -rf /*


adrianTNT

  • Guest
Reply #2 on: February 18, 2015, 11:55:14 PM
Hello again ZEROF.

I managed to write a quick PHP code that checks for the country code of current IP and if not in list of my VPN countries then it makes a beep, but ...
what would be best command to kill the network ? Maybe something that will just allow me to start it later from top right task-bar.



ZEROF

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • Pen Tester
Reply #3 on: February 18, 2015, 11:58:36 PM
Best command, pff, you can use airmon-ng check kill, but you can use sudo service network-manager stop to be sure.
« Last Edit: February 19, 2015, 12:39:16 AM by ZEROF »


Don't ask, read : http://wiki.backbox.org
or just run sudo rm -rf /*


adrianTNT

  • Guest
Reply #4 on: February 22, 2015, 03:26:45 AM
After trying various things I found that best solution is to use the VPN client from the provider, it works nicely in both Backtrack, Windows, Android, very light weight, GUI. The key function of these apps is "Internet kill switch8)

The other methods seem hard to implement and unreliable, the simple PHP script for example blocked after too many "check network" loops.