-
Notifications
You must be signed in to change notification settings - Fork 391
Added support for automatically disconnecting from a tunnel when connected to a specified Wi-Fi network. #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…one of specified Wi-Fi networks Signed-off-by: asivery <[email protected]>
Signed-off-by: asivery <[email protected]>
Signed-off-by: asivery <[email protected]>
Can you add a use case for this in the PR description? You've explained how and what but not why, which is a necessity for something this big. Was this feature discussed somewhere prior to implementation? I can't seem to find anything on the mailing list. |
Signed-off-by: asivery <[email protected]>
@msfjarvis I've added an explanation. I didn't discuss this feature on any mailing list, because I wasn't aware there was a mailing list. If needed, I can close this PR here, and first discuss it on the mailing list. |
I am waiting for this for a year now. Nice work. If this works then only the automatic connecting to the tunnel if you disconnect from the SSID is missing. |
827495b
to
4ba8794
Compare
…o blocked network Signed-off-by: asivery <[email protected]>
@msfjarvis if you search the web on how to automatically disable WireGuard on local wifi, you will get a ton of hits where people are looking for exactly this feature. |
Will this ever get implemented? I'd like to automatically disconnect from my home VPN, when I'm at home.. And not rely on third party apps to do that. |
@msfjarvis and @zx2c4 Can we get this reviewed and merged? So many people would love this feature, and are looking toward other apps to solve it. I've experienced this with iphones and it's a dream. |
…eboot Signed-off-by: asivery <[email protected]>
I'd really love to see this merged BUT I wonder if the opposite functionality - reconnecting the VPN tunnel once the device leaves the configured networks - is also available? |
Hey, what's the state of this? |
I just want to add support for this. The iOS client has it, the android one should too. It's so useful to just disconnect automatically when home and then reconnect when I leave. |
@msfjarvis I'm curious what's needed to get this integrated into the app? This feature is already present in the iOS and MacOS versions, and there's plenty of easily discovered discussion out there on why users would want this feature. |
c1d59a2
to
6aab7cc
Compare
My hesitation about this is that, due to wifi autoconnect, this makes it possible for an attacker to knock a user off the VPN. On iOS the OS provides this functionality for us, and all the dangers that entails. Here we're explicitly adding the potential vulnerability, which makes me uneasy. That's not to say that I'm nack'ing this. I'm just kind of hesitant and not totally convinced yet that it's a wise whistle to add. Thoughts on this? |
shouldn't it be up to the user if he is willing to take the risk or not? And could you maybe elaborate as to how this could be exploited? If an attacker already is in my home network/wifi, my least concern would be if my phone is still using the VPN to my home network or not. And spoofing the SSID of the home network alone should not trigger the disconnect, right? It will require an established connection, no? |
@@ -257,4 +257,14 @@ | |||
<string name="biometric_prompt_private_key_title">Authenticate to view private key</string> | |||
<string name="biometric_auth_error">Authentication failure</string> | |||
<string name="biometric_auth_error_reason">Authentication failure: %s</string> | |||
<string name="wifi_settings">Wi-Fi Settings</string> | |||
<string name="wifi_auto_disconnect_checkbox">Disconnect when using to one of these networks:</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the to
is a remnant from a previous iteration of this label (..when connected to...
) and should be removed now.
<string name="wifi_auto_disconnect_checkbox">Disconnect when using to one of these networks:</string> | ||
<string name="auto_disconnect_networks_hint">Network1, Network2, Network3</string> | ||
<string name="auto_disconnect_networks_label">Networks</string> | ||
<string name="blacklisted_wifi_networks">Blacklisted Wi-Fi networks</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally have no issue with it, but the name blacklist
might offend some people these days (just like master
branches etc), so it might be good to use a different term..
I appreciate your concern, and I believe this feature should be implemented with a warning as such. If I'm turning wire guard off when I get home already, the vector is already there. The convenience keeps me connected more often as I don't have to remember to turn it back on. |
There's a small faction of us that are using the 3rd party WG Tunnel app to fill this gap. As others have stated - I think a warning before enabling it allows the user to make the decision whether the risk is applicable to their scenario. |
Since writing this pull request, I have switched to the WG Tunnel app. If anyone wants to make my changes compatible with the current version of this app, go for it, but I myself do not have a reason to do so now. |
Added support for automatically disconnecting from a tunnel when connected to a specified Wi-Fi network.
How does this work for users?
Now when editing a tunnel, there's a field in which the user can enter the names of networks, connecting to which will cause this tunnel to be disconnected.
There's also a checkbox that will enable or disable this functionality for this particular tunnel.
What changes were made to previous components to support this?
These values are stored in the WgQuick config as comments following the scheme
ADD;key;value
:Limitations and possible points for future improvement
Why was this added?
If NAT hairpinning doesn't work correctly in a Wi-Fi network, and there is a tunnel to that same network open, all packets will go through Wireguard, and eventually get dropped. With this feature active, the Wireguard app will terminate the tunnel once the user connects to that network, and, as a result, the user will still have an internet connection.
This is already a feature in the iOS app, but there it has more features (it can f.ex. auto-connect to a tunnel when connected to a certain network).