2

I have the same basic issue as this question but it wasn't resolved. I have one functioning service, everything runs fine:

HiddenServiceDir /var/www/tor/test1/
HiddenServicePort 80 127.0.0.1:44403

If I attempt to add another HiddenServiceDir directive like this:

HiddenServiceDir /var/www/tor/test1/
HiddenServiceDir /var/www/tor/test2/
HiddenServicePort 80 127.0.0.1:44403

The service in /test1/ fails to connect, but /test2/ loads fine. If I switch the HiddenServiceDir lines around, the top one fails but the second one works fine. My lighttpd config looks like this:

server.document-root = "/var/www/tor/lighttpddefault/files" 
server.port = 44401

$SERVER["socket"] == ":44403" { 
  $HTTP["host"] =~ "(^|\.)XXXXXXXXXXXXXXXX\.onion$" {
    server.document-root = "/var/www/tor/test1/files" 
  }
  $HTTP["host"] =~ "(^|\.)XXXXXXXXXXXXXXXX\.onion$" {
    server.document-root = "/var/www/tor/test2/files" 
  }
}

To answer the questions in the linked question; Tor starts successfully each time, does not throw any error messages. Both directories have the same permission. All keys are Tor generated.

4

HiddenServicePort corresponds to the most recent HiddenServiceDir entry.

  HiddenServicePort VIRTPORT [TARGET]
       Configure a virtual port VIRTPORT for a hidden service. You may use this option multiple times; each time applies to the service using the most recent
       HiddenServiceDir. By default, this option maps the virtual port to the same port on 127.0.0.1 over TCP. You may override the target port, address, or both
       by specifying a target of addr, port, addr:port, or unix:path. (You can specify an IPv6 target as [addr]:port.) You may also have multiple lines with the
       same VIRTPORT: when a user connects to that VIRTPORT, one of the TARGETs from those lines will be chosen at random.

So something like this:

HiddenServiceDir /var/www/tor/test1/
HiddenServicePort 80 127.0.0.1:44403
HiddenServiceDir /var/www/tor/test2/
HiddenServicePort 80 127.0.0.1:44403

Also you shouldn't be putting your private keys in /var/www, put them in /var/lib/tor. The httpd doesn't need to and shouldn't be able to read the private keys for the onion. Only the user that tor is running as should have access, following the principle of least authority.

  • 1
    I feel pretty stupid, thats seems obvious. Much thanks – CAllende Aug 8 '16 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.