[tor-bugs] #8366 [Ooni]: ooni: tls_handshake.py should be able to take hostnames as arguments

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu May 9 10:02:09 UTC 2013


#8366: ooni: tls_handshake.py should be able to take hostnames as arguments
---------------------------------+------------------------------------------
 Reporter:  isis                 |          Owner:  isis    
     Type:  enhancement          |         Status:  accepted
 Priority:  normal               |      Milestone:          
Component:  Ooni                 |        Version:          
 Keywords:  ooni, tls_handshake  |         Parent:          
   Points:                       |   Actualpoints:          
---------------------------------+------------------------------------------
Changes (by isis):

  * status:  new => accepted


Comment:

 A traceback with an unhandled error is generated when attempting to run
 tls_handshake.py with a hostname rather than an IP address is not handled
 correctly. So, regardless of whether or not we are going to implement
 hostname lookup in the test, we should at least handle this error and exit
 gracefully:

 {{{
 (ooni)?!isis?wintermute:~/code/torproject/ooni-probe ? bin/ooniprobe -n
 nettests/experimental/tls_handshake.py -h torproject.org:443
 Log opened.
 Not reporting using a collector
 [D] No test deck detected
 [D] Tor is not running. Skipping IP lookup via Tor.
 [D] Cannot determine the probe IP address with a traceroute, becase of
 insufficient priviledges
 Looking up your IP address via torproject
 Starting factory <twisted.web.client._HTTP11ClientFactory instance at
 0x2c6d440>
 Found your IP via a GeoIP service: 108.185.38.73
 [D] adding callback for startNetTest
 [D] Creating ./report-tls-handshake-2013-05-09T095553Z.yamloo
 [D] Writing report with YAML reporter
 [D] Created report with <ooni.reporter.YAMLReporter object at 0x2c6f050>
 [D] Starting this task <generator object generateMeasurements at
 0x2c73370>
 [D] Running <class 'nettests.experimental.tls_handshake.HandshakeTest'>
 test_handshake
 [!] No SSL/TLS context chosen! Defaulting to TLSv1.
 Using default Firefox ciphersuite list.
 Beginning handshake test for torproject.org:443
 [D] Checking all tasks for completion 0 == 1
 [!] Connection failed with reason: [Failure instance: Traceback: <type
 'exceptions.ValueError'>: 'torproject.org' does not appear to be an IPv4
 or IPv6 address
 /usr/lib/python2.7/threading.py:525:__bootstrap
 /usr/lib/python2.7/threading.py:552:__bootstrap_inner
 /usr/lib/python2.7/threading.py:505:run
 --- <exception caught here> ---
 /home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/threadpool.py:172:_worker
 /home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/context.py:118:callWithContext
 /home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/context.py:81:callWithContext
 /home/isis/code/torproject/ooni-
 probe/nettests/experimental/tls_handshake.py:312:makeConnection
 /home/isis/code/torproject/ooni-
 probe/nettests/experimental/tls_handshake.py:217:buildSocket
 /home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/ipaddr.py:78:IPAddress
 ]
 Handshake with torproject.org:443 failed!
 Handshake failed with reason: Socket 'torproject.org' does not appear to
 be an IPv4 or IPv6 address
 Unhandled error in Deferred:
 Unhandled Error
 Traceback (most recent call last):
   File "/usr/lib/python2.7/threading.py", line 525, in __bootstrap
     self.__bootstrap_inner()
   File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
     self.run()
   File "/usr/lib/python2.7/threading.py", line 505, in run
     self.__target(*self.__args, **self.__kwargs)
 --- <exception caught here> ---
   File "/home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/threadpool.py", line 172, in _worker
     result = context.call(ctx, function, *args, **kwargs)
   File "/home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/context.py", line 118, in callWithContext
     return self.currentContext().callWithContext(ctx, func, *args, **kw)
   File "/home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/twisted/python/context.py", line 81, in callWithContext
     return func(*args,**kw)
   File "/home/isis/code/torproject/ooni-
 probe/nettests/experimental/tls_handshake.py", line 312, in makeConnection
     sckt = self.buildSocket(addr)
   File "/home/isis/code/torproject/ooni-
 probe/nettests/experimental/tls_handshake.py", line 217, in buildSocket
     ip = ipaddr.IPAddress(addr) ## learn if we're IPv4 or IPv6
   File "/home/isis/.virtualenvs/ooni/local/lib/python2.7/site-
 packages/ipaddr.py", line 78, in IPAddress
     address)
 exceptions.ValueError: 'torproject.org' does not appear to be an IPv4 or
 IPv6 address

 [D] connectionShutdown: got NoneType for connection
 None
 Successfully completed measurement: <ooni.tasks.Measurement object at
 0x2c6f350>
 [D] Starting this task <ooni.tasks.ReportEntry object at 0x2d24410>
 [D] Writing report with YAML reporter
 [D] Successfully performed report <ooni.tasks.ReportEntry object at
 0x2d24410>
 [D] None
 [D] Checking all tasks for completion 1 == 1
 [D] Halting reactor
 [D] Successfully performed measurement <ooni.tasks.Measurement object at
 0x2c6f350>
 [D] None
 Stopping factory <twisted.web.client._HTTP11ClientFactory instance at
 0x2c6d440>
 Main loop terminated.
 }}}

 I'm not sure if this should be a separate bug or not, but since it's
 related it seemed it should go here.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8366#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list