[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] support unix-socket tor control ports #479 (#715)
commit 19a301c6a1b9bd66b237c3c5a231f75b1f2bded7
Author: E.Iosifidis <iosifidise@xxxxxxxxx>
Date: Thu Jan 19 16:49:26 2017 +0200
support unix-socket tor control ports #479 (#715)
* Added a space when printing the -g opt
* support unix-socket tor control ports
---
data/ooniprobe.conf.sample | 3 +++
ooni/settings.py | 27 ++++++++++++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/data/ooniprobe.conf.sample b/data/ooniprobe.conf.sample
index e324c8a3..8a663824 100644
--- a/data/ooniprobe.conf.sample
+++ b/data/ooniprobe.conf.sample
@@ -67,6 +67,9 @@ advanced:
tor:
#socks_port: 8801
#control_port: 8802
+ # Alternatively set control_port to the unix domain socket. Useful for Debian based systems
+ #control_port: unix:/var/run/tor/control
+ #
# Specify the absolute path to the Tor bridges to use for testing
#bridges: bridges.list
# Specify path of the tor datadirectory.
diff --git a/ooni/settings.py b/ooni/settings.py
index eb4f052d..a59664cd 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -85,6 +85,9 @@ advanced:
tor:
#socks_port: 8801
#control_port: 8802
+ # Alternatively set control_port to the unix domain socket. Useful for Debian based systems
+ #control_port: unix:/var/run/tor/control
+ #
# Specify the absolute path to the Tor bridges to use for testing
#bridges: bridges.list
# Specify path of the tor datadirectory.
@@ -520,13 +523,23 @@ class OConfig(object):
incoherent.append('tor:socks_port')
if self.tor.control_port is not None:
- control_port_ep = TCP4ClientEndpoint(reactor,
- "localhost",
- self.tor.control_port)
- try:
- yield connectProtocol(control_port_ep, ConnectAndCloseProtocol())
- except Exception:
- incoherent.append('tor:control_port')
+ if isinstance(self.tor.control_port, int):
+ control_port_ep = TCP4ClientEndpoint(reactor,
+ "localhost",
+ self.tor.control_port)
+ try:
+ yield connectProtocol(control_port_ep, ConnectAndCloseProtocol())
+ except Exception:
+ incoherent.append('tor:control_port')
+ else:
+ conf_unix_socket_path = self.tor.control_port
+ if conf_unix_socket_path.lstrip.startswith("unix:"):
+ if os.path.exists(conf_unix_socket_path.lstrip("unix:")):
+ unix_socket_path = conf_unix_socket_path.lstrip("unix:")
+ else:
+ incoherent.append('tor:control_port')
+ else:
+ incoherent.append('tor:control_port')
self.log_incoherences(incoherent)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits