Opened 5 years ago

Closed 5 years ago

#13150 closed defect (duplicate)

Windows Tor Launcher trying to connect 9151 control port always, instead of using settings

Reported by: VasiliyPetrov Owned by: brade
Priority: Medium Milestone:
Component: Applications/Tor Launcher Version:
Severity: Keywords: ControlPort, windows
Cc: mcs Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Installation package:
torbrowser-install-3.6.5_en-US.exe
(v3.6.5)

I'm trying to start Two Tor Bundle browsers on the same system to have different sessions and split a persons (not to mixup them, but to have a possibility to browse internet at the same time).

I had two copies of Tor Browser Bundle Installed.
For example, the first one is installed to (1):
X:\Tor Browser\

The second one is installed to (2):
X:\Tor Browser 2ND\

(1) - default settings, nothing is changed. I.e. we will have:
SocksPort - 9150, ControlPort - 9151, FlashPort - 9000

(2) - immediately after fresh installation, without starting anything, I had edited following files (see "->" symbol):

[.\Data\Tor\torrc-defaults]
SocksPort 9150 -> 9250
ControlPort 9151 -> 9251
ClientTransportPlugin flashproxy exec Tor\PluggableTransports\flashproxy-client --register :0 :9000 -> :9100

[.\Data\Browser\profile.default\preferences\extension-overrides.js]
pref("extensions.torbutton.socks_port", 9150 -> 9250);

So, it seems like second Tor Browser Bundle must use only following ports: 9250, 9251 and 9100? But... NO!

What I'm doing?

  1. Starting (1) Tor Browser Bundle. It starts perfect and all is working perfect (default settings, default ports). Working in it - all is fine.
  1. Now, without closing the (1) we are trying to start (2) Tor Browser Bundle. (All actions are controlled by firewall-process/HIPS to see any actions on the machine. And what I will see?

I'm getting a request to my firewall, that process
X:\Tor Browser 2ND\Browser\firefox.exe
is trying to create socket on 127.0.0.1:9250
OK, it is what we expect.

But when GUI is starting it is trying to create socket on...
127.0.0.1:9151 (Default ControlPort) instead of 127.0.0.1:9251 (ControlPort). WTF?!

If you will block this try to use this port, you will get a error message:
========================
Tor Launcher
Could not connect to Tor control port.
[OK]
========================
and Tor Browser will not be started.

So, Tor Launcher of (2) using/trying to use 9151 port instead of configured 9251!

Child Tickets

Attachments (1)

tor-settings-repository-diff-fix.zip (6.6 KB) - added by VasiliyPetrov 5 years ago.
It is required to add overrider strings to a repository file (but with default port values)

Download all attachments as: .zip

Change History (14)

comment:1 Changed 5 years ago by VasiliyPetrov

I think this tickets must be linked: #10439
(for guys who want to understand how to configure Tor Browser properly to start as second, third or more instances parallel on the same computer)

comment:2 Changed 5 years ago by VasiliyPetrov

I had added following string to extension-overrides.js file:

# Tor Launcher Preferences:
pref("extensions.torlauncher.control_port", "9251");
././ WARNING: here is error, port number must be written without errors, see here:
././ https://trac.torproject.org/projects/tor/ticket/13150#comment:7

but did not helped anyway.
(I had reinstalled Tor Browser Bundle to a clean directory, and changed again torrc-defaults and extension-overrides.js).

It is still trying to use ControlPort 9151 -- where it get it?!

Last edited 5 years ago by VasiliyPetrov (previous) (diff)

comment:3 Changed 5 years ago by VasiliyPetrov

BTW, if "torrc-defaults" must be renamed to "torrc" (I tried this too -- nothing changed), it will be better to write this in the first string of that file. Because for Windows users this behaviour of configs is not so obivious like for *nix users

comment:4 Changed 5 years ago by VasiliyPetrov

I made a clean install again (removing all files), and added another one string to a extension-overrides.js:

pref("extensions.torbutton.settings_method", "custom");

Checked again. Nothing changed...

comment:5 Changed 5 years ago by VasiliyPetrov

The workaround way:

  1. Shutdown (close) (1) instance.
  2. Install new instance to (2).
  3. Run it with default settings. Wait until all is started.

4.

  1. Click Tor button menu and select "Preferences..."
  2. Set "(o) Use custom proxy settings"
  3. Change Socks Port from 9150 to 9250 (for example)
  4. Click "OK"

(You were able to do this by modifying settings:
"extensions.torbutton.settings_method" to a "custom"
and
"extensions.torbutton.socks_port" to a 9250 (for example)

5.

  1. Put "about:config" in opened tab as URL
  2. Put "extensions.torlauncher.control_port" to an input box
  3. Change Control Port value from 9151 to 9251 (for example)
  1. Exit from Tor Browser Bundle
  1. Check file .\Data\Browser\profile.default\prefs.js for a settings:

user_pref("extensions.torbutton.custom.socks_port", 9250);
user_pref("network.proxy.socks_port", 9250);
user_pref("extensions.torlauncher.control_port", 9251);
If they are configured - all is fine.
(9250 and 9251 as example)

  1. Change torrc-defaults as (for example):

SocksPort 9250
ControlPort 9251
ClientTransportPlugin flashproxy exec Tor\PluggableTransports\flashproxy-client --register :0 :9100

  1. Copy torrc-defaults to torrc
  1. Now you can use Tor Browser Bundle (1) and (2) and they will not mixup with each other

comment:6 Changed 5 years ago by VasiliyPetrov

The main problem of #13150 ticket (Tor Launcher problem) is because of control port is put (and not changed) in the extension .xpi archive:

.\Data\Browser\profile.default\extensions\tor-launcher@…
and the file inside this (zip) archive:
:\defaults\preferences

pref("extensions.torlauncher.control_host", "127.0.0.1");
pref("extensions.torlauncher.control_port", 9151);

(!)

And this setting is not overrided by any other possible way.
So, when TBB starting first time, it is reading a ControlPort from... xpi file!
Why it cannot be overrided?

Something like extension-overrides.js, I do not know.
I'm sure that it is can be fixed.

So you will be able to configure all ports without so long and difficult story...
(For example, currently I'm sure, that if I will make a default installation, then change a files like I wrote in the ticket/first comments and *then change a port inside .xpi archive*, it will work. I did not checked, but I'm sure that it will work).

comment:7 Changed 5 years ago by VasiliyPetrov

BTW, I found why this:
https://trac.torproject.org/projects/tor/ticket/13150#comment:2
not worked

Because I wrote a port number in quotes, but it must be written without it:

# Tor Launcher Preferences:
pref("extensions.torlauncher.control_port", 9251);

Please add this string to extension-overrides.js in repository (but with default control port - 9151).

Anyway, there is a one thing, that I do not know how to override correctly before first start of TBB:
user_pref("network.proxy.type", 1); 1 - manual, see here: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/Mozilla_networking_preferences
user_pref("network.proxy.socks_port", 9150);

I tried with the same way in the extension-overrides.js:
pref("network.proxy.socks_port", 9250);
but it did not helped; probably, because it is a common browser settings, but not an extension (I do not sure about this).

Last edited 5 years ago by VasiliyPetrov (previous) (diff)

comment:8 Changed 5 years ago by VasiliyPetrov

(!) (!) (!) OK, it is done (!) (!) (!)

Finally I found the solution how to configure a fresh copy (NOT STARTED YET! ONLY INSTALLED)

For example, we want to have the second (2) instance with ports: Socks - 9250 instead of 9150; Control - 9251 instead of 9151; FlashProxy - 9100 instead of 9000

[1]. Editing ".\Data\Tor\torrc-defaults" (correcting exist strings)

==========================================================
SocksPort 9250
ControlPort 9251

ClientTransportPlugin flashproxy exec Tor\PluggableTransports\flashproxy-client --register :0 :9100
==========================================================

[2]. Copying ".\Data\Tor\torrc-defaults" to ".\Data\Tor\torrc" file (overwriting)

[3]. Editing ".\Data\Browser\profile.default\preferences\extension-overrides.js"

[3.a]. Adding following strings (they does not exist; 9251 = ControlPort, 9250 = SocksPort; Firefox Settings *must* *much* TorButton settings, or it will not work):

==========================================================
# Tor Launcher Preferences:
pref("extensions.torlauncher.control_port", 9251);

# Firefox ESR Network Settings (to use "Manual" proxy the same as Tor Button)
pref("network.proxy.type", 1);
# 1 - manual, see here: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/Mozilla_networking_preferences
pref("network.proxy.socks_port", 9250);

pref("extensions.torbutton.settings_method", "custom");
==========================================================

[3.b]. Correcting exist strings (9150 -> 9250):

==========================================================
pref("extensions.torbutton.socks_port", 9250);
==========================================================

THAT'S ALL!

Now you can start TBB in a common way and it will WORK PERFECTLY with the first run with required ControlPort (9251), SocksPort (9250) and FlashProxy Port (9100)!

THAT'S ALL!

I'm attaching in .zip archive a sample of changes with original files to compare/diff.

I'm sure(!) that developers MUST include following strings to a default repository file ".\Data\Browser\profile.default\preferences\extension-overrides.js":
==========================================================
# Tor Launcher Preferences:
pref("extensions.torlauncher.control_port", 9151);

# Firefox ESR Network Settings (to use "Manual" proxy the same as Tor Button)
pref("network.proxy.type", 1);
# 1 - manual, see here: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/Mozilla_networking_preferences
pref("network.proxy.socks_port", 9150);

pref("extensions.torbutton.settings_method", "custom");
==========================================================
See all diffs in https://trac.torproject.org/projects/tor/attachment/ticket/13150/tor-settings-repository-diff-fix.zip

It is required to add overrider strings to a repository file (but with default port values). In this case any guy will be able to change all settings just by searching 9150 and 9151 inside files, without so long story like I wrote here to solve this issue! And it will work!

Last edited 5 years ago by VasiliyPetrov (previous) (diff)

Changed 5 years ago by VasiliyPetrov

It is required to add overrider strings to a repository file (but with default port values)

comment:9 Changed 5 years ago by mcs

Cc: mcs added

comment:10 Changed 5 years ago by mcs

Unfortunately, the files torrc-defaults and extension-overrides.js will be overwritten during a browser update (and we are moving towards automated/easier updates). For that reason, the settings should probably be added to .\Data\Browser\profile.default\prefs.js and .\Data\Tor\torrc (which are not overwritten). But since those files are empty or non-existent in a new installation, we would need to provide documentation rather than a template (I realize that makes this process less obvious). The ultimate solution is #10439.

comment:11 Changed 5 years ago by VasiliyPetrov

Probably you did not understand my request.

Current default files (that are used for pre-configuration of all components on *the first start*) does not contain all required options. So, when even skilled user trying to "search and replace" ports to a different values, he will get non-working copy of the TBB. Just because pre-configured templates does not contain *all* options.

I had added a few settings (see attached tor-settings-repository-diff-fix.zip) to a torrc-defaults and extension-overrides.js files. These changes are enough to have a fully pre-configured copy. With added following strings you will have:

  1. If you installing without any changes of configs -- the same as currently have in TBB v3.5.6 and others. Just a common installation package: install and use.
  2. If you install, do not start, and want to change required ports just by searching "9051", "9151" -- you will find *all* locations, where you need to change, and after these changes *all* will work fine. (In the current TBB v3.5.6, even if you will change all what you will find, TBB will not run and will not work correctly; because templates of config and overrides settings for first install *does not contain some of the variables, that must be changed or stay default, if you do not changing*).

All this stuff will not damage an update process, because after updating (new installation package will have the same template, with all variables, but default values written) user will be able to make the same changes.

Shortly what I want to ask/to do:
Just fix templates to add *all* required variables, just with default values to give to a user a possibility to correctly change all *without running*, just by text editor - "search and replace". All attached info is enough for finishing this task.

Main idea: with that changes NOTHING will be changed to any of previously working functions, methods and ways of configuration. Just you will have a NEW *correct* way to pre-configure your TBB copy without (!) starting it with default settings!

Last edited 5 years ago by VasiliyPetrov (previous) (diff)

comment:12 Changed 5 years ago by brade

I understand that you would like the default values to appear in a few easily accessible locations for users to be able to uncomment and modify and also that you don't want users to have to run Tor Browser in order to make these changes.

Unfortunately the two files you suggest will be completely rewritten when the browser is updated. I don't want end users to think that it is acceptable to put ANY settings in those particular files (especially when they should be put in more appropriate places such as torrc).

The other considerations I have include:
(1) I do not want the values appearing in multiple locations in the source code (especially with different values) and
(2) Tor Launcher is used by more than Tor Browser; changes should not negatively impact TorBirdy nor TAILS.

comment:13 Changed 5 years ago by mcs

Resolution: duplicate
Status: newclosed

Resolving this as a duplicate of the older #10439.

Note: See TracTickets for help on using tickets.