[tor-commits] [ooni-probe/master] Fixes to support cloudfronting and https collectors

art at torproject.org art at torproject.org
Sun Jul 10 20:22:57 UTC 2016


commit c9e7ac559bf4ca2754105495ab86b3f533287843
Author: Arturo Filastò <arturo at filasto.net>
Date:   Tue Jun 21 16:28:18 2016 +0200

    Fixes to support cloudfronting and https collectors
---
 ooni/backend_client.py | 11 ++++++-----
 ooni/constants.py      |  4 ++--
 ooni/deck.py           |  3 ++-
 ooni/oonicli.py        |  1 +
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/ooni/backend_client.py b/ooni/backend_client.py
index 71b774f..83869cc 100644
--- a/ooni/backend_client.py
+++ b/ooni/backend_client.py
@@ -36,19 +36,17 @@ class OONIBClient(object):
         self.base_headers = {}
         self.backend_type = settings.get('type', None)
         self.base_address = settings.get('address', address)
+        self.front = settings.get('front', '').encode('ascii')
 
         if self.backend_type is None:
             self.backend_type = guess_backend_type(self.base_address)
         self.backend_type = self.backend_type.encode('ascii')
 
-        if self.backend_type == 'cloudfront':
-            self.base_headers['Host'] = settings['front'].encode('ascii')
-
         self._setupBaseAddress()
         self.settings = {
             'type': self.backend_type,
             'address': self.base_address,
-            'front': settings.get('front', '').encode('ascii')
+            'front': self.front
         }
 
     def _setupBaseAddress(self):
@@ -64,8 +62,11 @@ class OONIBClient(object):
                                                   parsed_address.netloc))
         elif self.backend_type == 'http':
             self.base_address = ("http://%s" % parsed_address.netloc)
-        elif self.backend_type in ('https', 'cloudfront'):
+        elif self.backend_type == 'https':
             self.base_address = ("https://%s" % parsed_address.netloc)
+        elif self.backend_type == 'cloudfront':
+            self.base_headers['Host'] = [parsed_address.netloc]
+            self.base_address = ("https://%s" % self.front)
         self.base_address = self.base_address.encode('ascii')
 
     def isSupported(self):
diff --git a/ooni/constants.py b/ooni/constants.py
index ef1f3d7..881a932 100644
--- a/ooni/constants.py
+++ b/ooni/constants.py
@@ -1,8 +1,8 @@
 CANONICAL_BOUNCER_ONION = 'httpo://nkvphnp3p6agi5qq.onion'
 CANONICAL_BOUNCER_HTTPS = 'https://bouncer.ooni.io'
 CANONICAL_BOUNCER_CLOUDFRONT = (
-    'XXXX.cloudfront.net',
-    'https://a0.awsstatic.com/'
+    'https://XXXX.cloudfront.net/',
+    'a0.awsstatic.com'
 )
 
 MEEK_BRIDGES = [
diff --git a/ooni/deck.py b/ooni/deck.py
index 2aa958d..aee3da9 100644
--- a/ooni/deck.py
+++ b/ooni/deck.py
@@ -219,7 +219,8 @@ class Deck(InputFile):
             yield self.fetchAndVerifyNetTestInput(net_test_loader)
 
         if self.bouncer:
-            log.msg("Looking up collector and test helpers")
+            log.msg("Looking up collector and test helpers with {0}".format(
+                self.bouncer.base_address))
             yield self.lookupCollectorAndTestHelpers()
 
 
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index 43654b6..c0ee5cd 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -345,6 +345,7 @@ def runWithDirector(global_options):
     test!
     """
     from ooni.director import Director
+    start_tor = False
     director = Director()
     if global_options['list']:
         net_tests = [net_test for net_test in director.getNetTests().items()]





More information about the tor-commits mailing list