PanagiotisDrakatos/T0rlib4j

Unable to load Config file (torrc.txt)

Opened this issue · 4 comments

# Unable to load tor config file. Here is the whole debug message when trying to run ServerSocketViaTor.java file from samples:

[main] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Tor is not running

[main] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Starting Tor

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.418 [notice] Tor 0.3.2.9 running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2l, Zlib 1.2.8, Liblzma N/A, and Libzstd N/A.

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.418 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.418 [notice] Read configuration file "/home/nandan/IdeaProjects/T0rlib4j/torfiles/torrc.txt".

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423 [warn] Path for GeoIPFile (geoip.txt) is relative and will resolve to /home/nandan/IdeaProjects/T0rlib4j/torfiles/geoip.txt. Is this what you wanted?

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423 [warn] Path for GeoIPv6File (geoip6.txt) is relative and will resolve to /home/nandan/IdeaProjects/T0rlib4j/torfiles/geoip6.txt. Is this what you wanted?

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423 [warn] Path for PidFile (pid) is relative and will resolve to /home/nandan/IdeaProjects/T0rlib4j/torfiles/pid. Is this what you wanted?

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423 [warn] Failed to parse/validate config: You have specified at least one relative path (see above) with the RunAsDaemon option. RunAsDaemon is not compatible with relative paths.

[main] WARN com.msopentech.thali.java.toronionproxy.OnionProxyManager - Tor exited with value 1

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423
[err] Reading config failed--see warnings above.

Exception in thread "main" java.io.IOException: Could not Start Tor.
at net.sf.T0rlib4j.controller.network.JavaTorRelay.initTor(JavaTorRelay.java:59)
at net.sf.T0rlib4j.controller.network.JavaTorRelay.(JavaTorRelay.java:24)
at net.sf.T0rlib4j.samples.Server.ServerSocketViaTor.main(ServerSocketViaTor.java:29)

Process finished with exit code 1

Turning off the RunAsDaemon (i.e., replacing 1 with 0 in src/Data/torrc.txt) and turning off the DisableNetwork (replacing 1 with 0) seems to be working. But, as Tor is not running as daemon, it halts the further execution of ServerSocketViaTor.main(). Tor bootstraps to 100% but the Hidden Service won't start. So, what can be done here?

Here's how the modified torrc.txt file looks like:

ControlPort auto
CookieAuthentication 1
DisableNetwork 0
PidFile pid
RunAsDaemon 0
SafeSocks 1
SOCKSPort auto

RunAsDaemon 0 or 1it has no effect with your problem If 1, Tor forks and daemonizes to the background. This option also has no effect on Windows. i think this is not your problem. share your code if possible and i will try to help y

  1. I have tried the same code that you have provided as a sample. I am using Debian. Your library had no Tor binaries for Linux. I have fixed it here #3 . (Please check if I have done that correctly)

  2. After including the binaries for Linux, I was not able start the Tor process.
    I have already posted the whole log information when I opened this issue. If you look at that, you can see that Tor doesn't accept relative paths when RunAsDaemon is turned on.

[Thread-1] INFO com.msopentech.thali.java.toronionproxy.OnionProxyManager - Apr 14 01:07:32.423 [warn] Failed to parse/validate config: You have specified at least one relative path (see above) with the RunAsDaemon option. RunAsDaemon is not compatible with relative paths.

But I confirmed that the Tor was already seeing the absolute paths (here).

So, I thought of changing RunAsDaemon from 1 to 0 in torrc.txt

And now, it was working! But, there is one more problem. Although Tor bootstraps to 100%, it just halts at this line (here) and hence Hidden Service won't start at all.

This library is very unstable on Linux. Can you assist me in sorting this out?

sir, the library has been tested only for windows it will be an update in the near future for other OS but thanks i will add this specification it in the readme.md