Showing posts with label VPN. Show all posts
Showing posts with label VPN. Show all posts

Monday, May 16, 2011

How To Block All Internet Traffic / Connections If Not Connected to a VPN

This post will outline a method using the Windows 7 Firewall to block all Internet traffic unless you are connected to your VPN.

This post assumes you have already followed the steps in the earlier post, How to only use the VPN Connection and Block ISP.

If you implement these rules, your system will have no Internet access unless you are connected to your VPN. That is to say, your system will be connected to the Internet, but no traffic can get in or out unless specifically permitted by a separate firewall rule. If a rule allowing an application exists, that application's traffic will still be able to pass through the firewall.

I have used these rules on my system without ill effect (Windows 7 Home Premium 64-bit). Depending on what other applications you use, you will likely have to create additional rules. If you break your system, don't blame me. Always back up before messing with system settings, and take notes as you go.

It is possible this method could still potentially leak data by way of the system process svchost.exe. If you attempt to block svchost.exe, your PC will not be able to communicate with your router/modem, and you really will have blocked all network functionality - i.e. nothing will work.

That being said, I have monitored VPN disconnects using TCPView and spotted no leaks - just all processes (including system processes) engaged in Internet traffic instantly changing from ESTABLISHED to TIME_WAIT, and shortly thereafter vanishing.

Steps:

