[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #12533 [Stem]: multiple hidden services and get_conf_map('HiddenServiceOptions') response format



#12533: multiple hidden services and get_conf_map('HiddenServiceOptions') response
format
-------------------------------------+------------------------
 Reporter:  jthayer                  |          Owner:  atagar
     Type:  defect                   |         Status:  new
 Priority:  normal                   |      Milestone:
Component:  Stem                     |        Version:
 Keywords:  get_conf hidden service  |  Actual Points:
Parent ID:                           |         Points:
-------------------------------------+------------------------
 Hi, I'm trying to add a new hidden service to a client which is already
 running one (or more) service. The naive approach,

 {{{
     controller.set_options([
         ('HiddenServiceDir', hs_dir),
         ('HiddenServicePort', hs_port)
     ])
 }}}

 clobbers the existing services. Since there doesn't seem to be an API call
 expressly for adding (not replacing) hidden services, I started
 investigating the idea of fetching the existing hidden services from the
 client, then re-adding those in addition to the new service.

 However, the data returned from `get_conf_map('HiddenServiceOptions')`
 isn't appropriate for that, as far as I can tell. That call returns two
 flat lists (associated with `HiddenServiceDir` and `HiddenServicePort`),
 which leaves us in the dark about which ports are associated with which
 dirs.

 {{{
     >>>
 controller.set_options([('HiddenServiceDir','/tmp/hiddenservice2/'),
                                 ('HiddenServicePort','1235
 127.0.0.1:1235'),
                                 ('HiddenServicePort','1236
 127.0.0.1:1236'),
 ('HiddenServiceDir','/tmp/hiddenservice3/'),
                                 ('HiddenServicePort','1237
 127.0.0.1:1237')])

     >>> controller.get_conf_map('HiddenServiceOptions')
     {'HiddenServiceDir': ['/tmp/hiddenservice2/', '/tmp/hiddenservice3/'],
      'HiddenServicePort': ['1235 127.0.0.1:1235', '1236 127.0.0.1:1236',
 '1237 127.0.0.1:1237']}
 }}}

 More useful in this case would be a list of Dir->[Port] mappings:

 {{{

     >>> controller.get_conf_map('HiddenServiceOptionsMap')
     {'/tmp/hiddenservice2/': ['1235 127.0.0.1:1235','1236
 127.0.0.1:1236'],
      '/tmp/hiddenservice3/': ['1237 127.0.0.1:1237']}
 }}}

 With that data, then, it would be easy to make the appropriate
 `SetOptions` calls not only to add a new service, but to re-add the
 existing services.

 I'm not very familiar with Tor's control protocol, so perhaps this isn't a
 limitation of Stem but of the protocol in general.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12533>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs