summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Trying all available authentication methodsbug3958Damian Johnson2011-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When multiple control port authentication methods were defined we would just try the first then abort. This is always cookie auth so this became a problem in the following use case: - User installs our new tor deb which has cookie auth by default - User adds a hashed password to their torrc and starts tor - TorCtl attempts to connect but can't read the cookie file due to permissions, so it fails to connect. - User is confused why they weren't prompted for their password. This change makes does a couple things... - Makes an alternate functions which give a list of authentication methods rather than just the first. To avoid breaking backward compatability these are new functions, with the old ones functionally unchanged... get_auth_type => get_auth_types preauth_connect => preauth_connect_alt Pydocs for the old functions mention that they're deprecated. - The 'authenticate' method now attempts all connection methods, and by extension so does 'connect'. If all authentication methods fail then this raises an exception for the last failed attempt. I tested this with no auth, cookie auth, and dual auth where the cookie file was unreadable... - Presents connection components which now has a list of auth methods rather than just one. >>> TorCtl.preauth_connect_alt() (<TorCtl.Connection instance at 0xb78749cc>, ['COOKIE', 'PASSWORD'], '/tmp/torData/control_auth_cookie') - For a single auth method (this example with an open connection)... >>> TorCtl.preauth_connect_alt() (<TorCtl.Connection instance at 0xb787b9cc>, ['NONE'], '') >>> conn = TorCtl.connect() >>> conn.get_info("version") {'version': '0.2.2.23-alpha (git-b85eb949b528f4d7)'} - Attempts (1) auth cookie, (2) caller provided password, (3) prompts user for a password. All fails and connect returns None. >>> TorCtl.connect(passphrase="blarg") NOTICE[Wed Sep 21 08:40:43 2011]:Tor closed control connection. Exiting event thread. INFO[Wed Sep 21 08:40:43 2011]:Event loop received close message. Provided passphrase was incorrect Password: NOTICE[Wed Sep 21 08:40:45 2011]:Tor closed control connection. Exiting event thread. INFO[Wed Sep 21 08:40:45 2011]:Event loop received close message. Unable to authenticate: password incorrect
* fix: correcting default control socket pathbug3638Damian Johnson2011-08-11
| | | | | According to dererk the default control socket path is "/var/run/tor/control" rather than "/var/lib/tor/control" (the path mentioned by Peter).
* Adding ControlSocket supportDamian Johnson2011-08-04
| | | | | Adding support for unix domain control sockets via another connect method. This is for 'https://trac.torproject.org/projects/tor/ticket/3638'.
* Dropping the BUILD_FLAGS argument for CIRC eventsbug3679Damian Johnson2011-08-02
| | | | | | The BUILD_FLAGS, which is for ticket 2411, isn't in tor yet so it shouldn't yet be in torctl either. This looks like it will be a comma separated list, but until it's added to the spec we shouldn't depend on that.
* Condensing common event constructor codeDamian Johnson2011-08-02
| | | | | Avoids repetitive constructors among new style events and parsing the positional/kw arguments if they won't be used.
* Refactoring GUARD event parsingDamian Johnson2011-08-02
| | | | | | Using the new style for GUARD events, also fixing a minor bug where the nickname attribute might be left unset after init. Tested this by deleting the state directory and restarting tor.
* Refactoring BUILDTIMEOUT_SET event parsingDamian Johnson2011-08-02
| | | | | | | | | Using the new style for BUILDTIMEOUT_SET events, also adding support for its TIMEOUT_RATE, CLOSE_MS, and CLOSE_RATE parameters. *This is not tested* - I didn't figure out a method for triggering BUILDTIMEOUT_SET events (tried client usage and removing the state directory/reinitializing but no luck)
* Refactoring ADDRMAP event parsingDamian Johnson2011-08-02
| | | | | | | | | Using the new style for ADDRMAP events. These events have both quoted and non-quoted values breaking positional and keyword parsing, so keeping the regex parsing. This expands the event to include the ERROR and GMTExpiry attributes. This was tested by visiting sites with TBB and printing out the ADDRMAP results.
* Refactoring NEWDESC event parsingDamian Johnson2011-08-02
| | | | | | Using the new style for NEWDESC events. This isn't using the positional or kw pattern so effectively this is just moving the body parsing into the event. Tested by attaching to a new tor instance to get NEWDESC events.
* Refactoring msg event parsingDamian Johnson2011-08-02
| | | | | | This one isn't actually using the new style since the events aren't of the positional or keyword pattern. I'm just adding the empty positional and kw args so this doesn't need to become a special case later.
* Refactoring BW event parsingDamian Johnson2011-08-02
| | | | | Using the new style for BW events. Tested by attaching to a TBB instance and exercising the event.
* Refactoring STREAM_BW event parsingDamian Johnson2011-08-02
| | | | | Using the new style for STREAM_BW events. Tested by attaching to a TBB instance and exercising the event.
* fix: misparsing port-only stream eventsDamian Johnson2011-08-02
| | | | | If a colon was missing from the target field then the stream event would leave its port unset. I'm not sure how to exercise this so this change is untested.
* fix: dropping nonexistent ORCONN attributesDamian Johnson2011-08-02
| | | | | | The AGE, READ, and WRITTEN attributes of ORCONN events were for a prospective change, and never actually added to Tor. Dropping the parsing of these values to cut down on confusion by torctl users.
* Refactoring ORCONN event parsingDamian Johnson2011-07-29
| | | | | Replacing event parsing for ORCONN events. Tested by listening for the events and checking the parsed results.
* Refactoring CIRC event parsingDamian Johnson2011-07-29
| | | | | | | Replacing the event parsing for CircuitEvent, and adding parsing for the BUILD_FLAGS field being introduced in ticket 2411. This was tested by running Robert's 'feature2411-v3' branch and printing the parsed results for CIRC events.
* Refactoring STREAM event parsingDamian Johnson2011-07-29
| | | | | | | | | | Refactoring the parsing for STREAM events (other event types are to follow). This is related to ticket 2411 [1] where a new field will cause breakage for our parsing. Besides that, this is both a more generic and readable parsing implementation. Testing was by connecting to a TBB instance and listening to STREAM events. Thanks to nickm for a rough draft of the new implementation. [1] https://trac.torproject.org/projects/tor/ticket/2411
* Merge branch 'ratio-restrictions'Mike Perry2011-06-27
|\
| * Implement ratio ranking support.Mike Perry2011-06-24
| |
* | Allow TorCtl.connect() to specify alternate Connection classes.Mike Perry2011-06-25
|/ | | | Need to move it for that...
* Add a little more rambling to reset_all().Mike Perry2011-06-24
|
* Merge remote branch 'aagbsn/testing'Mike Perry2011-06-24
|\
| * Added refresh_all() and warnings to reset_all()aagbsn2011-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQLSupport.refresh_all() is required to keep Elixir and tc_session in sync. Otherwise it is possible for routers added by the consensus update to not show up in queries using the Elixir model i.e. Router.query.all() Also, warnings have been added to SQLSupport.reset_all() because this does not work properly -- in some cases relation tables were not being reset properly (this resulted in old bw measurements being repeated in future output!). Finally, even when reset_all() works properly, bwauthority memory usage continues to grow.
| * update consensus after resetting stats within the same jobaagbsn2011-06-23
| |
| * added reset_stats() to Scansupport.pyaagbsn2011-06-23
| | | | | | | | | | | | | | | | calls parent and SQLSupport reset functions Tests show that SQLSupport.reset_all() may clear too much because if BwAuthority calls Scansupport.reset_stats() after each speedrace() run only the first slice is properly recorded; the rest are empty. See: https://trac.torproject.org/projects/tor/ticket/2947
| * add case for longaagbsn2011-06-18
| |
| * generalize db message, we now support postgres and mysql tooaagbsn2011-06-17
| |
| * fixes for divide-by-zerosaagbsn2011-06-17
| | | | | | | | | | | | Postgres doesn't ignore divide-by-zeros like MySQL CASE statement added to set the result to NULL if the denominator is zero
| * rewrite query for mysql compatibility attempt 2aagbsn2011-06-17
| | | | | | | | this actually appears to work
| * rewrite query for mysql compatibility attempt 1aagbsn2011-06-17
| |
| * backward compatibility with SQLAlchemy 0.5.xaagbsn2011-06-17
| |
| * SQLAlchemey and Elixir upgradeaagbsn2011-06-17
| | | | | | | | | | | | | | enabled elixir migration aid options. renamed a few function calls, as per SQLAlchemy upgrade docs: session.clear() is removed. use session.remove_all()
* | Eliminate a warn about a consensus miscount.Mike Perry2011-06-24
| | | | | | | | By fixing the miscount, of course.
* | Remove python 2.5ismMike Perry2011-06-20
|/
* Rename make_connection to preauth_connect and export it.Mike Perry2011-06-17
|
* Rename connectionComp and export ns_body_iter.Mike Perry2011-06-17
|
* Add iterator support to get_consensus().Mike Perry2011-06-17
| | | | Also rename getIterator to get_iterator.
* Merge remote branch 'atagar/bug2812'Mike Perry2011-06-17
|\
| * Merge commit '40f7cbc' into bug2812bug2812Damian Johnson2011-06-16
| |\ | | | | | | | | | | | | Conflicts: TorUtil.py
| | * Closing connection in case of auth failurebug3409Damian Johnson2011-06-16
| | | | | | | | | | | | | | | When authentication failed in TorCtl.connect() the abandoned connection wasn't being closed.
| | * TorCtl connect method inflexibleDamian Johnson2011-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The connect method is a nice helper for cli initiation, but lacks sufficient call visibility to help in more general use cases. In particular it... - sends feedback to stdout - prompts for the controller password on stdin - suppresses exceptions To get around this I'm adding a more generic 'connectionComp' that does the icky bits of the connection negotiation I was trying to hide while still giving the caller what it needs to handle the connection process however it'd like. Tested by exercising the connect functionality with cookies, password, and connection components to handle my TBB cookie auth renegotiation fix.
| | * Option to get get_network_status as an iteratorbug3406Damian Johnson2011-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the 'getIterator' argument drops the memory usage of calling get_network_status by 71% (from 3.5 MB to 1 MB). This is still higher than what I was expecting from a generator, though certainly much better. Unfortunately this didn't have an impact on the ConsensusTracker. The memory usage from its constructor dwarfs anything else I've looked at (18.8 MB) and didn't drop like I'd expect when consensus_only was false. :(
| | * Handling for connections to non-control socketsbug2580Damian Johnson2011-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we attempt to initiate a control connection to a non-control port (for instance tor's socks port instead)... - the socket shutdown issues an error since it's not connected yet - checking the authentication type fails with a TorCtlClosed rather than error reply For more information see bug 2580.
| | * Unblocking waits for a response when we errorbug1329Damian Johnson2011-06-13
| | | | | | | | | | | | | | | When the signal sent by _sendImpl causes the control connection to close we block indefinitely waiting for a response. For more information see bug 1329.
* | | Merge branch 'bug2812'Mike Perry2011-06-16
|\ \ \ | |/ / | | / | |/ |/|
| * Removing socket timeout for thread wakeupDamian Johnson2011-06-16
| | | | | | | | | | The shutdown added in this branch wakes the socket so there's no need for the loop we previously had.
* | Replacing old TorCtl example with a BW listenerbug2065Damian Johnson2011-06-12
|/ | | | | Event listening, particularly BW events, is a common request on irc so using it as the TorCtl example. For more information see bug 2065.
* Shutting down sockets when closedDamian Johnson2011-06-12
| | | | | Each TorCtl instance spawned a socket that would continue to live for the life of the python process. For more information see ticket 2812.
* Removing indefinite blocking on socket recvbug2412Damian Johnson2011-06-12
| | | | | | When shutting down we can't join on _thread unless the socket receives data because we didn't have a timeout. This issues a 20 ms timeout on socket reads and cleans up _thread when we close.
* Fix some issues with SmartSocket.Mike Perry2011-03-07
| | | | Also remove some traceback debugging statements.