Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.82k stars 196 forks source link

Explicit (SOCKS) proxy support through commandline flag or preferably settings #1045

Open Mikaela opened 2 years ago

Mikaela commented 2 years ago

The Problem

As per https://github.com/Nheko-Reborn/nheko/pull/626, proxy support should be configurable by environment variable http_proxy. However flatpak run --env=http_proxy=http://127.0.0.1:8118/ io.github.NhekoReborn.Nheko//master (with torrc HTTPTunnelPort 8118 IsolateDestAddr PreferIPv6 IsolateSOCKSAuth) still doesn't go through Tor.

The Solution

My preferred solution would be in two parts:

In my opinion also when connection to the proxy fails, Nheko shouldn't connect to the server without proxy if one is configured and instead show a warning.

Alternatives

No response

Additional context

My testing method included running flatpak run --env=http_proxy=http://127.0.0.1:8118/ io.github.NhekoReborn.Nheko//master and then opening Element Web and performing a clear cache and reload and Element Web restart which still resulted into Element Web claiming the two sessions were connecting from the same IP address.

Happens in the latest version

Mikaela commented 2 years ago

It turns out the comment in #626 is wrong and the corrent environment variable to set is either https_proxy (I didn't try) or all_proxy which also accepts socks5 and works:

flatpak run --env=all_proxy=socks5://127.0.0.1:9050/ io.github.NhekoReborn.Nheko//master

However that makes matrix.org accounts not connect and terminal be flooded with html Cloudflare captchas, but I imagine that is a server-side problem.

deepbluev7 commented 2 years ago

Cloudflare doesn't like tor, iirc.

Sazu-bit commented 1 year ago

Just commenting as I'm a prolific tor user and not being able to use tor with nheko is preventing me and others from using it.

Please note that other clients do not trigger the Cloudflare problems.

Normally this would be a server side issue as Mikaela points out and in fact I had such a problem that was resolved by opening the protections against Tor. However, with Nheko and Nheko alone I still get the disconnects. So I suspect that Nheko is spamming the connection somehow.

The problem occurs across multiple homeservers, engaging across various federated rooms.

gagzzz commented 8 months ago

I've been using env HTTP_PROXY=socks://127.0.0.1:9050 HTTPS_PROXY=socks://127.0.0.1:9050 /usr/bin/flatpak run … with nhekoreborn for quite a while now with great success (i have a firewall AND if i omit these env nheko never connects of course) But I use nice homeservers so they don't ask for captchas. Also i was able to connect through the SAML login of one of my providers with success

spirillen commented 1 week ago

Cloudflare doesn't like tor, iirc.

Nope, because they can't fingerprint you, That is why a program like this needs proxy socks5h support. This both as CLI and inside the GUI as default startup variable


I've been using env HTTP_PROXY=socks://127.0.0.1:9050 HTTPS_PROXY=socks://127.0.0.1:9050

Use torsocks and drop the flatpack as flatpack is tracking = antiprivacy