Skip to content
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

[BUG] - Excessive auto-tunnel location checks on Wi-Fi #557

Open
iskunk opened this issue Jan 21, 2025 · 10 comments
Open

[BUG] - Excessive auto-tunnel location checks on Wi-Fi #557

iskunk opened this issue Jan 21, 2025 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@iskunk
Copy link

iskunk commented Jan 21, 2025

Describe the bug
I am using auto-tunneling on Wi-Fi and mobile data, with a trusted Wi-Fi SSID.

When I am on a Wi-Fi connection (home or foreign) and using an application that accesses the network, the green location-services indicator at the top-right of the screen pops up repeatedly despite the Wi-Fi connection remaining stable. This is especially noticeable when I browse the catalog in the official F-Droid app.

Smartphone

  • Device: Motorola
  • Android Version: 13
  • App Version 3.6.6
  • Backend: Userspace

To Reproduce
(see description)

Expected behavior
The location check occurs only when a Wi-Fi connection is initiated.

Additional context
The trusted SSID is matched using a wildcard.

@iskunk iskunk added the bug Something isn't working label Jan 21, 2025
@schafskopf
Copy link

Same for me, without wildcard.

@i7andy
Copy link

i7andy commented Jan 22, 2025

Same with me, I must get a location check every minute or so.

@zaneschepke
Copy link
Owner

zaneschepke commented Jan 22, 2025

Hello! I've done all I can to optimize this so we only query the wifi name when we detect that the wifi network has changed.

Despite these changes, this location checking persists. Unfortunately, I don't think there is much else I can do at this point to reduce this.

The old way of doing this type of network change monitoring via broadcast receiver is deprecated.

Android's APIs really are a mess. :(

We can continue this conversation, but I'll mark this as closed for now. Unfortunately, I don't think there is anything actionable for this issue. I'll reopen if we come up with something.

One note: If your device is rooted, we have a feature that bypasses the need for this location permissions and we get the wifi name via shell.

@iskunk
Copy link
Author

iskunk commented Jan 22, 2025

Thanks for considering this, @zaneschepke. I think I'll need to forego the trusted-Wi-Fi feature, then. Excluding local IP ranges from the tunnel already avoids the issue of connecting to local resources, but as I also use a VPN on my home network, it was nice to avoid double-stacking the home + phone VPNs.

(Greatly appreciate your work on this app! I don't fully understand the brouhaha with the official WG app in F-Droid, but I'm glad that a well-maintained alternative is available)

@dmsimard
Copy link

I don't have a suggestion or a workaround but chiming in to say that I am also seeing the "an app is using the location permission" green notification every minute or so on GrapheneOS which isn't rooted.

Image

I hope we can eventually find a way that doesn't require the location permission.

This app is otherwise fantastic AND open source, great work.

Thanks.

@rhoot
Copy link

rhoot commented Feb 15, 2025

The old way of doing this type of network change monitoring via broadcast receiver is deprecated.

Please excuse if I'm missing something (I'm not an Android programmer), but are you talking about SUPPLICANT_CONNECTION_CHANGE_ACTION being deprecated? If so, WIFI_STATE_CHANGED_ACTION does not appear to be deprecated. Would that not work?

If so I think it'd be perfectly acceptable to use the current location service path to get the SSID in response to that broadcast. Then the green indicator would only show up when the wifi state changes.

@zaneschepke zaneschepke reopened this Feb 15, 2025
@rhoot
Copy link

rhoot commented Mar 2, 2025

As a workaround for now on grapheneOS, I chose to hide the location indicator system-wide on my phone. It has no use to me personally. I don't give location permissions to any app that doesn't strictly need it anyway, which at the moment is literally just two FOSS apps. Having it constantly pop up (not just by wg-tunnel) makes it pretty useless either way as you become used to just ignoring it. You can always check the Location section in Settings to see which apps have used your location and how long ago.

Rumor has it that the setting resets itself occasionally though, so I guess we'll see.

For anyone that feels the same, it can be toggled in Developer options. Just know that you will no longer get notified any time an app uses your location, so you won't know if a stalker or malware has started tracking you.

Expand for instructions.
  1. Go to Settings > About phone.
  2. Scroll down to Build number and tap it repeatedly until a notification says you are a developer.
  3. Go back to Settings and go to System > Developer options.
  4. Scroll down to Location (just about at the bottom of the list).
  5. Disable Status bar location indicator.

If you don't see the location indicator toggle you may have to make it visible from a computer with android tools installed.

  1. On the phone go to Settings > System > Developer options.
  2. Near the top, enable USB debugging and accept the popup.
  3. On your computer, make sure you have the android tools installed (e.g the android-tools package on Arch Linux).
  4. Plug your phone into your computer and accept the pop-up on your phone to allow debugging. (You may have to first run an adb command to start the daemon on the computer. Just do adb devices if so and re-plug the USB cable.)
  5. On the computer, run: adb shell cmd device_config put privacy location_indicator_settings_enabled true default
  6. As a safety measure, disable USB debugging again (unless you had another reason to keep it on).

Now you should see the Status bar location indicator toggle in Developer options (you may have to leave the page and go back).

@zaneschepke
Copy link
Owner

zaneschepke commented Mar 2, 2025

So, I looked a lot into this and the broadcast receiver still works but it no longer passes the wifi ssid in the extras, no matter what permissions you have accepted. It is a bit slow as well.

I found a different solution where I use the new network callback api, but then (instead of passing the required flag to include the wifi information which constantly queries location) I query the old wifiManager api to get the ssid synchronously. This is also deprecated, but still works (for now). It is likely this will not work in future version of android (possibly Android 16), but we can run with this for now.

These changes will be available soon in the nightly version to test. I'll share a link soon.

@zaneschepke
Copy link
Owner

Please give this a shot and see if it helps: https://github.com/zaneschepke/wgtunnel/releases/tag/nightly

Also, please help me make sure it works reliably as this was a pretty fundamental change.

Thanks!

@rhoot
Copy link

rhoot commented Mar 5, 2025

After re-enabling the system location indicator the nightly doesn't appear to help. It still shows up every 10-20 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants