SK-Yang / torchat

Automatically exported from code.google.com/p/torchat
0 stars 0 forks source link

tor.sh not working for debian #96

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
tor.sh can't work for debian with tor installed, because only root can start 
tor. 
So I think torchat is only working on my debian because it falls back on the 
tor started as root at boot time (with hidden services activated). If I stop 
tor before starting torchat, it won't connect at all.

I tried to start torchat as root (via sux - root with access to X) so tor.sh 
can start tor, but then I get following error:

1) [tc_client,2033,startPortableTor] trying to start Tor
(1) [tc_client,2051,startPortableTor] tor pid is 11652
(1) [tc_client,2058,startPortableTor] successfully started Tor (pid=11652)
(1) [tc_client,2067,startPortableTor] trying to read hostname file (try 1 of 20)
Jan 26 20:03:04.543 [warn] Failed to parse/validate config: Can't use a 
relative path to torrc when RunAsDaemon is set.
Jan 26 20:03:04.543 [err] Reading config failed--see warnings above.
(1) [tc_client,2067,startPortableTor] trying to read hostname file (try 2 of 20)

Additionally: there might be a problem with the pid. The log above states the 
tor pid is 11652, but if I check the processes with top the pid 11652 is set 
for the command "tor.sh".

Original issue reported on code.google.com by kdg83...@trash-mail.com on 26 Jan 2011 at 7:23

GoogleCodeExporter commented 9 years ago
every user can start tor.

You must not start torchat as root! Never do this!

what happens if you open a console and type
tor
and hit enter?

Original comment by prof7...@gmail.com on 26 Jan 2011 at 7:53

GoogleCodeExporter commented 9 years ago
where is the tor binary located? is it in /usr/bin/ or in /usr/sbin/ and if it 
is in sbin is this in your $PATH?

Maybe tor.sh needs to be modified to look for the tor binary in other places if 
it is not in the path.

Original comment by prof7...@gmail.com on 26 Jan 2011 at 8:03

GoogleCodeExporter commented 9 years ago
the pid is the pid of the starter script, this is ok. tor.sh is meant as a drop 
in replacement for the actual tor binary. 

Torchat treats the script as if it were tor itself and use this pid to kill 
tor.sh with SIGTERM when it quits. the script in turn will also behave as if it 
were tor and catch SIGTERM and forward it to the real tor process that it has 
started. I could also have used a symlink for the same purpose but i relied on 
the fact that tor is always in the path and the script simply calls tor.

On windows tor.sh is replaced by the real tor.exe, everything else stays the 
same.

Original comment by prof7...@gmail.com on 26 Jan 2011 at 8:10

GoogleCodeExporter commented 9 years ago
I just started torchat as root to try debugging it... I don't do that in a 
productive environment.

Tor in debian is located in /usr/sbin which is not included in the $PATH of 
normal users. Changing the tor.sh ("tor -f torrc.txt --PidFile tor.pid &" to 
"/usr/sbin/tor -f torrc.txt --PidFile tor.pid &") is solving the issue. So you 
are right with assuming that tor.sh needs to be modified to search tor outside 
the path, at least for debian.

Now I do have a new ID in torchat (since it used the hidden service ID of 
standard tor before) and torchat shows the old and the new ID as "(myself)", 
see the attached image. This might affect other debian users as well when 
updating to torchat with a new tor.sh.

Original comment by kdg83...@trash-mail.com on 27 Jan 2011 at 1:43

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for explaining how the tor.sh/tor pid is used in torchat.

Original comment by kdg83...@trash-mail.com on 27 Jan 2011 at 1:46

GoogleCodeExporter commented 9 years ago
you can now safely delete the old ID (you can even safely delete all 
myself-IDs, torchat will recreate the corect one on the next start). Don't 
forget to disable the manually created but now unused hidden service in your 
other tor installation, it looks like its still accepting connections.

I will fix tor.sh

Original comment by prof7...@gmail.com on 27 Jan 2011 at 1:08

GoogleCodeExporter commented 9 years ago
Adding /usr/sbin to the PATH used by the script should solve the problem. The 
simple patch is attached.

I used "export", so /usr/sbin is in the PATH for the started tor instance too 
and not only for the script.

Original comment by erik.est...@googlemail.com on 13 Feb 2011 at 7:10

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r529.

Original comment by prof7...@gmail.com on 27 Feb 2011 at 6:59