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

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



commit 8ff77ca17a987949285ba3de163c1a6e9ab6c10f
Author: aagbsn <aagbsn@xxxxxxxx>
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
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits