ics-openvpn icon indicating copy to clipboard operation
ics-openvpn copied to clipboard

WiFi connection management

Open schwabe opened this issue 9 years ago • 33 comments

Main windows gets a new tab that does connection management.

List of conditions/actions. First action that matches will be taken.

Conditions should include Mobile network/specific WiFis or the category unencrypted WiFis.

Action should include Connect VPN x, Disconnect VPN, (and disconnect/connect only if not a specific WiFI is used.

DeviceListener already is already triggered on network reconnect.

schwabe avatar Jul 02 '15 08:07 schwabe

How do you suggest to manage the policy enforcement?

  1. To create an overlay management that decide whether to connect/disconnect you by your policy?
  2. To maintain the socket connection for a few seconds after the connection change, but to detach it from the android vpn immediately? (is that even possible?)

I'd love to hear more ideas about the techy part, and not the UI part. I have developed for my own use an "overlay" management such as in (1).. but it still not stable enough

AlmogBaku avatar Jul 03 '15 19:07 AlmogBaku

This would be an excellent feature! There are certain networks I connect to that I trust, and having to manually disconnect openVPN when connecting to the network and then (try to remember to) connect to openvpn when leaving the network is quite cumbersome..

Alternatively, adding support for other apps such as Tasker or Automagic Premium to initiate connections/disconnections using this app would establish the same thing, since users could create rules in those apps to detect when the network changes.

craftyguy avatar Oct 24 '15 20:10 craftyguy

Hello. I can't find the new tab: Connection management. Is this available only in beta?

mesterj avatar Oct 25 '15 10:10 mesterj

@mesterj not yet.

I've built this feature internally, but I need to find a time to contribute the code into a PR.

AlmogBaku avatar Dec 06 '15 19:12 AlmogBaku

I'm trying to do this with Tasker. Connecting is already possible by sending an intent. Disconnecting or pausing is not possible this way. AIUI, sending an intent from Tasker is the same what happens when clicking a shortcut, so another way to formulate this requirement would be: Add launcher shortcuts for pause/resume/disconnect, then automation with Tasker becomes possible.

OlafTitz avatar Feb 07 '16 13:02 OlafTitz

There is a 3rd party plugin for Tasker that allow full control of OpenVPN for Android. I do not want to allow general disconnect/pause etc. intents since otherwise arbitrary apps could control connections

schwabe avatar Feb 07 '16 13:02 schwabe

I would love to have an option when I connect to WiFi network A or B then fire up VPN. Or any open WiFi then fire up VPN. And disconnect when no longer on that network

wifiuk avatar Feb 12 '16 22:02 wifiuk

I was just about to create a new issue to suggest this. This would be great, possibly with a switch to deny any communication on unsecured Wi-Fi networks until a connection is established. (Minus the app/service in charge of connectivity checks, to allow the user to click through captive logins)

smiley avatar Mar 03 '16 12:03 smiley

You could allow disconnecting by intent, and make it an option that is disabled by default. This would allow folks that want to use this to have it as long as they understand the risk.

@AlmogBaku any chance you've had time to get your changes organized? :)

craftyguy avatar Jun 11 '16 21:06 craftyguy

@schwabe @craftyguy @smiley

Hey, perhaps a dumb idea from a non-programmer but... hear me out :-)

In android, it's possible to have activities that are non exported (android:exported="false")

In this case, other "vanilla" applications will not be able to start this activity

HOWEVER automagic4android and/or tasker will be able to launch this activity on a rooted device (something like su -c am start -n de.blinkt.openvpn/stuff.stuff.stuff) and get the desired behavior (disable VPN on specific connections, ensure that a specific VPN profile is launched for specific connections, etc etc)

It doesn't make the security more broken than just having rooted device does ;-)

tonsimple avatar Jun 27 '16 10:06 tonsimple

Requiring root for anything as simple as this, where a non root solution already is possible, would be a real security disaster. Am 27.06.2016 12:20 schrieb "Simply Sarah" [email protected]:

@schwabe https://github.com/schwabe @craftyguy https://github.com/craftyguy @smiley https://github.com/smiley

Hey, perhaps a dumb idea from a non-programmer but... hear me out :-)

In android, it's possible to have activities that are non exported (android:exported="false")

In this case, other "vanilla" applications will not be able to start this activity

HOWEVER automagic4android and/or tasker will be able to launch this activity on a rooted device (something like su -c am start -n de.blinkt.openvpn/stuff.stuff.stuff/) and get the desired behavior (disable VPN on specific connections, ensure that a specific VPN profile is launched for specific connections, etc etc)

It doesn't make the security much more broken than just having rooted device does ;-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/schwabe/ics-openvpn/issues/370#issuecomment-228707869, or mute the thread https://github.com/notifications/unsubscribe/AQUPyqRaIjVUH6qur_4mdTs3_qiT1b5lks5qP6P_gaJpZM4FQfnu .

OlafTitz avatar Jun 27 '16 10:06 OlafTitz

I don't like the Intent without restriction as it would allow arbitrary apps to break the connection. Disconnecting via is already possible but apps using that api need to prompt for permissions from OpenVPN for Android.

schwabe avatar Jun 27 '16 10:06 schwabe

Allow the use of intent to be configurable, and disable it by default. I don't care, as long as the functionality exists then those of us who trust the apps on our devices and understand the risk can use it and everyone else can leave it off.

This app seems to arbitrarily disconnect itself or fail to reconnect on multiple network changes, so having it be controllable by intent might actually help us to recover from an errant disconnect by using something like Tasker

craftyguy avatar Sep 09 '16 04:09 craftyguy

Since #103 was closed as a duplicate of this issue, are there any plans to implement a network blacklist such that openvpn won't try to connect when the device is connected to one of the networks in the blacklist? That request seems a bit unrelated to this intent discussion (triggering a disconnect vs not connecting in the first place [ie #103])

craftyguy avatar Nov 18 '16 17:11 craftyguy

The OpenVPN Tasker plugin does not work with OpenVPN for Android at present, and has not been working since version 0.6.60, based on the google play comments, it looks like there have been a number of times in the past where this has broken, but the plugin has not been updated since 2014.

Since I'd imagine the thing most people are trying to do with Tasker is to configure the VPN to connect on any WiFI networks that are not their home network, this feature would be very useful. Certainly better than relying on a 3rd party plugin app which contains ads and in-app purchases

priceaj avatar Jan 02 '17 12:01 priceaj

Yes, but I have had not time and motivation to implement this yet. Keep in mind that OpenVPN for Android is a spare time project for me.

schwabe avatar Jan 02 '17 16:01 schwabe

Is there anything we could do to motivate you to work on this? it's literally the only thing keeping this app from being usable for me.. since it essentially breaks every time I wander to my local network (where my VPN server is located). I could configure my router to loopback, but having to VPN from within the network where my server is located to the same network is silly.

craftyguy avatar Jan 03 '17 01:01 craftyguy

I use the CyberGhost VPN Android app and really like how it handles the network settings. E.g., it is possible to exclude my two trusted home WLANs (SSIDs House LANister + It Hurts When IP) and automatically start the VPN on other networks. If interested, you can download the app and test it for a week.

GregoryGoodnight avatar Sep 03 '17 11:09 GregoryGoodnight

@GregoryGoodnight I don't think a proprietary application is an appropriate replacement for this one..

craftyguy avatar Sep 03 '17 19:09 craftyguy

Sorry for the confusion @craftyguy, I did NOT mean to replace this app with another one. I just like the way that the Cyberghost VPN Android app handles the WiFi connection management and that we could take it as an inspiration.

GregoryGoodnight avatar Sep 04 '17 06:09 GregoryGoodnight

Bummer, I really thought this would be a basic function, REALLY like the app include/exclude list, that ROCKS! But I really need a way to...when on home WiFi connect to Work VPN, when on work WiFi connect to Home VPN, seems like a logical thing people do...

daltonch avatar Nov 15 '17 06:11 daltonch

I am having the same issue. I want to disable the VPN on home and Work network for various reasons. So tried using E-Robot app to control the connections but the expressions and conditions make it more complicated and triggering multiple events to enable or disable the VPN connection. It would be very valuable feature enhancement if we can add Wifi connection management to this app to enable/disable or pause/resume functionality.

uniquesuresh avatar Jan 23 '18 16:01 uniquesuresh

Did someone get such a bevahiour with Autoset? So far, it can start OpenVPN when I leave my home WiFi, but I did not figure out how it could stop the VPN connection when I arrive at home.

bjo81 avatar Mar 06 '18 15:03 bjo81

Would also like to request this feature. The setup i want to use is "always on VPN" for all my WiFi/4G connections, with the exception of my home network.

neoatomic avatar Apr 15 '18 21:04 neoatomic

FYI, intents were enabled per f014940abd99c372004e227f2e68f31820162731, bb3c4aecd89e63e21c93d5966df8771dfa672ef2, and 3eca5f7e424f6b1989e3245567bcdd034a80c92d.

The workaround that was implemented seems to be an approval mechanism to allow the app sending the intents to do so.

mvastola avatar Jun 24 '18 07:06 mvastola

is there a way that we get that feature soon? I think a simple line in the client config can help here.

something like: disable if gateway 192.168.1.1 or better: disable remote route 192.169.1.0 255.255.255.0 if gateway 192.168.1.1

there is a soltuion at the moment that works (only tested on linux, ubuntu) add this to your client config: route 192.169.1.0 255.255.255.0 192.168.1.1 if the client is in the local network, this rule will apply and the server can't push the route anymore.

if the client is not in the local network, the rules gives a error and you can connect though the VPN to your local netowork:

/sbin/ip route add 192.169.83.0/24 via 192.168.50.1
Error: Nexthop has invalid gateway.
ERROR: Linux route add command failed: external program exited with error status: 2

but that seems only to apply on the initial connection and its not tested with windows / mac / android / etc

TheCherry avatar Aug 05 '20 10:08 TheCherry

Not likely. It is on my TODO list since 2015 and there has never been enough motivation to implement it.

schwabe avatar Aug 08 '20 17:08 schwabe

The motivational use-case is very well explained in OpenVPN's support forum: https://forums.openvpn.net/viewtopic.php?f=36&t=28794

Hope you reconsider the motivation !

Meetsch avatar Nov 05 '20 07:11 Meetsch

@Meetsch I see the use case. It is just not something that I personally use or really interested in. It is also not something that is very easy to implement or simple.

schwabe avatar Nov 05 '20 10:11 schwabe

this is getting more and more important and has to be implemented in the app without funny tasker. in the faq http://ics-openvpn.blinkt.de/FAQ.html you advise how to block non vpn connections. consider this makes vpn useless for many when we need connect phone to android auto or garmin dash cam or drone wifi spot and so on, there are more and more devices accessible only with local wifi hotspots. excluding routes option does not work. if you do not add such option you will leave no choice for us but negative feedback for your app. other app had at least option to use vpn either over mobile data or wifi but begining with android 8 even that was removed. p.s. lack of such option is privacy violation. what is so difficult to check list of whitelisted wifis and connect or allow pass-thru.

gitlot6 avatar Jun 08 '21 02:06 gitlot6

@gitlot6 if you go by the privacy argumentation then this feature would not be for you either. There is simply no way to implement this without leaking data as the app can only react AFTER the WiFi has connected but at that time, you will already have data flowing.

So again a half-baked implementation is also nothing that I am happy with and the current APIs just don't allow any "Use VPN always on certains WiFI but not on other" in any proper way that doesn't leak traffic.

Also trying to pressure me into developing something with the threat of negative feedback is not helping.

schwabe avatar Jun 08 '21 13:06 schwabe