[Q] Block Wifi if VPN is down? - Android Q&A, Help & Troubleshooting

I want to ensure nothing on my phone as access to wifi if my vpn is not connected. Anybody know how I could achieve this?
Any ideas greatly appreciated.

You might want to give Tasker a try. Llama (it's free / haven't used it though), or another Task automation tool might work too. It depends on how the app works, but you may have to do one or two things manually. For instance
Example Pseudo-code:
Code:
IF VPN app OPENED (
TURN OFF WIFI
SET VARIABLE vpnfrontend=1)
IF VPN app LOSES FOCUS (closed) (
ASK "Is VPN Enabled?"
IF YES (
ENABLE WIFI
SET VARIABLE vpnfrontend=0 )
IF NO (
SET VARIABLE vpnfrontend=0 ) )
That's the best I can think of off the top of my head.
Hope this helps!

Thanks for the reply closeone.
I purchased Tasker a couple of days ago. Hopefully I'll be able to do this - afraid there are going to be some manual steps though. I bought WifiJumper to auto connect to hotspots (known or unknown) so my wifi phone (Samsung Galaxy Player YP-G70) would be more like a cell phone. I thought if I could get OpenVPN working on my phone it automatically tries to reconnect but it is sometimes a slow process - thereby leaving my wifi connection open for a minute or so.
The ultimate goal here is: Android is a lot like CarrierIQ in that it tracks every IP you log in from. So I want to use a vpn so the IP I login from is the same one no matter where I'm at. I'm not a hacker, pedo, or even using P2P - I just want my privacy. Kind of a principal type of thing.

Your code is similar to what I was thinking of but.... I'm thinking I won't be able to check to see if VPN is enabled and then turn on wifi because the vpn requires wifi access to connect.
I'm still new to Android but so far the only tool I see to block wifi access is Airplane Mode and I think it blocks all apps (including the vpn). Maybe pdroid or Droidwall have some options for what I want to do????

Got to thinking if Droidwall had profiles I could build a profile that had wifi blocked for everything except Vpn. Then use Tasker to check to see if vpn was up. If not then set Droidwall to that profile. Problem is I don't think there is a way to run Tasker rule constantly. So there would be data leakage.
Sent from my YP-G70 using Tapatalk

Related

[Q] Anyone get VPN Connections to work?

Hey guys,
I have been keeping my eyes out for the tun.ko module to come out in one of the kernels, and it finally did in the 1.76 GHz kernel. I had to reinstall VPN connections after flashing the kernel, and then VPN connections would tell me that my VPN was connected properly. However, I can't get data to pass through the VPN. No pings to the remote end, no RDP, nothing.
Anybody else get this working?
Thanks,
Seth
I thought I set up my VPN wrong >_> Well that explains it! Thanks! Same issue. I have however been able to see my phone in my router, though I can't do anything with it there in or out.
This sounds like the same issue I was having with openvpn (I assume that's what you're referring to since you're talking about the tun module). I'm running Das BAMF 1.3.2, and tun is already built into the kernel. I'm having the same problem. The VPN connects, no errors at all, even ran it in the terminal so I could see all of OpenVPN's connection output. But data is not routed through the tunnel. WhatIsMyIP still reports my Verizon IP address.
Now, on two occasions I have had success. I was able to connect and disconnect my VPN all I wanted and everything worked. However this only lasted for the current phone 'life cycle', ie it failed again after the next reboot. I can't find a pattern or anything, it seems that it will randomly work after a reboot, but not that often... 1 out of 10 maybe? I didn't waste my time trying to nail down a ghost.
I think I solved the OpenVPN problem. There's an option in OpenVPN settings called 'Fix HTC Routes'. If you check it, you can get the link to view the issue tracker. Essentially it deletes a few routing tables after OpenVPN starts up. For some reason, it doesn't seem to work on the Thunderbolt. Perhaps that option is using a deprecated script command (ip ru del route)? Whatever the reason, the fix is simple. After connecting to OpenVPN, open a terminal and issue the following commands:
Code:
ip ru del table gprs
ip ru del table wifi
Ignore any errors you might get if the routing table doesn't exist. I don't think you need SU, and you can use GScript Lite to make the process easier on you.
I'll give this a shot with VPN Connections when I get a chance and report back. If anybody else has any success, please post here.
I have had better success, but it's not right yet for me. I am able to get some data to flow using RDP, Telnet, etc., but nothing actually works completely right.
When telnetting into routers, I am not able to actually authenticate. however, I CAN finally see the prompts.
When using RDP, it doesn't time out any more, but I don't get any video data back to my phone's screen. No login page, etc.
Those two commands also seem to time out eventually. I need to reenter them to get the data flowing again, it seems.
Anybody else have better results?
Seth
Well, without knowing which VPN you're using, I can't say. But it does seem to work with openvpn and the OpenVPN Settings market app (I have my own install of openvpn, so I don't use the related OpenVPN Installer app).
The routing tables gprs/wifi are automatically recreated when those connections are re-established. Meaning, if you are on VPN via wifi, and wifi disconnects/reconnects, then the wifi routing table is recreated. The same goes for gprs if you lose connection and it is reestablished. I don't know what the system might try to do using the built in VPN connections.
Sorry about that, the lack of info wasn't very helpful.
I'm trying to connect to my Cisco VPN. We are using group authentication as well as user authentication. The outside device is a 2811 router, and if there are any other specifics that might help, I'd be happy to provide it.
Thanks,
Seth

Turning on wifi on demand

Is there a way to reconnect to wifi whenever an application accesses the network?
Background: I have a rooted e-book reader that runs Android 2.2 (Sony Reader PRS-T1). The system offers an option to automatically enter wifi standby mode when the connection is idle, which I like: This behavior saves a lot of battery juice when reading an e-book.
Some of the preinstalled apps know how to reconnect the wifi whenever they need network access. Unfortunately, conventional Android apps do not know how to do this and fail. For example, I have installed the Kindle for Android app, and it fails to sync reading positions unless I have manually re-enabled the the wifi before trying to do so.
Is there a method to leave wifi standby mode and reconnect to wifi whenever there is demand?
altruizine said:
Is there a way to reconnect to wifi whenever an application accesses the network?
Background: I have a rooted e-book reader that runs Android 2.2 (Sony Reader PRS-T1). The system offers an option to automatically enter wifi standby mode when the connection is idle, which I like: This behavior saves a lot of battery juice when reading an e-book.
Some of the preinstalled apps know how to reconnect the wifi whenever they need network access. Unfortunately, conventional Android apps do not know how to do this and fail. For example, I have installed the Kindle for Android app, and it fails to sync reading positions unless I have manually re-enabled the the wifi before trying to do so.
Is there a method to leave wifi standby mode and reconnect to wifi whenever there is demand?
Click to expand...
Click to collapse
Yes. You could buy an app called Tasker. It automates whatever you want on your android so you could tell it to, for example, turn wifi on when certain apps run.
There is also a free seven day trial version so you could see if it is worth it for you.
Dave
( http://www.google.com/producer/editions/CAownKXmAQ/bigfatuniverse )
Sent from my LG P920 using Tapatalk 2
Thanks for your reply!
Yes, I know about Tasker, and have thought about it before. Unfortunately, it does not quite cover my use case:
Often, the need for Wifi access doesn't depend on which app is running, but on what I'm doing with one particular app. In case of the Kindle app, I'd like Wifi to go disconnect when reading, but to reconnect when syncing books or reading positions.

[Q] Recommend me a VPN?

I'm going to be using public wifi a lot and wanted to use a VPN to keep my data secure. So far, I've tried SurfEasy (which disconnects every five or so minutes, rendering it useless) and DroidVPN (which won't connect at all, telling me the server is full or my user name and PW are incorrect, even though I'm already logged into the app).
Can anyone recommend a VPN that will work with me just setting it up in the phone's VPN settings under More Connections, instead of requiring an app download?
Do a quick Google Search for "Open VPN". Should be exactly what you are looking for ( no installation) just be sure to download the certificates and watch when they change the passwords (every month or so).
OpenVPN also let's you run your own from your home PC. That's what I use. It took me about an hour to read some guides and get it set up.
I actually meant to put VPNBook. Open VPN is like what @brizey mentioned for rolling your own VPN
RE
Get PureVPN and setup the VPN settings on your phone manually.
Will we ever really get a free tor VPN that is unlimited without root? If you know of one please pm me.
Sent from my SCH-I545 using XDA Free mobile app

No VPN sorry no WiFi

Hi there,
I am building a home router on some decent pc hardware. I do this only to have a router with enough power to support decent encrypted vpn connections.
What I need to know is the following.
Is there a way to let an android device connect to WiFi -only- if the vpn is working?
This is tricky I guess. There has to be a WiFi connection otherwise the device cannot contact a vpn server.
But the point is that I don't want my users (wife and to lovely boys aging three and five) to connect to the Internet (via wifi) without any decent encryption.
I don't want to use a vpn service. I do this at home with the power router I build.
If I must pay for an app that does this than please suggest that. I love to pay for a good app that does what I want.
Any thoughts or suggestions?
Many thanks,
Sebastiaan.
You could use Tasker to kill their mobile data at home (depending on the phone, ROM, root, etc,) and then if the *only* Wi-Fi hotspots configured on the phones are the VPN-enabled ones, then you should be fine.
At my house, I use an Asus router with VPN Fusion. I set up my Surfshark once in the core, and my entire mesh has VPN. I just go to a page to tag each device, or set default to whatever VPN I want. Some of them go to another site I use in a different state, and some use Surfshark. If my mobile data was off, I'd be totally disconnected from the evils of the internet.
Also recommend using something like Blokada, and ensure you have always-on VPN set to either that, or another service. You can definitely set it so Android pulls that up on boot. That being said, in the case of rebooting the phone away from home, I'd imagine there's some period of time that the stuff on your device could hit the regular internet. That's where something like Blokada comes in handy. I use it to block as many google servers as I can, while still having some of those apps still work to some degree.
Depending how crazy you want to get with this, you could set a static DNS on the phone that only works when the VPN tunnel is established. There are many ways to skin this cat.
sebastiaankop said:
Hi there,
I am building a home router on some decent pc hardware. I do this only to have a router with enough power to support decent encrypted vpn connections.
What I need to know is the following.
Is there a way to let an android device connect to WiFi -only- if the vpn is working?
This is tricky I guess. There has to be a WiFi connection otherwise the device cannot contact a vpn server.
But the point is that I don't want my users (wife and to lovely boys aging three and five) to connect to the Internet (via wifi) without any decent encryption.
I don't want to use a vpn service. I do this at home with the power router I build.
If I must pay for an app that does this than please suggest that. I love to pay for a good app that does what I want.
Any thoughts or suggestions?
Many thanks,
Sebastiaan.
Click to expand...
Click to collapse
Why don't you just change the dns in the router
The Ultimate Guide to Changing Your DNS Server
There are many reasons you might want to use a third-party DNS server, from parental controls and security features to speed and reliability improvements. You can change the DNS server for your entire home network on your router, or set it individually on a PC, Mac, iPhone, iPad, Android device...
www.howtogeek.com

Prevent Certain Apps from Using My Work Wi-Fi - Anything better than Tasker?

Hi all,
I want to prevent certain apps from accessing my work Wi-Fi, mostly so my employer can't see what I'm doing. Specifically, I don't want to be connected to my employer's Wi-Fi while on Facebook, Evernote, etc.
For some other apps, I still want to use Wi-Fi to save data.
I just installed Tasker and have already a Task set up to shut off Wi-Fi for these apps. My question is: is this really secure? Does anyone think this will prevent my employer from seeing what's on my Facebook, or is there a flaw I'm not thinking of?
Ex: maybe Tasker has a delay which will allow my employer to see Facebook load anyway.
Alternatively, if anyone knows a more efficient way of doing this (in Tasker or anywhere else in Android) that'd be great.
Thanks
Question your boss is a hacker?
Because if he isn't he can't see anything in theory because he doesn't know how.
But you can use vpn connection as Hotspot Shield
so your traffic inside that network and all over the internet is encrypted.
You can also use "Firewall" for that.Firewall apps that they stop apps that you choose from getting access to internet.
if you aren't rooted try this one NoRoot Data Firewall . it use VPN
connection. So this vpn connection is local and when the blocked app tries to connect the internet it just get the localhost ip as gateway . the other apps continue to work normally.
if you are rooted try this one AFWall+ (Android Firewall +)
depends on your needs of course.

Categories

Resources