1. Open Windows Firewall with Advanced Security (in this guide, start at step #4)

2. Select Inbound Rules. The New Inbound Rule Wizard will appear.

3. Select Custom Rule (see below).


4. Select All Programs.

5. Select Any IP Address, for both Local and Remote.

6. Select Block The Connection (see below).


7. Select Domain and Private, leaving Private and Public unticked (see below)



8. Name your rule and click Finish. Repeat steps 1 through 8 for Outbound Rules.

9.  In the Windows Firewall with Advanced Security window, select Windows Firewall Properties (see below).


10. In the resulting window, choose to block both inbound and outbound traffic for the Domain and Private profiles (see below). You may also want to block outbound traffic on the Public profile as well, but you will need to create specific allow rules for every application that needs Internet access.


You should test your configuration at this point to ensure it is working. Connect to your VPN, start up some downloads, and disconnect. All traffic should die immediately.

Friday, February 25, 2011

Allow a VPN Connection in Windows 7 Firewall - Ports to Open - Error 809

If you are using Windows 7 Firewall with outbound traffic restrictions, you may run into problems if you attempt to use a VPN service, receiving Error 809. I block all outbound traffic that does not match an existing rule by default, and ran into some trouble attempting to connect to my VPN.

(NOTE: The instructions below assume some familiarity with modifying rules in the Windows 7 Firewall. If you need some further direction, see this guide, and start at step #4.)

To use an L2TP - based VPN, you must create a rule to allow outbound UDP connections on port 1701. You should apply this to the Private and Public profiles (Domain should not be necessary - but if this fails, try Domain as well).

To use a PPTP - based VPN, the same applies, however you must allow TCP port 1723.

To use an IPSec - based VPN, the same applies, however you must allow UDP port 500.

Some router /  protocol combinations may also require that you modify router settings to allow them. My D-Link DIR-625 has a specific "tick-box" to allow certain protocols, such as PPTP. Your best bet if you use a router is to consult your router manual / your router's settings if opening your port locally is not successful.

Friday, February 4, 2011

avast! Web Shield and VPN - bypasses VPN connection

I recently changed antivirus programs from Panda Cloud to avast! antivirus. Suddenly, my browser was being allowed through the firewall without any issue no matter what network I was using, despite all the steps I had taken in the guide here. I was baffled, and in fact I didn't connect the installation of avast! with the problem (note to self: when things suddenly stop working, ask self - what changes have I made recently?)

Turns out the avast! program essentially acts as a proxy, passing all HTTP traffic through avast! and then to the Internet - bypassing any rule you have to block the browser from doing so.

Since Windows Firewall allows all outbound connections that do not match a rule - it's gonna get out. So - if you use an antivirus program with a "Web Shield" or similar functionality - you may want to consider disabling that function to prevent leaking one's true IP address.

...of course, that decision is fraught with its own perils...browse carefully!

Monday, January 17, 2011

How to Always / Only Use VPN Connection and block ISP - Make Bittorrent only use VPN Connection

VPNs are great for added security when using the Internet - but what about when the VPN drops or disconnects? Unfortunately, if you use Windows (any version), any running application (for example, BitTorrent, your browser) will revert to using your ISP connection, exposing your IP address and opening you up to security and privacy issues. This is of particular concern when using a VPN to secure a public wi-fi spot. Windows will not prevent traffic in the event of a disconnect.

There are many guides found online to prevent this using third-party firewalls such as Comodo, or using a third-party applications such as VPNetMon or VPNCheck (neither of which I know anything about, and cannot speak to their reliability or safety).

This guide will show you how to configure Windows 7 Firewall to block any specified application (I have used Firefox as an example - but you can pick any application, e.g. utorrent or your preferred torrent client) from using your ISP connection, and permit it to connect the the Internet using only the VPN connection. Users who are unfamiliar with the basic aspects of Windows 7 Firewall may wish to consult this guide. Unfortunately, this will not work with the built-in firewall in Windows XP or Vista.

Preliminary Considerations:

1. If you use an antivirus program such as avast! that has a Web Shield / Filter that passes HTTP traffic through an antivirus/malware scan, you may want to consider this post.

2. The IPv6 functionality in Windows 7 can also leak IP information - you may wish to disable it - see the guide here.

3. After you complete the steps in this guide, you may want to consider adding a rule to block all traffic that does not match a rule to the Domain and Private profile. See the guide here.

4. If you want to create these rules for one user account, and maintain less strict rules for another user account, please see this post. 

5. If you are blocking a torrent application such as uTorrent, you'll want to disable uTP, DHT, UPnP, Local Peer Discovery and IPv6.

Steps:

1. Connect to your VPN as you normally would. 

2. Open the Network and Sharing Center - right-click on the Internet connection icon in the taskbar and choose "Open Network and Sharing Center" (see below)


3. You should see (at least) two networks listed under "View Your Active Networks" - your VPN connection and one called "Network" - a.k.a. your ISP Connection. Ensure that your VPN is a "Public Network", and your ISP connection is "Home Network". If you need to change either connection, click it and an option window will appear (see below).



4. Go to the Control Panel and click System and Security (see below).




5. In the resulting window, click Windows Firewall (see below).



6. In the Windows Firewall  window, click Advanced Settings on the left pane (see below).  
Note: You must be logged in as an Adminstrator to make changes to the Firewall Settings.




7. You should see a window titled Windows Firewall with Advanced Security. In this window, click Inbound Rules (see below).




8.  On the right pane, you will see an option for a New Rule. Click it (see below).



9.  In the New Inbound Rule Wizard (which should appear), do the following:

  •  Choose Program and click Next.


    •  Choose the program you wish to block all traffic to except on the VPN connection, and click next.

    •  Choose Block the Connection.

    •  Tick Domain and Private. Make sure Public is left unticked.

      10. Repeat Step 9 for Outbound Rules.

      When all of the above steps are complete, you should test the configuration. Run the application you made the rule for, and test that it is working when the VPN is connected. Start a download, and then disconnect from the VPN. If all is configured properly, the download should die immediately as the firewall will immediately block it from using your ISP-assigned IP address. If you wish to monitor traffic closely, use TCPView.


      TVersity - How to get TVersity to work when a VPN is connected

      Some of you may run a VPN service on the same computer which also serves as your media server running TVersity.

      However, you may notice that when the VPN is connected, TVersity fails to show up on network devices (e.g. PS3, Wii). The VPN creates a tunnel through the router, causing TVersity to fail to announce properly on your local network or subnet (that's the simplest explanation I can think of!). Here's how you can avoid this problem.

      Instructions for running TVersity on a VPN-connected computer:

      1. Open the TVersity Interface, and click on the "Settings" tab.

      2.  On the left side of the interface you will see many options - click "General".

      3. Scroll down to the "Home Network" section - there should be a blank field, followed by a port number (typically 41952 on most default TVersity configurations). In the blank field enter the local IP address of your computer.
      • If you don't know the local IP address of your computer, run a command window and type "ipconfig" - when the VPN is active you will see two connections - the IP address you want is "Local Area Connection" - this will typically be an address beginning in 192.168.*.*.  If you don't know how to run a command window, click here.
      4. Save your changes by clicking the "Save" button at the bottom.

      That's it. Check out your device(s) to see if the Media Server is visible (You may have to scan for servers.).