meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Incorrect parsing of SocksPort for connect() #237

Closed meejah closed 7 years ago

meejah commented 7 years ago

Regression from #215 / #218: these pulled the getting and parsing of SocksPort out of TorConfig for the special case of conenct()-ing to a Tor without lots of GETCONF/GETINFO queries. However, they aren't parsing away any options that might be on the SocksPort lines.

meejah commented 7 years ago

@warner notes that on Ubuntu zesty there's a SocksPort line like SocksPort unix:/var/run/tor/socks WorldWritable and we're incorrectly trying to open that whole thing (minus "unix:") as a file.

warner commented 7 years ago

That SocksPort line apparently comes from /usr/share/tor/tor-service-defaults-torrc , which contains the following:

# cat /usr/share/tor/tor-service-defaults-torrc
DataDirectory /var/lib/tor
PidFile /var/run/tor/tor.pid
RunAsDaemon 1
User debian-tor

ControlSocket /var/run/tor/control GroupWritable RelaxDirModeCheck
ControlSocketsGroupWritable 1
SocksPort unix:/var/run/tor/socks WorldWritable
SocksPort 9050

CookieAuthentication 1
CookieAuthFileGroupReadable 1
CookieAuthFile /var/run/tor/control.authcookie

Log notice file /var/log/tor/log
meejah commented 7 years ago

This is in 0.19.3