简体   繁体   English

Tor的主干模块(python)加载但不卸载配置

[英]Tor's stem module (python) loading but not unloading config

So in Tor's python module, Stem, I can add hidden services, replace hidden services, etc. However! 因此,在Tor的python模块Stem中,我可以添加隐藏服务,替换隐藏服务等。但是! I cannot remove ALL hidden services. 我无法删除所有隐藏的服务。 I do not know the magic magicness that does this... I've tried setting 'HiddenServiceDir/HiddenServicePort' and 'HiddenServiceOptions' to empty strings, empty lists and None. 我不知道这样做的魔力...我尝试将'HiddenServiceDir / HiddenServicePort'和'HiddenServiceOptions'设置为空字符串,空列表和无。 The only thing that does anything is setting 'HiddenServiceOptions' to None... which just brings back the last successful hidden service setting.... meaning that probably everything in between was just a bunk setting and I magically flipped a reset from tor control... 唯一可以做的事情就是将'HiddenServiceOptions'设置为None ...,这只会带回上一次成功的隐藏服务设置...。这意味着中间的所有内容都只是一个上下铺设置,而我神奇地从tor控件翻转了一个重置...

For example, here I start with a hidden service, then replace it with one or two more... 例如,这里我从一个隐藏的服务开始,然后再用一两个替换它...

>>> controller.is_authenticated()
True

>>> controller.get_conf_map('HiddenServiceOptions')
{'HiddenServiceDir': ['/tmp/hiddenservice1/'],
 'HiddenServicePort': ['1234 127.0.0.1:1234']}

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

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

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

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

...and now the fun... I try to get rid of ALL hidden services... ...而且现在很有趣...我试图摆脱所有隐藏的服务...

>>> controller.set_options([('HiddenServiceDir',None),('HiddenServicePort',None)])
### *OR*
>>> controller.set_options([('HiddenServiceDir',''),('HiddenServicePort','')])

### .... and the result is....
>>> controller.get_conf_map('HiddenServiceOptions')
{'HiddenServiceOptions': []}
### ... nothing, as expected... but then...

>>> controller.set_options([('HiddenServiceDir','/tmp/hiddenservice3/'),('HiddenServicePort','1236 127.0.0.1:1236')])
>>> controller.get_conf_map('HiddenServiceOptions')
{'HiddenServiceOptions': []}
### ... hidden service not showing again... until...

>>> controller.set_options([('HiddenServiceOptions',None)])
>>> controller.get_conf_map('HiddenServiceOptions')
{'HiddenServiceDir': ['/tmp/hiddenservice3/'],
 'HiddenServicePort': ['1236 127.0.0.1:1236']}
### ... suprise! It's back!

Funny thing, though... From checking my TOR connection in other ways, I can tell that my services were never all removed. 不过,有趣的是...通过以其他方式检查我的TOR连接,我可以知道我的服务从未被全部删除。 They just stayed at whatever the last hidden service(s) I set... 他们只是停留在我设置的最后一个隐藏服务中...

... so I could keep spinning my wheels or search for valhalla in the source code... or maybe some enlightened soul can inform me... how do I get rid of my hidden services in stem?! ...这样我就可以继续转动轮子或在源代码中搜索valhalla ...或者也许某个开明的灵魂可以通知我...我该如何摆脱茎中隐藏的服务?

UPDATE 更新

The problem seems to be a bug in how "HiddenServiceOptions" updates itself. 问题似乎是“ HiddenServiceOptions”如何自我更新的错误。

With a hidden service enabled, when I set both HiddenServiceDir and HiddenServicePort to None (or to empty strings; both have the exact same effect), it shows in my conf_map and I see a conf event sent out (from a listener on my controller) with configuration {'HiddenServiceOptions':None} (or as parsed_content, just 'HiddenServiceOptions' with no equal sign or anything). 启用隐藏服务后,当我将HiddenServiceDir和HiddenServicePort都设置为None(或设置为空字符串;两者都具有完全相同的效果)时,它将显示在conf_map中,并且我看到发出了conf事件(从控制器上的侦听器发出)配置{'HiddenServiceOptions':None}(或作为parsed_content,仅是'HiddenServiceOptions',没有等号或其他符号)。 This is as expected. 这是预期的。

...NOW, if I set another hidden service, I get a new configuration event sent to me showing the correct hidden service info. ...现在,如果我设置了另一个隐藏服务,则会收到一个发送给我的新配置事件,显示正确的隐藏服务信息。 At this point, the hidden service WORKS, BUT it still won't show if I ask it with "get_conf_map". 在这一点上,隐藏的服务工作,但是如果我用“ get_conf_map”询问它,它仍然不会显示。

Then I run reset_conf and it shows fine again. 然后我运行reset_conf,它再次显示正常。

The takeaway: if you setup a new service, first check if there are none. 要点:如果您设置了一项新服务,请首先检查是否没有。 If so, set the hidden service, then run reset_conf... 如果是这样,请设置隐藏的服务,然后运行reset_conf ...

Or for people who only rely on event_listeners, this doesn't affect them at all... 或者对于仅依赖event_listeners的人,这根本不会影响他们...

Thanks, Damian... 谢谢,达米安...

That's certainly odd. 这当然很奇怪。 I'd expect set_options() to behave the way you expect but tor's HiddenServiceOptions is certainly unconventional so I wouldn't be surprised if there's a bug here. 我希望set_options()的行为与您期望的一样,但是tor的HiddenServiceOptions当然是非常规的,因此如果这里有bug,我不会感到惊讶。 If you determine the root cause of this then please let us know ! 如果您确定此问题的根本原因,请告诉我们

Out of curiosity, does issuing a RESETCONF rather than SETCONF do the trick? 出于好奇,发出RESETCONF而不是SETCONF可以解决问题吗? You can do this via... 您可以通过...

>>> controller.reset_conf('HiddenServiceOptions')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM