6

I want to host multiple hidden services on the same Tor instance and have the ability to add/remove "programmaticaly" hidden services while Tor is running. As of now I would update a Torrc file and send a "RELOAD" signal on the instance's control port in order to apply the addition/deletion of a hidden service.

I initially thought that when I do "RELOAD", Tor would be smart by killing open "client" circuits and rebuild new ones + update HS circuits that need to be updated (ie, add a new circuit, or kill one, depending on what has changed in the HS part of the config). I recently discovered (edit: from what I understood by reading the control spec and the source code) that it's doesn't seem to be the case : since Tor clears its internal state, all open circuits (HS or not) will be killed.

I've looked again into the Tor control protocol spec to see how I could set hidden services while Tor is running. I've found how to do it (SETCONF with the list of HiddenService* lines you would put in the torrc file, in the correct order). Example:

SETCONF HiddenServiceDir="/path/to/key1" HiddenServicePort="80 127.0.0.1:80" HiddenServiceDir="/path/to/key2" HiddenServicePort="80 127.0.0.1:80" [more hidden services here]\r\n

However, I haven't found a way to apply these new settings without doing a SIGNAL RELOAD again. Is there an other way to have those new hidden services be taken into account?

Edit : this question applies actually to adding/removing hidden services or modifying a service's port bindings

  • The correct way would be to host only one hidden service per tor instance to prevent availability corellation attacks which can lead to deanonymization. Yes, this likely is inconvenient for your setup. – MacLemon May 28 '14 at 0:27
  • @MacLemon - we have a developing body of client/services like ricochet, onionshare/onionize, onionmx, and probably others, some of which might be sensibly run on the same tor instance. ie. if I want to chat and share files, those could sensibly go together. All a correlation is going to show is that two services are on the same machine. – Diagon Jun 30 at 23:51
3

It is now possible to create ephemeral onion services via the control port using the ADD_ONION and DEL_ONION commands (added in Tor 0.2.7.1-alpha).

To create a new onion service (the address and private key are returned to you):

ADD_ONION NEW:BEST Port=80

This will return the address (as exampleonion1234 without the trailing .onion) and private key (as a string).

To shut down a currently-running onion service:

DEL_ONION exampleonion1234

To restart a previously-created onion service:

ADD_ONION [PrivateKeyString] Port=80

See sections 3.27 and 3.28 of control-spec.txt for all options.

  • setconf HiddenServiceDir=... behaviour equals to add_onion ... Flags=Detach. Do not forget to add Detach flag. – puchu Mar 7 '18 at 22:49

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.