[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Add script for harvesting collector and test helper addresses
commit dd591db19187fe2684e13ccb92fd6bd0435c08b0
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Fri Jan 10 18:58:56 2014 +0100
Add script for harvesting collector and test helper addresses
---
fabfile.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/fabfile.py b/fabfile.py
index 119d669..f97f6df 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -4,9 +4,12 @@
# :license: see included LICENSE file
import os
import sys
+import yaml
import xmlrpclib
+from StringIO import StringIO
-from fabric.api import run, cd, sudo
+from fabric.operations import get
+from fabric.api import run, cd, sudo, env
api_auth = {}
# Set these values
@@ -17,6 +20,12 @@ slice_name = "your_slice_name"
### Do not change this
api_auth['AuthMethod'] = "password"
+env.user = 'root'
+def set_hosts(host_file):
+ with open(host_file) as f:
+ for host in f:
+ env.hosts.append(host)
+
def search_node(nfilter="*.cert.org.cn"):
api_server = xmlrpclib.ServerProxy('https://www.planet-lab.org/PLCAPI/')
if api_server.AuthCheck(api_auth):
@@ -53,3 +62,39 @@ def deployooniprobe(distro="debian"):
run("pip install https://hg.secdev.org/scapy/archive/tip.zip")
run("pip install -r requirements.txt")
+def generate_bouncer_file(install_directory='/data/oonib/', bouncer_file="bouncer.yaml"):
+ output = StringIO()
+ get(os.path.join(install_directory, 'oonib.conf'), output)
+ output.seek(0)
+ oonib_configuration = yaml.safe_load(output)
+
+ output.truncate(0)
+ get(os.path.join(oonib_configuration['main']['tor_datadir'], 'collector', 'hostname'),
+ output)
+ output.seek(0)
+ collector_hidden_service = output.readlines()[0].strip()
+
+ address = env.host
+ test_helpers = {
+ 'dns': address + ':' + str(oonib_configuration['helpers']['dns']['tcp_port']),
+ 'ssl': 'https://' + address,
+ 'traceroute': address,
+ }
+ if oonib_configuration['helpers']['tcp-echo']['port'] == 80:
+ test_helpers['tcp-echo'] = address
+ else:
+ test_helpers['http-return-json-headers'] = 'http://' + address
+
+ bouncer_data = {
+ 'collector':
+ {
+ 'httpo://'+collector_hidden_service: {'test-helper': test_helpers}
+ }
+ }
+ with open(bouncer_file) as f:
+ old_bouncer_data = yaml.safe_load(f)
+
+ with open(bouncer_file, 'w+') as f:
+ old_bouncer_data['collector']['httpo://'+collector_hidden_service] = {}
+ old_bouncer_data['collector']['httpo://'+collector_hidden_service]['test-helper'] = test_helpers
+ yaml.dump(old_bouncer_data, f)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits