Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Apps like messenger cannot access the internet unless exluded? #415

Closed
CodeCracker-oss opened this issue Nov 17, 2021 · 14 comments
Closed

Comments

@CodeCracker-oss
Copy link

Hello,

I've seen the note under the option for Allow bypass, which seems to mention apps like whatsapp will need it to function properly, but what it fails to explain is why?

Messenger will connect fine if under dns battery save mode only, will fail in firewall or dns+firewall mode. It will still fail if whitelisted under firewall mode. It will only connect if excluded. Sometimes it connects when allow bypass is on, sometimes it doesn't.

So it seems to be some part of the firewall thats blocking messenger. Even if all options under universal are disabled, and messenger is disabled in firewalls app list, it will still fail to connect which is confusing.

As I am using afwall+ donate version at the moment still, afwall will only block apps that i select, which is what rethinkdns should do, not blocking apps that I dont want blocked, currently seems to only be an issue with messenger.

There are 2 other apps I need excluded as well, but its because of its LAN functionality, which is syncthing and vlc. Syncthing I have configured to route only on lan, never to the internet and vlc only used for devices like chromecast, but when excluding them it bypasses not just firewall but also dns, and in the case of syncthing, if I did decide to re-configure syncthing to sync with devices over the internet, dns qureries wouldn't be encrypted then. Those lan based apps, I am fine having it bypass just firewall though, as its needed. Whitelisting them doesn't work.

Also, I prefer to have always on vpn and Block connections without vpn enabled to prevent data leaks, and as app will mention, exclude apps and Allow bypass dont work in lock down mode.

I know that to communicate with lan, lockdown mode needs to be off anyway though, android limitation, but thats my concerns as to adding to the exclude list.

So far, I can replace AdAway and private dns function with rethinkdns, working on replace afwall with it, for a vpn based method to avoid iptables.

Anyway to address this?

Thank you :)

@ignoramous
Copy link
Collaborator

ignoramous commented Nov 18, 2021

I've seen the note under the option for Allow bypass, which seems to mention apps like whatsapp will need it to function properly, but what it fails to explain is why?

Well, there's a lot of nuance to unpack here, but it is an assumption that those apps may not happy with socksifiers like the RethinkDNS app.

  1. WebRTC apps may use SCTP, a transport protocol that RethinkDNS doesn't support. It only understands and routes TCP and UDP traffic (Explore gVisor Netstack #89).

  2. They may want to bind to a faster (low latency, less jitter) network interface. Androids can be connected to both Mobile Data and WiFi, and apps are free to choose which ever. May be, these apps like to choose what interface they bind to, and aren't happy if they are unable (Disallowing bypass prevents them from doing so).

  3. RethinkDNS does not handle multicasts / broadcasts / discovery (ex: DNS-SD / mDNS) at all. It simply forwards them to some place it shouldn't. See Handle undelegated domain names #368

  4. There might be other reasons, I don't fully understand yet.

I thought, this information is too much for any one user to be included in the app. May be we should FAQ this, or put it up in our docs page (which are already linked from the app from the About page).

Messenger will connect fine if under dns battery save mode only, will fail in firewall or dns+firewall mode. It will still fail if whitelisted under firewall mode. It will only connect if excluded. Even if all options under universal are disabled, and messenger is disabled in firewalls app list, it will still fail to connect which is confusing.

Facebook Messenger? Ah, don't use it so never knew it breaks this spectacularly. What do you see in (firewall) Network Logs when Messenger doesn't work? Do you see the firewall blocking any connections from other apps or endpoints?

Also, I prefer to have always on vpn and Block connections without vpn enabled to prevent data leaks, and as app will mention, exclude apps and Allow bypass dont work in lock down mode.

Yep, we need to handle LAN and discovery (IoT) better (rather than require users enable bypass / exclude apps that break). That's pending (#26), but likely we take that up only after we implement other important features / issues that don't even have a workaround today (for ex: #52).

I know that to communicate with lan, lockdown mode needs to be off anyway though, android limitation...

You sure that LAN traffic isn't forwarded to the VPN by Android?

working on replace afwall with it, for a vpn based method to avoid iptables.

AfWall+ is always going to be more leak proof than RethinkDNS (given it uses iptables/nftables, an implementation in the kernel itself, and likely more robust and better equipped to handle any and all network / protocol scenarios). It is sad that the only available firewall APIs ([ip|nf]tables) require root, and there's no other alternative non-root API. Curiously Google engs are building up some kind of a Firewall framework, let's see if they end up exposing it to apps in any meaningful way.

Anyway to address this?

Sure, do you know how to code? ;) Otherwise, let's see when we get to tackle these problems. The Messenger one is a "troubling" bug to say the least.

@CodeCracker-oss
Copy link
Author

@ignoramous

Do you see the firewall blocking any connections from other apps or endpoints?

I just noticed that that messenger had said blocked "dns bypassed", Block connections that bypass dns is turned on, at the time. Though because messenger was added to whitelist, when testing it said it would bypass firewall rules, so I thought it would bypass that option, as its under firewall configuration settings.

So it appears messenger will work if dns is allowed to be bypassed, though to prevent other apps bypassing it, maybe adding an exclusion list for specific apps to be allowed to bypass?

You sure that LAN traffic isn't forwarded to the VPN by Android?

It is, as rethinkdns seems to have that ability integrated, but android it's self seems to block lan when in lockdown mode. For e.g my vpn i occasionaly use (ProtonVPN) has an option in settings of it to " Allow lan connections" if enabled, i can connect to things like chromecast, computers ftp server on lan or printer while still connected to vpn, but as soon as I enabled "Block connections without vpn in system settings, lan connections refuse to work.

It seems like it scans for devices ok, but during connection to it, like screen casting (mirroring android display) to chromecast, will initialize it on chromecast, as if it at least knows how to communicate, but then drops connection erroring, without displaying anything as if no data can be sent to it.

AfWall+ is always going to be more leak proof than RethinkDNS

Rethinkdns is better at being leak proof during boot, which is excellent. for e.g) AfWall + will take roughly 15 seconds after device boot (or should i say after first device unlock, after decryption) so within those 15 seconds apps can connect as if no firewall is active. Rethinkdns appears and connects successfully within 1 second, literally.

I know about the other leaks regarding ICMP that's not yet implemented, but im not at all familiar with it as Im only use to UDP and TCP

A basic firewall should be a already built-in and configurable feature of android since marshmallow when introducing users required to give permission access manually, rather than require root or work arounds like vpn based solutions, but at least were able to get it to work for the most part.

@ignoramous
Copy link
Collaborator

Though because messenger was added to whitelist, when testing it said it would bypass firewall rules, so I thought it would bypass that option, as its under firewall configuration settings.

Yes, Messenger should have been allowed past 'Block connections when DNS is bypassed' firewall rule if whitelisted. I am not able to reproduce this scenario with other apps. For ex, WhatsApp, Instagram, Telegram bypass DNS routinely, and when whitelisted, they have no connections firewalled because of it.

So it appears messenger will work if dns is allowed to be bypassed, though to prevent other apps bypassing it, maybe adding an exclusion list for specific apps to be allowed to bypass?

Whitelisting Messenger should have worked... I don't know why it didn't in your case. Can you recheck if this still happens?

my vpn i occasionaly use (ProtonVPN) has an option in settings of it to " Allow lan connections" if enabled, i can connect to things like chromecast, computers ftp server on lan or printer while still connected to vpn, but as soon as I enabled "Block connections without vpn in system settings, lan connections refuse to work.

Could be the way ProtonVPN implemented this feature breaks LAN connections in VPN lockdown mode (that is, 'Block connections without VPN' mode). I am going take a stab at it one of these months to make mDNS/Bonjour/LAN work. Let's see how that goes.


Yet to find a phone with Messenger installed and signed-in to debug this. I'll come back to this thread when I've had a chance.

@CodeCracker-oss
Copy link
Author

Whitelisting Messenger should have worked... I don't know why it didn't in your case. Can you recheck if this still happens?

While debugging this more, since my last reply it appears as if sometimes messenger connects without dns bypass option enabled and other times only if its excluded.

When messenger is whitelisted but not excluded, the network logs will mention it was allowed stating its whitelisted, if taken out of whitelist, some connections are blocked saying rule is DNS bypassed. Just appears buggy when it comes to messenger, Im hoping to get rid of messenger soon anyway over privacy concerns.

Could be the way ProtonVPN implemented this feature breaks LAN connections in VPN lockdown mo

All my vpn based apps such as ProtonVPN and ivpn have this option in app, Invizble Pro which isn't actually a vpn, but uses its functionality similar to rethinkdns has option as well.

I know from experience that lockdown mode rejects any lan communication unless app forwards it through the vpn, as per the option in app I was referring to.

@ignoramous
Copy link
Collaborator

ignoramous commented Nov 20, 2021

Many thanks for reporting back.

While debugging this more, since my last reply it appears as if sometimes messenger connects without dns bypass option enabled and other times only if its excluded.

So I found someone with Messenger installed on their Android to test. Messenger worked fine on their device regardless of Firewall rules I set.

If I were to guess, in your case, some DNS blocklist is nerfing Messenger. You can search for which blocklists block facebook related domains on rethinkdns.com/search (ex: rethinkdns.com/search?q=graph.facebook.com).

The Android I tested Messenger on, had these 20 blocklists: https://basic.rethinkdns.com/1:EMD_HwDgYIE= (view: rethinkdns.com/configure#1:EMD_HwDgYIE=).

Can you please test if it is DNS blocking that's causing Messenger this connectivity pain?

I know from experience that lockdown mode rejects any lan communication unless app forwards it through the vpn, as per the option in app I was referring to.

There might be a way to split-tunnel without compromising on 'Block connections without VPN' setup. I see some clues for it in the tailscale codebase. Let's see if it works when we do get to implementing it.

@CodeCracker-oss
Copy link
Author

Can you please test if it is DNS blocking that's causing Messenger this connectivity pain?

You do appear to be correct. What I did during my testing was remove messenger from exclude list, disabled on-device blocklist (and adaway, as I use until i figure if rethinkdns is a suitable replacement) and I connect no problem.

I then enabled on-device blocklist and it when loading some message threads thats when messenger threw the failed connection error, under dns logs graph.facebook.com was blocked by 2 blocklist.

web.facebook.com was blocked during a sending of a message which i found strange as using the same list in adaway (energizer xtreme extension) it wasn't blocked.

With rethinkdns blocklist disabled and adaway enabled with same blocklist, certain message threads failed to load as graph.facebook.com was blocked, but sending messages succeeded through web.facebook.com url. Allowing an exception to graph.facebook.com in allow list, messenger then worked entirely.

One thing seems to confuse me, web.facebook.com seems to be blocked by energizer xtreme extension in rethinkdns, but not by adaway using same list.

@CodeCracker-oss
Copy link
Author

There might be a way to split-tunnel without compromising on 'Block connections without VPN' setup

I see that I spoke incorrectly about how this lockdown seems to function, but when in lockdown there appears no way for even an app to allow lan or anything to do with it unless disabled.

As an e.g. Regardless of which app I have set as always on and Block connections without vpn, the system feature Screen Cast will detect lan device such as chromecast, but when selecting it takes a minute to load an will say that connection failed. As soon as I disable "Block connections without a vpn", the connection will succeed. Again, this screen cast I'm referring to is a system feaure, not a 3rd party app. The " Allow lan" option of the app Im talking about, can either allow or not allow lan connections when vpn is connected, but in either case can't be in lockdown mode.

Do you know of any way I could maybe gather system level logs of this, to more like have physical proof android itself is rejecting lan connections?

@ignoramous
Copy link
Collaborator

web.facebook.com was blocked during a sending of a message which i found strange as using the same list in adaway (energizer xtreme extension) it wasn't blocked.

Are you sure it was Energized? rethinkdns.com/search right now points to CPBL. The logs on RethinkDNS app would show the blocklists that block web.facebook if you're using on-device blocklists / RethinkDNS+.

Also, can you share the on-device and/or RethinkDNS+ blocklists stamp (the URL) so we may debug if there's a bug in the code that's doing the blocking? You should see a copy > button (tapping it copies the blocklist stamps) at the top of the webpage where blocklists are configured.

Do you know of any way I could maybe gather system level logs of this, to more like have physical proof android itself is rejecting lan connections?

I'm not on my pc to test this, but output from

adb logcat | grep -iE "(netd|connect)"

Should capture what's going on when you start the VPN with Block connections without VPN.

@CodeCracker-oss
Copy link
Author

CodeCracker-oss commented Nov 21, 2021

Are you sure it was Energized?

Not sure, but when web.facebook.com was displayed as blocked under dns logs of rethinkdns, i slected it and saw a tab on right side showing privacy, when clicking it, it displayed a msg saying that the Energized Extreme Extension was the blocklist blocking its url, don't remember it word by word though.

As of now, I reduced the # of blocklist used to the same ones used by AdAway I had set (AdAway official host, Energized Unified, Energized Xtreme Extension, GoodbyeAds & Peter Lowe) so far everything seems fine with messenger other than occasional older msg threads that fail to connect but I do know that is caused because graph.facebook.com is blocked by the GoodbyeAds host, which I refuse to unblock for privacy reasons. That url though isn't needed for most things in messenger.

Also, can you share the on-device and/or RethinkDNS+ blocklists stamp (the URL) so we may debug if there's a bug in the code that's doing the blocking?

https://basic.rethinkdns.com/1:0AIABAAhQAAQAA==

I'm not on my pc to test this, but output from

adb logcat | grep -iE "(netd|connect)"

Should capture what's going on when you start the VPN with Block connections without VPN.

I will try and test this when I can get on my computer sometime this week.

I can send them to you as well if you believe they may help.

@ignoramous
Copy link
Collaborator

I can send them to you as well if you believe they may help

Sure, if you're comfortable sharing those over email mz at celzero dot com or on telegram t.me/aliakbarmurtaza.

You mentioned ProtonVPN, so I expect to test it myself, too.

@CodeCracker-oss
Copy link
Author

You mentioned ProtonVPN, so I expect to test it myself, too.

By this do you mean that you have protonvpn that you will be testing yourself, or expecting me to test it with protonvpn, over the other vpn apps?

@ignoramous
Copy link
Collaborator

Sorry, I should have been clearer.

I'll do adb logcat myself with ProtonVPN with 'Block connections without VPN' enabled. It seems straight forward enough.

@CodeCracker-oss
Copy link
Author

I had just sent you the e-mail, containg the logs.

Comes from a temporary e-mail address of mine (which forwards to my real one): 67deaf1d-79f8-4648-8848-484049d08714@slmail.me

@ignoramous
Copy link
Collaborator

I looked at the logs you sent, but unfortunately, there not many clues in there to explain what you're seeing.

RethinkDNS is due a major network-engine overhaul in the next few months. Let's see if the current variant of the issue you're seeing persists post that release.

For now though, closing this issue as the original reported bug has been resolved, and moving this thread to a discussion instead.

@celzero celzero locked and limited conversation to collaborators Mar 18, 2022
@ignoramous ignoramous converted this issue into discussion #465 Mar 18, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants