2 TC: A Tor control protocol (Version 1)
8 1.1. Forward-compatibility
10 2.1. Description format
11 2.1.1. Notes on an escaping bug
12 2.2. Commands from controller to Tor
13 2.3. Replies from Tor to the controller
14 2.4. General-use tokens
26 3.11. SETCIRCUITPURPOSE
27 3.12. SETROUTERPURPOSE
45 3.30. ONION_CLIENT_AUTH_ADD
46 3.31. ONION_CLIENT_AUTH_REMOVE
47 3.32. ONION_CLIENT_AUTH_VIEW
51 4.1. Asynchronous events
52 4.1.1. Circuit status changed
53 4.1.2. Stream status changed
54 4.1.3. OR Connection status changed
55 4.1.4. Bandwidth used in the last second
57 4.1.6. New descriptors available
58 4.1.7. New Address mapping
59 4.1.8. Descriptors uploaded to us in our role as authoritative dirserver
60 4.1.9. Our descriptor changed
62 4.1.11. Our set of guard nodes has changed
63 4.1.12. Network status has changed
64 4.1.13. Bandwidth used on an application stream
65 4.1.14. Per-country client stats
66 4.1.15. New consensus networkstatus has arrived
67 4.1.16. New circuit buildtime has been set
68 4.1.17. Signal received
69 4.1.18. Configuration changed
70 4.1.19. Circuit status changed slightly
71 4.1.20. Pluggable transport launched
72 4.1.21. Bandwidth used on an OR or DIR or EXIT connection
73 4.1.22. Bandwidth used by all streams attached to a circuit
74 4.1.23. Per-circuit cell stats
75 4.1.24. Token buckets refilled
76 4.1.25. HiddenService descriptors
77 4.1.26. HiddenService descriptors content
78 4.1.27. Network liveness has changed
79 4.1.28. Pluggable Transport Logs
80 4.1.29. Pluggable Transport Status
81 5. Implementation notes
83 5.2. Don't let the buffer get too big
84 5.3. Backward compatibility with v0 control protocol
85 5.4. Tor config options for use by controllers
86 5.5. Phases from the Bootstrap status event
87 5.5.1. Overview of Bootstrap reporting.
88 5.5.2. Phases in Bootstrap Stage 1
89 5.5.3. Phases in Bootstrap Stage 2
90 5.5.4. Phases in Bootstrap Stage 3
91 5.6 Bootstrap phases reported by older versions of Tor
95 This document describes an implementation-specific protocol that is used
96 for other programs (such as frontend user-interfaces) to communicate with a
97 locally running Tor process. It is not part of the Tor onion routing
100 This protocol replaces version 0 of TC, which is now deprecated. For
101 reference, TC is described in "control-spec-v0.txt". Implementors are
102 recommended to avoid using TC directly, but instead to use a library that
103 can easily be updated to use the newer protocol. (Version 0 is used by Tor
104 versions 0.1.0.x; the protocol in this document only works with Tor
105 versions in the 0.1.1.x series and later.)
107 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
108 NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
109 "OPTIONAL" in this document are to be interpreted as described in
114 TC is a bidirectional message-based protocol. It assumes an underlying
115 stream for communication between a controlling process (the "client"
116 or "controller") and a Tor process (or "server"). The stream may be
117 implemented via TCP, TLS-over-TCP, a Unix-domain socket, or so on,
118 but it must provide reliable in-order delivery. For security, the
119 stream should not be accessible by untrusted parties.
121 In TC, the client and server send typed messages to each other over the
122 underlying stream. The client sends "commands" and the server sends
125 By default, all messages from the server are in response to messages from
126 the client. Some client requests, however, will cause the server to send
127 messages to the client indefinitely far into the future. Such
128 "asynchronous" replies are marked as such.
130 Servers respond to messages in the order messages are received.
132 1.1. Forward-compatibility
134 This is an evolving protocol; new client and server behavior will be
135 allowed in future versions. To allow new backward-compatible behavior
136 on behalf of the client, we may add new commands and allow existing
137 commands to take new arguments in future versions. To allow new
138 backward-compatible server behavior, we note various places below
139 where servers speaking a future version of this protocol may insert
140 new data, and note that clients should/must "tolerate" unexpected
141 elements in these places. There are two ways that we do this:
143 * Adding a new field to a message:
145 For example, we might say "This message has three space-separated
146 fields; clients MUST tolerate more fields." This means that a
147 client MUST NOT crash or otherwise fail to parse the message or
148 other subsequent messages when there are more than three fields, and
149 that it SHOULD function at least as well when more fields are
150 provided as it does when it only gets the fields it accepts. The
151 most obvious way to do this is by ignoring additional fields; the
152 next-most-obvious way is to report additional fields verbatim to the
153 user, perhaps as part of an expert UI.
155 * Adding a new possible value to a list of alternatives:
157 For example, we might say "This field will be OPEN, CLOSED, or
158 CONNECTED. Clients MUST tolerate unexpected values." This means
159 that a client MUST NOT crash or otherwise fail to parse the message
160 or other subsequent messages when there are unexpected values, and
161 that it SHOULD try to handle the rest of the message as well as it
162 can. The most obvious way to do this is by pretending that each
163 list of alternatives has an additional "unrecognized value" element,
164 and mapping any unrecognized values to that element; the
165 next-most-obvious way is to create a separate "unrecognized value"
166 element for each unrecognized value.
168 Clients SHOULD NOT "tolerate" unrecognized alternatives by
169 pretending that the message containing them is absent. For example,
170 a stream closed for an unrecognized reason is nevertheless closed,
171 and should be reported as such.
173 (If some list of alternatives is given, and there isn't an explicit
174 statement that clients must tolerate unexpected values, clients still
175 must tolerate unexpected values. The only exception would be if there
176 were an explicit statement that no future values will ever be added.)
180 2.1. Description format
182 The message formats listed below use ABNF as described in RFC 2234.
183 The protocol itself is loosely based on SMTP (see RFC 2821).
185 We use the following nonterminals from RFC 2822: atom, qcontent
187 We define the following general-use nonterminals:
189 QuotedString = DQUOTE *qcontent DQUOTE
191 There are explicitly no limits on line length. All 8-bit characters
192 are permitted unless explicitly disallowed. In QuotedStrings,
193 backslashes and quotes must be escaped; other characters need not be
196 Wherever CRLF is specified to be accepted from the controller, Tor MAY also
197 accept LF. Tor, however, MUST NOT generate LF instead of CRLF.
198 Controllers SHOULD always send CRLF.
200 2.1.1. Notes on an escaping bug
202 CString = DQUOTE *qcontent DQUOTE
204 Note that although these nonterminals have the same grammar, they
205 are interpreted differently. In a QuotedString, a backslash
206 followed by any character represents that character. But
207 in a CString, the escapes "\n", "\t", "\r", and the octal escapes
208 "\0" ... "\377" represent newline, tab, carriage return, and the
209 256 possible octet values respectively.
211 The use of CString in this document reflects a bug in Tor;
212 they should have been QuotedString instead. In the future, they
213 may migrate to use QuotedString instead. If they do, the
214 QuotedString implementation will never place a backslash before a
215 "n", "t", "r", or digit, to ensure that old controllers don't get
218 For future-proofing, controller implementors MAY use the following
219 rules to be compatible with buggy Tor implementations and with
220 future ones that implement the spec as intended:
222 Read \n \t \r and \0 ... \377 as C escapes.
223 Treat a backslash followed by any other character as that character.
225 Currently, many of the QuotedString instances below that Tor
226 outputs are in fact CStrings. We intend to fix this in future
227 versions of Tor, and document which ones were broken. (See
228 bugtracker ticket #14555 for a bit more information.)
230 Note that this bug exists only in strings generated by Tor for the
231 Tor controller; Tor should parse input QuotedStrings from the
232 controller correctly.
235 2.2. Commands from controller to Tor
237 Command = Keyword OptArguments CRLF / "+" Keyword OptArguments CRLF CmdData
239 OptArguments = [ SP *(SP / VCHAR) ]
241 A command is either a single line containing a Keyword and arguments, or a
242 multiline command whose initial keyword begins with +, and whose data
243 section ends with a single "." on a line of its own. (We use a special
244 character to distinguish multiline commands so that Tor can correctly parse
245 multi-line commands that it does not recognize.) Specific commands and
246 their arguments are described below in section 3.
248 2.3. Replies from Tor to the controller
250 Reply = SyncReply / AsyncReply
251 SyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
252 AsyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
254 MidReplyLine = StatusCode "-" ReplyLine
255 DataReplyLine = StatusCode "+" ReplyLine CmdData
256 EndReplyLine = StatusCode SP ReplyLine
257 ReplyLine = [ReplyText] CRLF
261 Unless specified otherwise, multiple lines in a single reply from
262 Tor to the controller are guaranteed to share the same status
263 code. Specific replies are mentioned below in section 3, and
264 described more fully in section 4.
266 [Compatibility note: versions of Tor before 0.2.0.3-alpha sometimes
267 generate AsyncReplies of the form "*(MidReplyLine / DataReplyLine)".
268 This is incorrect, but controllers that need to work with these
269 versions of Tor should be prepared to get multi-line AsyncReplies with
270 the final line (usually "650 OK") omitted.]
272 2.4. General-use tokens
274 ; CRLF means, "the ASCII Carriage Return character (decimal value 13)
275 ; followed by the ASCII Linefeed character (decimal value 10)."
278 ; How a controller tells Tor about a particular OR. There are four
280 ; $Fingerprint -- The router whose identity key hashes to the fingerprint.
281 ; This is the preferred way to refer to an OR.
282 ; $Fingerprint~Nickname -- The router whose identity key hashes to the
283 ; given fingerprint, but only if the router has the given nickname.
284 ; $Fingerprint=Nickname -- The router whose identity key hashes to the
285 ; given fingerprint, but only if the router is Named and has the given
287 ; Nickname -- The Named router with the given nickname, or, if no such
288 ; router exists, any router whose nickname matches the one given.
289 ; This is not a safe way to refer to routers, since Named status
290 ; could under some circumstances change over time.
292 ; The tokens that implement the above follow:
294 ServerSpec = LongName / Nickname
295 LongName = Fingerprint [ "~" Nickname ]
297 ; For tors older than 0.3.1.3-alpha, LongName may have included an equal
298 ; sign ("=") in lieu of a tilde ("~"). The presence of an equal sign
299 ; denoted that the OR possessed the "Named" flag:
301 LongName = Fingerprint [ ( "=" / "~" ) Nickname ]
303 Fingerprint = "$" 40*HEXDIG
304 NicknameChar = "a"-"z" / "A"-"Z" / "0" - "9"
305 Nickname = 1*19 NicknameChar
307 ; What follows is an outdated way to refer to ORs.
308 ; Feature VERBOSE_NAMES replaces ServerID with LongName in events and
309 ; GETINFO results. VERBOSE_NAMES can be enabled starting in Tor version
310 ; 0.1.2.2-alpha and it is always-on in 0.2.2.1-alpha and later.
311 ServerID = Nickname / Fingerprint
314 ; Unique identifiers for streams or circuits. Currently, Tor only
315 ; uses digits, but this may change
316 StreamID = 1*16 IDChar
317 CircuitID = 1*16 IDChar
319 QueueID = 1*16 IDChar
320 IDChar = ALPHA / DIGIT
322 Address = ip4-address / ip6-address / hostname (XXXX Define these)
324 ; A "CmdData" section is a sequence of octets concluded by the terminating
325 ; sequence CRLF "." CRLF. The terminating sequence may not appear in the
326 ; body of the data. Leading periods on lines in the data are escaped with
327 ; an additional leading period as in RFC 2821 section 4.5.2.
328 CmdData = *DataLine "." CRLF
329 DataLine = CRLF / "." 1*LineItem CRLF / NonDotItem *LineItem CRLF
330 LineItem = NonCR / 1*CR NonCRLF
331 NonDotItem = NonDotCR / 1*CR NonCRLF
333 ; ISOTime, ISOTime2, and ISOTime2Frac are time formats as specified in
335 ; example ISOTime: "2012-01-11 12:15:33"
336 ; example ISOTime2: "2012-01-11T12:15:33"
337 ; example ISOTime2Frac: "2012-01-11T12:15:33.51"
338 IsoDatePart = 4*DIGIT "-" 2*DIGIT "-" 2*DIGIT
339 IsoTimePart = 2*DIGIT ":" 2*DIGIT ":" 2*DIGIT
340 ISOTime = IsoDatePart " " IsoTimePart
341 ISOTime2 = IsoDatePart "T" IsoTimePart
342 ISOTime2Frac = IsoTime2 [ "." 1*DIGIT ]
345 LeadingDigit = "1" - "9"
346 UInt = LeadingDigit *Digit
350 All commands are case-insensitive, but most keywords are case-sensitive.
354 Change the value of one or more configuration variables. The syntax is:
356 "SETCONF" 1*(SP keyword ["=" value]) CRLF
357 value = String / QuotedString
359 Tor behaves as though it had just read each of the key-value pairs
360 from its configuration file. Keywords with no corresponding values have
361 their configuration values reset to 0 or NULL (use RESETCONF if you want
362 to set it back to its default). SETCONF is all-or-nothing: if there
363 is an error in any of the configuration settings, Tor sets none of them.
365 Tor responds with a "250 OK" reply on success.
366 If some of the listed keywords can't be found, Tor replies with a
367 "552 Unrecognized option" message. Otherwise, Tor responds with a
368 "513 syntax error in configuration values" reply on syntax error, or a
369 "553 impossible configuration setting" reply on a semantic error.
371 Some configuration options (e.g. "Bridge") take multiple values. Also,
372 some configuration keys (e.g. for hidden services and for entry
373 guard lists) form a context-sensitive group where order matters (see
374 GETCONF below). In these cases, setting _any_ of the options in a
375 SETCONF command is taken to reset all of the others. For example,
376 if two ORListenAddress values are configured, and a SETCONF command
377 arrives containing a single ORListenAddress value, the new command's
378 value replaces the two old values.
380 Sometimes it is not possible to change configuration options solely by
381 issuing a series of SETCONF commands, because the value of one of the
382 configuration options depends on the value of another which has not yet
383 been set. Such situations can be overcome by setting multiple configuration
384 options with a single SETCONF command (e.g. SETCONF ORPort=443
385 ORListenAddress=9001).
389 Remove all settings for a given configuration option entirely, assign
390 its default value (if any), and then assign the String provided.
391 Typically the String is left empty, to simply set an option back to
392 its default. The syntax is:
394 "RESETCONF" 1*(SP keyword ["=" String]) CRLF
396 Otherwise it behaves like SETCONF above.
400 Request the value of zero or more configuration variable(s).
403 "GETCONF" *(SP keyword) CRLF
405 If all of the listed keywords exist in the Tor configuration, Tor replies
406 with a series of reply lines of the form:
410 If any option is set to a 'default' value semantically different from an
411 empty string, Tor may reply with a reply line of the form:
415 Value may be a raw value or a quoted string. Tor will try to use unquoted
416 values except when the value could be misinterpreted through not being
417 quoted. (Right now, Tor supports no such misinterpretable values for
418 configuration options.)
420 If some of the listed keywords can't be found, Tor replies with a
421 "552 unknown configuration keyword" message.
423 If an option appears multiple times in the configuration, all of its
424 key-value pairs are returned in order.
426 If no keywords were provided, Tor responds with "250 OK" message.
428 Some options are context-sensitive, and depend on other options with
429 different keywords. These cannot be fetched directly. Currently there
430 is only one such option: clients should use the "HiddenServiceOptions"
431 virtual keyword to get all HiddenServiceDir, HiddenServicePort,
432 HiddenServiceVersion, and HiddenserviceAuthorizeClient option settings.
436 Request the server to inform the client about interesting events. The
439 "SETEVENTS" [SP "EXTENDED"] *(SP EventCode) CRLF
441 EventCode = 1*(ALPHA / "_") (see section 4.1.x for event types)
443 Any events *not* listed in the SETEVENTS line are turned off; thus, sending
444 SETEVENTS with an empty body turns off all event reporting.
446 The server responds with a "250 OK" reply on success, and a "552
447 Unrecognized event" reply if one of the event codes isn't recognized. (On
448 error, the list of active event codes isn't changed.)
450 If the flag string "EXTENDED" is provided, Tor may provide extra
451 information with events for this connection; see 4.1 for more information.
452 NOTE: All events on a given connection will be provided in extended format,
454 NOTE: "EXTENDED" was first supported in Tor 0.1.1.9-alpha; it is
455 always-on in Tor 0.2.2.1-alpha and later.
457 Each event is described in more detail in Section 4.1.
461 Sent from the client to the server. The syntax is:
463 "AUTHENTICATE" [ SP 1*HEXDIG / QuotedString ] CRLF
465 This command is used to authenticate to the server. The provided string is
466 one of the following:
468 * (For the HASHEDPASSWORD authentication method; see 3.21)
469 The original password represented as a QuotedString.
471 * (For the COOKIE is authentication method; see 3.21)
472 The contents of the cookie file, formatted in hexadecimal
474 * (For the SAFECOOKIE authentication method; see 3.21)
475 The HMAC based on the AUTHCHALLENGE message, in hexadecimal.
477 The server responds with "250 OK" on success or "515 Bad authentication" if
478 the authentication cookie is incorrect. Tor closes the connection on an
479 authentication failure.
481 The authentication token can be specified as either a quoted ASCII string,
482 or as an unquoted hexadecimal encoding of that same string (to avoid escaping
485 For information on how the implementation securely stores authentication
486 information on disk, see section 5.1.
488 Before the client has authenticated, no command other than
489 PROTOCOLINFO, AUTHCHALLENGE, AUTHENTICATE, or QUIT is valid. If the
490 controller sends any other command, or sends a malformed command, or
491 sends an unsuccessful AUTHENTICATE command, or sends PROTOCOLINFO or
492 AUTHCHALLENGE more than once, Tor sends an error reply and closes
495 To prevent some cross-protocol attacks, the AUTHENTICATE command is still
496 required even if all authentication methods in Tor are disabled. In this
497 case, the controller should just send "AUTHENTICATE" CRLF.
499 (Versions of Tor before 0.1.2.16 and 0.2.0.4-alpha did not close the
500 connection after an authentication failure.)
504 Sent from the client to the server. The syntax is:
506 "SAVECONF" [SP "FORCE"] CRLF
508 Instructs the server to write out its config options into its torrc. Server
509 returns "250 OK" if successful, or "551 Unable to write configuration
510 to disk" if it can't write the file or some other error occurs.
512 If the %include option is used on torrc, SAVECONF will not write the
513 configuration to disk. If the flag string "FORCE" is provided, the
514 configuration will be overwritten even if %include is used. Using %include
515 on defaults-torrc does not affect SAVECONF. (Introduced in 0.3.1.1-alpha.)
517 See also the "getinfo config-text" command, if the controller wants
518 to write the torrc file itself.
520 See also the "getinfo config-can-saveconf" command, to tell if the FORCE
521 flag will be required. (Also introduced in 0.3.1.1-alpha.)
525 Sent from the client to the server. The syntax is:
527 "SIGNAL" SP Signal CRLF
529 Signal = "RELOAD" / "SHUTDOWN" / "DUMP" / "DEBUG" / "HALT" /
530 "HUP" / "INT" / "USR1" / "USR2" / "TERM" / "NEWNYM" /
531 "CLEARDNSCACHE" / "HEARTBEAT" / "ACTIVE" / "DORMANT"
533 The meaning of the signals are:
535 RELOAD -- Reload: reload config items.
536 SHUTDOWN -- Controlled shutdown: if server is an OP, exit immediately.
537 If it's an OR, close listeners and exit after
538 ShutdownWaitLength seconds.
539 DUMP -- Dump stats: log information about open connections and
541 DEBUG -- Debug: switch all open logs to loglevel debug.
542 HALT -- Immediate shutdown: clean up and exit now.
543 CLEARDNSCACHE -- Forget the client-side cached IPs for all hostnames.
544 NEWNYM -- Switch to clean circuits, so new application requests
545 don't share any circuits with old ones. Also clears
546 the client-side DNS cache. (Tor MAY rate-limit its
547 response to this signal.)
548 HEARTBEAT -- Make Tor dump an unscheduled Heartbeat message to log.
549 DORMANT -- Tell Tor to become "dormant". A dormant Tor will
550 try to avoid CPU and network usage until it receives
551 user-initiated network request. (Don't use this
552 on relays or hidden services yet!)
553 ACTIVE -- Tell Tor to stop being "dormant", as if it had received
554 a user-initiated network request.
556 The server responds with "250 OK" if the signal is recognized (or simply
557 closes the socket if it was asked to close immediately), or "552
558 Unrecognized signal" if the signal is unrecognized.
560 Note that not all of these signals have POSIX signal equivalents. The
561 ones that do are as below. You may also use these POSIX names for the
562 signal that have them.
570 [SIGNAL DORMANT and SIGNAL ACTIVE were added in 0.4.0.1-alpha.]
574 Sent from the client to the server. The syntax is:
576 "MAPADDRESS" 1*(Address "=" Address SP) CRLF
578 The first address in each pair is an "original" address; the second is a
579 "replacement" address. The client sends this message to the server in
580 order to tell it that future SOCKS requests for connections to the original
581 address should be replaced with connections to the specified replacement
582 address. If the addresses are well-formed, and the server is able to
583 fulfill the request, the server replies with a 250 message:
585 250-OldAddress1=NewAddress1
586 250 OldAddress2=NewAddress2
588 containing the source and destination addresses. If request is
589 malformed, the server replies with "512 syntax error in command
590 argument". If the server can't fulfill the request, it replies with
591 "451 resource exhausted".
593 The client may decline to provide a body for the original address, and
594 instead send a special null address ("0.0.0.0" for IPv4, "::0" for IPv6, or
595 "." for hostname), signifying that the server should choose the original
596 address itself, and return that address in the reply. The server
597 should ensure that it returns an element of address space that is unlikely
598 to be in actual use. If there is already an address mapped to the
599 destination address, the server may reuse that mapping.
601 If the original address is already mapped to a different address, the old
602 mapping is removed. If the original address and the destination address
603 are the same, the server removes any mapping in place for the original
608 C: MAPADDRESS 1.2.3.4=torproject.org
609 S: 250 1.2.3.4=torproject.org
611 C: GETINFO address-mappings/control
612 S: 250-address-mappings/control=1.2.3.4 torproject.org NEVER
615 C: MAPADDRESS 1.2.3.4=1.2.3.4
616 S: 250 1.2.3.4=1.2.3.4
618 C: GETINFO address-mappings/control
619 S: 250-address-mappings/control=
622 {Note: This feature is designed to be used to help Tor-ify applications
623 that need to use SOCKS4 or hostname-less SOCKS5. There are three
624 approaches to doing this:
626 1. Somehow make them use SOCKS4a or SOCKS5-with-hostnames instead.
627 2. Use tor-resolve (or another interface to Tor's resolve-over-SOCKS
628 feature) to resolve the hostname remotely. This doesn't work
629 with special addresses like x.onion or x.y.exit.
630 3. Use MAPADDRESS to map an IP address to the desired hostname, and then
631 arrange to fool the application into thinking that the hostname
632 has resolved to that IP.
634 This functionality is designed to help implement the 3rd approach.}
636 Mappings set by the controller last until the Tor process exits:
637 they never expire. If the controller wants the mapping to last only
638 a certain time, then it must explicitly un-map the address when that
641 MapAddress replies MAY contain mixed status codes.
645 C: MAPADDRESS xxx=@@@ 0.0.0.0=bogus1.google.com
646 S: 512-syntax error: invalid address '@@@'
647 S: 250 127.199.80.246=bogus1.google.com
651 Sent from the client to the server. The syntax is as for GETCONF:
653 "GETINFO" 1*(SP keyword) CRLF
655 Unlike GETCONF, this message is used for data that are not stored in the Tor
656 configuration file, and that may be longer than a single line. On success,
657 one ReplyLine is sent for each requested value, followed by a final 250 OK
658 ReplyLine. If a value fits on a single line, the format is:
661 If a value must be split over multiple lines, the format is:
666 The server sends a 551 or 552 error on failure.
668 Recognized keys and their values include:
670 "version" -- The version of the server's software, which MAY include the
671 name of the software, such as "Tor 0.0.9.4". The name of the software,
672 if absent, is assumed to be "Tor".
674 "config-file" -- The location of Tor's configuration file ("torrc").
676 "config-defaults-file" -- The location of Tor's configuration
677 defaults file ("torrc.defaults"). This file gets parsed before
678 torrc, and is typically used to replace Tor's default
679 configuration values. [First implemented in 0.2.3.9-alpha.]
681 "config-text" -- The contents that Tor would write if you send it
682 a SAVECONF command, so the controller can write the file to
683 disk itself. [First implemented in 0.2.2.7-alpha.]
685 "exit-policy/default" -- The default exit policy lines that Tor will
686 *append* to the ExitPolicy config option.
688 "exit-policy/reject-private/default" -- The default exit policy lines
689 that Tor will *prepend* to the ExitPolicy config option when
690 ExitPolicyRejectPrivate is 1.
692 "exit-policy/reject-private/relay" -- The relay-specific exit policy
693 lines that Tor will *prepend* to the ExitPolicy config option based
694 on the current values of ExitPolicyRejectPrivate and
695 ExitPolicyRejectLocalInterfaces. These lines are based on the public
696 addresses configured in the torrc and present on the relay's
697 interfaces. Will send 552 error if the server is not running as
698 onion router. Will send 551 on internal error which may be transient.
702 "exit-policy/full" -- This OR's exit policy, in IPv4-only, IPv6-only, or
703 all-entries flavors. Handles errors in the same way as "exit-policy/
704 reject-private/relay" does.
706 "desc/id/<OR identity>" or "desc/name/<OR nickname>" -- the latest
707 server descriptor for a given OR. (Note that modern Tor clients
708 do not download server descriptors by default, but download
709 microdescriptors instead. If microdescriptors are enabled, you'll
710 need to use "md" instead.)
712 "md/all" -- all known microdescriptors for the entire Tor network.
713 Each microdescriptor is terminated by a newline.
714 [First implemented in 0.3.5.1-alpha]
716 "md/id/<OR identity>" or "md/name/<OR nickname>" -- the latest
717 microdescriptor for a given OR. Empty if we have no microdescriptor for
718 that OR (because we haven't downloaded one, or it isn't in the
719 consensus). [First implemented in 0.2.3.8-alpha.]
721 "desc/download-enabled" -- "1" if we try to download router descriptors;
722 "0" otherwise. [First implemented in 0.3.2.1-alpha]
724 "md/download-enabled" -- "1" if we try to download microdescriptors;
725 "0" otherwise. [First implemented in 0.3.2.1-alpha]
727 "dormant" -- A nonnegative integer: zero if Tor is currently active and
728 building circuits, and nonzero if Tor has gone idle due to lack of use
729 or some similar reason. [First implemented in 0.2.3.16-alpha]
731 "desc-annotations/id/<OR identity>" -- outputs the annotations string
732 (source, timestamp of arrival, purpose, etc) for the corresponding
733 descriptor. [First implemented in 0.2.0.13-alpha.]
735 "extra-info/digest/<digest>" -- the extrainfo document whose digest (in
736 hex) is <digest>. Only available if we're downloading extra-info
739 "ns/id/<OR identity>" or "ns/name/<OR nickname>" -- the latest router
740 status info (v3 directory style) for a given OR. Router status
741 info is as given in dir-spec.txt, and reflects the latest
742 consensus opinion about the
743 router in question. Like directory clients, controllers MUST
744 tolerate unrecognized flags and lines. The published date and
745 descriptor digest are those believed to be best by this Tor,
746 not necessarily those for a descriptor that Tor currently has.
747 [First implemented in 0.1.2.3-alpha.]
748 [In 0.2.0.9-alpha this switched from v2 directory style to v3]
750 "ns/all" -- Router status info (v3 directory style) for all ORs we
751 that the consensus has an opinion about, joined by newlines.
752 [First implemented in 0.1.2.3-alpha.]
753 [In 0.2.0.9-alpha this switched from v2 directory style to v3]
755 "ns/purpose/<purpose>" -- Router status info (v3 directory style)
756 for all ORs of this purpose. Mostly designed for /ns/purpose/bridge
758 [First implemented in 0.2.0.13-alpha.]
759 [In 0.2.0.9-alpha this switched from v2 directory style to v3]
760 [In versions before 0.4.1.1-alpha we set the Running flag on
761 bridges when /ns/purpose/bridge is accessed]
762 [In 0.4.1.1-alpha we set the Running flag on bridges when the
763 bridge networkstatus file is written to disk]
765 "desc/all-recent" -- the latest server descriptor for every router that
766 Tor knows about. (See md note about "desc/id" and "desc/name" above.)
768 "network-status" -- [Deprecated in 0.3.1.1-alpha, removed
771 "address-mappings/all"
772 "address-mappings/config"
773 "address-mappings/cache"
774 "address-mappings/control" -- a \r\n-separated list of address
775 mappings, each in the form of "from-address to-address expiry".
776 The 'config' key returns those address mappings set in the
777 configuration; the 'cache' key returns the mappings in the
778 client-side DNS cache; the 'control' key returns the mappings set
779 via the control interface; the 'all' target returns the mappings
780 set through any mechanism.
781 Expiry is formatted as with ADDRMAP events, except that "expiry" is
782 always a time in UTC or the string "NEVER"; see section 4.1.7.
783 First introduced in 0.2.0.3-alpha.
785 "addr-mappings/*" -- as for address-mappings/*, but without the
786 expiry portion of the value. Use of this value is deprecated
787 since 0.2.0.3-alpha; use address-mappings instead.
789 "address" -- the best guess at our external IP address. If we
790 have no guess, return a 551 error. (Added in 0.1.2.2-alpha)
794 the best guess at our respective external IPv4 or IPv6 address.
795 If we have no guess, return a 551 error. (Added in 0.4.5.1-alpha)
797 "fingerprint" -- the contents of the fingerprint file that Tor
798 writes as a relay, or a 551 if we're not a relay currently.
799 (Added in 0.1.2.3-alpha)
802 A series of lines as for a circuit status event. Each line is of
803 the form described in section 4.1.1, omitting the initial
804 "650 CIRC ". Note that clients must be ready to accept additional
805 arguments as described in section 4.1.
808 A series of lines as for a stream status event. Each is of the form:
809 StreamID SP StreamStatus SP CircuitID SP Target CRLF
812 A series of lines as for an OR connection status event. In Tor
813 0.1.2.2-alpha with feature VERBOSE_NAMES enabled and in Tor
814 0.2.2.1-alpha and later by default, each line is of the form:
815 LongName SP ORStatus CRLF
817 In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
818 VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, each line
820 ServerID SP ORStatus CRLF
823 A series of lines listing the currently chosen entry guards, if any.
824 In Tor 0.1.2.2-alpha with feature VERBOSE_NAMES enabled and in Tor
825 0.2.2.1-alpha and later by default, each line is of the form:
826 LongName SP Status [SP ISOTime] CRLF
828 In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
829 VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, each line
831 ServerID2 SP Status [SP ISOTime] CRLF
832 ServerID2 = Nickname / 40*HEXDIG
834 The definition of Status is the same for both:
835 Status = "up" / "never-connected" / "down" /
836 "unusable" / "unlisted"
838 [From 0.1.1.4-alpha to 0.1.1.10-alpha, entry-guards was called
839 "helper-nodes". Tor still supports calling "helper-nodes", but it
840 is deprecated and should not be used.]
842 [Older versions of Tor (before 0.1.2.x-final) generated 'down' instead
843 of unlisted/unusable. Between 0.1.2.x-final and 0.2.6.3-alpha,
844 'down' was never generated.]
846 [XXXX ServerID2 differs from ServerID in not prefixing fingerprints
847 with a $. This is an implementation error. It would be nice to add
848 the $ back in if we can do so without breaking compatibility.]
850 "traffic/read" -- Total bytes read (downloaded).
852 "traffic/written" -- Total bytes written (uploaded).
854 "uptime" -- Uptime of the Tor daemon (in seconds). Added in
858 "accounting/hibernating"
860 "accounting/bytes-left"
861 "accounting/interval-start"
862 "accounting/interval-wake"
863 "accounting/interval-end"
864 Information about accounting status. If accounting is enabled,
865 "enabled" is 1; otherwise it is 0. The "hibernating" field is "hard"
866 if we are accepting no data; "soft" if we're accepting no new
867 connections, and "awake" if we're not hibernating at all. The "bytes"
868 and "bytes-left" fields contain (read-bytes SP write-bytes), for the
869 start and the rest of the interval respectively. The 'interval-start'
870 and 'interval-end' fields are the borders of the current interval; the
871 'interval-wake' field is the time within the current interval (if any)
872 where we plan[ned] to start being active. The times are UTC.
875 A series of lines listing the available configuration options. Each is
877 OptionName SP OptionType [ SP Documentation ] CRLF
879 OptionType = "Integer" / "TimeInterval" / "TimeMsecInterval" /
880 "DataSize" / "Float" / "Boolean" / "Time" / "CommaList" /
881 "Dependent" / "Virtual" / "String" / "LineList"
883 Note: The incorrect spelling "Dependant" was used from the time this key
884 was introduced in Tor 0.1.1.4-alpha until it was corrected in Tor
885 0.3.0.2-alpha. It is recommended that clients accept both spellings.
888 A series of lines listing default values for each configuration
889 option. Options which don't have a valid default don't show up
890 in the list. Introduced in Tor 0.2.4.1-alpha.
891 OptionName SP OptionValue CRLF
896 A series of lines listing the available GETINFO options. Each is of
898 OptionName SP Documentation CRLF
899 OptionPrefix SP Documentation CRLF
900 OptionPrefix = OptionName "/*"
901 The OptionPrefix form indicates a number of options beginning with the
902 prefix. So if "config/*" is listed, other options beginning with
903 "config/" will work, but "config/*" itself is not an option.
906 A space-separated list of all the events supported by this version of
910 A space-separated list of all the features supported by this version
914 A space-separated list of all the values supported by the SIGNAL
917 "ip-to-country/ipv4-available"
918 "ip-to-country/ipv6-available"
919 "1" if the relevant geoip or geoip6 database is present; "0" otherwise.
920 This field was added in Tor 0.3.2.1-alpha.
923 Maps IP addresses to 2-letter country codes. For example,
924 "GETINFO ip-to-country/18.0.0.1" should give "US".
926 "process/pid" -- Process id belonging to the main tor process.
927 "process/uid" -- User id running the tor process, -1 if unknown (this is
928 unimplemented on Windows, returning -1).
929 "process/user" -- Username under which the tor process is running,
930 providing an empty string if none exists (this is unimplemented on
931 Windows, returning an empty string).
932 "process/descriptor-limit" -- Upper bound on the file descriptor limit, -1
935 "dir/status-vote/current/consensus" [added in Tor 0.2.1.6-alpha]
936 "dir/status-vote/current/consensus-microdesc" [added in Tor 0.4.3.1-alpha]
937 "dir/status/authority"
939 "dir/status/fp/<F1>+<F2>+<F3>"
942 "dir/server/fp/<F1>+<F2>+<F3>"
944 "dir/server/d/<D1>+<D2>+<D3>"
945 "dir/server/authority"
947 A series of lines listing directory contents, provided according to the
948 specification for the URLs listed in Section 4.4 of dir-spec.txt. Note
949 that Tor MUST NOT provide private information, such as descriptors for
950 routers not marked as general-purpose. When asked for 'authority'
951 information for which this Tor is not authoritative, Tor replies with
954 Note that, as of Tor 0.2.3.3-alpha, Tor clients don't download server
955 descriptors anymore, but microdescriptors. So, a "551 Servers
956 unavailable" reply to all "GETINFO dir/server/*" requests is actually
957 correct. If you have an old program which absolutely requires server
958 descriptors to work, try setting UseMicrodescriptors 0 or
959 FetchUselessDescriptors 1 in your client's torrc.
961 "status/circuit-established"
962 "status/enough-dir-info"
963 "status/good-server-descriptor"
964 "status/accepted-server-descriptor"
966 These provide the current internal Tor values for various Tor
967 states. See Section 4.1.10 for explanations. (Only a few of the
968 status events are available as getinfo's currently. Let us know if
969 you want more exposed.)
970 "status/reachability-succeeded/or"
971 0 or 1, depending on whether we've found our ORPort reachable.
972 "status/reachability-succeeded/dir"
973 0 or 1, depending on whether we've found our DirPort reachable.
974 1 if there is no DirPort, and therefore no need for a reachability
976 "status/reachability-succeeded"
977 "OR=" ("0"/"1") SP "DIR=" ("0"/"1")
978 Combines status/reachability-succeeded/*; controllers MUST ignore
979 unrecognized elements in this entry.
980 "status/bootstrap-phase"
981 Returns the most recent bootstrap phase status event
982 sent. Specifically, it returns a string starting with either
983 "NOTICE BOOTSTRAP ..." or "WARN BOOTSTRAP ...". Controllers should
984 use this getinfo when they connect or attach to Tor to learn its
985 current bootstrap state.
986 "status/version/recommended"
987 List of currently recommended versions.
988 "status/version/current"
989 Status of the current version. One of: new, old, unrecommended,
990 recommended, new in series, obsolete, unknown.
991 "status/clients-seen"
992 A summary of which countries we've seen clients from recently,
993 formatted the same as the CLIENTS_SEEN status event described in
994 Section 4.1.14. This GETINFO option is currently available only
996 "status/fresh-relay-descs"
997 Provides fresh server and extra-info descriptors for our relay. Note
998 this is *not* the latest descriptors we've published, but rather what we
999 would generate if we needed to make a new descriptor right now.
1003 A quoted, space-separated list of the locations where Tor is listening
1004 for connections of the specified type. These can contain IPv4
1007 "127.0.0.1:9050" "127.0.0.1:9051"
1009 ... or local unix sockets...
1011 "unix:/home/my_user/.tor/socket"
1013 ... or IPv6 network addresses:
1015 "[2001:0db8:7000:0000:0000:dead:beef:1234]:9050"
1017 [New in Tor 0.2.2.26-beta.]
1021 Listeners for OR connections. Talks Tor protocol as described in
1026 Listeners for Tor directory protocol, as described in dir-spec.txt.
1028 "net/listeners/socks"
1030 Listeners for onion proxy connections that talk SOCKS4/4a/5 protocol.
1032 "net/listeners/trans"
1034 Listeners for transparent connections redirected by firewall, such as
1037 "net/listeners/natd"
1039 Listeners for transparent connections redirected by natd.
1043 Listeners for a subset of DNS protocol that Tor network supports.
1045 "net/listeners/control"
1047 Listeners for Tor control protocol, described herein.
1049 "net/listeners/extor"
1051 Listeners corresponding to Extended ORPorts for integration with
1052 pluggable transports. See proposals 180 and 196.
1054 "net/listeners/httptunnel"
1056 Listeners for onion proxy connections that leverage HTTP CONNECT
1059 [The extor and httptunnel lists were added in 0.3.2.12, 0.3.3.10, and
1063 A newline-separated list of how many bytes we've served to answer
1064 each type of directory request. The format of each line is:
1065 Keyword 1*SP Integer 1*SP Integer
1066 where the first integer is the number of bytes written, and the second
1067 is the number of requests answered.
1069 [This feature was added in Tor 0.2.2.1-alpha, and removed in
1070 Tor 0.2.9.1-alpha. Even when it existed, it only provided
1071 useful output when the Tor client was built with either the
1072 INSTRUMENT_DOWNLOADS or RUNNING_DOXYGEN compile-time options.]
1075 A space-separated summary of recent BW events in chronological order
1076 from oldest to newest. Each event is represented by a comma-separated
1077 tuple of "R,W", R is the number of bytes read, and W is the number of
1078 bytes written. These entries each represent about one second's worth
1080 [New in Tor 0.2.6.3-alpha]
1082 "consensus/valid-after"
1083 "consensus/fresh-until"
1084 "consensus/valid-until"
1085 Each of these produces an ISOTime describing part of the lifetime of
1086 the current (valid, accepted) consensus that Tor has.
1087 [New in Tor 0.2.6.3-alpha]
1089 "hs/client/desc/id/<ADDR>"
1090 Prints the content of the hidden service descriptor corresponding to
1091 the given <ADDR> which is an onion address without the ".onion" part.
1092 The client's cache is queried to find the descriptor. The format of
1093 the descriptor is described in section 1.3 of the rend-spec.txt
1096 If <ADDR> is unrecognized or if not found in the cache, a 551 error is
1099 [New in Tor 0.2.7.1-alpha]
1100 [HS v3 support added 0.3.3.1-alpha]
1102 "hs/service/desc/id/<ADDR>"
1103 Prints the content of the hidden service descriptor corresponding to
1104 the given <ADDR> which is an onion address without the ".onion" part.
1105 The service's local descriptor cache is queried to find the descriptor.
1106 The format of the descriptor is described in section 1.3 of the
1107 rend-spec.txt document.
1109 If <ADDR> is unrecognized or if not found in the cache, a 551 error is
1112 [New in Tor 0.2.7.2-alpha]
1113 [HS v3 support added 0.3.3.1-alpha]
1117 A newline-separated list of the Onion ("Hidden") Services created
1118 via the "ADD_ONION" command. The 'current' key returns Onion Services
1119 belonging to the current control connection. The 'detached' key
1120 returns Onion Services detached from the parent control connection
1121 (as in, belonging to no control connection).
1122 The format of each line is:
1124 [New in Tor 0.2.7.1-alpha.]
1125 [HS v3 support added 0.3.3.1-alpha]
1128 The string "up" or "down", indicating whether we currently believe the
1129 network is reachable.
1132 The keys under downloads/ are used to query download statuses; they all
1133 return either a sequence of newline-terminated hex encoded digests, or
1134 a "serialized download status" as follows:
1136 SerializedDownloadStatus =
1137 -- when do we plan to next attempt to download this object?
1138 "next-attempt-at" SP ISOTime CRLF
1139 -- how many times have we failed since the last success?
1140 "n-download-failures" SP UInt CRLF
1141 -- how many times have we tried to download this?
1142 "n-download-attempts" SP UInt CRLF
1143 -- according to which schedule rule will we download this?
1144 "schedule" SP DownloadSchedule CRLF
1145 -- do we want to fetch this from an authority, or will any cache do?
1146 "want-authority" SP DownloadWantAuthority CRLF
1147 -- do we increase our download delay whenever we fail to fetch this,
1148 -- or whenever we attempt fetching this?
1149 "increment-on" SP DownloadIncrementOn CRLF
1150 -- do we increase the download schedule deterministically, or at
1152 "backoff" SP DownloadBackoff CRLF
1154 -- with an exponential backoff, where are we in the schedule?
1155 "last-backoff-position" Uint CRLF
1156 -- with an exponential backoff, what was our last delay?
1157 "last-delay-used UInt CRLF
1163 "DL_SCHED_GENERIC" / "DL_SCHED_CONSENSUS" / "DL_SCHED_BRIDGE"
1164 DownloadWantAuthority =
1165 "DL_WANT_ANY_DIRSERVER" / "DL_WANT_AUTHORITY"
1166 DownloadIncrementOn =
1167 "DL_SCHED_INCREMENT_FAILURE" / "DL_SCHED_INCREMENT_ATTEMPT"
1169 "DL_SCHED_DETERMINISTIC" / "DL_SCHED_RANDOM_EXPONENTIAL"
1171 The optional last two lines must be present if DownloadBackoff is
1172 "DL_SCHED_RANDOM_EXPONENTIAL" and must be absent if DownloadBackoff
1173 is "DL_SCHED_DETERMINISTIC".
1175 In detail, the keys supported are:
1177 "downloads/networkstatus/ns"
1178 The SerializedDownloadStatus for the NS-flavored consensus for
1179 whichever bootstrap state Tor is currently in.
1181 "downloads/networkstatus/ns/bootstrap"
1182 The SerializedDownloadStatus for the NS-flavored consensus at
1183 bootstrap time, regardless of whether we are currently bootstrapping.
1185 "downloads/networkstatus/ns/running"
1187 The SerializedDownloadStatus for the NS-flavored consensus when
1188 running, regardless of whether we are currently bootstrapping.
1190 "downloads/networkstatus/microdesc"
1191 The SerializedDownloadStatus for the microdesc-flavored consensus for
1192 whichever bootstrap state Tor is currently in.
1194 "downloads/networkstatus/microdesc/bootstrap"
1195 The SerializedDownloadStatus for the microdesc-flavored consensus at
1196 bootstrap time, regardless of whether we are currently bootstrapping.
1198 "downloads/networkstatus/microdesc/running"
1199 The SerializedDownloadStatus for the microdesc-flavored consensus when
1200 running, regardless of whether we are currently bootstrapping.
1202 "downloads/cert/fps"
1204 A newline-separated list of hex-encoded digests for authority
1205 certificates for which we have download status available.
1207 "downloads/cert/fp/<Fingerprint>"
1208 A SerializedDownloadStatus for the default certificate for the
1209 identity digest <Fingerprint> returned by the downloads/cert/fps key.
1211 "downloads/cert/fp/<Fingerprint>/sks"
1212 A newline-separated list of hex-encoded signing key digests for the
1213 authority identity digest <Fingerprint> returned by the
1214 downloads/cert/fps key.
1216 "downloads/cert/fp/<Fingerprint>/<SKDigest>"
1217 A SerializedDownloadStatus for the certificate for the identity
1218 digest <Fingerprint> returned by the downloads/cert/fps key and signing
1219 key digest <SKDigest> returned by the downloads/cert/fp/<Fingerprint>/
1222 "downloads/desc/descs"
1223 A newline-separated list of hex-encoded router descriptor digests
1224 [note, not identity digests - the Tor process may not have seen them
1225 yet while downloading router descriptors]. If the Tor process is not
1226 using a NS-flavored consensus, a 551 error is returned.
1228 "downloads/desc/<Digest>"
1229 A SerializedDownloadStatus for the router descriptor with digest
1230 <Digest> as returned by the downloads/desc/descs key. If the Tor
1231 process is not using a NS-flavored consensus, a 551 error is returned.
1233 "downloads/bridge/bridges"
1234 A newline-separated list of hex-encoded bridge identity digests. If
1235 the Tor process is not using bridges, a 551 error is returned.
1237 "downloads/bridge/<Digest>"
1238 A SerializedDownloadStatus for the bridge descriptor with identity
1239 digest <Digest> as returned by the downloads/bridge/bridges key. If
1240 the Tor process is not using bridges, a 551 error is returned.
1244 The current or previous shared random value, as received in the
1245 consensus, base-64 encoded. An empty value means that either
1246 the consensus has no shared random value, or Tor has no consensus.
1248 "current-time/local"
1250 The current system or UTC time, as returned by the system, in ISOTime2
1251 format. (Introduced in 0.3.4.1-alpha.)
1253 "stats/ntor/requested"
1254 "stats/ntor/assigned"
1255 The NTor circuit onion handshake rephist values which are requested or
1256 assigned. (Introduced in 0.4.5.1-alpha)
1258 "stats/tap/requested"
1259 "stats/tap/assigned"
1260 The TAP circuit onion handshake rephist values which are requested or
1261 assigned. (Introduced in 0.4.5.1-alpha)
1263 "config-can-saveconf"
1264 0 or 1, depending on whether it is possible to use SAVECONF without the
1265 FORCE flag. (Introduced in 0.3.1.1-alpha.)
1267 "limits/max-mem-in-queues"
1268 The amount of memory that Tor's out-of-memory checker will allow
1269 Tor to allocate (in places it can see) before it starts freeing memory
1270 and killing circuits. See the MaxMemInQueues option for more
1271 details. Unlike the option, this value reflects Tor's actual limit, and
1272 may be adjusted depending on the available system memory rather than on
1273 the MaxMemInQueues option. (Introduced in 0.2.5.4-alpha)
1277 C: GETINFO version desc/name/moria1
1278 S: 250+desc/name/moria=
1279 S: [Descriptor for moria]
1281 S: 250-version=Tor 0.1.1.0-alpha-cvs
1286 Sent from the client to the server. The format is:
1288 "EXTENDCIRCUIT" SP CircuitID
1289 [SP ServerSpec *("," ServerSpec)]
1290 [SP "purpose=" Purpose] CRLF
1292 This request takes one of two forms: either the CircuitID is zero, in
1293 which case it is a request for the server to build a new circuit,
1294 or the CircuitID is nonzero, in which case it is a request for the
1295 server to extend an existing circuit with that ID according to the
1298 If the CircuitID is 0, the controller has the option of providing
1299 a path for Tor to use to build the circuit. If it does not provide
1300 a path, Tor will select one automatically from high capacity nodes
1301 according to path-spec.txt.
1303 If CircuitID is 0 and "purpose=" is specified, then the circuit's
1304 purpose is set. Two choices are recognized: "general" and
1305 "controller". If not specified, circuits are created as "general".
1307 If the request is successful, the server sends a reply containing a
1308 message body consisting of the CircuitID of the (maybe newly created)
1309 circuit. The syntax is "250" SP "EXTENDED" SP CircuitID CRLF.
1311 3.11. SETCIRCUITPURPOSE
1313 Sent from the client to the server. The format is:
1315 "SETCIRCUITPURPOSE" SP CircuitID SP "purpose=" Purpose CRLF
1317 This changes the circuit's purpose. See EXTENDCIRCUIT above for details.
1319 3.12. SETROUTERPURPOSE
1321 Sent from the client to the server. The format is:
1323 "SETROUTERPURPOSE" SP NicknameOrKey SP Purpose CRLF
1325 This changes the descriptor's purpose. See +POSTDESCRIPTOR below
1328 NOTE: This command was disabled and made obsolete as of Tor
1329 0.2.0.8-alpha. It doesn't exist anymore, and is listed here only for
1330 historical interest.
1334 Sent from the client to the server. The syntax is:
1336 "ATTACHSTREAM" SP StreamID SP CircuitID [SP "HOP=" HopNum] CRLF
1338 This message informs the server that the specified stream should be
1339 associated with the specified circuit. Each stream may be associated with
1340 at most one circuit, and multiple streams may share the same circuit.
1341 Streams can only be attached to completed circuits (that is, circuits that
1342 have sent a circuit status 'BUILT' event or are listed as built in a
1343 GETINFO circuit-status request).
1345 If the circuit ID is 0, responsibility for attaching the given stream is
1348 If HOP=HopNum is specified, Tor will choose the HopNumth hop in the
1349 circuit as the exit node, rather than the last node in the circuit.
1350 Hops are 1-indexed; generally, it is not permitted to attach to hop 1.
1352 Tor responds with "250 OK" if it can attach the stream, 552 if the
1353 circuit or stream didn't exist, 555 if the stream isn't in an
1354 appropriate state to be attached (e.g. it's already open), or 551 if
1355 the stream couldn't be attached for another reason.
1357 {Implementation note: Tor will close unattached streams by itself,
1358 roughly two minutes after they are born. Let the developers know if
1359 that turns out to be a problem.}
1361 {Implementation note: By default, Tor automatically attaches streams to
1362 circuits itself, unless the configuration variable
1363 "__LeaveStreamsUnattached" is set to "1". Attempting to attach streams
1364 via TC when "__LeaveStreamsUnattached" is false may cause a race between
1365 Tor and the controller, as both attempt to attach streams to circuits.}
1367 {Implementation note: You can try to attachstream to a stream that
1368 has already sent a connect or resolve request but hasn't succeeded
1369 yet, in which case Tor will detach the stream from its current circuit
1370 before proceeding with the new attach request.}
1372 3.14. POSTDESCRIPTOR
1374 Sent from the client to the server. The syntax is:
1376 "+POSTDESCRIPTOR" [SP "purpose=" Purpose] [SP "cache=" Cache]
1377 CRLF Descriptor CRLF "." CRLF
1379 This message informs the server about a new descriptor. If Purpose is
1380 specified, it must be either "general", "controller", or "bridge",
1381 else we return a 552 error. The default is "general".
1383 If Cache is specified, it must be either "no" or "yes", else we
1384 return a 552 error. If Cache is not specified, Tor will decide for
1385 itself whether it wants to cache the descriptor, and controllers
1386 must not rely on its choice.
1388 The descriptor, when parsed, must contain a number of well-specified
1389 fields, including fields for its nickname and identity.
1391 If there is an error in parsing the descriptor, the server must send a
1392 "554 Invalid descriptor" reply. If the descriptor is well-formed but
1393 the server chooses not to add it, it must reply with a 251 message
1394 whose body explains why the server was not added. If the descriptor
1395 is added, Tor replies with "250 OK".
1397 3.15. REDIRECTSTREAM
1399 Sent from the client to the server. The syntax is:
1401 "REDIRECTSTREAM" SP StreamID SP Address [SP Port] CRLF
1403 Tells the server to change the exit address on the specified stream. If
1404 Port is specified, changes the destination port as well. No remapping
1405 is performed on the new provided address.
1407 To be sure that the modified address will be used, this event must be sent
1408 after a new stream event is received, and before attaching this stream to
1411 Tor replies with "250 OK" on success.
1415 Sent from the client to the server. The syntax is:
1417 "CLOSESTREAM" SP StreamID SP Reason *(SP Flag) CRLF
1419 Tells the server to close the specified stream. The reason should be one
1420 of the Tor RELAY_END reasons given in tor-spec.txt, as a decimal. Flags is
1421 not used currently; Tor servers SHOULD ignore unrecognized flags. Tor may
1422 hold the stream open for a while to flush any data that is pending.
1424 Tor replies with "250 OK" on success, or a 512 if there aren't enough
1425 arguments, or a 552 if it doesn't recognize the StreamID or reason.
1431 "CLOSECIRCUIT" SP CircuitID *(SP Flag) CRLF
1434 Tells the server to close the specified circuit. If "IfUnused" is
1435 provided, do not close the circuit unless it is unused.
1437 Other flags may be defined in the future; Tor SHOULD ignore unrecognized
1440 Tor replies with "250 OK" on success, or a 512 if there aren't enough
1441 arguments, or a 552 if it doesn't recognize the CircuitID.
1445 Tells the server to hang up on this controller connection. This command
1446 can be used before authenticating.
1450 Adding additional features to the control protocol sometimes will break
1451 backwards compatibility. Initially such features are added into Tor and
1452 disabled by default. USEFEATURE can enable these additional features.
1456 "USEFEATURE" *(SP FeatureName) CRLF
1457 FeatureName = 1*(ALPHA / DIGIT / "_" / "-")
1459 Feature names are case-insensitive.
1461 Once enabled, a feature stays enabled for the duration of the connection
1462 to the controller. A new connection to the controller must be opened to
1463 disable an enabled feature.
1465 Features are a forward-compatibility mechanism; each feature will eventually
1466 become a standard part of the control protocol. Once a feature becomes part
1467 of the protocol, it is always-on. Each feature documents the version it was
1468 introduced as a feature and the version in which it became part of the
1471 Tor will ignore a request to use any feature that is always-on. Tor will give
1472 a 552 error in response to an unrecognized feature.
1476 Same as passing 'EXTENDED' to SETEVENTS; this is the preferred way to
1477 request the extended event syntax.
1479 This feature was first introduced in 0.1.2.3-alpha. It is always-on
1480 and part of the protocol in Tor 0.2.2.1-alpha and later.
1484 Replaces ServerID with LongName in events and GETINFO results. LongName
1485 provides a Fingerprint for all routers, an indication of Named status,
1486 and a Nickname if one is known. LongName is strictly more informative
1487 than ServerID, which only provides either a Fingerprint or a Nickname.
1489 This feature was first introduced in 0.1.2.2-alpha. It is always-on and
1490 part of the protocol in Tor 0.2.2.1-alpha and later.
1496 "RESOLVE" *Option *Address CRLF
1497 Option = "mode=reverse"
1498 Address = a hostname or IPv4 address
1500 This command launches a remote hostname lookup request for every specified
1501 request (or reverse lookup if "mode=reverse" is specified). Note that the
1502 request is done in the background: to see the answers, your controller will
1503 need to listen for ADDRMAP events; see 4.1.7 below.
1505 [Added in Tor 0.2.0.3-alpha]
1511 "PROTOCOLINFO" *(SP PIVERSION) CRLF
1513 The server reply format is:
1515 "250-PROTOCOLINFO" SP PIVERSION CRLF *InfoLine "250 OK" CRLF
1517 InfoLine = AuthLine / VersionLine / OtherLine
1519 AuthLine = "250-AUTH" SP "METHODS=" AuthMethod *("," AuthMethod)
1520 *(SP "COOKIEFILE=" AuthCookieFile) CRLF
1521 VersionLine = "250-VERSION" SP "Tor=" TorVersion OptArguments CRLF
1524 "NULL" / ; No authentication is required
1525 "HASHEDPASSWORD" / ; A controller must supply the original password
1526 "COOKIE" / ; ... or supply the contents of a cookie file
1527 "SAFECOOKIE" ; ... or prove knowledge of a cookie file's contents
1529 AuthCookieFile = QuotedString
1530 TorVersion = QuotedString
1532 OtherLine = "250-" Keyword OptArguments CRLF
1536 This command tells the controller what kinds of authentication are
1539 Tor MAY give its InfoLines in any order; controllers MUST ignore InfoLines
1540 with keywords they do not recognize. Controllers MUST ignore extraneous
1541 data on any InfoLine.
1543 PIVERSION is there in case we drastically change the syntax one day. For
1544 now it should always be "1". Controllers MAY provide a list of the
1545 protocolinfo versions they support; Tor MAY select a version that the
1546 controller does not support.
1548 AuthMethod is used to specify one or more control authentication
1549 methods that Tor currently accepts.
1551 AuthCookieFile specifies the absolute path and filename of the
1552 authentication cookie that Tor is expecting and is provided iff the
1553 METHODS field contains the method "COOKIE" and/or "SAFECOOKIE".
1554 Controllers MUST handle escape sequences inside this string.
1556 All authentication cookies are 32 bytes long. Controllers MUST NOT
1557 use the contents of a non-32-byte-long file as an authentication
1560 If the METHODS field contains the method "SAFECOOKIE", every
1561 AuthCookieFile must contain the same authentication cookie.
1563 The COOKIE authentication method exposes the user running a
1564 controller to an unintended information disclosure attack whenever
1565 the controller has greater filesystem read access than the process
1566 that it has connected to. (Note that a controller may connect to a
1567 process other than Tor.) It is almost never safe to use, even if
1568 the controller's user has explicitly specified which filename to
1569 read an authentication cookie from. For this reason, the COOKIE
1570 authentication method has been deprecated and will be removed from
1571 a future version of Tor.
1573 The VERSION line contains the Tor version.
1575 [Unlike other commands besides AUTHENTICATE, PROTOCOLINFO may be used (but
1576 only once!) before AUTHENTICATE.]
1578 [PROTOCOLINFO was not supported before Tor 0.2.0.5-alpha.]
1584 "+LOADCONF" CRLF ConfigText CRLF "." CRLF
1586 This command allows a controller to upload the text of a config file
1587 to Tor over the control port. This config file is then loaded as if
1588 it had been read from disk.
1590 [LOADCONF was added in Tor 0.2.1.1-alpha.]
1596 "TAKEOWNERSHIP" CRLF
1598 This command instructs Tor to shut down when this control
1599 connection is closed. This command affects each control connection
1600 that sends it independently; if multiple control connections send
1601 the TAKEOWNERSHIP command to a Tor instance, Tor will shut down when
1602 any of those connections closes.
1604 (As of Tor 0.2.5.2-alpha, Tor does not wait a while for circuits to
1605 close when shutting down because of an exiting controller. If you
1606 want to ensure a clean shutdown--and you should!--then send "SIGNAL
1607 SHUTDOWN" and wait for the Tor process to close.)
1609 This command is intended to be used with the
1610 __OwningControllerProcess configuration option. A controller that
1611 starts a Tor process which the user cannot easily control or stop
1612 should 'own' that Tor process:
1614 * When starting Tor, the controller should specify its PID in an
1615 __OwningControllerProcess on Tor's command line. This will
1616 cause Tor to poll for the existence of a process with that PID,
1617 and exit if it does not find such a process. (This is not a
1618 completely reliable way to detect whether the 'owning
1619 controller' is still running, but it should work well enough in
1622 * Once the controller has connected to Tor's control port, it
1623 should send the TAKEOWNERSHIP command along its control
1624 connection. At this point, *both* the TAKEOWNERSHIP command and
1625 the __OwningControllerProcess option are in effect: Tor will
1626 exit when the control connection ends *and* Tor will exit if it
1627 detects that there is no process with the PID specified in the
1628 __OwningControllerProcess option.
1630 * After the controller has sent the TAKEOWNERSHIP command, it
1631 should send "RESETCONF __OwningControllerProcess" along its
1632 control connection. This will cause Tor to stop polling for the
1633 existence of a process with its owning controller's PID; Tor
1634 will still exit when the control connection ends.
1636 [TAKEOWNERSHIP was added in Tor 0.2.2.28-beta.]
1642 "AUTHCHALLENGE" SP "SAFECOOKIE"
1646 ClientNonce = 2*HEXDIG / QuotedString
1648 This command is used to begin the authentication routine for the
1649 SAFECOOKIE method of authentication.
1651 If the server accepts the command, the server reply format is:
1654 SP "SERVERHASH=" ServerHash
1655 SP "SERVERNONCE=" ServerNonce
1658 ServerHash = 64*64HEXDIG
1659 ServerNonce = 64*64HEXDIG
1661 The ClientNonce, ServerHash, and ServerNonce values are
1662 encoded/decoded in the same way as the argument passed to the
1663 AUTHENTICATE command. ServerNonce MUST be 32 bytes long.
1665 ServerHash is computed as:
1667 HMAC-SHA256("Tor safe cookie authentication server-to-controller hash",
1668 CookieString | ClientNonce | ServerNonce)
1670 (with the HMAC key as its first argument)
1672 After a controller sends a successful AUTHCHALLENGE command, the
1673 next command sent on the connection must be an AUTHENTICATE command,
1674 and the only authentication string which that AUTHENTICATE command
1677 HMAC-SHA256("Tor safe cookie authentication controller-to-server hash",
1678 CookieString | ClientNonce | ServerNonce)
1680 [Unlike other commands besides AUTHENTICATE, AUTHCHALLENGE may be
1681 used (but only once!) before AUTHENTICATE.]
1683 [AUTHCHALLENGE was added in Tor 0.2.3.13-alpha.]
1691 Tells the server to drop all guard nodes. Do not invoke this command
1692 lightly; it can increase vulnerability to tracking attacks over time.
1694 Tor replies with "250 OK" on success.
1696 [DROPGUARDS was added in Tor 0.2.5.2-alpha.]
1702 "HSFETCH" SP (HSAddress / "v" Version "-" DescId)
1703 *[SP "SERVER=" Server] CRLF
1705 HSAddress = 16*Base32Character / 56*Base32Character
1707 DescId = 32*Base32Character
1710 This command launches hidden service descriptor fetch(es) for the given
1711 HSAddress or DescId.
1713 HSAddress can be version 2 or version 3 addresses. DescIDs can only be
1714 version 2 IDs. Version 2 addresses consist of 16*Base32Character and
1715 version 3 addresses consist of 56*Base32Character.
1717 If a DescId is specified, at least one Server MUST also be provided,
1718 otherwise a 512 error is returned. If no DescId and Server(s) are specified,
1719 it behaves like a normal Tor client descriptor fetch. If one or more
1720 Server are given, they are used instead triggering a fetch on each of them
1723 The caching behavior when fetching a descriptor using this command is
1724 identical to normal Tor client behavior.
1726 Details on how to compute a descriptor id (DescId) can be found in
1727 rend-spec.txt section 1.3.
1729 If any values are unrecognized, a 513 error is returned and the command is
1730 stopped. On success, Tor replies "250 OK" then Tor MUST eventually follow
1731 this with both a HS_DESC and HS_DESC_CONTENT events with the results. If
1732 SERVER is specified then events are emitted for each location.
1736 C: HSFETCH v2-gezdgnbvgy3tqolbmjrwizlgm5ugs2tl
1737 SERVER=9695DFC35FFEB861329B9F1AB04C46397020CE31
1740 C: HSFETCH ajkhdsfuygaesfaa
1743 C: HSFETCH vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd
1746 [HSFETCH was added in Tor 0.2.7.1-alpha]
1747 [HS v3 support added 0.4.1.1-alpha]
1753 "ADD_ONION" SP KeyType ":" KeyBlob
1754 [SP "Flags=" Flag *("," Flag)]
1755 [SP "MaxStreams=" NumStreams]
1756 1*(SP "Port=" VirtPort ["," Target])
1757 *(SP "ClientAuth=" ClientName [":" ClientBlob]) CRLF
1758 *(SP "ClientAuthV3=" V3Key) CRLF
1761 "NEW" / ; The server should generate a key of algorithm KeyBlob
1762 "RSA1024" / ; The server should use the 1024 bit RSA key provided
1764 "ED25519-V3"; The server should use the ed25519 v3 key provided in as
1768 "BEST" / ; The server should generate a key using the "best"
1769 supported algorithm (KeyType == "NEW").
1770 [As of 0.4.2.3-alpha, ED25519-V3 is used]
1771 "RSA1024" / ; The server should generate a 1024 bit RSA key
1772 (KeyType == "NEW") (v2).
1773 "ED25519-V3"; The server should generate an ed25519 private key
1774 (KeyType == "NEW") (v3).
1775 String ; A serialized private key (without whitespace)
1778 "DiscardPK" / ; The server should not include the newly generated
1779 private key as part of the response.
1780 "Detach" / ; Do not associate the newly created Onion Service
1781 to the current control connection.
1782 "BasicAuth" / ; Client authorization is required using the "basic"
1784 "V3Auth" / ; Version 3 client authorization is required (v3 only).
1786 "NonAnonymous" /; Add a non-anonymous Single Onion Service. Tor
1787 checks this flag matches its configured hidden
1788 service anonymity mode.
1789 "MaxStreamsCloseCircuit"; Close the circuit is the maximum streams
1792 NumStreams = A value between 0 and 65535 which is used as the maximum
1793 streams that can be attached on a rendezvous circuit. Setting
1794 it to 0 means unlimited which is also the default behavior.
1796 VirtPort = The virtual TCP Port for the Onion Service (As in the
1797 HiddenServicePort "VIRTPORT" argument).
1799 Target = The (optional) target for the given VirtPort (As in the
1800 optional HiddenServicePort "TARGET" argument).
1802 ClientName = An identifier 1 to 16 characters long, using only
1803 characters in A-Za-z0-9+-_ (no spaces) (v2 only).
1805 ClientBlob = Authorization data for the client, in an opaque format
1806 specific to the authorization method (v2 only).
1808 V3Key = The client's base32-encoded x25519 public key, using only the key
1809 part of rend-spec-v3.txt section G.1.2 (v3 only).
1811 The server reply format is:
1813 "250-ServiceID=" ServiceID CRLF
1814 ["250-PrivateKey=" KeyType ":" KeyBlob CRLF]
1815 *("250-ClientAuth=" ClientName ":" ClientBlob CRLF)
1818 ServiceID = The Onion Service address without the trailing ".onion"
1821 Tells the server to create a new Onion ("Hidden") Service, with the
1822 specified private key and algorithm. If a KeyType of "NEW" is selected,
1823 the server will generate a new keypair using the selected algorithm.
1824 The "Port" argument's VirtPort and Target values have identical
1825 semantics to the corresponding HiddenServicePort configuration values.
1827 The server response will only include a private key if the server was
1828 requested to generate a new keypair, and also the "DiscardPK" flag was
1829 not specified. (Note that if "DiscardPK" flag is specified, there is no
1830 way to recreate the generated keypair and the corresponding Onion
1831 Service at a later date).
1833 If client authorization is enabled using the "BasicAuth" flag (which is v2
1834 only), the service will not be accessible to clients without valid
1835 authorization data (configured with the "HidServAuth" option). The list of
1836 authorized clients is specified with one or more "ClientAuth" parameters.
1837 If "ClientBlob" is not specified for a client, a new credential will be
1838 randomly generated and returned.
1840 Tor instances can either be in anonymous hidden service mode, or
1841 non-anonymous single onion service mode. All hidden services on the same
1842 tor instance have the same anonymity. To guard against unexpected loss
1843 of anonymity, Tor checks that the ADD_ONION "NonAnonymous" flag matches
1844 the current hidden service anonymity mode. The hidden service anonymity
1845 mode is configured using the Tor options HiddenServiceSingleHopMode and
1846 HiddenServiceNonAnonymousMode. If both these options are 1, the
1847 "NonAnonymous" flag must be provided to ADD_ONION. If both these options
1848 are 0 (the Tor default), the flag must NOT be provided.
1850 Once created the new Onion Service will remain active until either the
1851 Onion Service is removed via "DEL_ONION", the server terminates, or the
1852 control connection that originated the "ADD_ONION" command is closed.
1853 It is possible to override disabling the Onion Service on control
1854 connection close by specifying the "Detach" flag.
1856 It is the Onion Service server application's responsibility to close
1857 existing client connections if desired after the Onion Service is
1860 (The KeyBlob format is left intentionally opaque, however for "RSA1024"
1861 keys it is currently the Base64 encoded DER representation of a PKCS#1
1862 RSAPrivateKey, with all newlines removed. For a "ED25519-V3" key is
1863 the Base64 encoding of the concatenation of the 32-byte ed25519 secret
1864 scalar in little-endian and the 32-byte ed25519 PRF secret.)
1866 [Note: The ED25519-V3 format is not the same as, e.g., SUPERCOP
1867 ed25519/ref, which stores the concatenation of the 32-byte ed25519
1868 hash seed concatenated with the 32-byte public key, and which derives
1869 the secret scalar and PRF secret by expanding the hash seed with
1870 SHA-512. Our key blinding scheme is incompatible with storing
1871 private keys as seeds, so we store the secret scalar alongside the
1872 PRF secret, and just pay the cost of recomputing the public key when
1873 importing an ED25519-V3 key.]
1877 C: ADD_ONION NEW:BEST Flags=DiscardPK Port=80
1878 S: 250-ServiceID=exampleoniont2pqglbny66wpovyvao3ylc23eileodtevc4b75ikpad
1881 C: ADD_ONION RSA1024:[Blob Redacted] Port=80,192.168.1.1:8080
1882 S: 250-ServiceID=sampleonion12456
1885 C: ADD_ONION NEW:BEST Port=22 Port=80,8080
1886 S: 250-ServiceID=sampleonion4t2pqglbny66wpovyvao3ylc23eileodtevc4b75ikpad
1887 S: 250-PrivateKey=ED25519-V3:[Blob Redacted]
1890 C: ADD_ONION NEW:RSA1024 Flags=DiscardPK,BasicAuth Port=22
1891 ClientAuth=alice:[Blob Redacted] ClientAuth=bob
1892 S: 250-ServiceID=testonion1234567
1893 S: 250-ClientAuth=bob:[Blob Redacted]
1896 C: ADD_ONION NEW:ED25519-V3 ClientAuthV3=[Blob Redacted] Port=22
1897 S: 250-ServiceID=n35etu3yjxrqjpntmfziom5sjwspoydchmelc4xleoy4jk2u4lziz2yd
1898 S: 250-ClientAuthV3=[Blob Redacted]
1901 Examples with Tor in anonymous onion service mode:
1903 C: ADD_ONION NEW:BEST Flags=DiscardPK Port=22
1904 S: 250-ServiceID=exampleoniont2pqglbny66wpovyvao3ylc23eileodtevc4b75ikpad
1907 C: ADD_ONION NEW:BEST Flags=DiscardPK,NonAnonymous Port=22
1908 S: 512 Tor is in anonymous hidden service mode
1910 Examples with Tor in non-anonymous onion service mode:
1912 C: ADD_ONION NEW:BEST Flags=DiscardPK Port=22
1913 S: 512 Tor is in non-anonymous hidden service mode
1915 C: ADD_ONION NEW:BEST Flags=DiscardPK,NonAnonymous Port=22
1916 S: 250-ServiceID=exampleoniont2pqglbny66wpovyvao3ylc23eileodtevc4b75ikpad
1919 [ADD_ONION was added in Tor 0.2.7.1-alpha.]
1920 [MaxStreams and MaxStreamsCloseCircuit were added in Tor 0.2.7.2-alpha]
1921 [ClientAuth was added in Tor 0.2.9.1-alpha. It is v2 only.]
1922 [NonAnonymous was added in Tor 0.2.9.3-alpha.]
1923 [HS v3 support added 0.3.3.1-alpha]
1924 [ClientV3Auth support added 0.4.6.1-alpha]
1930 "DEL_ONION" SP ServiceID CRLF
1932 ServiceID = The Onion Service address without the trailing ".onion"
1935 Tells the server to remove an Onion ("Hidden") Service, that was
1936 previously created via an "ADD_ONION" command. It is only possible to
1937 remove Onion Services that were created on the same control connection
1938 as the "DEL_ONION" command, and those that belong to no control
1939 connection in particular (The "Detach" flag was specified at creation).
1941 If the ServiceID is invalid, or is neither owned by the current control
1942 connection nor a detached Onion Service, the server will return a 552.
1944 It is the Onion Service server application's responsibility to close
1945 existing client connections if desired after the Onion Service has been
1946 removed via "DEL_ONION".
1948 Tor replies with "250 OK" on success, or a 512 if there are an invalid
1949 number of arguments, or a 552 if it doesn't recognize the ServiceID.
1951 [DEL_ONION was added in Tor 0.2.7.1-alpha.]
1952 [HS v3 support added 0.3.3.1-alpha]
1958 "+HSPOST" *[SP "SERVER=" Server] [SP "HSADDRESS=" HSAddress]
1959 CRLF Descriptor CRLF "." CRLF
1962 HSAddress = 56*Base32Character
1963 Descriptor = The text of the descriptor formatted as specified
1964 in rend-spec.txt section 1.3.
1966 The "HSAddress" key is optional and only applies for v3 descriptors. A 513
1967 error is returned if used with v2.
1969 This command launches a hidden service descriptor upload to the specified
1970 HSDirs. If one or more Server arguments are provided, an upload is triggered
1971 on each of them in parallel. If no Server options are provided, it behaves
1972 like a normal HS descriptor upload and will upload to the set of responsible
1975 If any value is unrecognized, a 552 error is returned and the command is
1976 stopped. If there is an error in parsing the descriptor, the server
1977 must send a "554 Invalid descriptor" reply.
1979 On success, Tor replies "250 OK" then Tor MUST eventually follow
1980 this with a HS_DESC event with the result for each upload location.
1984 C: +HSPOST SERVER=9695DFC35FFEB861329B9F1AB04C46397020CE31
1989 [HSPOST was added in Tor 0.2.7.1-alpha]
1991 3.30. ONION_CLIENT_AUTH_ADD
1995 "ONION_CLIENT_AUTH_ADD" SP HSAddress
1996 SP KeyType ":" PrivateKeyBlob
1997 [SP "ClientName=" Nickname]
1998 [SP "Flags=" TYPE] CRLF
2000 HSAddress = 56*Base32Character
2001 KeyType = "x25519" is the only one supported right now
2002 PrivateKeyBlob = base64 encoding of x25519 key
2004 Tells the connected Tor to add client-side v3 client auth credentials for the
2005 onion service with "HSAddress". The "PrivateKeyBlob" is the x25519 private
2006 key that should be used for this client, and "Nickname" is an optional
2007 nickname for the client.
2009 FLAGS is a comma-separated tuple of flags for this new client. For now, the
2010 currently supported flags are:
2012 "Permanent" - This client's credentials should be stored in the filesystem.
2013 If this is not set, the client's credentials are ephemeral
2014 and stored in memory.
2016 If client auth credentials already existed for this service, replace them
2019 If Tor has cached onion service descriptors that it has been unable to
2020 decrypt in the past (due to lack of client auth credentials), attempt to
2021 decrypt those descriptors as soon as this command succeeds.
2023 On success, "250 OK" is returned. Otherwise, the following error codes exist:
2025 251 - Client auth credentials for this onion service already existed and replaced.
2026 252 - Added client auth credentials and successfully decrypted a cached descriptor.
2027 451 - We reached authorized client capacity
2028 512 - Syntax error in "HSAddress", or "PrivateKeyBlob" or "Nickname"
2029 551 - Client with with this "Nickname" already exists
2030 552 - Unrecognized KeyType
2032 [ONION_CLIENT_AUTH_ADD was added in Tor 0.4.3.1-alpha]
2034 3.31. ONION_CLIENT_AUTH_REMOVE
2038 "ONION_CLIENT_AUTH_REMOVE" SP HSAddress
2040 KeyType = "x25519" is the only one supported right now
2042 Tells the connected Tor to remove the client-side v3 client auth credentials
2043 for the onion service with "HSAddress".
2045 On success "250 OK" is returned. Otherwise, the following error codes exist:
2047 512 - Syntax error in "HSAddress".
2048 251 - Client credentials for "HSAddress" did not exist.
2050 [ONION_CLIENT_AUTH_REMOVE was added in Tor 0.4.3.1-alpha]
2052 3.32. ONION_CLIENT_AUTH_VIEW
2056 "ONION_CLIENT_AUTH_VIEW" [SP HSAddress] CRLF
2058 Tells the connected Tor to list all the stored client-side v3 client auth
2059 credentials for "HSAddress". If no "HSAddress" is provided, list all the
2060 stored client-side v3 client auth credentials.
2062 The server reply format is:
2064 "250-ONION_CLIENT_AUTH_VIEW" [SP HSAddress] CRLF
2065 *("250-CLIENT" SP HSAddress SP KeyType ":" PrivateKeyBlob
2066 [SP "ClientName=" Nickname]
2067 [SP "Flags=" FLAGS] CRLF)
2070 HSAddress = The onion address under which this credential is stored
2071 KeyType = "x25519" is the only one supported right now
2072 PrivateKeyBlob = base64 encoding of x25519 key
2074 "Nickname" is an optional nickname for this client, which can be set either
2075 through the ONION_CLIENT_AUTH_ADD command, or it's the filename of this
2076 client if the credentials are stored in the filesystem.
2078 FLAGS is a comma-separated field of flags for this client, the currently
2079 supported flags are:
2081 "Permanent" - This client's credentials are stored in the filesystem.
2083 On success "250 OK" is returned. Otherwise, the following error codes exist:
2085 512 - Syntax error in "HSAddress".
2087 [ONION_CLIENT_AUTH_VIEW was added in Tor 0.4.3.1-alpha]
2093 "DROPOWNERSHIP" CRLF
2095 This command instructs Tor to relinquish ownership of its control
2096 connection. As such tor will not shut down when this control
2097 connection is closed.
2099 This method is idempotent. If the control connection does not
2100 already have ownership this method returns successfully, and
2103 The controller can call TAKEOWNERSHIP again to re-establish
2106 [DROPOWNERSHIP was added in Tor 0.4.0.0-alpha]
2113 Tells the server to drop all circuit build times. Do not invoke this command
2114 lightly; it can increase vulnerability to tracking attacks over time.
2116 Tor replies with "250 OK" on success. Tor also emits the BUILDTIMEOUT_SET
2117 RESET event right after this "250 OK".
2119 [DROPTIMEOUTS was added in Tor 0.4.5.0-alpha.]
2123 Reply codes follow the same 3-character format as used by SMTP, with the
2124 first character defining a status, the second character defining a
2125 subsystem, and the third designating fine-grained information.
2127 The TC protocol currently uses the following first characters:
2129 2yz Positive Completion Reply
2130 The command was successful; a new request can be started.
2132 4yz Temporary Negative Completion reply
2133 The command was unsuccessful but might be reattempted later.
2135 5yz Permanent Negative Completion Reply
2136 The command was unsuccessful; the client should not try exactly
2137 that sequence of commands again.
2139 6yz Asynchronous Reply
2140 Sent out-of-order in response to an earlier SETEVENTS command.
2142 The following second characters are used:
2145 Sent in response to ill-formed or nonsensical commands.
2148 Refers to operations of the Tor Control protocol.
2151 Refers to actual operations of Tor system.
2153 The following codes are defined:
2156 251 Operation was unnecessary
2157 [Tor has declined to perform the operation, but no harm was done.]
2159 451 Resource exhausted
2161 500 Syntax error: protocol
2163 510 Unrecognized command
2164 511 Unimplemented command
2165 512 Syntax error in command argument
2166 513 Unrecognized command argument
2167 514 Authentication required
2168 515 Bad authentication
2170 550 Unspecified Tor error
2173 [Something went wrong inside Tor, so that the client's
2174 request couldn't be fulfilled.]
2176 552 Unrecognized entity
2177 [A configuration key, a stream ID, circuit ID, event,
2178 mentioned in the command did not actually exist.]
2180 553 Invalid configuration value
2181 [The client tried to set a configuration option to an
2182 incorrect, ill-formed, or impossible value.]
2184 554 Invalid descriptor
2186 555 Unmanaged entity
2188 650 Asynchronous event notification
2190 Unless specified to have specific contents, the human-readable messages
2191 in error replies should not be relied upon to match those in this document.
2193 4.1. Asynchronous events
2195 These replies can be sent after a corresponding SETEVENTS command has been
2196 received. They will not be interleaved with other Reply elements, but they
2197 can appear between a command and its corresponding reply. For example,
2198 this sequence is possible:
2202 C: GETCONF SOCKSPORT ORPORT
2203 S: 650 CIRC 1000 EXTENDED moria1,moria2
2204 S: 250-SOCKSPORT=9050
2207 But this sequence is disallowed:
2211 C: GETCONF SOCKSPORT ORPORT
2212 S: 250-SOCKSPORT=9050
2213 S: 650 CIRC 1000 EXTENDED moria1,moria2
2216 Clients MUST tolerate more arguments in an asynchronous reply than
2217 expected, and MUST tolerate more lines in an asynchronous reply than
2218 expected. For instance, a client that expects a CIRC message like:
2220 650 CIRC 1000 EXTENDED moria1,moria2
2224 650-CIRC 1000 EXTENDED moria1,moria2 0xBEEF
2228 If clients receives extended events (selected by USEFEATUERE
2229 EXTENDED_EVENTS in Tor 0.1.2.2-alpha..Tor-0.2.1.x, and always-on in
2230 Tor 0.2.2.x and later), then each event line as specified below may be
2231 followed by additional arguments and additional lines. Additional
2232 lines will be of the form:
2234 "650" ("-"/" ") KEYWORD ["=" ARGUMENTS] CRLF
2236 Additional arguments will be of the form
2238 SP KEYWORD ["=" ( QuotedString / * NonSpDquote ) ]
2240 Clients MUST tolerate events with arguments and keywords they do not
2241 recognize, and SHOULD process those events as if any unrecognized
2242 arguments and keywords were not present.
2244 Clients SHOULD NOT depend on the order of keyword=value arguments,
2245 and SHOULD NOT depend on there being no new keyword=value arguments
2246 appearing between existing keyword=value arguments, though as of this
2247 writing (Jun 2011) some do. Thus, extensions to this protocol should
2248 add new keywords only after the existing keywords, until all
2249 controllers have been fixed. At some point this "SHOULD NOT" might
2250 become a "MUST NOT".
2252 4.1.1. Circuit status changed
2256 "650" SP "CIRC" SP CircuitID SP CircStatus [SP Path]
2257 [SP "BUILD_FLAGS=" BuildFlags] [SP "PURPOSE=" Purpose]
2258 [SP "HS_STATE=" HSState] [SP "REND_QUERY=" HSAddress]
2259 [SP "TIME_CREATED=" TimeCreated]
2260 [SP "REASON=" Reason [SP "REMOTE_REASON=" Reason]]
2261 [SP "SOCKS_USERNAME=" EscapedUsername]
2262 [SP "SOCKS_PASSWORD=" EscapedPassword]
2263 [SP "HS_POW=" HSPoW ]
2267 "LAUNCHED" / ; circuit ID assigned to new circuit
2268 "BUILT" / ; all hops finished, can now accept streams
2269 "GUARD_WAIT" / ; all hops finished, waiting to see if a
2270 ; circuit with a better guard will be usable.
2271 "EXTENDED" / ; one more hop has been completed
2272 "FAILED" / ; circuit closed (was not built)
2273 "CLOSED" ; circuit closed (was built)
2275 Path = LongName *("," LongName)
2276 ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
2277 ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, Path
2279 ; Path = ServerID *("," ServerID)
2281 BuildFlags = BuildFlag *("," BuildFlag)
2282 BuildFlag = "ONEHOP_TUNNEL" / "IS_INTERNAL" /
2283 "NEED_CAPACITY" / "NEED_UPTIME"
2285 Purpose = "GENERAL" / "HS_CLIENT_INTRO" / "HS_CLIENT_REND" /
2286 "HS_SERVICE_INTRO" / "HS_SERVICE_REND" / "TESTING" /
2287 "CONTROLLER" / "MEASURE_TIMEOUT" /
2288 "HS_VANGUARDS" / "PATH_BIAS_TESTING" /
2291 HSState = "HSCI_CONNECTING" / "HSCI_INTRO_SENT" / "HSCI_DONE" /
2292 "HSCR_CONNECTING" / "HSCR_ESTABLISHED_IDLE" /
2293 "HSCR_ESTABLISHED_WAITING" / "HSCR_JOINED" /
2294 "HSSI_CONNECTING" / "HSSI_ESTABLISHED" /
2295 "HSSR_CONNECTING" / "HSSR_JOINED"
2298 HSPoWEffort = 1*DIGIT
2299 HSPoW = HSPoWType "," HSPoWEffort
2301 EscapedUsername = QuotedString
2302 EscapedPassword = QuotedString
2304 HSAddress = 16*Base32Character / 56*Base32Character
2305 Base32Character = ALPHA / "2" / "3" / "4" / "5" / "6" / "7"
2307 TimeCreated = ISOTime2Frac
2309 Microseconds = 1*DIGIT
2311 Reason = "NONE" / "TORPROTOCOL" / "INTERNAL" / "REQUESTED" /
2312 "HIBERNATING" / "RESOURCELIMIT" / "CONNECTFAILED" /
2313 "OR_IDENTITY" / "OR_CONN_CLOSED" / "TIMEOUT" /
2314 "FINISHED" / "DESTROYED" / "NOPATH" / "NOSUCHSERVICE" /
2315 "MEASUREMENT_EXPIRED"
2317 The path is provided only when the circuit has been extended at least one
2320 The "BUILD_FLAGS" field is provided only in versions 0.2.3.11-alpha
2321 and later. Clients MUST accept build flags not listed above.
2322 Build flags are defined as follows:
2324 ONEHOP_TUNNEL (one-hop circuit, used for tunneled directory conns)
2325 IS_INTERNAL (internal circuit, not to be used for exiting streams)
2326 NEED_CAPACITY (this circuit must use only high-capacity nodes)
2327 NEED_UPTIME (this circuit must use only high-uptime nodes)
2329 The "PURPOSE" field is provided only in versions 0.2.1.6-alpha and
2330 later, and only if extended events are enabled (see 3.19). Clients
2331 MUST accept purposes not listed above. Purposes are defined as
2334 GENERAL (circuit for AP and/or directory request streams)
2335 HS_CLIENT_INTRO (HS client-side introduction-point circuit)
2336 HS_CLIENT_REND (HS client-side rendezvous circuit; carries AP streams)
2337 HS_SERVICE_INTRO (HS service-side introduction-point circuit)
2338 HS_SERVICE_REND (HS service-side rendezvous circuit)
2339 TESTING (reachability-testing circuit; carries no traffic)
2340 CONTROLLER (circuit built by a controller)
2341 MEASURE_TIMEOUT (circuit being kept around to see how long it takes)
2342 HS_VANGUARDS (circuit created ahead of time when using
2343 HS vanguards, and later repurposed as needed)
2344 PATH_BIAS_TESTING (circuit used to probe whether our circuits are
2345 being deliberately closed by an attacker)
2346 CIRCUIT_PADDING (circuit that is being held open to disguise its
2349 The "HS_STATE" field is provided only for hidden-service circuits,
2350 and only in versions 0.2.3.11-alpha and later. Clients MUST accept
2351 hidden-service circuit states not listed above. Hidden-service
2352 circuit states are defined as follows:
2354 HSCI_* (client-side introduction-point circuit states)
2355 HSCI_CONNECTING (connecting to intro point)
2356 HSCI_INTRO_SENT (sent INTRODUCE1; waiting for reply from IP)
2357 HSCI_DONE (received reply from IP relay; closing)
2359 HSCR_* (client-side rendezvous-point circuit states)
2360 HSCR_CONNECTING (connecting to or waiting for reply from RP)
2361 HSCR_ESTABLISHED_IDLE (established RP; waiting for introduction)
2362 HSCR_ESTABLISHED_WAITING (introduction sent to HS; waiting for rend)
2363 HSCR_JOINED (connected to HS)
2365 HSSI_* (service-side introduction-point circuit states)
2366 HSSI_CONNECTING (connecting to intro point)
2367 HSSI_ESTABLISHED (established intro point)
2369 HSSR_* (service-side rendezvous-point circuit states)
2370 HSSR_CONNECTING (connecting to client's rend point)
2371 HSSR_JOINED (connected to client's RP circuit)
2373 The "SOCKS_USERNAME" and "SOCKS_PASSWORD" fields indicate the credentials
2374 that were used by a SOCKS client to connect to Tor's SOCKS port and
2375 initiate this circuit. (Streams for SOCKS clients connected with different
2376 usernames and/or passwords are isolated on separate circuits if the
2377 IsolateSOCKSAuth flag is active; see Proposal 171.) [Added in Tor
2380 The "REND_QUERY" field is provided only for hidden-service-related
2381 circuits, and only in versions 0.2.3.11-alpha and later. Clients
2382 MUST accept hidden service addresses in formats other than that
2383 specified above. [Added in Tor 0.4.3.1-alpha.]
2385 The "TIME_CREATED" field is provided only in versions 0.2.3.11-alpha and
2386 later. TIME_CREATED is the time at which the circuit was created or
2387 cannibalized. [Added in Tor 0.4.3.1-alpha.]
2389 The "REASON" field is provided only for FAILED and CLOSED events, and only
2390 if extended events are enabled (see 3.19). Clients MUST accept reasons
2391 not listed above. [Added in Tor 0.4.3.1-alpha.] Reasons are as given in
2392 tor-spec.txt, except for:
2394 NOPATH (Not enough nodes to make circuit)
2395 MEASUREMENT_EXPIRED (As "TIMEOUT", except that we had left the circuit
2396 open for measurement purposes to see how long it
2397 would take to finish.)
2398 IP_NOW_REDUNDANT (Closing a circuit to an introduction point that
2399 has become redundant, since some other circuit
2400 opened in parallel with it has succeeded.)
2402 The "REMOTE_REASON" field is provided only when we receive a DESTROY or
2403 TRUNCATE cell, and only if extended events are enabled. It contains the
2404 actual reason given by the remote OR for closing the circuit. Clients MUST
2405 accept reasons not listed above. Reasons are as listed in tor-spec.txt.
2406 [Added in Tor 0.4.3.1-alpha.]
2408 4.1.2. Stream status changed
2412 "650" SP "STREAM" SP StreamID SP StreamStatus SP CircuitID SP Target
2413 [SP "REASON=" Reason [ SP "REMOTE_REASON=" Reason ]]
2414 [SP "SOURCE=" Source] [ SP "SOURCE_ADDR=" Address ":" Port ]
2415 [SP "PURPOSE=" Purpose] [SP "SOCKS_USERNAME=" EscapedUsername]
2416 [SP "SOCKS_PASSWORD=" EscapedPassword]
2417 [SP "CLIENT_PROTOCOL=" ClientProtocol] [SP "NYM_EPOCH=" NymEpoch]
2418 [SP "SESSION_GROUP=" SessionGroup] [SP "ISO_FIELDS=" IsoFields]
2422 "NEW" / ; New request to connect
2423 "NEWRESOLVE" / ; New request to resolve an address
2424 "REMAP" / ; Address re-mapped to another
2425 "SENTCONNECT" / ; Sent a connect cell along a circuit
2426 "SENTRESOLVE" / ; Sent a resolve cell along a circuit
2427 "SUCCEEDED" / ; Received a reply; stream established
2428 "FAILED" / ; Stream failed and not retriable
2429 "CLOSED" / ; Stream closed
2430 "DETACHED" / ; Detached from circuit; still retriable
2431 "CONTROLLER_WAIT" ; Waiting for controller to use ATTACHSTREAM
2432 ; (new in 0.4.5.1-alpha)
2433 "XOFF_SENT" ; XOFF has been sent for this stream
2434 ; (new in 0.4.7.5-alpha)
2435 "XOFF_RECV" ; XOFF has been received for this stream
2436 ; (new in 0.4.7.5-alpha)
2437 "XON_SENT" ; XON has been sent for this stream
2438 ; (new in 0.4.7.5-alpha)
2439 "XON_RECV" ; XON has been received for this stream
2440 ; (new in 0.4.7.5-alpha)
2442 Target = TargetAddress ":" Port
2443 Port = an integer from 0 to 65535 inclusive
2444 TargetAddress = Address / "(Tor_internal)"
2446 EscapedUsername = QuotedString
2447 EscapedPassword = QuotedString
2458 NymEpoch = a nonnegative integer
2459 SessionGroup = an integer
2461 IsoFields = a comma-separated list of IsoField values
2468 the name of a field that is valid for STREAM events
2470 The circuit ID designates which circuit this stream is attached to. If
2471 the stream is unattached, the circuit ID "0" is given. The target
2472 indicates the address which the stream is meant to resolve or connect to;
2473 it can be "(Tor_internal)" for a virtual stream created by the Tor program
2476 Reason = "MISC" / "RESOLVEFAILED" / "CONNECTREFUSED" /
2477 "EXITPOLICY" / "DESTROY" / "DONE" / "TIMEOUT" /
2478 "NOROUTE" / "HIBERNATING" / "INTERNAL"/ "RESOURCELIMIT" /
2479 "CONNRESET" / "TORPROTOCOL" / "NOTDIRECTORY" / "END" /
2482 The "REASON" field is provided only for FAILED, CLOSED, and DETACHED
2483 events, and only if extended events are enabled (see 3.19). Clients MUST
2484 accept reasons not listed above. Reasons are as given in tor-spec.txt,
2487 END (We received a RELAY_END cell from the other side of this
2489 PRIVATE_ADDR (The client tried to connect to a private address like
2490 127.0.0.1 or 10.0.0.1 over Tor.)
2491 [XXXX document more. -NM]
2493 The "REMOTE_REASON" field is provided only when we receive a RELAY_END
2494 cell, and only if extended events are enabled. It contains the actual
2495 reason given by the remote OR for closing the stream. Clients MUST accept
2496 reasons not listed above. Reasons are as listed in tor-spec.txt.
2498 "REMAP" events include a Source if extended events are enabled:
2500 Source = "CACHE" / "EXIT"
2502 Clients MUST accept sources not listed above. "CACHE" is given if
2503 the Tor client decided to remap the address because of a cached
2504 answer, and "EXIT" is given if the remote node we queried gave us
2505 the new address as a response.
2507 The "SOURCE_ADDR" field is included with NEW and NEWRESOLVE events if
2508 extended events are enabled. It indicates the address and port
2509 that requested the connection, and can be (e.g.) used to look up the
2512 Purpose = "DIR_FETCH" / "DIR_UPLOAD" / "DNS_REQUEST" /
2513 "USER" / "DIRPORT_TEST"
2515 The "PURPOSE" field is provided only for NEW and NEWRESOLVE events, and
2516 only if extended events are enabled (see 3.19). Clients MUST accept
2517 purposes not listed above. The purposes above are defined as:
2519 "DIR_FETCH" -- This stream is generated internally to Tor for
2520 fetching directory information.
2521 "DIR_UPLOAD" -- An internal stream for uploading information to
2522 a directory authority.
2523 "DIRPORT_TEST" -- A stream we're using to test our own directory
2524 port to make sure it's reachable.
2525 "DNS_REQUEST" -- A user-initiated DNS request.
2526 "USER" -- This stream is handling user traffic, OR it's internal
2527 to Tor, but it doesn't match one of the purposes above.
2529 The "SOCKS_USERNAME" and "SOCKS_PASSWORD" fields indicate the credentials
2530 that were used by a SOCKS client to connect to Tor's SOCKS port and
2531 initiate this stream. (Streams for SOCKS clients connected with different
2532 usernames and/or passwords are isolated on separate circuits if the
2533 IsolateSOCKSAuth flag is active; see Proposal 171.)
2535 The "CLIENT_PROTOCOL" field indicates the protocol that was used by a client
2536 to initiate this stream. (Streams for clients connected with different
2537 protocols are isolated on separate circuits if the IsolateClientProtocol
2538 flag is active.) Controllers MUST tolerate unrecognized client protocols.
2540 The "NYM_EPOCH" field indicates the nym epoch that was active when a client
2541 initiated this stream. The epoch increments when the NEWNYM signal is
2542 received. (Streams with different nym epochs are isolated on separate
2545 The "SESSION_GROUP" field indicates the session group of the listener port
2546 that a client used to initiate this stream. By default, the session group is
2547 different for each listener port, but this can be overridden for a listener
2548 via the "SessionGroup" option in torrc. (Streams with different session
2549 groups are isolated on separate circuits.)
2551 The "ISO_FIELDS" field indicates the set of STREAM event fields for which
2552 stream isolation is enabled for the listener port that a client used to
2553 initiate this stream. The special values "CLIENTADDR", "CLIENTPORT",
2554 "DESTADDR", and "DESTPORT", if their correspondingly named fields are not
2555 present, refer to the Address and Port components of the "SOURCE_ADDR" and
2558 4.1.3. OR Connection status changed
2562 "650" SP "ORCONN" SP (LongName / Target) SP ORStatus [ SP "REASON="
2563 Reason ] [ SP "NCIRCS=" NumCircuits ] [ SP "ID=" ConnID ] CRLF
2565 ORStatus = "NEW" / "LAUNCHED" / "CONNECTED" / "FAILED" / "CLOSED"
2567 ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
2568 ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, OR
2569 ; Connection is as follows:
2570 "650" SP "ORCONN" SP (ServerID / Target) SP ORStatus [ SP "REASON="
2571 Reason ] [ SP "NCIRCS=" NumCircuits ] CRLF
2573 NEW is for incoming connections, and LAUNCHED is for outgoing
2574 connections. CONNECTED means the TLS handshake has finished (in
2575 either direction). FAILED means a connection is being closed that
2576 hasn't finished its handshake, and CLOSED is for connections that
2579 A LongName or ServerID is specified unless it's a NEW connection, in
2580 which case we don't know what server it is yet, so we use Address:Port.
2582 If extended events are enabled (see 3.19), optional reason and
2583 circuit counting information is provided for CLOSED and FAILED
2586 Reason = "MISC" / "DONE" / "CONNECTREFUSED" /
2587 "IDENTITY" / "CONNECTRESET" / "TIMEOUT" / "NOROUTE" /
2588 "IOERROR" / "RESOURCELIMIT" / "PT_MISSING"
2590 NumCircuits counts both established and pending circuits.
2592 The ORStatus values are as follows:
2594 NEW -- We have received a new incoming OR connection, and are starting
2595 the server-side handshake.
2596 LAUNCHED -- We have launched a new outgoing OR connection, and are
2597 starting the client-side handshake.
2598 CONNECTED -- The OR connection has been connected and the handshake is
2600 FAILED -- Our attempt to open the OR connection failed.
2601 CLOSED -- The OR connection closed in an unremarkable way.
2603 The Reason values for closed/failed OR connections are:
2605 DONE -- The OR connection has shut down cleanly.
2606 CONNECTREFUSED -- We got an ECONNREFUSED while connecting to the target
2608 IDENTITY -- We connected to the OR, but found that its identity was
2609 not what we expected.
2610 CONNECTRESET -- We got an ECONNRESET or similar IO error from the
2611 connection with the OR.
2612 TIMEOUT -- We got an ETIMEOUT or similar IO error from the connection
2613 with the OR, or we're closing the connection for being idle for too
2615 NOROUTE -- We got an ENOTCONN, ENETUNREACH, ENETDOWN, EHOSTUNREACH, or
2616 similar error while connecting to the OR.
2617 IOERROR -- We got some other IO error on our connection to the OR.
2618 RESOURCELIMIT -- We don't have enough operating system resources (file
2619 descriptors, buffers, etc) to connect to the OR.
2620 PT_MISSING -- No pluggable transport was available.
2621 MISC -- The OR connection closed for some other reason.
2623 [First added ID parameter in 0.2.5.2-alpha]
2625 4.1.4. Bandwidth used in the last second
2629 "650" SP "BW" SP BytesRead SP BytesWritten *(SP Type "=" Num) CRLF
2631 BytesWritten = 1*DIGIT
2632 Type = "DIR" / "OR" / "EXIT" / "APP" / ...
2635 BytesRead and BytesWritten are the totals. [In a future Tor version,
2636 we may also include a breakdown of the connection types that used
2637 bandwidth this second (not implemented yet).]
2643 "650" SP Severity SP ReplyText CRLF
2647 "650+" Severity CRLF Data 650 SP "OK" CRLF
2649 Severity = "DEBUG" / "INFO" / "NOTICE" / "WARN"/ "ERR"
2651 Some low-level logs may be sent from signal handlers, so their destination
2652 logs must be signal-safe. These low-level logs include backtraces,
2653 logging function errors, and errors in code called by logging functions.
2654 Signal-safe logs are never sent as control port log events.
2656 Control port message trace debug logs are never sent as control port log
2657 events, to avoid modifying control output when debugging.
2659 4.1.6. New descriptors available
2661 This event is generated when new router descriptors (not microdescs or
2662 extrainfos or anything else) are received.
2666 "650" SP "NEWDESC" 1*(SP LongName) CRLF
2667 ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
2668 ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, it
2670 "650" SP "NEWDESC" 1*(SP ServerID) CRLF
2672 4.1.7. New Address mapping
2674 These events are generated when a new address mapping is entered in
2675 Tor's address map cache, or when the answer for a RESOLVE command is
2676 found. Entries can be created by a successful or failed DNS lookup,
2677 a successful or failed connection attempt, a RESOLVE command,
2678 a MAPADDRESS command, the AutomapHostsOnResolve feature, or the
2679 TrackHostExits feature.
2683 "650" SP "ADDRMAP" SP Address SP NewAddress SP Expiry
2684 [SP "error=" ErrorCode] [SP "EXPIRES=" UTCExpiry] [SP "CACHED=" Cached]
2685 [SP "STREAMID=" StreamId] CRLF
2687 NewAddress = Address / "<error>"
2688 Expiry = DQUOTE ISOTime DQUOTE / "NEVER"
2690 ErrorCode = "yes" / "internal" / "Unable to launch resolve request"
2691 UTCExpiry = DQUOTE IsoTime DQUOTE
2693 Cached = DQUOTE "YES" DQUOTE / DQUOTE "NO" DQUOTE
2694 StreamId = DQUOTE StreamId DQUOTE
2696 Error and UTCExpiry are only provided if extended events are enabled.
2697 The values for Error are mostly useless. Future values will be
2698 chosen to match 1*(ALNUM / "_"); the "Unable to launch resolve request"
2699 value is a bug in Tor before 0.2.4.7-alpha.
2701 Expiry is expressed as the local time (rather than UTC). This is a bug,
2702 left in for backward compatibility; new code should look at UTCExpiry
2703 instead. (If Expiry is "NEVER", UTCExpiry is omitted.)
2705 Cached indicates whether the mapping will be stored until it expires, or if
2706 it is just a notification in response to a RESOLVE command.
2708 StreamId is the global stream identifier of the stream or circuit from which
2709 the address was resolved.
2711 4.1.8. Descriptors uploaded to us in our role as authoritative dirserver
2713 [NOTE: This feature was removed in Tor 0.3.2.1-alpha.]
2715 Tor generates this event when it's a directory authority, and
2716 somebody has just uploaded a server descriptor.
2720 "650" "+" "AUTHDIR_NEWDESCS" CRLF Action CRLF Message CRLF
2721 Descriptor CRLF "." CRLF "650" SP "OK" CRLF
2722 Action = "ACCEPTED" / "DROPPED" / "REJECTED"
2725 The Descriptor field is the text of the server descriptor; the Action
2726 field is "ACCEPTED" if we're accepting the descriptor as the new
2727 best valid descriptor for its router, "REJECTED" if we aren't taking
2728 the descriptor and we're complaining to the uploading relay about
2729 it, and "DROPPED" if we decide to drop the descriptor without
2730 complaining. The Message field is a human-readable string
2731 explaining why we chose the Action. (It doesn't contain newlines.)
2733 4.1.9. Our descriptor changed
2737 "650" SP "DESCCHANGED" CRLF
2739 [First added in 0.1.2.2-alpha.]
2741 4.1.10. Status events
2743 Status events (STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER) are sent
2744 based on occurrences in the Tor process pertaining to the general state of
2745 the program. Generally, they correspond to log messages of severity Notice
2746 or higher. They differ from log messages in that their format is a
2747 specified interface.
2751 "650" SP StatusType SP StatusSeverity SP StatusAction
2752 [SP StatusArguments] CRLF
2754 StatusType = "STATUS_GENERAL" / "STATUS_CLIENT" / "STATUS_SERVER"
2755 StatusSeverity = "NOTICE" / "WARN" / "ERR"
2756 StatusAction = 1*ALPHA
2757 StatusArguments = StatusArgument *(SP StatusArgument)
2758 StatusArgument = StatusKeyword '=' StatusValue
2759 StatusKeyword = 1*(ALNUM / "_")
2760 StatusValue = 1*(ALNUM / '_') / QuotedString
2762 StatusAction is a string, and StatusArguments is a series of
2763 keyword=value pairs on the same line. Values may be space-terminated
2764 strings, or quoted strings.
2766 These events are always produced with EXTENDED_EVENTS and
2767 VERBOSE_NAMES; see the explanations in the USEFEATURE section
2770 Controllers MUST tolerate unrecognized actions, MUST tolerate
2771 unrecognized arguments, MUST tolerate missing arguments, and MUST
2772 tolerate arguments that arrive in any order.
2774 Each event description below is accompanied by a recommendation for
2775 controllers. These recommendations are suggestions only; no controller
2776 is required to implement them.
2778 Compatibility note: versions of Tor before 0.2.0.22-rc incorrectly
2779 generated "STATUS_SERVER" as "STATUS_SEVER". To be compatible with those
2780 versions, tools should accept both.
2782 Actions for STATUS_GENERAL events can be as follows:
2786 Tor spent enough time without CPU cycles that it has closed all
2787 its circuits and will establish them anew. This typically
2788 happens when a laptop goes to sleep and then wakes up again. It
2789 also happens when the system is swapping so heavily that Tor is
2790 starving. The "time" argument specifies the number of seconds Tor
2791 thinks it was unconscious for (or alternatively, the number of
2792 seconds it went back in time).
2794 This status event is sent as NOTICE severity normally, but WARN
2795 severity if Tor is acting as a server currently.
2797 {Recommendation for controller: ignore it, since we don't really
2798 know what the user should do anyway. Hm.}
2802 "REASON=NEW/OBSOLETE/UNRECOMMENDED"
2803 "RECOMMENDED=\"version, version, ...\""
2804 Tor has found that directory servers don't recommend its version of
2805 the Tor software. RECOMMENDED is a comma-and-space-separated string
2806 of Tor versions that are recommended. REASON is NEW if this version
2807 of Tor is newer than any recommended version, OBSOLETE if
2808 this version of Tor is older than any recommended version, and
2809 UNRECOMMENDED if some recommended versions of Tor are newer and
2810 some are older than this version. (The "OBSOLETE" reason was called
2811 "OLD" from Tor 0.1.2.3-alpha up to and including 0.2.0.12-alpha.)
2813 {Controllers may want to suggest that the user upgrade OLD or
2814 UNRECOMMENDED versions. NEW versions may be known-insecure, or may
2815 simply be development versions.}
2817 TOO_MANY_CONNECTIONS
2819 Tor has reached its ulimit -n or whatever the native limit is on file
2820 descriptors or sockets. CURRENT is the number of sockets Tor
2821 currently has open. The user should really do something about
2822 this. The "current" argument shows the number of connections currently
2825 {Controllers may recommend that the user increase the limit, or
2826 increase it for them. Recommendations should be phrased in an
2827 OS-appropriate way and automated when possible.}
2831 Tor has encountered a situation that its developers never expected,
2832 and the developers would like to learn that it happened. Perhaps
2833 the controller can explain this to the user and encourage her to
2836 {Controllers should log bugs, but shouldn't annoy the user in case a
2837 bug appears frequently.}
2840 SKEW="+" / "-" SECONDS
2841 MIN_SKEW="+" / "-" SECONDS.
2842 SOURCE="DIRSERV:" IP ":" Port /
2843 "NETWORKSTATUS:" IP ":" Port /
2846 If "SKEW" is present, it's an estimate of how far we are from the
2847 time declared in the source. (In other words, if we're an hour in
2848 the past, the value is -3600.) "MIN_SKEW" is present, it's a lower
2849 bound. If the source is a DIRSERV, we got the current time from a
2850 connection to a dirserver. If the source is a NETWORKSTATUS, we
2851 decided we're skewed because we got a v2 networkstatus from far in
2852 the future. If the source is OR, the skew comes from a NETINFO
2853 cell from a connection to another relay. If the source is
2854 CONSENSUS, we decided we're skewed because we got a networkstatus
2855 consensus from the future.
2857 {Tor should send this message to controllers when it thinks the
2858 skew is so high that it will interfere with proper Tor operation.
2859 Controllers shouldn't blindly adjust the clock, since the more
2860 accurate source of skew info (DIRSERV) is currently
2864 "METHOD=" libevent method
2865 "VERSION=" libevent version
2866 "BADNESS=" "BROKEN" / "BUGGY" / "SLOW"
2867 "RECOVERED=" "NO" / "YES"
2868 Tor knows about bugs in using the configured event method in this
2869 version of libevent. "BROKEN" libevents won't work at all;
2870 "BUGGY" libevents might work okay; "SLOW" libevents will work
2871 fine, but not quickly. If "RECOVERED" is YES, Tor managed to
2872 switch to a more reliable (but probably slower!) libevent method.
2874 {Controllers may want to warn the user if this event occurs, though
2875 generally it's the fault of whoever built the Tor binary and there's
2876 not much the user can do besides upgrade libevent or upgrade the
2880 Tor believes that none of the known directory servers are
2881 reachable -- this is most likely because the local network is
2882 down or otherwise not working, and might help to explain for the
2883 user why Tor appears to be broken.
2885 {Controllers may want to warn the user if this event occurs; further
2886 action is generally not possible.}
2888 Actions for STATUS_CLIENT events can be as follows:
2897 ["RECOMMENDATION=" Keyword]
2898 ["HOST=" QuotedString]
2899 ["HOSTADDR=" QuotedString]
2901 Tor has made some progress at establishing a connection to the
2902 Tor network, fetching directory information, or making its first
2903 circuit; or it has encountered a problem while bootstrapping. This
2904 status event is especially useful for users with slow connections
2905 or with connectivity problems.
2907 "Progress" gives a number between 0 and 100 for how far through
2908 the bootstrapping process we are. "Summary" is a string that can
2909 be displayed to the user to describe the *next* task that Tor
2910 will tackle, i.e., the task it is working on after sending the
2911 status event. "Tag" is a string that controllers can use to
2912 recognize bootstrap phases, if they want to do something smarter
2913 than just blindly displaying the summary string; see Section 5
2914 for the current tags that Tor issues.
2916 The StatusSeverity describes whether this is a normal bootstrap
2917 phase (severity notice) or an indication of a bootstrapping
2918 problem (severity warn).
2920 For bootstrap problems, we include the same progress, tag, and
2921 summary values as we would for a normal bootstrap event, but we
2922 also include "warning", "reason", "count", and "recommendation"
2923 key/value combos. The "count" number tells how many bootstrap
2924 problems there have been so far at this phase. The "reason"
2925 string lists one of the reasons allowed in the ORCONN event. The
2926 "warning" argument string with any hints Tor has to offer about
2927 why it's having troubles bootstrapping.
2929 The "reason" values are long-term-stable controller-facing tags to
2930 identify particular issues in a bootstrapping step. The warning
2931 strings, on the other hand, are human-readable. Controllers
2932 SHOULD NOT rely on the format of any warning string. Currently
2933 the possible values for "recommendation" are either "ignore" or
2934 "warn" -- if ignore, the controller can accumulate the string in
2935 a pile of problems to show the user if the user asks; if warn,
2936 the controller should alert the user that Tor is pretty sure
2937 there's a bootstrapping problem.
2939 The "host" value is the identity digest (in hex) of the node we're
2940 trying to connect to; the "hostaddr" is an address:port combination,
2941 where 'address' is an ipv4 or ipv6 address.
2943 Currently Tor uses recommendation=ignore for the first
2944 nine bootstrap problem reports for a given phase, and then
2945 uses recommendation=warn for subsequent problems at that
2946 phase. Hopefully this is a good balance between tolerating
2947 occasional errors and reporting serious problems quickly.
2950 Tor now knows enough network-status documents and enough server
2951 descriptors that it's going to start trying to build circuits now.
2952 [Newer versions of Tor (0.2.6.2-alpha and later):
2953 If the consensus contains Exits (the typical case), Tor will build
2954 both exit and internal circuits. If not, Tor will only build internal
2957 {Controllers may want to use this event to decide when to indicate
2958 progress to their users, but should not interrupt the user's browsing
2962 We discarded expired statuses and server descriptors to fall
2963 below the desired threshold of directory information. We won't
2964 try to build any circuits until ENOUGH_DIR_INFO occurs again.
2966 {Controllers may want to use this event to decide when to indicate
2967 progress to their users, but should not interrupt the user's browsing
2971 Tor is able to establish circuits for client use. This event will
2972 only be sent if we just built a circuit that changed our mind --
2973 that is, prior to this event we didn't know whether we could
2976 {Suggested use: controllers can notify their users that Tor is
2977 ready for use as a client once they see this status event. [Perhaps
2978 controllers should also have a timeout if too much time passes and
2979 this event hasn't arrived, to give tips on how to troubleshoot.
2980 On the other hand, hopefully Tor will send further status events
2981 if it can identify the problem.]}
2983 CIRCUIT_NOT_ESTABLISHED
2984 "REASON=" "EXTERNAL_ADDRESS" / "DIR_ALL_UNREACHABLE" / "CLOCK_JUMPED"
2985 We are no longer confident that we can build circuits. The "reason"
2986 keyword provides an explanation: which other status event type caused
2987 our lack of confidence.
2989 {Controllers may want to use this event to decide when to indicate
2990 progress to their users, but should not interrupt the user's browsing
2992 [Note: only REASON=CLOCK_JUMPED is implemented currently.]
2995 Tor has received and validated a new consensus networkstatus.
2996 (This event can be delayed a little while after the consensus
2997 is received, if Tor needs to fetch certificates.)
3001 "RESULT=" "REJECT" / "WARN"
3002 A stream was initiated to a port that's commonly used for
3003 vulnerable-plaintext protocols. If the Result is "reject", we
3004 refused the connection; whereas if it's "warn", we allowed it.
3006 {Controllers should warn their users when this occurs, unless they
3007 happen to know that the application using Tor is in fact doing so
3008 correctly (e.g., because it is part of a distributed bundle). They
3009 might also want some sort of interface to let the user configure
3010 their RejectPlaintextPorts and WarnPlaintextPorts config options.}
3013 "PROTOCOL=" "SOCKS4" / "SOCKS5"
3015 A connection was made to Tor's SOCKS port using one of the SOCKS
3016 approaches that doesn't support hostnames -- only raw IP addresses.
3017 If the client application got this address from gethostbyname(),
3018 it may be leaking target addresses via DNS.
3020 {Controllers should warn their users when this occurs, unless they
3021 happen to know that the application using Tor is in fact doing so
3022 correctly (e.g., because it is part of a distributed bundle).}
3024 SOCKS_UNKNOWN_PROTOCOL
3026 A connection was made to Tor's SOCKS port that tried to use it
3027 for something other than the SOCKS protocol. Perhaps the user is
3028 using Tor as an HTTP proxy? The DATA is the first few characters
3029 sent to Tor on the SOCKS port.
3031 {Controllers may want to warn their users when this occurs: it
3032 indicates a misconfigured application.}
3035 "HOSTNAME=QuotedString"
3036 Some application gave us a funny-looking hostname. Perhaps
3037 it is broken? In any case it won't work with Tor and the user
3040 {Controllers may want to warn their users when this occurs: it
3041 usually indicates a misconfigured application.}
3043 Actions for STATUS_SERVER can be as follows:
3048 "METHOD=CONFIGURED/CONFIGURED_ORPORT/DIRSERV/RESOLVED/
3049 INTERFACE/GETHOSTNAME"
3050 Our best idea for our externally visible IP has changed to 'IP'. If
3051 'HOSTNAME' is present, we got the new IP by resolving 'NAME'. If the
3052 method is 'CONFIGURED', the IP was given verbatim as the Address
3053 configuration option. If the method is 'CONFIGURED_ORPORT', the IP was
3054 given verbatim in the ORPort configuration option. If the method is
3055 'RESOLVED', we resolved the Address configuration option to get the IP.
3056 If the method is 'GETHOSTNAME', we resolved our hostname to get the IP.
3057 If the method is 'INTERFACE', we got the address of one of our network
3058 interfaces to get the IP. If the method is 'DIRSERV', a directory
3059 server told us a guess for what our IP might be.
3061 {Controllers may want to record this info and display it to the user.}
3063 CHECKING_REACHABILITY
3065 "DIRADDRESS=IP:port"
3066 We're going to start testing the reachability of our external OR port
3069 {This event could affect the controller's idea of server status, but
3070 the controller should not interrupt the user to tell them so.}
3072 REACHABILITY_SUCCEEDED
3074 "DIRADDRESS=IP:port"
3075 We successfully verified the reachability of our external OR port or
3076 directory port (depending on which of ORADDRESS or DIRADDRESS is
3079 {This event could affect the controller's idea of server status, but
3080 the controller should not interrupt the user to tell them so.}
3082 GOOD_SERVER_DESCRIPTOR
3083 We successfully uploaded our server descriptor to at least one
3084 of the directory authorities, with no complaints.
3086 {Originally, the goal of this event was to declare "every authority
3087 has accepted the descriptor, so there will be no complaints
3088 about it." But since some authorities might be offline, it's
3089 harder to get certainty than we had thought. As such, this event
3090 is equivalent to ACCEPTED_SERVER_DESCRIPTOR below. Controllers
3091 should just look at ACCEPTED_SERVER_DESCRIPTOR and should ignore
3092 this event for now.}
3094 SERVER_DESCRIPTOR_STATUS
3095 "STATUS=" "LISTED" / "UNLISTED"
3096 We just got a new networkstatus consensus, and whether we're in
3097 it or not in it has changed. Specifically, status is "listed"
3098 if we're listed in it but previous to this point we didn't know
3099 we were listed in a consensus; and status is "unlisted" if we
3100 thought we should have been listed in it (e.g. we were listed in
3101 the last one), but we're not.
3103 {Moving from listed to unlisted is not necessarily cause for
3104 alarm. The relay might have failed a few reachability tests,
3105 or the Internet might have had some routing problems. So this
3106 feature is mainly to let relay operators know when their relay
3107 has successfully been listed in the consensus.}
3109 [Not implemented yet. We should do this in 0.2.2.x. -RD]
3113 "STATUS=" "UP" / "DOWN"
3115 One of our nameservers has changed status.
3117 {This event could affect the controller's idea of server status, but
3118 the controller should not interrupt the user to tell them so.}
3121 All of our nameservers have gone down.
3123 {This is a problem; if it happens often without the nameservers
3124 coming up again, the user needs to configure more or better
3128 Our DNS provider is providing an address when it should be saying
3129 "NOTFOUND"; Tor will treat the address as a synonym for "NOTFOUND".
3131 {This is an annoyance; controllers may want to tell admins that their
3132 DNS provider is not to be trusted.}
3135 Our DNS provider is giving a hijacked address instead of well-known
3136 websites; Tor will not try to be an exit node.
3138 {Controllers could warn the admin if the relay is running as an
3139 exit node: the admin needs to configure a good DNS server.
3140 Alternatively, this happens a lot in some restrictive environments
3141 (hotels, universities, coffeeshops) when the user hasn't registered.}
3143 BAD_SERVER_DESCRIPTOR
3146 A directory authority rejected our descriptor. Possible reasons
3147 include malformed descriptors, incorrect keys, highly skewed clocks,
3150 {Controllers should warn the admin, and try to cope if they can.}
3152 ACCEPTED_SERVER_DESCRIPTOR
3154 A single directory authority accepted our descriptor.
3157 {This event could affect the controller's idea of server status, but
3158 the controller should not interrupt the user to tell them so.}
3162 "DIRADDRESS=IP:port"
3163 We failed to connect to our external OR port or directory port
3166 {This event could affect the controller's idea of server status. The
3167 controller should warn the admin and suggest reasonable steps to take.}
3170 "STATUS=" "AWAKE" | "SOFT" | "HARD"
3171 Our bandwidth based accounting status has changed, and we are now
3172 relaying traffic/rejecting new connections/hibernating.
3174 {This event could affect the controller's idea of server status. The
3175 controller MAY inform the admin, though presumably the accounting was
3176 explicitly enabled for a reason.}
3178 [This event was added in tor 0.2.9.0-alpha.]
3180 4.1.11. Our set of guard nodes has changed
3184 "650" SP "GUARD" SP Type SP Name SP Status ... CRLF
3187 (Identifies the guard affected)
3188 Status = "NEW" | "UP" | "DOWN" | "BAD" | "GOOD" | "DROPPED"
3190 The ENTRY type indicates a guard used for connections to the Tor
3193 The Status values are:
3195 "NEW" -- This node was not previously used as a guard; now we have
3197 "DROPPED" -- This node is one we previously picked as a guard; we
3198 no longer consider it to be a member of our guard list.
3199 "UP" -- The guard now seems to be reachable.
3200 "DOWN" -- The guard now seems to be unreachable.
3201 "BAD" -- Because of flags set in the consensus and/or values in the
3202 configuration, this node is now unusable as a guard.
3203 "BAD_L2" -- This layer2 guard has expired or got removed from the
3204 consensus. This node is removed from the layer2 guard set.
3205 "GOOD" -- Because of flags set in the consensus and/or values in the
3206 configuration, this node is now usable as a guard.
3208 Controllers must accept unrecognized types and unrecognized statuses.
3210 4.1.12. Network status has changed
3214 "650" "+" "NS" CRLF 1*NetworkStatus "." CRLF "650" SP "OK" CRLF
3216 The event is used whenever our local view of a relay status changes.
3217 This happens when we get a new v3 consensus (in which case the entries
3218 we see are a duplicate of what we see in the NEWCONSENSUS event,
3219 below), but it also happens when we decide to mark a relay as up or
3220 down in our local status, for example based on connection attempts.
3222 [First added in 0.1.2.3-alpha]
3224 4.1.13. Bandwidth used on an application stream
3228 "650" SP "STREAM_BW" SP StreamID SP BytesWritten SP BytesRead SP
3230 BytesWritten = 1*DIGIT
3234 BytesWritten and BytesRead are the number of bytes written and read
3235 by the application since the last STREAM_BW event on this stream.
3237 Note that from Tor's perspective, *reading* a byte on a stream means
3238 that the application *wrote* the byte. That's why the order of "written"
3239 vs "read" is opposite for stream_bw events compared to bw events.
3241 The Time field is provided only in versions 0.3.2.1-alpha and later. It
3242 records when Tor created the bandwidth event.
3244 These events are generated about once per second per stream; no events
3245 are generated for streams that have not written or read. These events
3246 apply only to streams entering Tor (such as on a SOCKSPort, TransPort,
3247 or so on). They are not generated for exiting streams.
3249 4.1.14. Per-country client stats
3253 "650" SP "CLIENTS_SEEN" SP TimeStarted SP CountrySummary SP
3256 We just generated a new summary of which countries we've seen clients
3257 from recently. The controller could display this for the user, e.g.
3258 in their "relay" configuration window, to give them a sense that they
3259 are actually being useful.
3261 Currently only bridge relays will receive this event, but once we figure
3262 out how to sufficiently aggregate and sanitize the client counts on
3263 main relays, we might start sending these events in other cases too.
3265 TimeStarted is a quoted string indicating when the reported summary
3266 counts from (in UTCS).
3268 The CountrySummary keyword has as its argument a comma-separated,
3269 possibly empty set of "countrycode=count" pairs. For example (without
3271 650-CLIENTS_SEEN TimeStarted="2008-12-25 23:50:43"
3272 CountrySummary=us=16,de=8,uk=8
3274 The IPVersions keyword has as its argument a comma-separated set of
3275 "protocol-family=count" pairs. For example,
3276 IPVersions=v4=16,v6=40
3278 Note that these values are rounded, not exact. The rounding
3279 algorithm is specified in the description of "geoip-client-origins"
3282 4.1.15. New consensus networkstatus has arrived
3286 "650" "+" "NEWCONSENSUS" CRLF 1*NetworkStatus "." CRLF "650" SP
3289 A new consensus networkstatus has arrived. We include NS-style lines for
3290 every relay in the consensus. NEWCONSENSUS is a separate event from the
3291 NS event, because the list here represents every usable relay: so any
3292 relay *not* mentioned in this list is implicitly no longer recommended.
3294 [First added in 0.2.1.13-alpha]
3296 4.1.16. New circuit buildtime has been set
3300 "650" SP "BUILDTIMEOUT_SET" SP Type SP "TOTAL_TIMES=" Total SP
3301 "TIMEOUT_MS=" Timeout SP "XM=" Xm SP "ALPHA=" Alpha SP
3302 "CUTOFF_QUANTILE=" Quantile SP "TIMEOUT_RATE=" TimeoutRate SP
3303 "CLOSE_MS=" CloseTimeout SP "CLOSE_RATE=" CloseRate
3305 Type = "COMPUTED" / "RESET" / "SUSPENDED" / "DISCARD" / "RESUME"
3306 Total = Integer count of timeouts stored
3307 Timeout = Integer timeout in milliseconds
3308 Xm = Estimated integer Pareto parameter Xm in milliseconds
3309 Alpha = Estimated floating point Paredo parameter alpha
3310 Quantile = Floating point CDF quantile cutoff point for this timeout
3311 TimeoutRate = Floating point ratio of circuits that timeout
3312 CloseTimeout = How long to keep measurement circs in milliseconds
3313 CloseRate = Floating point ratio of measurement circuits that are closed
3315 A new circuit build timeout time has been set. If Type is "COMPUTED",
3316 Tor has computed the value based on historical data. If Type is "RESET",
3317 initialization or drastic network changes have caused Tor to reset
3318 the timeout back to the default, to relearn again. If Type is
3319 "SUSPENDED", Tor has detected a loss of network connectivity and has
3320 temporarily changed the timeout value to the default until the network
3321 recovers. If type is "DISCARD", Tor has decided to discard timeout
3322 values that likely happened while the network was down. If type is
3323 "RESUME", Tor has decided to resume timeout calculation.
3325 The Total value is the count of circuit build times Tor used in
3326 computing this value. It is capped internally at the maximum number
3327 of build times Tor stores (NCIRCUITS_TO_OBSERVE).
3329 The Timeout itself is provided in milliseconds. Internally, Tor rounds
3330 this value to the nearest second before using it.
3332 [First added in 0.2.2.7-alpha]
3334 4.1.17. Signal received
3338 "650" SP "SIGNAL" SP Signal CRLF
3340 Signal = "RELOAD" / "DUMP" / "DEBUG" / "NEWNYM" / "CLEARDNSCACHE"
3342 A signal has been received and actions taken by Tor. The meaning of each
3343 signal, and the mapping to Unix signals, is as defined in section 3.7.
3344 Future versions of Tor MAY generate signals other than those listed here;
3345 controllers MUST be able to accept them.
3347 If Tor chose to ignore a signal (such as NEWNYM), this event will not be
3348 sent. Note that some options (like ReloadTorrcOnSIGHUP) may affect the
3349 semantics of the signals here.
3351 Note that the HALT (SIGTERM) and SHUTDOWN (SIGINT) signals do not currently
3354 [First added in 0.2.3.1-alpha]
3356 4.1.18. Configuration changed
3360 StartReplyLine *(MidReplyLine) EndReplyLine
3362 StartReplyLine = "650-CONF_CHANGED" CRLF
3363 MidReplyLine = "650-" KEYWORD ["=" VALUE] CRLF
3364 EndReplyLine = "650 OK"
3366 Tor configuration options have changed (such as via a SETCONF or RELOAD
3367 signal). KEYWORD and VALUE specify the configuration option that was changed.
3368 Undefined configuration options contain only the KEYWORD.
3370 4.1.19. Circuit status changed slightly
3374 "650" SP "CIRC_MINOR" SP CircuitID SP CircEvent [SP Path]
3375 [SP "BUILD_FLAGS=" BuildFlags] [SP "PURPOSE=" Purpose]
3376 [SP "HS_STATE=" HSState] [SP "REND_QUERY=" HSAddress]
3377 [SP "TIME_CREATED=" TimeCreated]
3378 [SP "OLD_PURPOSE=" Purpose [SP "OLD_HS_STATE=" HSState]] CRLF
3381 "PURPOSE_CHANGED" / ; circuit purpose or HS-related state changed
3382 "CANNIBALIZED" ; circuit cannibalized
3384 Clients MUST accept circuit events not listed above.
3386 The "OLD_PURPOSE" field is provided for both PURPOSE_CHANGED and
3387 CANNIBALIZED events. The "OLD_HS_STATE" field is provided whenever
3388 the "OLD_PURPOSE" field is provided and is a hidden-service-related
3391 Other fields are as specified in section 4.1.1 above.
3393 [First added in 0.2.3.11-alpha]
3395 4.1.20. Pluggable transport launched
3399 "650" SP "TRANSPORT_LAUNCHED" SP Type SP Name SP TransportAddress SP Port
3400 Type = "server" | "client"
3401 Name = The name of the pluggable transport
3402 TransportAddress = An IPv4 or IPv6 address on which the pluggable
3403 transport is listening for connections
3404 Port = The TCP port on which it is listening for connections.
3406 A pluggable transport called 'Name' of type 'Type' was launched
3407 successfully and is now listening for connections on 'Address':'Port'.
3409 4.1.21. Bandwidth used on an OR or DIR or EXIT connection
3413 "650" SP "CONN_BW" SP "ID=" ConnID SP "TYPE=" ConnType
3414 SP "READ=" BytesRead SP "WRITTEN=" BytesWritten CRLF
3416 ConnType = "OR" / ; Carrying traffic within the tor network. This can
3417 either be our own (client) traffic or traffic we're
3418 relaying within the network.
3419 "DIR" / ; Fetching tor descriptor data, or transmitting
3420 descriptors we're mirroring.
3421 "EXIT" ; Carrying traffic between the tor network and an
3422 external destination.
3425 BytesWritten = 1*DIGIT
3427 Controllers MUST tolerate unrecognized connection types.
3429 BytesWritten and BytesRead are the number of bytes written and read
3430 by Tor since the last CONN_BW event on this connection.
3432 These events are generated about once per second per connection; no
3433 events are generated for connections that have not read or written.
3434 These events are only generated if TestingTorNetwork is set.
3436 [First added in 0.2.5.2-alpha]
3438 4.1.22. Bandwidth used by all streams attached to a circuit
3442 "650" SP "CIRC_BW" SP "ID=" CircuitID SP "READ=" BytesRead SP
3443 "WRITTEN=" BytesWritten SP "TIME=" Time SP
3444 "DELIVERED_READ=" DeliveredBytesRead SP
3445 "OVERHEAD_READ=" OverheadBytesRead SP
3446 "DELIVERED_WRITTEN=" DeliveredBytesWritten SP
3447 "OVERHEAD_WRITTEN=" OverheadBytesWritten SP
3448 "SS=" SlowStartState SP
3449 "CWND=" CWNDCells SP
3450 "RTT=" RTTMilliseconds SP
3451 "MIN_RTT=" RTTMilliseconds CRLF
3453 BytesWritten = 1*DIGIT
3454 OverheadBytesRead = 1*DIGIT
3455 OverheadBytesWritten = 1*DIGIT
3456 DeliveredBytesRead = 1*DIGIT
3457 DeliveredBytesWritten = 1*DIGIT
3458 SlowStartState = 0 or 1
3460 RTTMilliseconds= 1*DIGIT
3463 BytesRead and BytesWritten are the number of bytes read and written
3464 on this circuit since the last CIRC_BW event. These bytes have not
3465 necessarily been validated by Tor, and can include invalid cells,
3466 dropped cells, and ignored cells (such as padding cells). These
3467 values include the relay headers, but not circuit headers.
3469 Circuit data that has been validated and processed by Tor is further
3470 broken down into two categories: delivered payloads and overhead.
3471 DeliveredBytesRead and DeliveredBytesWritten are the total relay cell
3472 payloads transmitted since the last CIRC_BW event, not counting relay
3473 cell headers or circuit headers. OverheadBytesRead and
3474 OverheadBytesWritten are the extra unused bytes at the end of each
3475 cell in order for it to be the fixed CELL_LEN bytes long.
3477 The sum of DeliveredBytesRead and OverheadBytesRead MUST be less than
3478 BytesRead, and the same is true for their written counterparts. This
3479 sum represents the total relay cell bytes on the circuit that
3480 have been validated by Tor, not counting relay headers and cell headers.
3481 Subtracting this sum (plus relay cell headers) from the BytesRead
3482 (or BytesWritten) value gives the byte count that Tor has decided to
3483 reject due to protocol errors, or has otherwise decided to ignore.
3485 The Time field is provided only in versions 0.3.2.1-alpha and later. It
3486 records when Tor created the bandwidth event.
3488 The SS, CWND, RTT, and MIN_RTT fields are present only if the circuit
3489 has negotiated congestion control to an onion service or Exit hop (any
3490 intermediate leaky pipe congestion control hops are not examined here).
3491 SS provides an indication if the circuit is in slow start (1), or not (0).
3492 CWND is the size of the congestion window in terms of number of cells.
3493 RTT is the N_EWMA smoothed current RTT value, and MIN_RTT is the minimum
3494 RTT value of the circuit. The SS and CWND fields apply only to the
3495 upstream direction of the circuit. The slow start state and CWND values
3496 of the other endpoint may be different.
3498 These events are generated about once per second per circuit; no events
3499 are generated for circuits that had no attached stream writing or
3502 [First added in 0.2.5.2-alpha]
3504 [DELIVERED_READ, OVERHEAD_READ, DELIVERED_WRITTEN, and OVERHEAD_WRITTEN
3505 were added in Tor 0.3.4.0-alpha]
3507 [SS, CWND, RTT, and MIN_RTT were added in Tor 0.4.7.5-alpha]
3509 4.1.23. Per-circuit cell stats
3513 "650" SP "CELL_STATS"
3514 [ SP "ID=" CircuitID ]
3515 [ SP "InboundQueue=" QueueID SP "InboundConn=" ConnID ]
3516 [ SP "InboundAdded=" CellsByType ]
3517 [ SP "InboundRemoved=" CellsByType SP
3518 "InboundTime=" MsecByType ]
3519 [ SP "OutboundQueue=" QueueID SP "OutboundConn=" ConnID ]
3520 [ SP "OutboundAdded=" CellsByType ]
3521 [ SP "OutboundRemoved=" CellsByType SP
3522 "OutboundTime=" MsecByType ] CRLF
3523 CellsByType, MsecByType = CellType ":" 1*DIGIT
3524 0*( "," CellType ":" 1*DIGIT )
3525 CellType = 1*( "a" - "z" / "0" - "9" / "_" )
3529 650 CELL_STATS ID=14 OutboundQueue=19403 OutboundConn=15
3530 OutboundAdded=create_fast:1,relay_early:2
3531 OutboundRemoved=create_fast:1,relay_early:2
3532 OutboundTime=create_fast:0,relay_early:0
3533 650 CELL_STATS InboundQueue=19403 InboundConn=32
3534 InboundAdded=relay:1,created_fast:1
3535 InboundRemoved=relay:1,created_fast:1
3536 InboundTime=relay:0,created_fast:0
3537 OutboundQueue=6710 OutboundConn=18
3538 OutboundAdded=create:1,relay_early:1
3539 OutboundRemoved=create:1,relay_early:1
3540 OutboundTime=create:0,relay_early:0
3542 ID is the locally unique circuit identifier that is only included if the
3543 circuit originates at this node.
3545 Inbound and outbound refer to the direction of cell flow through the
3546 circuit which is either to origin (inbound) or from origin (outbound).
3548 InboundQueue and OutboundQueue are identifiers of the inbound and
3549 outbound circuit queues of this circuit. These identifiers are only
3550 unique per OR connection. OutboundQueue is chosen by this node and
3551 matches InboundQueue of the next node in the circuit.
3553 InboundConn and OutboundConn are locally unique IDs of inbound and
3554 outbound OR connection. OutboundConn does not necessarily match
3555 InboundConn of the next node in the circuit.
3557 InboundQueue and InboundConn are not present if the circuit originates
3558 at this node. OutboundQueue and OutboundConn are not present if the
3559 circuit (currently) ends at this node.
3561 InboundAdded and OutboundAdded are total number of cells by cell type
3562 added to inbound and outbound queues. Only present if at least one cell
3563 was added to a queue.
3565 InboundRemoved and OutboundRemoved are total number of cells by
3566 cell type processed from inbound and outbound queues. InboundTime and
3567 OutboundTime are total waiting times in milliseconds of all processed
3568 cells by cell type. Only present if at least one cell was removed from
3571 These events are generated about once per second per circuit; no
3572 events are generated for circuits that have not added or processed any
3573 cell. These events are only generated if TestingTorNetwork is set.
3575 [First added in 0.2.5.2-alpha]
3577 4.1.24. Token buckets refilled
3581 "650" SP "TB_EMPTY" SP BucketName [ SP "ID=" ConnID ] SP
3582 "READ=" ReadBucketEmpty SP "WRITTEN=" WriteBucketEmpty SP
3583 "LAST=" LastRefill CRLF
3585 BucketName = "GLOBAL" / "RELAY" / "ORCONN"
3586 ReadBucketEmpty = 1*DIGIT
3587 WriteBucketEmpty = 1*DIGIT
3588 LastRefill = 1*DIGIT
3592 650 TB_EMPTY ORCONN ID=16 READ=0 WRITTEN=0 LAST=100
3593 650 TB_EMPTY GLOBAL READ=93 WRITTEN=93 LAST=100
3594 650 TB_EMPTY RELAY READ=93 WRITTEN=93 LAST=100
3596 This event is generated when refilling a previously empty token
3597 bucket. BucketNames "GLOBAL" and "RELAY" keywords are used for the
3598 global or relay token buckets, BucketName "ORCONN" is used for the
3599 token buckets of an OR connection. Controllers MUST tolerate
3600 unrecognized bucket names.
3602 ConnID is only included if the BucketName is "ORCONN".
3604 If both global and relay buckets and/or the buckets of one or more OR
3605 connections run out of tokens at the same time, multiple separate
3606 events are generated.
3608 ReadBucketEmpty (WriteBucketEmpty) is the time in millis that the read
3609 (write) bucket was empty since the last refill. LastRefill is the
3610 time in millis since the last refill.
3612 If a bucket went negative and if refilling tokens didn't make it go
3613 positive again, there will be multiple consecutive TB_EMPTY events for
3614 each refill interval during which the bucket contained zero tokens or
3615 less. In such a case, ReadBucketEmpty or WriteBucketEmpty are capped
3616 at LastRefill in order not to report empty times more than once.
3618 These events are only generated if TestingTorNetwork is set.
3620 [First added in 0.2.5.2-alpha]
3622 4.1.25. HiddenService descriptors
3626 "650" SP "HS_DESC" SP Action SP HSAddress SP AuthType SP HsDir
3627 [SP DescriptorID] [SP "REASON=" Reason] [SP "REPLICA=" Replica]
3628 [SP "HSDIR_INDEX=" HSDirIndex]
3630 Action = "REQUESTED" / "UPLOAD" / "RECEIVED" / "UPLOADED" / "IGNORE" /
3631 "FAILED" / "CREATED"
3632 HSAddress = 16*Base32Character / 56*Base32Character / "UNKNOWN"
3633 AuthType = "NO_AUTH" / "BASIC_AUTH" / "STEALTH_AUTH" / "UNKNOWN"
3634 HsDir = LongName / Fingerprint / "UNKNOWN"
3635 DescriptorID = 32*Base32Character / 43*Base64Character
3636 Reason = "BAD_DESC" / "QUERY_REJECTED" / "UPLOAD_REJECTED" / "NOT_FOUND" /
3637 "UNEXPECTED" / "QUERY_NO_HSDIR" / "QUERY_RATE_LIMITED"
3639 HSDirIndex = 64*HEXDIG
3641 These events will be triggered when required HiddenService descriptor is
3642 not found in the cache and a fetch or upload with the network is performed.
3644 If the fetch was triggered with only a DescriptorID (using the HSFETCH
3645 command for instance), the HSAddress only appears in the Action=RECEIVED
3646 since there is no way to know the HSAddress from the DescriptorID thus
3647 the value will be "UNKNOWN".
3649 If we already had the v0 descriptor, the newly fetched v2 descriptor
3650 will be ignored and a "HS_DESC" event with "IGNORE" action will be
3653 For HsDir, LongName is always preferred. If HsDir cannot be found in node
3654 list at the time event is sent, Fingerprint will be used instead.
3656 If Action is "FAILED", Tor SHOULD send Reason field as well. Possible
3657 values of Reason are:
3658 - "BAD_DESC" - descriptor was retrieved, but found to be unparsable.
3659 - "QUERY_REJECTED" - query was rejected by HS directory.
3660 - "UPLOAD_REJECTED" - descriptor was rejected by HS directory.
3661 - "NOT_FOUND" - HS descriptor with given identifier was not found.
3662 - "UNEXPECTED" - nature of failure is unknown.
3663 - "QUERY_NO_HSDIR" - No suitable HSDir were found for the query.
3664 - "QUERY_RATE_LIMITED" - query for this service is rate-limited
3666 For "QUERY_NO_HSDIR" or "QUERY_RATE_LIMITED", the HsDir will be set to
3667 "UNKNOWN" which was introduced in tor 0.3.1.0-alpha and 0.4.1.0-alpha
3670 If Action is "CREATED", Tor SHOULD send Replica field as well. The Replica
3671 field contains the replica number of the generated descriptor. The Replica
3672 number is specified in rend-spec.txt section 1.3 and determines the
3673 descriptor ID of the descriptor.
3675 For hidden service v3, the following applies:
3677 The "HSDIR_INDEX=" is an optional field that is only for version 3
3678 which contains the computed index of the HsDir the descriptor was
3679 uploaded to or fetched from.
3681 The "DescriptorID" key is the descriptor blinded key used for the index
3682 value at the "HsDir".
3684 The "REPLICA=" field is not used for the "CREATED" event because v3
3685 doesn't use the replica number in the descriptor ID computation.
3687 Because client authentication is not yet implemented, the "AuthType"
3688 field is always "NO_AUTH".
3690 [HS v3 support added 0.3.3.1-alpha]
3692 4.1.26. HiddenService descriptors content
3696 "650" "+" "HS_DESC_CONTENT" SP HSAddress SP DescId SP HsDir CRLF
3697 Descriptor CRLF "." CRLF "650" SP "OK" CRLF
3699 HSAddress = 16*Base32Character / 56*Base32Character / "UNKNOWN"
3700 DescId = 32*Base32Character / 32*Base64Character
3701 HsDir = LongName / "UNKNOWN"
3702 Descriptor = The text of the descriptor formatted as specified in
3703 rend-spec.txt section 1.3 (v2) or rend-spec-v3.txt
3704 section 2.4 (v3) or empty string on failure.
3706 This event is triggered when a successfully fetched HS descriptor is
3707 received. The text of that descriptor is then replied. If the HS_DESC
3708 event is enabled, it is replied just after the RECEIVED action.
3710 If a fetch fails, the Descriptor is an empty string and HSAddress is set
3711 to "UNKNOWN". The HS_DESC event should be used to get more information on
3714 If the fetch fails for the QUERY_NO_HSDIR or QUERY_RATE_LIMITED reason from
3715 the HS_DESC event, the HsDir is set to "UNKNOWN". This was introduced in
3716 0.3.1.0-alpha and 0.4.1.0-alpha respectively.
3718 It's expected to receive a reply relatively fast as in it's the time it
3719 takes to fetch something over the Tor network. This can be between a
3720 couple of seconds up to 60 seconds (not a hard limit). But, in any cases,
3721 this event will reply either the descriptor's content or an empty one.
3723 [HS_DESC_CONTENT was added in Tor 0.2.7.1-alpha]
3724 [HS v3 support added 0.3.3.1-alpha]
3726 4.1.27. Network liveness has changed
3730 "650" SP "NETWORK_LIVENESS" SP Status CRLF
3731 Status = "UP" / ; The network now seems to be reachable.
3732 "DOWN" / ; The network now seems to be unreachable.
3734 Controllers MUST tolerate unrecognized status types.
3736 [NETWORK_LIVENESS was added in Tor 0.2.7.2-alpha]
3738 4.1.28. Pluggable Transport Logs
3742 "650" SP "PT_LOG" SP PT=Program SP Message
3744 Program = The program path as defined in the *TransportPlugin
3745 configuration option. Tor accepts relative and full path.
3746 Message = The log message that the PT sends back to the tor parent
3747 process minus the "LOG" string prefix. Formatted as
3748 specified in pt-spec.txt section "3.3.4. Pluggable
3749 Transport Log Message".
3751 This event is triggered when tor receives a log message from the PT.
3755 PT (obfs4): LOG SEVERITY=debug MESSAGE="Connected to bridge A"
3757 the resulting control port event would be:
3759 Tor: 650 PT_LOG PT=/usr/bin/obs4proxy SEVERITY=debug MESSAGE="Connected to bridge A"
3761 [PT_LOG was added in Tor 0.4.0.1-alpha]
3763 4.1.29. Pluggable Transport Status
3767 "650" SP "PT_STATUS" SP PT=Program SP TRANSPORT=Transport SP Message
3769 Program = The program path as defined in the *TransportPlugin
3770 configuration option. Tor accepts relative and full path.
3771 Transport = This value indicates a hint on what the PT is such as the
3772 name or the protocol used for instance.
3773 Message = The status message that the PT sends back to the tor parent
3774 process minus the "STATUS" string prefix. Formatted as
3775 specified in pt-spec.txt section "3.3.5 Pluggable
3776 Transport Status Message".
3778 This event is triggered when tor receives a log message from the PT.
3782 PT (obfs4): STATUS TRANSPORT=obfs4 CONNECT=Success
3784 the resulting control port event would be:
3786 Tor: 650 PT_STATUS PT=/usr/bin/obs4proxy TRANSPORT=obfs4 CONNECT=Success
3788 [PT_STATUS was added in Tor 0.4.0.1-alpha]
3790 5. Implementation notes
3794 If the control port is open and no authentication operation is enabled, Tor
3795 trusts any local user that connects to the control port. This is generally
3798 If the 'CookieAuthentication' option is true, Tor writes a "magic
3799 cookie" file named "control_auth_cookie" into its data directory (or
3800 to another file specified in the 'CookieAuthFile' option). To
3801 authenticate, the controller must demonstrate that it can read the
3802 contents of the cookie file:
3804 * Current versions of Tor support cookie authentication
3806 using the "COOKIE" authentication method: the controller sends the
3807 contents of the cookie file, encoded in hexadecimal. This
3808 authentication method exposes the user running a controller to an
3809 unintended information disclosure attack whenever the controller
3810 has greater filesystem read access than the process that it has
3811 connected to. (Note that a controller may connect to a process
3812 other than Tor.) It is almost never safe to use, even if the
3813 controller's user has explicitly specified which filename to read
3814 an authentication cookie from. For this reason, the COOKIE
3815 authentication method has been deprecated and will be removed from
3816 Tor before some future version of Tor.
3818 * 0.2.2.x versions of Tor starting with 0.2.2.36, and all versions of
3820 Tor after 0.2.3.12-alpha, support cookie authentication using the
3821 "SAFECOOKIE" authentication method, which discloses much less
3822 information about the contents of the cookie file.
3824 If the 'HashedControlPassword' option is set, it must contain the salted
3825 hash of a secret password. The salted hash is computed according to the
3826 S2K algorithm in RFC 2440 (OpenPGP), and prefixed with the s2k specifier.
3827 This is then encoded in hexadecimal, prefixed by the indicator sequence
3828 "16:". Thus, for example, the password 'foo' could encode to:
3830 16:660537E3E1CD49996044A3BF558097A981F539FEA2F9DA662B4626C1C2
3831 ++++++++++++++++**^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3835 You can generate the salt of a password by calling
3837 'tor --hash-password <password>'
3839 or by using the example code in the Python and Java controller libraries.
3840 To authenticate under this scheme, the controller sends Tor the original
3841 secret that was used to generate the password, either as a quoted string
3842 or encoded in hexadecimal.
3844 5.2. Don't let the buffer get too big.
3846 With old versions of Tor (before 0.2.0.16-alpha), if you ask for
3847 lots of events, and 16MB of them queue up on the buffer, the Tor
3848 process will close the socket.
3850 Newer Tor versions do not have this 16 MB buffer limit. However,
3851 if you leave huge numbers of events unread, Tor may still run out
3852 of memory, so you should still be careful about buffer size.
3854 5.3. Backward compatibility with v0 control protocol.
3856 The 'version 0' control protocol was replaced in Tor 0.1.1.x. Support
3857 was removed in Tor 0.2.0.x. Every non-obsolete version of Tor now
3858 supports the version 1 control protocol.
3860 For backward compatibility with the "version 0" control protocol,
3861 Tor used to check whether the third octet of the first command is zero.
3862 (If it was, Tor assumed that version 0 is in use.)
3864 This compatibility was removed in Tor 0.1.2.16 and 0.2.0.4-alpha.
3866 5.4. Tor config options for use by controllers
3868 Tor provides a few special configuration options for use by controllers.
3869 These options are not saved to disk by SAVECONF. Most can be set and
3870 examined by the SETCONF and GETCONF commands, but some (noted below) can
3871 only be given in a torrc file or on the command line.
3873 Generally, these options make Tor unusable by disabling a portion of Tor's
3874 normal operations. Unless a controller provides replacement functionality
3875 to fill this gap, Tor will not correctly handle user requests.
3877 __AllDirActionsPrivate
3879 If true, Tor will try to launch all directory operations through
3880 anonymous connections. (Ordinarily, Tor only tries to anonymize
3881 requests related to hidden services.) This option will slow down
3882 directory access, and may stop Tor from working entirely if it does not
3883 yet have enough directory information to build circuits.
3885 (Boolean. Default: "0".)
3887 __DisablePredictedCircuits
3889 If true, Tor will not launch preemptive "general-purpose" circuits for
3890 streams to attach to. (It will still launch circuits for testing and
3891 for hidden services.)
3893 (Boolean. Default: "0".)
3895 __LeaveStreamsUnattached
3897 If true, Tor will not automatically attach new streams to circuits;
3898 instead, the controller must attach them with ATTACHSTREAM. If the
3899 controller does not attach the streams, their data will never be routed.
3901 (Boolean. Default: "0".)
3903 __HashedControlSessionPassword
3905 As HashedControlPassword, but is not saved to the torrc file by
3906 SAVECONF. Added in Tor 0.2.0.20-rc.
3908 __ReloadTorrcOnSIGHUP
3910 If this option is true (the default), we reload the torrc from disk
3911 every time we get a SIGHUP (from the controller or via a signal).
3912 Otherwise, we don't. This option exists so that controllers can keep
3913 their options from getting overwritten when a user sends Tor a HUP for
3914 some other reason (for example, to rotate the logs).
3916 (Boolean. Default: "1")
3918 __OwningControllerProcess
3920 If this option is set to a process ID, Tor will periodically check
3921 whether a process with the specified PID exists, and exit if one
3922 does not. Added in Tor 0.2.2.28-beta. This option's intended use
3923 is documented in section 3.23 with the related TAKEOWNERSHIP
3926 Note that this option can only specify a single process ID, unlike
3927 the TAKEOWNERSHIP command which can be sent along multiple control
3930 (String. Default: unset.)
3932 __OwningControllerFD
3934 If this option is a valid socket, Tor will start with an open control
3935 connection on this socket. Added in Tor 0.3.3.1-alpha.
3937 This socket will be an owning controller, as if it had already called
3938 TAKEOWNERSHIP. It will be automatically authenticated. This option
3939 should only be used by other programs that are starting Tor.
3941 This option cannot be changed via SETCONF; it must be set in a torrc or
3942 via the command line.
3944 (Integer. Default: -1.)
3946 __DisableSignalHandlers
3948 If this option is set to true during startup, then Tor will not install
3949 any signal handlers to watch for POSIX signals. The SIGNAL controller
3950 command will still work.
3952 This option is meant for embedding Tor inside another process, when
3953 the controlling process would rather handle signals on its own.
3955 This option cannot be changed via SETCONF; it must be set in a torrc or
3956 via the command line.
3958 (Boolean. Default: 0.)
3960 5.5. Phases from the Bootstrap status event.
3962 [For the bootstrap phases reported by Tor prior to 0.4.0.x, see
3965 This section describes the various bootstrap phases currently reported
3966 by Tor. Controllers should not assume that the percentages and tags
3967 listed here will continue to match up, or even that the tags will stay
3968 in the same order. Some phases might also be skipped (not reported)
3969 if the associated bootstrap step is already complete, or if the phase
3970 no longer is necessary. Only "starting" and "done" are guaranteed to
3971 exist in all future versions.
3973 Current Tor versions enter these phases in order, monotonically.
3974 Future Tors MAY revisit earlier phases, for example, if the network
3977 5.5.1. Overview of Bootstrap reporting.
3979 Bootstrap phases can be viewed as belonging to one of three stages:
3981 1. Initial connection to a Tor relay or bridge
3982 2. Obtaining directory information
3983 3. Building an application circuit
3985 Tor doesn't specifically enter Stage 1; that is a side effect of
3986 other actions that Tor is taking. Tor could be making a connection
3987 to a fallback directory server, or it could be making a connection
3988 to a guard candidate. Either one counts as Stage 1 for the purposes
3989 of bootstrap reporting.
3991 Stage 2 might involve Tor contacting directory servers, or it might
3992 involve reading cached directory information from a previous
3993 session. Large parts of Stage 2 might be skipped if there is already
3994 enough cached directory information to build circuits. Tor will
3995 defer reporting progress in Stage 2 until Stage 1 is complete.
3997 Tor defers this reporting because Tor can already have enough
3998 directory information to build circuits, yet not be able to connect
3999 to a relay. Without that deferral, a user might misleadingly see Tor
4000 stuck at a large amount of progress when something as fundamental as
4001 making a TCP connection to any relay is failing.
4003 Tor also doesn't specifically enter Stage 3; that is a side effect
4004 of Tor building circuits for some purpose or other. In a typical
4005 client, Tor builds predicted circuits to provide lower latency for
4006 application connection requests. In Stage 3, Tor might make new
4007 connections to relays or bridges that it did not connect to in Stage
4010 5.5.2. Phases in Bootstrap Stage 1.
4013 tag=starting summary="Starting"
4015 Tor starts out in this phase.
4018 tag=conn_pt summary="Connecting to pluggable transport"
4019 [This phase is new in 0.4.0.x]
4021 Tor is making a TCP connection to the transport plugin for a
4022 pluggable transport. Tor will use this pluggable transport to make
4023 its first connection to a bridge.
4026 tag=conn_done_pt summary="Connected to pluggable transport"
4029 Tor has completed its TCP connection to the transport plugin for the
4030 pluggable transport.
4033 tag=conn_proxy summary="Connecting to proxy"
4036 Tor is making a TCP connection to a proxy to make its first
4037 connection to a relay or bridge.
4040 tag=conn_done_proxy summary="Connected to proxy"
4043 Tor has completed its TCP connection to a proxy to make its first
4044 connection to a relay or bridge.
4047 tag=conn summary="Connecting to a relay"
4048 [New in 0.4.0.x; prior versions of Tor had a "conn_dir" phase that
4049 sometimes but not always corresponded to connecting to a directory server]
4051 Tor is making its first connection to a relay. This might be through
4052 a pluggable transport or proxy connection that Tor has already
4056 tag=conn_done summary="Connected to a relay"
4059 Tor has completed its first connection to a relay.
4062 tag=handshake summary="Handshaking with a relay"
4063 [New in 0.4.0.x; prior versions of Tor had a "handshake_dir" phase]
4065 Tor is in the process of doing a TLS handshake with a relay.
4068 tag=handshake_done summary="Handshake with a relay done"
4071 Tor has completed its TLS handshake with a relay.
4073 5.5.3. Phases in Bootstrap Stage 2.
4076 tag=onehop_create summary="Establishing an encrypted directory connection"
4077 [prior to 0.4.0.x, this was numbered 15]
4079 Once TLS is finished with a relay, Tor will send a CREATE_FAST cell
4080 to establish a one-hop circuit for retrieving directory information.
4081 It will remain in this phase until it receives the CREATED_FAST cell
4082 back, indicating that the circuit is ready.
4085 tag=requesting_status summary="Asking for networkstatus consensus"
4086 [prior to 0.4.0.x, this was numbered 20]
4088 Once we've finished our one-hop circuit, we will start a new stream
4089 for fetching the networkstatus consensus. We'll stay in this phase
4090 until we get the 'connected' relay cell back, indicating that we've
4091 established a directory connection.
4094 tag=loading_status summary="Loading networkstatus consensus"
4095 [prior to 0.4.0.x, this was numbered 25]
4097 Once we've established a directory connection, we will start fetching
4098 the networkstatus consensus document. This could take a while; this
4099 phase is a good opportunity for using the "progress" keyword to indicate
4102 This phase could stall if the directory server we picked doesn't
4103 have a copy of the networkstatus consensus so we have to ask another,
4104 or it does give us a copy but we don't find it valid.
4107 tag=loading_keys summary="Loading authority key certs"
4109 Sometimes when we've finished loading the networkstatus consensus,
4110 we find that we don't have all the authority key certificates for the
4111 keys that signed the consensus. At that point we put the consensus we
4112 fetched on hold and fetch the keys so we can verify the signatures.
4115 tag=requesting_descriptors summary="Asking for relay descriptors"
4117 Once we have a valid networkstatus consensus and we've checked all
4118 its signatures, we start asking for relay descriptors. We stay in this
4119 phase until we have received a 'connected' relay cell in response to
4120 a request for descriptors.
4122 [Some versions of Tor (starting with 0.2.6.2-alpha but before
4123 0.4.0.x): Tor could report having internal paths only; see Section
4127 tag=loading_descriptors summary="Loading relay descriptors"
4129 We will ask for relay descriptors from several different locations,
4130 so this step will probably make up the bulk of the bootstrapping,
4131 especially for users with slow connections. We stay in this phase until
4132 we have descriptors for a significant fraction of the usable relays
4133 listed in the networkstatus consensus (this can be between 25% and 95%
4134 depending on Tor's configuration and network consensus parameters).
4135 This phase is also a good opportunity to use the "progress" keyword to
4136 indicate partial steps.
4138 [Some versions of Tor (starting with 0.2.6.2-alpha but before
4139 0.4.0.x): Tor could report having internal paths only; see Section
4143 tag=enough_dirinfo summary="Loaded enough directory info to build
4145 [New in 0.4.0.x; previously, Tor would misleadingly report the
4146 "conn_or" tag once it had enough directory info.]
4148 5.5.4. Phases in Bootstrap Stage 3.
4151 tag=ap_conn_pt summary="Connecting to pluggable transport to build
4155 This is similar to conn_pt, except for making connections to
4156 additional relays or bridges that Tor needs to use to build
4157 application circuits.
4160 tag=ap_conn_done_pt summary="Connected to pluggable transport to build circuits"
4163 This is similar to conn_done_pt, except for making connections to
4164 additional relays or bridges that Tor needs to use to build
4165 application circuits.
4168 tag=ap_conn_proxy summary="Connecting to proxy to build circuits"
4171 This is similar to conn_proxy, except for making connections to
4172 additional relays or bridges that Tor needs to use to build
4173 application circuits.
4176 tag=ap_conn_done_proxy summary="Connected to proxy to build circuits"
4179 This is similar to conn_done_proxy, except for making connections to
4180 additional relays or bridges that Tor needs to use to build
4181 application circuits.
4184 tag=ap_conn summary="Connecting to a relay to build circuits"
4187 This is similar to conn, except for making connections to additional
4188 relays or bridges that Tor needs to use to build application
4192 tag=ap_conn_done summary="Connected to a relay to build circuits"
4195 This is similar to conn_done, except for making connections to
4196 additional relays or bridges that Tor needs to use to build
4197 application circuits.
4200 tag=ap_handshake summary="Finishing handshake with a relay to build circuits"
4203 This is similar to handshake, except for making connections to
4204 additional relays or bridges that Tor needs to use to build
4205 application circuits.
4208 tag=ap_handshake_done summary="Handshake finished with a relay to build circuits"
4211 This is similar to handshake_done, except for making connections to
4212 additional relays or bridges that Tor needs to use to build
4213 application circuits.
4216 tag=circuit_create summary="Establishing a[n internal] Tor circuit"
4217 [prior to 0.4.0.x, this was numbered 90]
4219 Once we've finished our TLS handshake with the first hop of a circuit,
4220 we will set about trying to make some 3-hop circuits in case we need them
4223 [Some versions of Tor (starting with 0.2.6.2-alpha but before
4224 0.4.0.x): Tor could report having internal paths only; see Section
4228 tag=done summary="Done"
4230 A full 3-hop circuit has been established. Tor is ready to handle
4231 application connections now.
4233 [Some versions of Tor (starting with 0.2.6.2-alpha but before
4234 0.4.0.x): Tor could report having internal paths only; see Section
4237 5.6. Bootstrap phases reported by older versions of Tor
4239 These phases were reported by Tor older than 0.4.0.x. For newer
4240 versions of Tor, see Section 5.5.
4242 [Newer versions of Tor (0.2.6.2-alpha and later):
4243 If the consensus contains Exits (the typical case), Tor will build both
4244 exit and internal circuits. When bootstrap completes, Tor will be ready
4245 to handle an application requesting an exit circuit to services like the
4248 If the consensus does not contain Exits, Tor will only build internal
4249 circuits. In this case, earlier statuses will have included "internal"
4250 as indicated above. When bootstrap completes, Tor will be ready to handle
4251 an application requesting an internal circuit to hidden services at
4254 If a future consensus contains Exits, exit circuits may become available.]
4257 tag=starting summary="Starting"
4259 Tor starts out in this phase.
4262 tag=conn_dir summary="Connecting to directory server"
4264 Tor sends this event as soon as Tor has chosen a directory server --
4265 e.g. one of the authorities if bootstrapping for the first time or
4266 after a long downtime, or one of the relays listed in its cached
4267 directory information otherwise.
4269 Tor will stay at this phase until it has successfully established
4270 a TCP connection with some directory server. Problems in this phase
4271 generally happen because Tor doesn't have a network connection, or
4272 because the local firewall is dropping SYN packets.
4275 tag=handshake_dir summary="Finishing handshake with directory server"
4277 This event occurs when Tor establishes a TCP connection with a relay or
4278 authority used as a directory server (or its https proxy if it's using
4279 one). Tor remains in this phase until the TLS handshake with the relay
4280 or authority is finished.
4282 Problems in this phase generally happen because Tor's firewall is
4283 doing more sophisticated MITM attacks on it, or doing packet-level
4284 keyword recognition of Tor's handshake.
4287 tag=onehop_create summary="Establishing an encrypted directory connection"
4289 Once TLS is finished with a relay, Tor will send a CREATE_FAST cell
4290 to establish a one-hop circuit for retrieving directory information.
4291 It will remain in this phase until it receives the CREATED_FAST cell
4292 back, indicating that the circuit is ready.
4295 tag=requesting_status summary="Asking for networkstatus consensus"
4297 Once we've finished our one-hop circuit, we will start a new stream
4298 for fetching the networkstatus consensus. We'll stay in this phase
4299 until we get the 'connected' relay cell back, indicating that we've
4300 established a directory connection.
4303 tag=loading_status summary="Loading networkstatus consensus"
4305 Once we've established a directory connection, we will start fetching
4306 the networkstatus consensus document. This could take a while; this
4307 phase is a good opportunity for using the "progress" keyword to indicate
4310 This phase could stall if the directory server we picked doesn't
4311 have a copy of the networkstatus consensus so we have to ask another,
4312 or it does give us a copy but we don't find it valid.
4315 tag=loading_keys summary="Loading authority key certs"
4317 Sometimes when we've finished loading the networkstatus consensus,
4318 we find that we don't have all the authority key certificates for the
4319 keys that signed the consensus. At that point we put the consensus we
4320 fetched on hold and fetch the keys so we can verify the signatures.
4323 tag=requesting_descriptors summary="Asking for relay descriptors
4324 [ for internal paths]"
4326 Once we have a valid networkstatus consensus and we've checked all
4327 its signatures, we start asking for relay descriptors. We stay in this
4328 phase until we have received a 'connected' relay cell in response to
4329 a request for descriptors.
4331 [Newer versions of Tor (0.2.6.2-alpha and later):
4332 If the consensus contains Exits (the typical case), Tor will ask for
4333 descriptors for both exit and internal paths. If not, Tor will only ask
4334 for descriptors for internal paths. In this case, this status will
4335 include "internal" as indicated above.]
4338 tag=loading_descriptors summary="Loading relay descriptors[ for internal
4341 We will ask for relay descriptors from several different locations,
4342 so this step will probably make up the bulk of the bootstrapping,
4343 especially for users with slow connections. We stay in this phase until
4344 we have descriptors for a significant fraction of the usable relays
4345 listed in the networkstatus consensus (this can be between 25% and 95%
4346 depending on Tor's configuration and network consensus parameters).
4347 This phase is also a good opportunity to use the "progress" keyword to
4348 indicate partial steps.
4350 [Newer versions of Tor (0.2.6.2-alpha and later):
4351 If the consensus contains Exits (the typical case), Tor will download
4352 descriptors for both exit and internal paths. If not, Tor will only
4353 download descriptors for internal paths. In this case, this status will
4354 include "internal" as indicated above.]
4357 tag=conn_or summary="Connecting to the Tor network[ internally]"
4359 Once we have a valid consensus and enough relay descriptors, we choose
4360 entry guard(s) and start trying to build some circuits. This step
4361 is similar to the "conn_dir" phase above; the only difference is
4364 If a Tor starts with enough recent cached directory information,
4365 its first bootstrap status event will be for the conn_or phase.
4367 [Newer versions of Tor (0.2.6.2-alpha and later):
4368 If the consensus contains Exits (the typical case), Tor will build both
4369 exit and internal circuits. If not, Tor will only build internal circuits.
4370 In this case, this status will include "internal(ly)" as indicated above.]
4373 tag=handshake_or summary="Finishing handshake with first hop[ of internal
4376 This phase is similar to the "handshake_dir" phase, but it gets reached
4377 if we finish a TCP connection to a Tor relay and we have already reached
4378 the "conn_or" phase. We'll stay in this phase until we complete a TLS
4379 handshake with a Tor relay.
4381 [Newer versions of Tor (0.2.6.2-alpha and later):
4382 If the consensus contains Exits (the typical case), Tor may be finishing
4383 a handshake with the first hop if either an exit or internal circuit. In
4384 this case, it won't specify which type. If the consensus contains no Exits,
4385 Tor will only build internal circuits. In this case, this status will
4386 include "internal" as indicated above.]
4389 tag=circuit_create summary="Establishing a[n internal] Tor circuit"
4391 Once we've finished our TLS handshake with the first hop of a circuit,
4392 we will set about trying to make some 3-hop circuits in case we need them
4395 [Newer versions of Tor (0.2.6.2-alpha and later):
4396 If the consensus contains Exits (the typical case), Tor will build both
4397 exit and internal circuits. If not, Tor will only build internal circuits.
4398 In this case, this status will include "internal" as indicated above.]
4401 tag=done summary="Done"
4403 A full 3-hop circuit has been established. Tor is ready to handle
4404 application connections now.
4406 [Newer versions of Tor (0.2.6.2-alpha and later):
4407 If the consensus contains Exits (the typical case), Tor will build both
4408 exit and internal circuits. At this stage, Tor will be ready to handle
4409 an application requesting an exit circuit to services like the World
4412 If the consensus does not contain Exits, Tor will only build internal
4413 circuits. In this case, earlier statuses will have included "internal"
4414 as indicated above. At this stage, Tor will be ready to handle an
4415 application requesting an internal circuit to hidden services at ".onion"
4418 If a future consensus contains Exits, exit circuits may become available.]