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