MeisterP / torbrowser-overlay

Gentoo overlay for Tor Browser related ebuilds
https://0xacab.org/poncho/torbrowser-overlay
31 stars 12 forks source link

Tor Browser opens 86 tabs on start-up. #56

Closed princessalicorn closed 6 months ago

princessalicorn commented 2 years ago

I just enabled and used the repository and it emerged fine. No errors, and I open the browser. And It opens a ludicrous amount of tabs when it starts. Nothing else seems incorrect and I dont seem to get any errors, but I do not know why tabs would be spammed open. Maybe it has something to do with my window-manager (BSPWM)

to replicate the error: Emerge the newest release of torbrowser Start tor browser 86 Tabs open

Expected Behavior: 1 tab opens

Log for when I start it from the terminal is,

Gtk-Message: 11:34:48.437: Failed to load module "colorreload-gtk-module" Gtk-Message: 11:34:48.437: Failed to load module "window-decorations-gtk-module" ...

MeisterP commented 2 years ago

I can not reproduce this issue. Does it happen if you download and launch the upstream Tor Browser from https://www.torproject.org/download/ as well? Have you tried resetting your profile?

leycec commented 2 years ago

I can reproduce this issue. Additionally, in my case, the Tor system service fails to connect to some (but not all) clearnet sites. I see an unreasonable number of fatal resolve failed log errors resembling:

Nov 21 03:16:47.000 [notice] Closed 1 streams for service [scrubbed].onion for reason resolve failed. Fetch status: No more HSDir available to query.

This renders torbrowser effectively unusable for me. Of course, I'm also hit by #55. Since installing Wayland just for TorBrowser isn't happening, I've currently elected to avoid using TorBrowser on Gentoo entirely until the radioactive dust settles here.

I understand none of this is your fault, @MeisterP. This is all on upstream for failing to properly test. Thanks for your many years of faithful volunteerism! We'll get this right – eventually. </sigh>

midnightpizza commented 2 years ago

What is your TOR_SOCKS_IPC_PATH set to? When i do have my env set with this: TOR_SOCKS_IPC_PATH=/run/tor/socks I too get over 80 Tabs, and the error that something went wrong. But it magically will work if i unset the TOR_SOCKS_IPC_PATH env variable.

torrc is also set like the example torrc is indicating. net-vpn/tor is build with those useflags: caps lzma man seccomp selinux server tor-hardening verify-sig zstd

I Probably have the control password set wrong, torrc is hashed and env is not hashed or both hashed? its not fully clear. Also it seems i don't have a /run/tor/control

leycec commented 2 years ago

To summarize @midnightpizza's helpful response: tor as a system service is indeed the :hankey: show we always knew it to be. Is it any wonder they push Tor Browser so hard? It is not.

That said...

But it magically will work if i unset the TOR_SOCKS_IPC_PATH env variable.

This is fascinating. In my case, I'm fairly sure I tried that – but not certain. My /etc/env.d/99torbrowser contains this helpful comment from my past to future self:

#FIXME: *UGH.* None of the following work. We've tried all possible
#permutations. Disabling this causes "torbrowser" to superficially support a
#subset of some clearnet sites -- but hardly all clearnet sites. Frustration!
#We're convinced this simply does *NOT* work to any reasonable degree.
#FIXME: Disable all of the following if re-enabling "torbrowser-launcher". See:
#    https://github.com/MeisterP/torbrowser-overlay
#TOR_SOCKS_HOST=127.0.0.1
#TOR_SOCKS_PORT=9150
#TOR_SOCKS_IPC_PATH=/run/tor/socks
#
#TOR_CONTROL_HOST=127.0.0.1
#TOR_CONTROL_PORT=9151
#TOR_CONTROL_PASSWD=[cleansed]
#TOR_CONTROL_COOKIE_AUTH_FILE=/run/tor/control.authcookie
#TOR_CONTROL_IPC_PATH=/run/tor/control

Unsurprisingly, I eventually decided to eat crow and just install Wayland for Tor Browser. I'm convinced that most of the issues surrounding tor are due to inadequate error or warning reporting in their log output. Sadly, I'm unwilling to ever try tor again. That was undeniably the worst experience with a system service I've ever had.

I still shudder from the painful memories.

MeisterP commented 2 years ago

Well, there are basically two ways to configure your locale tor instance. You either use localhost (the local network) or you use unix sockets. With localhost, permissions are handled by a password. With unix sockets, the file permissions of the sockets are used (the user running torbrowser needs to access the sockets)

localhost env.d/99torbrowser

TOR_SOCKS_HOST=127.0.0.1
TOR_SOCKS_PORT=9150
TOR_CONTROL_HOST=127.0.0.1
TOR_CONTROL_PORT=9151
TOR_CONTROL_PASSWD='"my_password"'

/etc/tor/torrc

SocksPort 127.0.0.1:9150
ControlPort 127.0.0.1:9151
# tor --hash-password my_password
HashedControlPassword 16:1560E15656CEDF4A60CCEA0225BF746A9435B2B89050D3B66A3ADCE480

sockets env.d/99torbrowser

TOR_SOCKS_IPC_PATH=/run/tor/socks
TOR_CONTROL_IPC_PATH=/run/tor/control

/etc/tor/torrc

SocksPort unix:/run/tor/socks GroupWritable ExtendedErrors
ControlPort unix:/run/tor/control GroupWritable

Your user should have access to /run/tor/socks and /run/tor/control. With GroupWritable this should work if your user is in the same group as tor is running with. If you use systemd, the RuntimeDirectoryMode option in tor.service needs to be set accordingly as well.

bbergeron0 commented 2 years ago

MeisterP, /etc/tor/torrc is pulled with net-vpn/tor but that package does not appear in www-client/torbrowser's dependency. Last time I had www-client/torbrowser on my system, I was having the same issue as OP, and each tab reported that tor couldn't start on my system. I think the package may have a missing dependency.

MeisterP commented 2 years ago

www-client/torbrowser needs access to a tor daemon. (TOR_SOCKS_HOST and TOR_SOCKS_PORT). Whether tor is running on the local machine or on a server on your local network depends on your setup. There are use cases without tor on the same machine as torbrowser. That's why it is not depending on net-vpn/tor

MeisterP commented 9 months ago

Is this still an issue?