[tor-commits] [oonib/master] Monkeypatch txtorcon version < 0.9.0 TCPHiddenServiceEndpoint

art at torproject.org art at torproject.org
Fri Jan 31 10:32:35 UTC 2014


commit 8ff77ca17a987949285ba3de163c1a6e9ab6c10f
Author: aagbsn <aagbsn at extc.org>
Date:   Fri Nov 22 12:13:13 2013 +0000

    Monkeypatch txtorcon version < 0.9.0 TCPHiddenServiceEndpoint
    
    In txtorcon versions < 0.9.0, TCPHiddenServiceEndpoints uses the
    default TCP4ServerEndpoint, which listens on all addresses by default.
---
 oonib/runner.py |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/oonib/runner.py b/oonib/runner.py
index 04e5310..3cd825b 100644
--- a/oonib/runner.py
+++ b/oonib/runner.py
@@ -28,6 +28,21 @@ from oonib import config
 from oonib import log
 
 
+from txtorcon import __version__ as txtorcon_version
+if txtorcon_version < '0.9.0':
+    """
+    Fix for bug in txtorcon versions < 0.9.0 where TCPHiddenServiceEndpoint
+    listens on all interfaces by default.
+    """
+    def create_listener(self, proto):
+        self._update_onion(self.hiddenservice.dir)
+        self.tcp_endpoint = TCP4ServerEndpoint(self.reactor, self.listen_port,
+                interface='127.0.0.1')
+        d = self.tcp_endpoint.listen(self.protocolfactory)
+        d.addCallback(self._add_attributes).addErrback(self._retry_local_port)
+        return d
+    TCPHiddenServiceEndpoint._create_listener =  create_listener
+
 class OBaseRunner(object):
     pass
 





More information about the tor-commits mailing list