control-spec.txt 140 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348
  1. TC: A Tor control protocol (Version 1)
  2. 0. Scope
  3. This document describes an implementation-specific protocol that is used
  4. for other programs (such as frontend user-interfaces) to communicate with a
  5. locally running Tor process. It is not part of the Tor onion routing
  6. protocol.
  7. This protocol replaces version 0 of TC, which is now deprecated. For
  8. reference, TC is described in "control-spec-v0.txt". Implementors are
  9. recommended to avoid using TC directly, but instead to use a library that
  10. can easily be updated to use the newer protocol. (Version 0 is used by Tor
  11. versions 0.1.0.x; the protocol in this document only works with Tor
  12. versions in the 0.1.1.x series and later.)
  13. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
  14. NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
  15. "OPTIONAL" in this document are to be interpreted as described in
  16. RFC 2119.
  17. 1. Protocol outline
  18. TC is a bidirectional message-based protocol. It assumes an underlying
  19. stream for communication between a controlling process (the "client"
  20. or "controller") and a Tor process (or "server"). The stream may be
  21. implemented via TCP, TLS-over-TCP, a Unix-domain socket, or so on,
  22. but it must provide reliable in-order delivery. For security, the
  23. stream should not be accessible by untrusted parties.
  24. In TC, the client and server send typed messages to each other over the
  25. underlying stream. The client sends "commands" and the server sends
  26. "replies".
  27. By default, all messages from the server are in response to messages from
  28. the client. Some client requests, however, will cause the server to send
  29. messages to the client indefinitely far into the future. Such
  30. "asynchronous" replies are marked as such.
  31. Servers respond to messages in the order messages are received.
  32. 1.1. Forward-compatibility
  33. This is an evolving protocol; new client and server behavior will be
  34. allowed in future versions. To allow new backward-compatible behavior
  35. on behalf of the client, we may add new commands and allow existing
  36. commands to take new arguments in future versions. To allow new
  37. backward-compatible server behavior, we note various places below
  38. where servers speaking a future version of this protocol may insert
  39. new data, and note that clients should/must "tolerate" unexpected
  40. elements in these places. There are two ways that we do this:
  41. * Adding a new field to a message:
  42. For example, we might say "This message has three space-separated
  43. fields; clients MUST tolerate more fields." This means that a
  44. client MUST NOT crash or otherwise fail to parse the message or
  45. other subsequent messages when there are more than three fields, and
  46. that it SHOULD function at least as well when more fields are
  47. provided as it does when it only gets the fields it accepts. The
  48. most obvious way to do this is by ignoring additional fields; the
  49. next-most-obvious way is to report additional fields verbatim to the
  50. user, perhaps as part of an expert UI.
  51. * Adding a new possible value to a list of alternatives:
  52. For example, we might say "This field will be OPEN, CLOSED, or
  53. CONNECTED. Clients MUST tolerate unexpected values." This means
  54. that a client MUST NOT crash or otherwise fail to parse the message
  55. or other subsequent messages when there are unexpected values, and
  56. that it SHOULD try to handle the rest of the message as well as it
  57. can. The most obvious way to do this is by pretending that each
  58. list of alternatives has an additional "unrecognized value" element,
  59. and mapping any unrecognized values to that element; the
  60. next-most-obvious way is to create a separate "unrecognized value"
  61. element for each unrecognized value.
  62. Clients SHOULD NOT "tolerate" unrecognized alternatives by
  63. pretending that the message containing them is absent. For example,
  64. a stream closed for an unrecognized reason is nevertheless closed,
  65. and should be reported as such.
  66. (If some list of alternatives is given, and there isn't an explicit
  67. statement that clients must tolerate unexpected values, clients still
  68. must tolerate unexpected values. The only exception would be if there
  69. were an explicit statement that no future values will ever be added.)
  70. 2. Message format
  71. 2.1. Description format
  72. The message formats listed below use ABNF as described in RFC 2234.
  73. The protocol itself is loosely based on SMTP (see RFC 2821).
  74. We use the following nonterminals from RFC 2822: atom, qcontent
  75. We define the following general-use nonterminals:
  76. QuotedString = DQUOTE *qcontent DQUOTE
  77. There are explicitly no limits on line length. All 8-bit characters
  78. are permitted unless explicitly disallowed. In QuotedStrings,
  79. backslashes and quotes must be escaped; other characters need not be
  80. escaped.
  81. Wherever CRLF is specified to be accepted from the controller, Tor MAY also
  82. accept LF. Tor, however, MUST NOT generate LF instead of CRLF.
  83. Controllers SHOULD always send CRLF.
  84. 2.1.1. Notes on an escaping bug
  85. CString = DQUOTE *qcontent DQUOTE
  86. Note that although these nonterminals have the same grammar, they
  87. are interpreted differently. In a QuotedString, a backslash
  88. followed by any character represents that character. But
  89. in a CString, the escapes "\n", "\t", "\r", and the octal escapes
  90. "\0" ... "\377" represent newline, tab, carriage return, and the
  91. 256 possible octet values respectively.
  92. The use of CString in this document reflect a bug in Tor;
  93. they should have been QuotedString instead. In the future, they
  94. may migrate to use QuotedString instead. If they do, the
  95. QuotedString implementation will never place a backslash before a
  96. "n", "t", "r", or digit, to ensure that old controllers don't get
  97. confused.
  98. For future-proofing, controller implementors MAY use the following
  99. rules to be compatible with buggy Tor implementations and with
  100. future ones that implement the spec as intended:
  101. Read \n \t \r and \0 ... \377 as C escapes.
  102. Treat a backslash followed by any other character as that character.
  103. Currently, many of the QuotedString instances below that Tor
  104. outputs are in fact CStrings. We intend to fix this in future
  105. versions of Tor, and document which ones were broken. (See
  106. bugtracker ticket #14555 for a bit more information.)
  107. Note that this bug exists only in strings generated by Tor for the
  108. Tor controller; Tor should parse input QuotedStrings from the
  109. controller correctly.
  110. 2.2. Commands from controller to Tor
  111. Command = Keyword OptArguments CRLF / "+" Keyword OptArguments CRLF CmdData
  112. Keyword = 1*ALPHA
  113. OptArguments = [ SP *(SP / VCHAR) ]
  114. A command is either a single line containing a Keyword and arguments, or a
  115. multiline command whose initial keyword begins with +, and whose data
  116. section ends with a single "." on a line of its own. (We use a special
  117. character to distinguish multiline commands so that Tor can correctly parse
  118. multi-line commands that it does not recognize.) Specific commands and
  119. their arguments are described below in section 3.
  120. 2.3. Replies from Tor to the controller
  121. Reply = SyncReply / AsyncReply
  122. SyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
  123. AsyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
  124. MidReplyLine = StatusCode "-" ReplyLine
  125. DataReplyLine = StatusCode "+" ReplyLine CmdData
  126. EndReplyLine = StatusCode SP ReplyLine
  127. ReplyLine = [ReplyText] CRLF
  128. ReplyText = XXXX
  129. StatusCode = 3DIGIT
  130. Multiple lines in a single reply from Tor to the controller are guaranteed to
  131. share the same status code. Specific replies are mentioned below in section 3,
  132. and described more fully in section 4.
  133. [Compatibility note: versions of Tor before 0.2.0.3-alpha sometimes
  134. generate AsyncReplies of the form "*(MidReplyLine / DataReplyLine)".
  135. This is incorrect, but controllers that need to work with these
  136. versions of Tor should be prepared to get multi-line AsyncReplies with
  137. the final line (usually "650 OK") omitted.]
  138. 2.4. General-use tokens
  139. ; CRLF means, "the ASCII Carriage Return character (decimal value 13)
  140. ; followed by the ASCII Linefeed character (decimal value 10)."
  141. CRLF = CR LF
  142. ; How a controller tells Tor about a particular OR. There are four
  143. ; possible formats:
  144. ; $Fingerprint -- The router whose identity key hashes to the fingerprint.
  145. ; This is the preferred way to refer to an OR.
  146. ; $Fingerprint~Nickname -- The router whose identity key hashes to the
  147. ; given fingerprint, but only if the router has the given nickname.
  148. ; $Fingerprint=Nickname -- The router whose identity key hashes to the
  149. ; given fingerprint, but only if the router is Named and has the given
  150. ; nickname.
  151. ; Nickname -- The Named router with the given nickname, or, if no such
  152. ; router exists, any router whose nickname matches the one given.
  153. ; This is not a safe way to refer to routers, since Named status
  154. ; could under some circumstances change over time.
  155. ;
  156. ; The tokens that implement the above follow:
  157. ServerSpec = LongName / Nickname
  158. LongName = Fingerprint [ ( "=" / "~" ) Nickname ]
  159. Fingerprint = "$" 40*HEXDIG
  160. NicknameChar = "a"-"z" / "A"-"Z" / "0" - "9"
  161. Nickname = 1*19 NicknameChar
  162. ; What follows is an outdated way to refer to ORs.
  163. ; Feature VERBOSE_NAMES replaces ServerID with LongName in events and
  164. ; GETINFO results. VERBOSE_NAMES can be enabled starting in Tor version
  165. ; 0.1.2.2-alpha and it is always-on in 0.2.2.1-alpha and later.
  166. ServerID = Nickname / Fingerprint
  167. ; Unique identifiers for streams or circuits. Currently, Tor only
  168. ; uses digits, but this may change
  169. StreamID = 1*16 IDChar
  170. CircuitID = 1*16 IDChar
  171. ConnID = 1*16 IDChar
  172. QueueID = 1*16 IDChar
  173. IDChar = ALPHA / DIGIT
  174. Address = ip4-address / ip6-address / hostname (XXXX Define these)
  175. ; A "CmdData" section is a sequence of octets concluded by the terminating
  176. ; sequence CRLF "." CRLF. The terminating sequence may not appear in the
  177. ; body of the data. Leading periods on lines in the data are escaped with
  178. ; an additional leading period as in RFC 2821 section 4.5.2.
  179. CmdData = *DataLine "." CRLF
  180. DataLine = CRLF / "." 1*LineItem CRLF / NonDotItem *LineItem CRLF
  181. LineItem = NonCR / 1*CR NonCRLF
  182. NonDotItem = NonDotCR / 1*CR NonCRLF
  183. ; ISOTime, ISOTime2, and ISOTime2Frac are time formats as specified in
  184. ; ISO8601.
  185. ; example ISOTime: "2012-01-11 12:15:33"
  186. ; example ISOTime2: "2012-01-11T12:15:33"
  187. ; example ISOTime2Frac: "2012-01-11T12:15:33.51"
  188. IsoDatePart = 4*DIGIT "-" 2*DIGIT "-" 2*DIGIT
  189. IsoTimePart = 2*DIGIT ":" 2*DIGIT ":" 2*DIGIT
  190. ISOTime = IsoDatePart " " IsoTimePart
  191. ISOTime2 = IsoDatePart "T" IsoTimePart
  192. ISOTime2Frac = IsoTime2 [ "." 1*DIGIT ]
  193. ; Numbers
  194. LeadingDigit = "1" - "9"
  195. UInt = LeadingDigit *Digit
  196. 3. Commands
  197. All commands are case-insensitive, but most keywords are case-sensitive.
  198. 3.1. SETCONF
  199. Change the value of one or more configuration variables. The syntax is:
  200. "SETCONF" 1*(SP keyword ["=" value]) CRLF
  201. value = String / QuotedString
  202. Tor behaves as though it had just read each of the key-value pairs
  203. from its configuration file. Keywords with no corresponding values have
  204. their configuration values reset to 0 or NULL (use RESETCONF if you want
  205. to set it back to its default). SETCONF is all-or-nothing: if there
  206. is an error in any of the configuration settings, Tor sets none of them.
  207. Tor responds with a "250 configuration values set" reply on success.
  208. If some of the listed keywords can't be found, Tor replies with a
  209. "552 Unrecognized option" message. Otherwise, Tor responds with a
  210. "513 syntax error in configuration values" reply on syntax error, or a
  211. "553 impossible configuration setting" reply on a semantic error.
  212. Some configuration options (e.g. "Bridge") take multiple values. Also,
  213. some configuration keys (e.g. for hidden services and for entry
  214. guard lists) form a context-sensitive group where order matters (see
  215. GETCONF below). In these cases, setting _any_ of the options in a
  216. SETCONF command is taken to reset all of the others. For example,
  217. if two ORListenAddress values are configured, and a SETCONF command
  218. arrives containing a single ORListenAddress value, the new command's
  219. value replaces the two old values.
  220. Sometimes it is not possible to change configuration options solely by
  221. issuing a series of SETCONF commands, because the value of one of the
  222. configuration options depends on the value of another which has not yet
  223. been set. Such situations can be overcome by setting multiple configuration
  224. options with a single SETCONF command (e.g. SETCONF ORPort=443
  225. ORListenAddress=9001).
  226. 3.2. RESETCONF
  227. Remove all settings for a given configuration option entirely, assign
  228. its default value (if any), and then assign the String provided.
  229. Typically the String is left empty, to simply set an option back to
  230. its default. The syntax is:
  231. "RESETCONF" 1*(SP keyword ["=" String]) CRLF
  232. Otherwise it behaves like SETCONF above.
  233. 3.3. GETCONF
  234. Request the value of a configuration variable. The syntax is:
  235. "GETCONF" 1*(SP keyword) CRLF
  236. If all of the listed keywords exist in the Tor configuration, Tor replies
  237. with a series of reply lines of the form:
  238. 250 keyword=value
  239. If any option is set to a 'default' value semantically different from an
  240. empty string, Tor may reply with a reply line of the form:
  241. 250 keyword
  242. Value may be a raw value or a quoted string. Tor will try to use unquoted
  243. values except when the value could be misinterpreted through not being
  244. quoted. (Right now, Tor supports no such misinterpretable values for
  245. configuration options.)
  246. If some of the listed keywords can't be found, Tor replies with a
  247. "552 unknown configuration keyword" message.
  248. If an option appears multiple times in the configuration, all of its
  249. key-value pairs are returned in order.
  250. Some options are context-sensitive, and depend on other options with
  251. different keywords. These cannot be fetched directly. Currently there
  252. is only one such option: clients should use the "HiddenServiceOptions"
  253. virtual keyword to get all HiddenServiceDir, HiddenServicePort,
  254. HiddenServiceVersion, and HiddenserviceAuthorizeClient option settings.
  255. 3.4. SETEVENTS
  256. Request the server to inform the client about interesting events. The
  257. syntax is:
  258. "SETEVENTS" [SP "EXTENDED"] *(SP EventCode) CRLF
  259. EventCode = 1*(ALPHA / "_") (see section 4.1.x for event types)
  260. Any events *not* listed in the SETEVENTS line are turned off; thus, sending
  261. SETEVENTS with an empty body turns off all event reporting.
  262. The server responds with a "250 OK" reply on success, and a "552
  263. Unrecognized event" reply if one of the event codes isn't recognized. (On
  264. error, the list of active event codes isn't changed.)
  265. If the flag string "EXTENDED" is provided, Tor may provide extra
  266. information with events for this connection; see 4.1 for more information.
  267. NOTE: All events on a given connection will be provided in extended format,
  268. or none.
  269. NOTE: "EXTENDED" was first supported in Tor 0.1.1.9-alpha; it is
  270. always-on in Tor 0.2.2.1-alpha and later.
  271. Each event is described in more detail in Section 4.1.
  272. 3.5. AUTHENTICATE
  273. Sent from the client to the server. The syntax is:
  274. "AUTHENTICATE" [ SP 1*HEXDIG / QuotedString ] CRLF
  275. The server responds with "250 OK" on success or "515 Bad authentication" if
  276. the authentication cookie is incorrect. Tor closes the connection on an
  277. authentication failure.
  278. The authentication token can be specified as either a quoted ASCII string,
  279. or as an unquoted hexadecimal encoding of that same string (to avoid escaping
  280. issues).
  281. For information on how the implementation securely stores authentication
  282. information on disk, see section 5.1.
  283. Before the client has authenticated, no command other than
  284. PROTOCOLINFO, AUTHCHALLENGE, AUTHENTICATE, or QUIT is valid. If the
  285. controller sends any other command, or sends a malformed command, or
  286. sends an unsuccessful AUTHENTICATE command, or sends PROTOCOLINFO or
  287. AUTHCHALLENGE more than once, Tor sends an error reply and closes
  288. the connection.
  289. To prevent some cross-protocol attacks, the AUTHENTICATE command is still
  290. required even if all authentication methods in Tor are disabled. In this
  291. case, the controller should just send "AUTHENTICATE" CRLF.
  292. (Versions of Tor before 0.1.2.16 and 0.2.0.4-alpha did not close the
  293. connection after an authentication failure.)
  294. 3.6. SAVECONF
  295. Sent from the client to the server. The syntax is:
  296. "SAVECONF" CRLF
  297. Instructs the server to write out its config options into its torrc. Server
  298. returns "250 OK" if successful, or "551 Unable to write configuration
  299. to disk" if it can't write the file or some other error occurs.
  300. See also the "getinfo config-text" command, if the controller wants
  301. to write the torrc file itself.
  302. 3.7. SIGNAL
  303. Sent from the client to the server. The syntax is:
  304. "SIGNAL" SP Signal CRLF
  305. Signal = "RELOAD" / "SHUTDOWN" / "DUMP" / "DEBUG" / "HALT" /
  306. "HUP" / "INT" / "USR1" / "USR2" / "TERM" / "NEWNYM" /
  307. "CLEARDNSCACHE" / "HEARTBEAT"
  308. The meaning of the signals are:
  309. RELOAD -- Reload: reload config items. (like HUP)
  310. SHUTDOWN -- Controlled shutdown: if server is an OP, exit immediately.
  311. If it's an OR, close listeners and exit after
  312. ShutdownWaitLength seconds. (like INT)
  313. DUMP -- Dump stats: log information about open connections and
  314. circuits. (like USR1)
  315. DEBUG -- Debug: switch all open logs to loglevel debug. (like USR2)
  316. HALT -- Immediate shutdown: clean up and exit now. (like TERM)
  317. CLEARDNSCACHE -- Forget the client-side cached IPs for all hostnames.
  318. NEWNYM -- Switch to clean circuits, so new application requests
  319. don't share any circuits with old ones. Also clears
  320. the client-side DNS cache. (Tor MAY rate-limit its
  321. response to this signal.)
  322. HEARTBEAT -- Make Tor dump an unscheduled Heartbeat message to log.
  323. The server responds with "250 OK" if the signal is recognized (or simply
  324. closes the socket if it was asked to close immediately), or "552
  325. Unrecognized signal" if the signal is unrecognized.
  326. 3.8. MAPADDRESS
  327. Sent from the client to the server. The syntax is:
  328. "MAPADDRESS" 1*(Address "=" Address SP) CRLF
  329. The first address in each pair is an "original" address; the second is a
  330. "replacement" address. The client sends this message to the server in
  331. order to tell it that future SOCKS requests for connections to the original
  332. address should be replaced with connections to the specified replacement
  333. address. If the addresses are well-formed, and the server is able to
  334. fulfill the request, the server replies with a 250 message:
  335. 250-OldAddress1=NewAddress1
  336. 250 OldAddress2=NewAddress2
  337. containing the source and destination addresses. If request is
  338. malformed, the server replies with "512 syntax error in command
  339. argument". If the server can't fulfill the request, it replies with
  340. "451 resource exhausted".
  341. The client may decline to provide a body for the original address, and
  342. instead send a special null address ("0.0.0.0" for IPv4, "::0" for IPv6, or
  343. "." for hostname), signifying that the server should choose the original
  344. address itself, and return that address in the reply. The server
  345. should ensure that it returns an element of address space that is unlikely
  346. to be in actual use. If there is already an address mapped to the
  347. destination address, the server may reuse that mapping.
  348. If the original address is already mapped to a different address, the old
  349. mapping is removed. If the original address and the destination address
  350. are the same, the server removes any mapping in place for the original
  351. address.
  352. Example:
  353. C: MAPADDRESS 0.0.0.0=torproject.org 1.2.3.4=tor.freehaven.net
  354. S: 250-127.192.10.10=torproject.org
  355. S: 250 1.2.3.4=tor.freehaven.net
  356. {Note: This feature is designed to be used to help Tor-ify applications
  357. that need to use SOCKS4 or hostname-less SOCKS5. There are three
  358. approaches to doing this:
  359. 1. Somehow make them use SOCKS4a or SOCKS5-with-hostnames instead.
  360. 2. Use tor-resolve (or another interface to Tor's resolve-over-SOCKS
  361. feature) to resolve the hostname remotely. This doesn't work
  362. with special addresses like x.onion or x.y.exit.
  363. 3. Use MAPADDRESS to map an IP address to the desired hostname, and then
  364. arrange to fool the application into thinking that the hostname
  365. has resolved to that IP.
  366. This functionality is designed to help implement the 3rd approach.}
  367. Mappings set by the controller last until the Tor process exits:
  368. they never expire. If the controller wants the mapping to last only
  369. a certain time, then it must explicitly un-map the address when that
  370. time has elapsed.
  371. 3.9. GETINFO
  372. Sent from the client to the server. The syntax is as for GETCONF:
  373. "GETINFO" 1*(SP keyword) CRLF
  374. one or more NL-terminated strings. The server replies with an INFOVALUE
  375. message, or a 551 or 552 error.
  376. Unlike GETCONF, this message is used for data that are not stored in the Tor
  377. configuration file, and that may be longer than a single line. On success,
  378. one ReplyLine is sent for each requested value, followed by a final 250 OK
  379. ReplyLine. If a value fits on a single line, the format is:
  380. 250-keyword=value
  381. If a value must be split over multiple lines, the format is:
  382. 250+keyword=
  383. value
  384. .
  385. Recognized keys and their values include:
  386. "version" -- The version of the server's software, which MAY include the
  387. name of the software, such as "Tor 0.0.9.4". The name of the software,
  388. if absent, is assumed to be "Tor".
  389. "config-file" -- The location of Tor's configuration file ("torrc").
  390. "config-defaults-file" -- The location of Tor's configuration
  391. defaults file ("torrc.defaults"). This file gets parsed before
  392. torrc, and is typically used to replace Tor's default
  393. configuration values. [First implemented in 0.2.3.9-alpha.]
  394. "config-text" -- The contents that Tor would write if you send it
  395. a SAVECONF command, so the controller can write the file to
  396. disk itself. [First implemented in 0.2.2.7-alpha.]
  397. "exit-policy/default" -- The default exit policy lines that Tor will
  398. *append* to the ExitPolicy config option.
  399. "exit-policy/reject-private/default" -- The default exit policy lines
  400. that Tor will *prepend* to the ExitPolicy config option when
  401. ExitPolicyRejectPrivate is 1.
  402. "exit-policy/reject-private/relay" -- The relay-specific exit policy
  403. lines that Tor will *prepend* to the ExitPolicy config option based
  404. on the current values of ExitPolicyRejectPrivate and
  405. ExitPolicyRejectLocalInterfaces. These lines are based on the public
  406. addresses configured in the torrc and present on the relay's
  407. interfaces.
  408. "exit-policy/ipv4"
  409. "exit-policy/ipv6"
  410. "exit-policy/full" -- This OR's exit policy, in IPv4-only, IPv6-only, or
  411. all-entries flavors.
  412. "desc/id/<OR identity>" or "desc/name/<OR nickname>" -- the latest
  413. server descriptor for a given OR. (Note that modern Tor clients
  414. do not download server descriptors by default, but download
  415. microdescriptors instead. If microdescriptors are enabled, you'll
  416. need to use "md" instead.)
  417. "md/id/<OR identity>" or "md/name/<OR nickname>" -- the latest
  418. microdescriptor for a given OR. [First implemented in
  419. 0.2.3.8-alpha.]
  420. "dormant" -- A nonnegative integer: zero if Tor is currently active and
  421. building circuits, and nonzero if Tor has gone idle due to lack of use
  422. or some similar reason. [First implemented in 0.2.3.16-alpha]
  423. "desc-annotations/id/<OR identity>" -- outputs the annotations string
  424. (source, timestamp of arrival, purpose, etc) for the corresponding
  425. descriptor. [First implemented in 0.2.0.13-alpha.]
  426. "extra-info/digest/<digest>" -- the extrainfo document whose digest (in
  427. hex) is <digest>. Only available if we're downloading extra-info
  428. documents.
  429. "ns/id/<OR identity>" or "ns/name/<OR nickname>" -- the latest router
  430. status info (v3 directory style) for a given OR. Router status
  431. info is as given in
  432. dir-spec.txt, and reflects the current beliefs of this Tor about the
  433. router in question. Like directory clients, controllers MUST
  434. tolerate unrecognized flags and lines. The published date and
  435. descriptor digest are those believed to be best by this Tor,
  436. not necessarily those for a descriptor that Tor currently has.
  437. [First implemented in 0.1.2.3-alpha.]
  438. [In 0.2.0.9-alpha this switched from v2 directory style to v3]
  439. "ns/all" -- Router status info (v3 directory style) for all ORs we
  440. have an opinion about, joined by newlines.
  441. [First implemented in 0.1.2.3-alpha.]
  442. [In 0.2.0.9-alpha this switched from v2 directory style to v3]
  443. "ns/purpose/<purpose>" -- Router status info (v3 directory style)
  444. for all ORs of this purpose. Mostly designed for /ns/purpose/bridge
  445. queries.
  446. [First implemented in 0.2.0.13-alpha.]
  447. [In 0.2.0.9-alpha this switched from v2 directory style to v3]
  448. "desc/all-recent" -- the latest server descriptor for every router that
  449. Tor knows about. (See md note about "desc/id" and "desc/name" above.)
  450. "network-status" -- a space-separated list (v1 directory style)
  451. of all known OR identities. This is in the same format as the
  452. router-status line in v1 directories; see dir-spec-v1.txt section
  453. 3 for details. (If VERBOSE_NAMES is enabled, the output will
  454. not conform to dir-spec-v1.txt; instead, the result will be a
  455. space-separated list of LongName, each preceded by a "!" if it is
  456. believed to be not running.) This option is deprecated; use
  457. "ns/all" instead.
  458. "address-mappings/all"
  459. "address-mappings/config"
  460. "address-mappings/cache"
  461. "address-mappings/control" -- a \r\n-separated list of address
  462. mappings, each in the form of "from-address to-address expiry".
  463. The 'config' key returns those address mappings set in the
  464. configuration; the 'cache' key returns the mappings in the
  465. client-side DNS cache; the 'control' key returns the mappings set
  466. via the control interface; the 'all' target returns the mappings
  467. set through any mechanism.
  468. Expiry is formatted as with ADDRMAP events, except that "expiry" is
  469. always a time in UTC or the string "NEVER"; see section 4.1.7.
  470. First introduced in 0.2.0.3-alpha.
  471. "addr-mappings/*" -- as for address-mappings/*, but without the
  472. expiry portion of the value. Use of this value is deprecated
  473. since 0.2.0.3-alpha; use address-mappings instead.
  474. "address" -- the best guess at our external IP address. If we
  475. have no guess, return a 551 error. (Added in 0.1.2.2-alpha)
  476. "fingerprint" -- the contents of the fingerprint file that Tor
  477. writes as a relay, or a 551 if we're not a relay currently.
  478. (Added in 0.1.2.3-alpha)
  479. "circuit-status"
  480. A series of lines as for a circuit status event. Each line is of
  481. the form described in section 4.1.1, omitting the initial
  482. "650 CIRC ". Note that clients must be ready to accept additional
  483. arguments as described in section 4.1.
  484. "stream-status"
  485. A series of lines as for a stream status event. Each is of the form:
  486. StreamID SP StreamStatus SP CircuitID SP Target CRLF
  487. "orconn-status"
  488. A series of lines as for an OR connection status event. In Tor
  489. 0.1.2.2-alpha with feature VERBOSE_NAMES enabled and in Tor
  490. 0.2.2.1-alpha and later by default, each line is of the form:
  491. LongName SP ORStatus CRLF
  492. In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
  493. VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, each line
  494. is of the form:
  495. ServerID SP ORStatus CRLF
  496. "entry-guards"
  497. A series of lines listing the currently chosen entry guards, if any.
  498. In Tor 0.1.2.2-alpha with feature VERBOSE_NAMES enabled and in Tor
  499. 0.2.2.1-alpha and later by default, each line is of the form:
  500. LongName SP Status [SP ISOTime] CRLF
  501. In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
  502. VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, each line
  503. is of the form:
  504. ServerID2 SP Status [SP ISOTime] CRLF
  505. ServerID2 = Nickname / 40*HEXDIG
  506. The definition of Status is the same for both:
  507. Status = "up" / "never-connected" / "down" /
  508. "unusable" / "unlisted"
  509. [From 0.1.1.4-alpha to 0.1.1.10-alpha, entry-guards was called
  510. "helper-nodes". Tor still supports calling "helper-nodes", but it
  511. is deprecated and should not be used.]
  512. [Older versions of Tor (before 0.1.2.x-final) generated 'down' instead
  513. of unlisted/unusable. Between 0.1.2.x-final and 0.2.6.3-alpha,
  514. 'down' was never generated.]
  515. [XXXX ServerID2 differs from ServerID in not prefixing fingerprints
  516. with a $. This is an implementation error. It would be nice to add
  517. the $ back in if we can do so without breaking compatibility.]
  518. "traffic/read" -- Total bytes read (downloaded).
  519. "traffic/written" -- Total bytes written (uploaded).
  520. "accounting/enabled"
  521. "accounting/hibernating"
  522. "accounting/bytes"
  523. "accounting/bytes-left"
  524. "accounting/interval-start"
  525. "accounting/interval-wake"
  526. "accounting/interval-end"
  527. Information about accounting status. If accounting is enabled,
  528. "enabled" is 1; otherwise it is 0. The "hibernating" field is "hard"
  529. if we are accepting no data; "soft" if we're accepting no new
  530. connections, and "awake" if we're not hibernating at all. The "bytes"
  531. and "bytes-left" fields contain (read-bytes SP write-bytes), for the
  532. start and the rest of the interval respectively. The 'interval-start'
  533. and 'interval-end' fields are the borders of the current interval; the
  534. 'interval-wake' field is the time within the current interval (if any)
  535. where we plan[ned] to start being active. The times are UTC.
  536. "config/names"
  537. A series of lines listing the available configuration options. Each is
  538. of the form:
  539. OptionName SP OptionType [ SP Documentation ] CRLF
  540. OptionName = Keyword
  541. OptionType = "Integer" / "TimeInterval" / "TimeMsecInterval" /
  542. "DataSize" / "Float" / "Boolean" / "Time" / "CommaList" /
  543. "Dependent" / "Virtual" / "String" / "LineList"
  544. Documentation = Text
  545. Note: The incorrect spelling "Dependant" was used from the time this key
  546. was introduced in Tor 0.1.1.4-alpha until it was corrected in Tor
  547. 0.3.0.2-alpha. It is recommended that clients accept both spellings.
  548. "config/defaults"
  549. A series of lines listing default values for each configuration
  550. option. Options which don't have a valid default don't show up
  551. in the list. Introduced in Tor 0.2.4.1-alpha.
  552. OptionName SP OptionValue CRLF
  553. OptionName = Keyword
  554. OptionValue = Text
  555. "info/names"
  556. A series of lines listing the available GETINFO options. Each is of
  557. one of these forms:
  558. OptionName SP Documentation CRLF
  559. OptionPrefix SP Documentation CRLF
  560. OptionPrefix = OptionName "/*"
  561. The OptionPrefix form indicates a number of options beginning with the
  562. prefix. So if "config/*" is listed, other options beginning with
  563. "config/" will work, but "config/*" itself is not an option.
  564. "events/names"
  565. A space-separated list of all the events supported by this version of
  566. Tor's SETEVENTS.
  567. "features/names"
  568. A space-separated list of all the features supported by this version
  569. of Tor's USEFEATURE.
  570. "signal/names"
  571. A space-separated list of all the values supported by the SIGNAL
  572. command.
  573. "ip-to-country/*"
  574. Maps IP addresses to 2-letter country codes. For example,
  575. "GETINFO ip-to-country/18.0.0.1" should give "US".
  576. "next-circuit/IP:port"
  577. XXX todo.
  578. "process/pid" -- Process id belonging to the main tor process.
  579. "process/uid" -- User id running the tor process, -1 if unknown (this is
  580. unimplemented on Windows, returning -1).
  581. "process/user" -- Username under which the tor process is running,
  582. providing an empty string if none exists (this is unimplemented on
  583. Windows, returning an empty string).
  584. "process/descriptor-limit" -- Upper bound on the file descriptor limit, -1
  585. if unknown.
  586. "dir/status-vote/current/consensus" [added in Tor 0.2.1.6-alpha]
  587. "dir/status/authority"
  588. "dir/status/fp/<F>"
  589. "dir/status/fp/<F1>+<F2>+<F3>"
  590. "dir/status/all"
  591. "dir/server/fp/<F>"
  592. "dir/server/fp/<F1>+<F2>+<F3>"
  593. "dir/server/d/<D>"
  594. "dir/server/d/<D1>+<D2>+<D3>"
  595. "dir/server/authority"
  596. "dir/server/all"
  597. A series of lines listing directory contents, provided according to the
  598. specification for the URLs listed in Section 4.4 of dir-spec.txt. Note
  599. that Tor MUST NOT provide private information, such as descriptors for
  600. routers not marked as general-purpose. When asked for 'authority'
  601. information for which this Tor is not authoritative, Tor replies with
  602. an empty string.
  603. Note that, as of Tor 0.2.3.3-alpha, Tor clients don't download server
  604. descriptors anymore, but microdescriptors. So, a "551 Servers
  605. unavailable" reply to all "GETINFO dir/server/*" requests is actually
  606. correct. If you have an old program which absolutely requires server
  607. descriptors to work, try setting UseMicrodescriptors 0 or
  608. FetchUselessDescriptors 1 in your client's torrc.
  609. "status/circuit-established"
  610. "status/enough-dir-info"
  611. "status/good-server-descriptor"
  612. "status/accepted-server-descriptor"
  613. "status/..."
  614. These provide the current internal Tor values for various Tor
  615. states. See Section 4.1.10 for explanations. (Only a few of the
  616. status events are available as getinfo's currently. Let us know if
  617. you want more exposed.)
  618. "status/reachability-succeeded/or"
  619. 0 or 1, depending on whether we've found our ORPort reachable.
  620. "status/reachability-succeeded/dir"
  621. 0 or 1, depending on whether we've found our DirPort reachable.
  622. 1 if there is no DirPort, and therefore no need for a reachability
  623. check.
  624. "status/reachability-succeeded"
  625. "OR=" ("0"/"1") SP "DIR=" ("0"/"1")
  626. Combines status/reachability-succeeded/*; controllers MUST ignore
  627. unrecognized elements in this entry.
  628. "status/bootstrap-phase"
  629. Returns the most recent bootstrap phase status event
  630. sent. Specifically, it returns a string starting with either
  631. "NOTICE BOOTSTRAP ..." or "WARN BOOTSTRAP ...". Controllers should
  632. use this getinfo when they connect or attach to Tor to learn its
  633. current bootstrap state.
  634. "status/version/recommended"
  635. List of currently recommended versions.
  636. "status/version/current"
  637. Status of the current version. One of: new, old, unrecommended,
  638. recommended, new in series, obsolete, unknown.
  639. "status/version/num-concurring"
  640. "status/version/num-versioning"
  641. These options are deprecated; they no longer give useful information.
  642. "status/clients-seen"
  643. A summary of which countries we've seen clients from recently,
  644. formatted the same as the CLIENTS_SEEN status event described in
  645. Section 4.1.14. This GETINFO option is currently available only
  646. for bridge relays.
  647. "status/fresh-relay-descs"
  648. Provides fresh server and extra-info descriptors for our relay. Note
  649. this is *not* the latest descriptors we've published, but rather what we
  650. would generate if we needed to make a new descriptor right now.
  651. "net/listeners/or"
  652. "net/listeners/dir"
  653. "net/listeners/socks"
  654. "net/listeners/trans"
  655. "net/listeners/natd"
  656. "net/listeners/dns"
  657. "net/listeners/control"
  658. A quoted, space-separated list of the locations where Tor is listening
  659. for connections of the specified type. These can contain IPv4
  660. network address...
  661. "127.0.0.1:9050" "127.0.0.1:9051"
  662. ... or local unix sockets...
  663. "unix:/home/my_user/.tor/socket"
  664. ... or IPv6 network addresses:
  665. "[2001:0db8:7000:0000:0000:dead:beef:1234]:9050"
  666. [New in Tor 0.2.2.26-beta.]
  667. "dir-usage"
  668. A newline-separated list of how many bytes we've served to answer
  669. each type of directory request. The format of each line is:
  670. Keyword 1*SP Integer 1*SP Integer
  671. where the first integer is the number of bytes written, and the second
  672. is the number of requests answered.
  673. [This feature was added in Tor 0.2.2.1-alpha, and removed in
  674. Tor 0.2.9.1-alpha. Even when it existed, it only provided
  675. useful output when the Tor client was built with either the
  676. INSTRUMENT_DOWNLOADS or RUNNING_DOXYGEN compile-time options.]
  677. "bw-event-cache"
  678. A space-separated summary of recent BW events in chronological order
  679. from oldest to newest. Each event is represented by a comma-separated
  680. tuple of "R,W", R is the number of bytes read, and W is the number of
  681. bytes written. These entries each represent about one second's worth
  682. of traffic.
  683. [New in Tor 0.2.6.3-alpha]
  684. "consensus/valid-after"
  685. "consensus/fresh-until"
  686. "consensus/valid-until"
  687. Each of these produces an ISOTime describing part of the lifetime of
  688. the current (valid, accepted) consensus that Tor has.
  689. [New in Tor 0.2.6.3-alpha]
  690. "hs/client/desc/id/<ADDR>"
  691. Prints the content of the hidden service descriptor corresponding to
  692. the given <ADDR> which is an onion address without the ".onion" part.
  693. The client's cache is queried to find the descriptor. The format of
  694. the descriptor is described in section 1.3 of the rend-spec.txt
  695. document.
  696. If <ADDR> is unrecognized or if not found in the cache, a 551 error is
  697. returned.
  698. [New in Tor 0.2.7.1-alpha]
  699. "hs/service/desc/id/<ADDR>"
  700. Prints the content of the hidden service descriptor corresponding to
  701. the given <ADDR> which is an onion address without the ".onion" part.
  702. The service's local descriptor cache is queried to find the descriptor.
  703. The format of the descriptor is described in section 1.3 of the
  704. rend-spec.txt document.
  705. If <ADDR> is unrecognized or if not found in the cache, a 551 error is
  706. returned.
  707. [New in Tor 0.2.7.2-alpha]
  708. "onions/current"
  709. "onions/detached"
  710. A newline-separated list of the Onion ("Hidden") Services created
  711. via the "ADD_ONION" command. The 'current' key returns Onion Services
  712. belonging to the current control connection. The 'detached' key
  713. returns Onion Services detached from the parent control connection
  714. (as in, belonging to no control connection).
  715. The format of each line is:
  716. HSAddress
  717. [New in Tor 0.2.7.1-alpha.]
  718. "network-liveness"
  719. The string "up" or "down", indicating whether we currently believe the
  720. network is reachable.
  721. "downloads/"
  722. The keys under downloads/ are used to query download statuses; they all
  723. return either a sequence of newline-terminated hex encoded digests, or
  724. a serialized download status as follows:
  725. "next-attempt-at" SP ISOTime CRLF
  726. "n-download-failures" SP UInt CRLF
  727. "n-download-attempts" SP UInt CRLF
  728. "schedule" SP DownloadSchedule CRLF
  729. "want-authority" SP DownloadWantAuthority CRLF
  730. "increment-on" SP DownloadIncrementOn CRLF
  731. "backoff" SP DownloadBackoff CRLF
  732. [ "last-backoff-position" Uint CRLF
  733. "last-delay-used UInt CRLF ]
  734. where
  735. DownloadSchedule =
  736. "DL_SCHED_GENERIC" / "DL_SCHED_CONSENSUS" / "DL_SCHED_BRIDGE"
  737. DownloadWantAuthority =
  738. "DL_WANT_ANY_DIRSERVER" / "DL_WANT_AUTHORITY"
  739. DownloadIncrementOn =
  740. "DL_SCHED_INCREMENT_FAILURE" / "DL_SCHED_INCREMENT_ATTEMPT"
  741. DownloadBackoff =
  742. "DL_SCHED_DETERMINISTIC" / "DL_SCHED_RANDOM_EXPONENTIAL"
  743. The optional last two lines must be present if DownloadBackoff is
  744. "DL_SCHED_RANDOM_EXPONENTIAL" and must be absent if DownloadBackoff
  745. is "DL_SCHED_DETERMINISTIC".
  746. In detail, the keys supported are:
  747. "downloads/networkstatus/ns"
  748. The serialized download status for the FLAV_NS consensus for whichever
  749. bootstrap state Tor is currently in.
  750. "downloads/networkstatus/ns/bootstrap"
  751. The serialized download status for the FLAV_NS consensus at bootstrap
  752. time, regardless of whether we are currently bootstrapping.
  753. "downloads/networkstatus/ns/running"
  754. The serialized download status for the FLAV_NS consensus when running,
  755. regardless of whether we are currently bootstrapping.
  756. "downloads/networkstatus/microdesc"
  757. The serialized download status for the FLAV_MICRODESC consensus for
  758. whichever bootstrap state Tor is currently in.
  759. "downloads/networkstatus/microdesc/bootstrap"
  760. The serialized download status for the FLAV_MICRODESC consensus at
  761. bootstrap time, regardless of whether we are currently bootstrapping.
  762. "downloads/networkstatus/microdesc/running"
  763. The serialized download status for the FLAV_MICRODESC consensus when
  764. running, regardless of whether we are currently bootstrapping.
  765. "downloads/cert/fps"
  766. A newline-separated list of hex-encoded digests for authority certificates
  767. for which we have download status available.
  768. "downloads/cert/fp/<Fingerprint>"
  769. A serialized download status for the default certificate for the
  770. identity digest <Fingerprint> returned by the downloads/cert/fps key.
  771. "downloads/cert/fp/<Fingerprint>/sks"
  772. A newline-separated list of hex-encoded signing key digests for the
  773. authority identity digest <Fingerprint> returned by the
  774. downloads/cert/fps key.
  775. "downloads/cert/fp/<Fingerprint>/<SKDigest>"
  776. A serialized download status for the certificate for the identity
  777. digest <Fingerprint> returned by the downloads/cert/fps key and signing
  778. key digest <SKDigest> returned by the downloads/cert/fp/<Fingerprint>/
  779. sks key.
  780. "downloads/desc/descs"
  781. A newline-separated list of hex-encoded router descriptor digests
  782. [note, not identity digests - the Tor process may not have seen them
  783. yet while downloading router descriptors]. If the Tor process is not
  784. using a FLAV_NS consensus, a 551 error is returned.
  785. "downloads/desc/<Digest>"
  786. A serialized download status for the router descriptor with digest
  787. <Digest> as returned by the downloads/desc/descs key. If the Tor
  788. process is not using a FLAV_NS consensus, a 551 error is returned.
  789. "downloads/bridge/bridges"
  790. A newline-separated list of hex-encoded bridge identity digests. If
  791. the Tor process is not using bridges, a 551 error is returned.
  792. "downloads/bridge/<Digest>"
  793. A serialized download status for the bridge descriptor with identity
  794. digest <Digest> as returned by the downloads/bridge/bridges key. If
  795. the Tor process is not using bridges, a 551 error is returned.
  796. "sr/current"
  797. "sr/previous"
  798. The current or previous shared random value, as received in the
  799. consensus, base-64 encoded. An empty value means that either
  800. the consensus has no shared random value, or Tor has no consensus.
  801. Examples:
  802. C: GETINFO version desc/name/moria1
  803. S: 250+desc/name/moria=
  804. S: [Descriptor for moria]
  805. S: .
  806. S: 250-version=Tor 0.1.1.0-alpha-cvs
  807. S: 250 OK
  808. 3.10. EXTENDCIRCUIT
  809. Sent from the client to the server. The format is:
  810. "EXTENDCIRCUIT" SP CircuitID
  811. [SP ServerSpec *("," ServerSpec)]
  812. [SP "purpose=" Purpose] CRLF
  813. This request takes one of two forms: either the CircuitID is zero, in
  814. which case it is a request for the server to build a new circuit,
  815. or the CircuitID is nonzero, in which case it is a request for the
  816. server to extend an existing circuit with that ID according to the
  817. specified path.
  818. If the CircuitID is 0, the controller has the option of providing
  819. a path for Tor to use to build the circuit. If it does not provide
  820. a path, Tor will select one automatically from high capacity nodes
  821. according to path-spec.txt.
  822. If CircuitID is 0 and "purpose=" is specified, then the circuit's
  823. purpose is set. Two choices are recognized: "general" and
  824. "controller". If not specified, circuits are created as "general".
  825. If the request is successful, the server sends a reply containing a
  826. message body consisting of the CircuitID of the (maybe newly created)
  827. circuit. The syntax is "250" SP "EXTENDED" SP CircuitID CRLF.
  828. 3.11. SETCIRCUITPURPOSE
  829. Sent from the client to the server. The format is:
  830. "SETCIRCUITPURPOSE" SP CircuitID SP "purpose=" Purpose CRLF
  831. This changes the circuit's purpose. See EXTENDCIRCUIT above for details.
  832. 3.12. SETROUTERPURPOSE
  833. Sent from the client to the server. The format is:
  834. "SETROUTERPURPOSE" SP NicknameOrKey SP Purpose CRLF
  835. This changes the descriptor's purpose. See +POSTDESCRIPTOR below
  836. for details.
  837. NOTE: This command was disabled and made obsolete as of Tor
  838. 0.2.0.8-alpha. It doesn't exist anymore, and is listed here only for
  839. historical interest.
  840. 3.13. ATTACHSTREAM
  841. Sent from the client to the server. The syntax is:
  842. "ATTACHSTREAM" SP StreamID SP CircuitID [SP "HOP=" HopNum] CRLF
  843. This message informs the server that the specified stream should be
  844. associated with the specified circuit. Each stream may be associated with
  845. at most one circuit, and multiple streams may share the same circuit.
  846. Streams can only be attached to completed circuits (that is, circuits that
  847. have sent a circuit status 'BUILT' event or are listed as built in a
  848. GETINFO circuit-status request).
  849. If the circuit ID is 0, responsibility for attaching the given stream is
  850. returned to Tor.
  851. If HOP=HopNum is specified, Tor will choose the HopNumth hop in the
  852. circuit as the exit node, rather than the last node in the circuit.
  853. Hops are 1-indexed; generally, it is not permitted to attach to hop 1.
  854. Tor responds with "250 OK" if it can attach the stream, 552 if the
  855. circuit or stream didn't exist, 555 if the stream isn't in an
  856. appropriate state to be attached (e.g. it's already open), or 551 if
  857. the stream couldn't be attached for another reason.
  858. {Implementation note: Tor will close unattached streams by itself,
  859. roughly two minutes after they are born. Let the developers know if
  860. that turns out to be a problem.}
  861. {Implementation note: By default, Tor automatically attaches streams to
  862. circuits itself, unless the configuration variable
  863. "__LeaveStreamsUnattached" is set to "1". Attempting to attach streams
  864. via TC when "__LeaveStreamsUnattached" is false may cause a race between
  865. Tor and the controller, as both attempt to attach streams to circuits.}
  866. {Implementation note: You can try to attachstream to a stream that
  867. has already sent a connect or resolve request but hasn't succeeded
  868. yet, in which case Tor will detach the stream from its current circuit
  869. before proceeding with the new attach request.}
  870. 3.14. POSTDESCRIPTOR
  871. Sent from the client to the server. The syntax is:
  872. "+POSTDESCRIPTOR" [SP "purpose=" Purpose] [SP "cache=" Cache]
  873. CRLF Descriptor CRLF "." CRLF
  874. This message informs the server about a new descriptor. If Purpose is
  875. specified, it must be either "general", "controller", or "bridge",
  876. else we return a 552 error. The default is "general".
  877. If Cache is specified, it must be either "no" or "yes", else we
  878. return a 552 error. If Cache is not specified, Tor will decide for
  879. itself whether it wants to cache the descriptor, and controllers
  880. must not rely on its choice.
  881. The descriptor, when parsed, must contain a number of well-specified
  882. fields, including fields for its nickname and identity.
  883. If there is an error in parsing the descriptor, the server must send a
  884. "554 Invalid descriptor" reply. If the descriptor is well-formed but
  885. the server chooses not to add it, it must reply with a 251 message
  886. whose body explains why the server was not added. If the descriptor
  887. is added, Tor replies with "250 OK".
  888. 3.15. REDIRECTSTREAM
  889. Sent from the client to the server. The syntax is:
  890. "REDIRECTSTREAM" SP StreamID SP Address [SP Port] CRLF
  891. Tells the server to change the exit address on the specified stream. If
  892. Port is specified, changes the destination port as well. No remapping
  893. is performed on the new provided address.
  894. To be sure that the modified address will be used, this event must be sent
  895. after a new stream event is received, and before attaching this stream to
  896. a circuit.
  897. Tor replies with "250 OK" on success.
  898. 3.16. CLOSESTREAM
  899. Sent from the client to the server. The syntax is:
  900. "CLOSESTREAM" SP StreamID SP Reason *(SP Flag) CRLF
  901. Tells the server to close the specified stream. The reason should be one
  902. of the Tor RELAY_END reasons given in tor-spec.txt, as a decimal. Flags is
  903. not used currently; Tor servers SHOULD ignore unrecognized flags. Tor may
  904. hold the stream open for a while to flush any data that is pending.
  905. Tor replies with "250 OK" on success, or a 512 if there aren't enough
  906. arguments, or a 552 if it doesn't recognize the StreamID or reason.
  907. 3.17. CLOSECIRCUIT
  908. The syntax is:
  909. "CLOSECIRCUIT" SP CircuitID *(SP Flag) CRLF
  910. Flag = "IfUnused"
  911. Tells the server to close the specified circuit. If "IfUnused" is
  912. provided, do not close the circuit unless it is unused.
  913. Other flags may be defined in the future; Tor SHOULD ignore unrecognized
  914. flags.
  915. Tor replies with "250 OK" on success, or a 512 if there aren't enough
  916. arguments, or a 552 if it doesn't recognize the CircuitID.
  917. 3.18. QUIT
  918. Tells the server to hang up on this controller connection. This command
  919. can be used before authenticating.
  920. 3.19. USEFEATURE
  921. Adding additional features to the control protocol sometimes will break
  922. backwards compatibility. Initially such features are added into Tor and
  923. disabled by default. USEFEATURE can enable these additional features.
  924. The syntax is:
  925. "USEFEATURE" *(SP FeatureName) CRLF
  926. FeatureName = 1*(ALPHA / DIGIT / "_" / "-")
  927. Feature names are case-insensitive.
  928. Once enabled, a feature stays enabled for the duration of the connection
  929. to the controller. A new connection to the controller must be opened to
  930. disable an enabled feature.
  931. Features are a forward-compatibility mechanism; each feature will eventually
  932. become a standard part of the control protocol. Once a feature becomes part
  933. of the protocol, it is always-on. Each feature documents the version it was
  934. introduced as a feature and the version in which it became part of the
  935. protocol.
  936. Tor will ignore a request to use any feature that is always-on. Tor will give
  937. a 552 error in response to an unrecognized feature.
  938. EXTENDED_EVENTS
  939. Same as passing 'EXTENDED' to SETEVENTS; this is the preferred way to
  940. request the extended event syntax.
  941. This feature was first introduced in 0.1.2.3-alpha. It is always-on
  942. and part of the protocol in Tor 0.2.2.1-alpha and later.
  943. VERBOSE_NAMES
  944. Replaces ServerID with LongName in events and GETINFO results. LongName
  945. provides a Fingerprint for all routers, an indication of Named status,
  946. and a Nickname if one is known. LongName is strictly more informative
  947. than ServerID, which only provides either a Fingerprint or a Nickname.
  948. This feature was first introduced in 0.1.2.2-alpha. It is always-on and
  949. part of the protocol in Tor 0.2.2.1-alpha and later.
  950. 3.20. RESOLVE
  951. The syntax is
  952. "RESOLVE" *Option *Address CRLF
  953. Option = "mode=reverse"
  954. Address = a hostname or IPv4 address
  955. This command launches a remote hostname lookup request for every specified
  956. request (or reverse lookup if "mode=reverse" is specified). Note that the
  957. request is done in the background: to see the answers, your controller will
  958. need to listen for ADDRMAP events; see 4.1.7 below.
  959. [Added in Tor 0.2.0.3-alpha]
  960. 3.21. PROTOCOLINFO
  961. The syntax is:
  962. "PROTOCOLINFO" *(SP PIVERSION) CRLF
  963. The server reply format is:
  964. "250-PROTOCOLINFO" SP PIVERSION CRLF *InfoLine "250 OK" CRLF
  965. InfoLine = AuthLine / VersionLine / OtherLine
  966. AuthLine = "250-AUTH" SP "METHODS=" AuthMethod *("," AuthMethod)
  967. *(SP "COOKIEFILE=" AuthCookieFile) CRLF
  968. VersionLine = "250-VERSION" SP "Tor=" TorVersion OptArguments CRLF
  969. AuthMethod =
  970. "NULL" / ; No authentication is required
  971. "HASHEDPASSWORD" / ; A controller must supply the original password
  972. "COOKIE" / ; A controller must supply the contents of a cookie
  973. "SAFECOOKIE" ; A controller must prove knowledge of a cookie
  974. AuthCookieFile = QuotedString
  975. TorVersion = QuotedString
  976. OtherLine = "250-" Keyword OptArguments CRLF
  977. PIVERSION: 1*DIGIT
  978. Tor MAY give its InfoLines in any order; controllers MUST ignore InfoLines
  979. with keywords they do not recognize. Controllers MUST ignore extraneous
  980. data on any InfoLine.
  981. PIVERSION is there in case we drastically change the syntax one day. For
  982. now it should always be "1". Controllers MAY provide a list of the
  983. protocolinfo versions they support; Tor MAY select a version that the
  984. controller does not support.
  985. AuthMethod is used to specify one or more control authentication
  986. methods that Tor currently accepts.
  987. AuthCookieFile specifies the absolute path and filename of the
  988. authentication cookie that Tor is expecting and is provided iff the
  989. METHODS field contains the method "COOKIE" and/or "SAFECOOKIE".
  990. Controllers MUST handle escape sequences inside this string.
  991. All authentication cookies are 32 bytes long. Controllers MUST NOT
  992. use the contents of a non-32-byte-long file as an authentication
  993. cookie.
  994. If the METHODS field contains the method "SAFECOOKIE", every
  995. AuthCookieFile must contain the same authentication cookie.
  996. The COOKIE authentication method exposes the user running a
  997. controller to an unintended information disclosure attack whenever
  998. the controller has greater filesystem read access than the process
  999. that it has connected to. (Note that a controller may connect to a
  1000. process other than Tor.) It is almost never safe to use, even if
  1001. the controller's user has explicitly specified which filename to
  1002. read an authentication cookie from. For this reason, the COOKIE
  1003. authentication method has been deprecated and will be removed from
  1004. a future version of Tor.
  1005. The VERSION line contains the Tor version.
  1006. [Unlike other commands besides AUTHENTICATE, PROTOCOLINFO may be used (but
  1007. only once!) before AUTHENTICATE.]
  1008. [PROTOCOLINFO was not supported before Tor 0.2.0.5-alpha.]
  1009. 3.22. LOADCONF
  1010. The syntax is:
  1011. "+LOADCONF" CRLF ConfigText CRLF "." CRLF
  1012. This command allows a controller to upload the text of a config file
  1013. to Tor over the control port. This config file is then loaded as if
  1014. it had been read from disk.
  1015. [LOADCONF was added in Tor 0.2.1.1-alpha.]
  1016. 3.23. TAKEOWNERSHIP
  1017. The syntax is:
  1018. "TAKEOWNERSHIP" CRLF
  1019. This command instructs Tor to shut down when this control
  1020. connection is closed. This command affects each control connection
  1021. that sends it independently; if multiple control connections send
  1022. the TAKEOWNERSHIP command to a Tor instance, Tor will shut down when
  1023. any of those connections closes.
  1024. (As of Tor 0.2.5.2-alpha, Tor does not wait a while for circuits to
  1025. close when shutting down because of an exiting controller. If you
  1026. want to ensure a clean shutdown--and you should!--then send "SIGNAL
  1027. SHUTDOWN" and wait for the Tor process to close.)
  1028. This command is intended to be used with the
  1029. __OwningControllerProcess configuration option. A controller that
  1030. starts a Tor process which the user cannot easily control or stop
  1031. should 'own' that Tor process:
  1032. * When starting Tor, the controller should specify its PID in an
  1033. __OwningControllerProcess on Tor's command line. This will
  1034. cause Tor to poll for the existence of a process with that PID,
  1035. and exit if it does not find such a process. (This is not a
  1036. completely reliable way to detect whether the 'owning
  1037. controller' is still running, but it should work well enough in
  1038. most cases.)
  1039. * Once the controller has connected to Tor's control port, it
  1040. should send the TAKEOWNERSHIP command along its control
  1041. connection. At this point, *both* the TAKEOWNERSHIP command and
  1042. the __OwningControllerProcess option are in effect: Tor will
  1043. exit when the control connection ends *and* Tor will exit if it
  1044. detects that there is no process with the PID specified in the
  1045. __OwningControllerProcess option.
  1046. * After the controller has sent the TAKEOWNERSHIP command, it
  1047. should send "RESETCONF __OwningControllerProcess" along its
  1048. control connection. This will cause Tor to stop polling for the
  1049. existence of a process with its owning controller's PID; Tor
  1050. will still exit when the control connection ends.
  1051. [TAKEOWNERSHIP was added in Tor 0.2.2.28-beta.]
  1052. 3.24. AUTHCHALLENGE
  1053. The syntax is:
  1054. "AUTHCHALLENGE" SP "SAFECOOKIE"
  1055. SP ClientNonce
  1056. CRLF
  1057. ClientNonce = 2*HEXDIG / QuotedString
  1058. If the server accepts the command, the server reply format is:
  1059. "250 AUTHCHALLENGE"
  1060. SP "SERVERHASH=" ServerHash
  1061. SP "SERVERNONCE=" ServerNonce
  1062. CRLF
  1063. ServerHash = 64*64HEXDIG
  1064. ServerNonce = 64*64HEXDIG
  1065. The ClientNonce, ServerHash, and ServerNonce values are
  1066. encoded/decoded in the same way as the argument passed to the
  1067. AUTHENTICATE command. ServerNonce MUST be 32 bytes long.
  1068. ServerHash is computed as:
  1069. HMAC-SHA256("Tor safe cookie authentication server-to-controller hash",
  1070. CookieString | ClientNonce | ServerNonce)
  1071. (with the HMAC key as its first argument)
  1072. After a controller sends a successful AUTHCHALLENGE command, the
  1073. next command sent on the connection must be an AUTHENTICATE command,
  1074. and the only authentication string which that AUTHENTICATE command
  1075. will accept is:
  1076. HMAC-SHA256("Tor safe cookie authentication controller-to-server hash",
  1077. CookieString | ClientNonce | ServerNonce)
  1078. [Unlike other commands besides AUTHENTICATE, AUTHCHALLENGE may be
  1079. used (but only once!) before AUTHENTICATE.]
  1080. [AUTHCHALLENGE was added in Tor 0.2.3.13-alpha.]
  1081. 3.25. DROPGUARDS
  1082. The syntax is:
  1083. "DROPGUARDS" CRLF
  1084. Tells the server to drop all guard nodes. Do not invoke this command
  1085. lightly; it can increase vulnerability to tracking attacks over time.
  1086. Tor replies with "250 OK" on success.
  1087. [DROPGUARDS was added in Tor 0.2.5.2-alpha.]
  1088. 3.26. HSFETCH
  1089. The syntax is:
  1090. "HSFETCH" SP (HSAddress / "v" Version "-" DescId)
  1091. *[SP "SERVER=" Server] CRLF
  1092. HSAddress = 16*Base32Character
  1093. Version = 2
  1094. DescId = 32*Base32Character
  1095. Server = LongName
  1096. This command launches hidden service descriptor fetch(es) for the given
  1097. HSAddress or DescId.
  1098. If a DescId is specified, at least one Server MUST also be provided,
  1099. otherwise a 512 error is returned. If no DescId and Server(s) are specified,
  1100. it behaves like a normal Tor client descriptor fetch. If one or more
  1101. Server are given, they are used instead triggering a fetch on each of them
  1102. in parallel.
  1103. The caching behavior when fetching a descriptor using this command is
  1104. identical to normal Tor client behavior.
  1105. Details on how to compute a descriptor id (DescId) can be found in
  1106. rend-spec.txt section 1.3.
  1107. If any values are unrecognized, a 513 error is returned and the command is
  1108. stopped. On success, Tor replies "250 OK" then Tor MUST eventually follow
  1109. this with both a HS_DESC and HS_DESC_CONTENT events with the results. If
  1110. SERVER is specified then events are emitted for each location.
  1111. Examples are:
  1112. C: HSFETCH v2-gezdgnbvgy3tqolbmjrwizlgm5ugs2tl
  1113. SERVER=9695DFC35FFEB861329B9F1AB04C46397020CE31
  1114. S: 250 OK
  1115. C: HSFETCH ajkhdsfuygaesfaa
  1116. S: 250 OK
  1117. [HSFETCH was added in Tor 0.2.7.1-alpha]
  1118. 3.27. ADD_ONION
  1119. The syntax is:
  1120. "ADD_ONION" SP KeyType ":" KeyBlob
  1121. [SP "Flags=" Flag *("," Flag)]
  1122. 1*(SP "Port=" VirtPort ["," Target])
  1123. *(SP "ClientAuth=" ClientName [":" ClientBlob]) CRLF
  1124. KeyType =
  1125. "NEW" / ; The server should generate a key of algorithm KeyBlob
  1126. "RSA1024" ; The server should use the 1024 bit RSA key provided
  1127. in as KeyBlob
  1128. KeyBlob =
  1129. "BEST" / ; The server should generate a key using the "best"
  1130. supported algorithm (KeyType == "NEW")
  1131. "RSA1024" / ; The server should generate a 1024 bit RSA key
  1132. (KeyType == "NEW")
  1133. String ; A serialized private key (without whitespace)
  1134. Flag =
  1135. "DiscardPK" / ; The server should not include the newly generated
  1136. private key as part of the response.
  1137. "Detach" / ; Do not associate the newly created Onion Service
  1138. to the current control connection.
  1139. "BasicAuth" / ; Client authorization is required using the "basic"
  1140. method.
  1141. "NonAnonymous"; Add a non-anonymous Single Onion Service. Tor
  1142. checks this flag matches its configured hidden
  1143. service anonymity mode.
  1144. VirtPort = The virtual TCP Port for the Onion Service (As in the
  1145. HiddenServicePort "VIRTPORT" argument).
  1146. Target = The (optional) target for the given VirtPort (As in the
  1147. optional HiddenServicePort "TARGET" argument).
  1148. ClientName = An identifier 1 to 16 characters long, using only
  1149. characters in A-Za-z0-9+-_ (no spaces).
  1150. ClientBlob = Authorization data for the client, in an opaque format
  1151. specific to the authorization method.
  1152. The server reply format is:
  1153. "250-ServiceID=" ServiceID CRLF
  1154. ["250-PrivateKey=" KeyType ":" KeyBlob CRLF]
  1155. *("250-ClientAuth=" ClientName ":" ClientBlob CRLF)
  1156. "250 OK" CRLF
  1157. ServiceID = The Onion Service address without the trailing ".onion"
  1158. suffix
  1159. Tells the server to create a new Onion ("Hidden") Service, with the
  1160. specified private key and algorithm. If a KeyType of "NEW" is selected,
  1161. the server will generate a new keypair using the selected algorithm.
  1162. The "Port" argument's VirtPort and Target values have identical
  1163. semantics to the corresponding HiddenServicePort configuration values.
  1164. The server response will only include a private key if the server was
  1165. requested to generate a new keypair, and also the "DiscardPK" flag was
  1166. not specified. (Note that if "DiscardPK" flag is specified, there is no
  1167. way to recreate the generated keypair and the corresponding Onion
  1168. Service at a later date).
  1169. If client authorization is enabled using the "BasicAuth" flag, the
  1170. service will not be accessible to clients without valid authorization
  1171. data (configured with the "HidServAuth" option). The list of authorized
  1172. clients is specified with one or more "ClientAuth" parameters. If
  1173. "ClientBlob" is not specified for a client, a new credential will be
  1174. randomly generated and returned.
  1175. Tor instances can either be in anonymous hidden service mode, or
  1176. non-anonymous single onion service mode. All hidden services on the same
  1177. tor instance have the same anonymity. To guard against unexpected loss
  1178. of anonymity, Tor checks that the ADD_ONION "NonAnonymous" flag matches
  1179. the current hidden service anonymity mode. The hidden service anonymity
  1180. mode is configured using the Tor options HiddenServiceSingleHopMode and
  1181. HiddenServiceNonAnonymousMode. If both these options are 1, the
  1182. "NonAnonymous" flag must be provided to ADD_ONION. If both these options
  1183. are 0 (the Tor default), the flag must NOT be provided.
  1184. Once created the new Onion Service will remain active until either the
  1185. Onion Service is removed via "DEL_ONION", the server terminates, or the
  1186. control connection that originated the "ADD_ONION" command is closed.
  1187. It is possible to override disabling the Onion Service on control
  1188. connection close by specifying the "Detach" flag.
  1189. It is the Onion Service server application's responsibility to close
  1190. existing client connections if desired after the Onion Service is
  1191. removed.
  1192. (The KeyBlob format is left intentionally opaque, however for "RSA1024"
  1193. keys it is currently the Base64 encoded DER representation of a PKCS#1
  1194. RSAPrivateKey, with all newlines removed.)
  1195. Examples:
  1196. C: ADD_ONION NEW:BEST Flags=DiscardPK Port=80
  1197. S: 250-ServiceID=exampleonion1234
  1198. S: 250 OK
  1199. C: ADD_ONION RSA1024:[Blob Redacted] Port=80,192.168.1.1:8080
  1200. S: 250-ServiceID=sampleonion12456
  1201. S: 250 OK
  1202. C: ADD_ONION NEW:BEST Port=22 Port=80,8080
  1203. S: 250-ServiceID=testonion1234567
  1204. S: 250-PrivateKey=RSA1024:[Blob Redacted]
  1205. S: 250 OK
  1206. C: ADD_ONION NEW:BEST Flags=DiscardPK,BasicAuth Port=22
  1207. ClientAuth=alice:[Blob Redacted] ClientAuth=bob
  1208. S: 250-ServiceID=testonion1234567
  1209. S: 250-ClientAuth=bob:[Blob Redacted]
  1210. S: 250 OK
  1211. Examples with Tor in anonymous onion service mode:
  1212. C: ADD_ONION NEW:BEST Flags=DiscardPK Port=22
  1213. S: 250-ServiceID=testonion1234567
  1214. S: 250 OK
  1215. C: ADD_ONION NEW:BEST Flags=DiscardPK,NonAnonymous Port=22
  1216. S: 512 Tor is in anonymous hidden service mode
  1217. Examples with Tor in non-anonymous onion service mode:
  1218. C: ADD_ONION NEW:BEST Flags=DiscardPK Port=22
  1219. S: 512 Tor is in non-anonymous hidden service mode
  1220. C: ADD_ONION NEW:BEST Flags=DiscardPK,NonAnonymous Port=22
  1221. S: 250-ServiceID=testonion1234567
  1222. S: 250 OK
  1223. [ADD_ONION was added in Tor 0.2.7.1-alpha.]
  1224. [ClientAuth was added in Tor 0.2.9.1-alpha.]
  1225. [NonAnonymous was added in Tor 0.2.9.3-alpha.]
  1226. 3.28. DEL_ONION
  1227. The syntax is:
  1228. "DEL_ONION" SP ServiceID CRLF
  1229. ServiceID = The Onion Service address without the trailing ".onion"
  1230. suffix
  1231. Tells the server to remove an Onion ("Hidden") Service, that was
  1232. previously created via an "ADD_ONION" command. It is only possible to
  1233. remove Onion Services that were created on the same control connection
  1234. as the "DEL_ONION" command, and those that belong to no control
  1235. connection in particular (The "Detach" flag was specified at creation).
  1236. If the ServiceID is invalid, or is neither owned by the current control
  1237. connection nor a detached Onion Service, the server will return a 552.
  1238. It is the Onion Service server application's responsibility to close
  1239. existing client connections if desired after the Onion Service has been
  1240. removed via "DEL_ONION".
  1241. Tor replies with "250 OK" on success, or a 512 if there are an invalid
  1242. number of arguments, or a 552 if it doesn't recognize the ServiceID.
  1243. [DEL_ONION was added in Tor 0.2.7.1-alpha.]
  1244. 3.29. HSPOST
  1245. The syntax is:
  1246. "+HSPOST" *[SP "SERVER=" Server] CRLF Descriptor CRLF "." CRLF
  1247. Server = LongName
  1248. Descriptor = The text of the descriptor formatted as specified
  1249. in rend-spec.txt section 1.3.
  1250. This command launches a hidden service descriptor upload to the specified
  1251. HSDirs. If one or more Server arguments are provided, an upload is triggered
  1252. on each of them in parallel. If no Server options are provided, it behaves
  1253. like a normal HS descriptor upload and will upload to the set of responsible
  1254. HS directories.
  1255. If any value is unrecognized, a 552 error is returned and the command is
  1256. stopped. If there is an error in parsing the descriptor, the server
  1257. must send a "554 Invalid descriptor" reply.
  1258. On success, Tor replies "250 OK" then Tor MUST eventually follow
  1259. this with a HS_DESC event with the result for each upload location.
  1260. Examples are:
  1261. C: +HSPOST SERVER=9695DFC35FFEB861329B9F1AB04C46397020CE31
  1262. [DESCRIPTOR]
  1263. .
  1264. S: 250 OK
  1265. [HSPOST was added in Tor 0.2.7.1-alpha]
  1266. 4. Replies
  1267. Reply codes follow the same 3-character format as used by SMTP, with the
  1268. first character defining a status, the second character defining a
  1269. subsystem, and the third designating fine-grained information.
  1270. The TC protocol currently uses the following first characters:
  1271. 2yz Positive Completion Reply
  1272. The command was successful; a new request can be started.
  1273. 4yz Temporary Negative Completion reply
  1274. The command was unsuccessful but might be reattempted later.
  1275. 5yz Permanent Negative Completion Reply
  1276. The command was unsuccessful; the client should not try exactly
  1277. that sequence of commands again.
  1278. 6yz Asynchronous Reply
  1279. Sent out-of-order in response to an earlier SETEVENTS command.
  1280. The following second characters are used:
  1281. x0z Syntax
  1282. Sent in response to ill-formed or nonsensical commands.
  1283. x1z Protocol
  1284. Refers to operations of the Tor Control protocol.
  1285. x5z Tor
  1286. Refers to actual operations of Tor system.
  1287. The following codes are defined:
  1288. 250 OK
  1289. 251 Operation was unnecessary
  1290. [Tor has declined to perform the operation, but no harm was done.]
  1291. 451 Resource exhausted
  1292. 500 Syntax error: protocol
  1293. 510 Unrecognized command
  1294. 511 Unimplemented command
  1295. 512 Syntax error in command argument
  1296. 513 Unrecognized command argument
  1297. 514 Authentication required
  1298. 515 Bad authentication
  1299. 550 Unspecified Tor error
  1300. 551 Internal error
  1301. [Something went wrong inside Tor, so that the client's
  1302. request couldn't be fulfilled.]
  1303. 552 Unrecognized entity
  1304. [A configuration key, a stream ID, circuit ID, event,
  1305. mentioned in the command did not actually exist.]
  1306. 553 Invalid configuration value
  1307. [The client tried to set a configuration option to an
  1308. incorrect, ill-formed, or impossible value.]
  1309. 554 Invalid descriptor
  1310. 555 Unmanaged entity
  1311. 650 Asynchronous event notification
  1312. Unless specified to have specific contents, the human-readable messages
  1313. in error replies should not be relied upon to match those in this document.
  1314. 4.1. Asynchronous events
  1315. These replies can be sent after a corresponding SETEVENTS command has been
  1316. received. They will not be interleaved with other Reply elements, but they
  1317. can appear between a command and its corresponding reply. For example,
  1318. this sequence is possible:
  1319. C: SETEVENTS CIRC
  1320. S: 250 OK
  1321. C: GETCONF SOCKSPORT ORPORT
  1322. S: 650 CIRC 1000 EXTENDED moria1,moria2
  1323. S: 250-SOCKSPORT=9050
  1324. S: 250 ORPORT=0
  1325. But this sequence is disallowed:
  1326. C: SETEVENTS CIRC
  1327. S: 250 OK
  1328. C: GETCONF SOCKSPORT ORPORT
  1329. S: 250-SOCKSPORT=9050
  1330. S: 650 CIRC 1000 EXTENDED moria1,moria2
  1331. S: 250 ORPORT=0
  1332. Clients MUST tolerate more arguments in an asynchronous reply than
  1333. expected, and MUST tolerate more lines in an asynchronous reply than
  1334. expected. For instance, a client that expects a CIRC message like:
  1335. 650 CIRC 1000 EXTENDED moria1,moria2
  1336. must tolerate:
  1337. 650-CIRC 1000 EXTENDED moria1,moria2 0xBEEF
  1338. 650-EXTRAMAGIC=99
  1339. 650 ANONYMITY=high
  1340. If clients receives extended events (selected by USEFEATUERE
  1341. EXTENDED_EVENTS in Tor 0.1.2.2-alpha..Tor-0.2.1.x, and always-on in
  1342. Tor 0.2.2.x and later), then each event line as specified below may be
  1343. followed by additional arguments and additional lines. Additional
  1344. lines will be of the form:
  1345. "650" ("-"/" ") KEYWORD ["=" ARGUMENTS] CRLF
  1346. Additional arguments will be of the form
  1347. SP KEYWORD ["=" ( QuotedString / * NonSpDquote ) ]
  1348. Clients MUST tolerate events with arguments and keywords they do not
  1349. recognize, and SHOULD process those events as if any unrecognized
  1350. arguments and keywords were not present.
  1351. Clients SHOULD NOT depend on the order of keyword=value arguments,
  1352. and SHOULD NOT depend on there being no new keyword=value arguments
  1353. appearing between existing keyword=value arguments, though as of this
  1354. writing (Jun 2011) some do. Thus, extensions to this protocol should
  1355. add new keywords only after the existing keywords, until all
  1356. controllers have been fixed. At some point this "SHOULD NOT" might
  1357. become a "MUST NOT".
  1358. 4.1.1. Circuit status changed
  1359. The syntax is:
  1360. "650" SP "CIRC" SP CircuitID SP CircStatus [SP Path]
  1361. [SP "BUILD_FLAGS=" BuildFlags] [SP "PURPOSE=" Purpose]
  1362. [SP "HS_STATE=" HSState] [SP "REND_QUERY=" HSAddress]
  1363. [SP "TIME_CREATED=" TimeCreated]
  1364. [SP "REASON=" Reason [SP "REMOTE_REASON=" Reason]]
  1365. [SP "SOCKS_USERNAME=" EscapedUsername]
  1366. [SP "SOCKS_PASSWORD=" EscapedPassword]
  1367. CRLF
  1368. CircStatus =
  1369. "LAUNCHED" / ; circuit ID assigned to new circuit
  1370. "BUILT" / ; all hops finished, can now accept streams
  1371. "GUARD_WAIT" / ; all hops finished, waiting to see if a
  1372. ; circuit with a better guard will be usable.
  1373. "EXTENDED" / ; one more hop has been completed
  1374. "FAILED" / ; circuit closed (was not built)
  1375. "CLOSED" ; circuit closed (was built)
  1376. Path = LongName *("," LongName)
  1377. ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
  1378. ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, Path
  1379. ; is as follows:
  1380. ; Path = ServerID *("," ServerID)
  1381. BuildFlags = BuildFlag *("," BuildFlag)
  1382. BuildFlag = "ONEHOP_TUNNEL" / "IS_INTERNAL" /
  1383. "NEED_CAPACITY" / "NEED_UPTIME"
  1384. Purpose = "GENERAL" / "HS_CLIENT_INTRO" / "HS_CLIENT_REND" /
  1385. "HS_SERVICE_INTRO" / "HS_SERVICE_REND" / "TESTING" /
  1386. "CONTROLLER" / "MEASURE_TIMEOUT"
  1387. HSState = "HSCI_CONNECTING" / "HSCI_INTRO_SENT" / "HSCI_DONE" /
  1388. "HSCR_CONNECTING" / "HSCR_ESTABLISHED_IDLE" /
  1389. "HSCR_ESTABLISHED_WAITING" / "HSCR_JOINED" /
  1390. "HSSI_CONNECTING" / "HSSI_ESTABLISHED" /
  1391. "HSSR_CONNECTING" / "HSSR_JOINED"
  1392. EscapedUsername = QuotedString
  1393. EscapedPassword = QuotedString
  1394. HSAddress = 16*Base32Character
  1395. Base32Character = ALPHA / "2" / "3" / "4" / "5" / "6" / "7"
  1396. TimeCreated = ISOTime2Frac
  1397. Seconds = 1*DIGIT
  1398. Microseconds = 1*DIGIT
  1399. Reason = "NONE" / "TORPROTOCOL" / "INTERNAL" / "REQUESTED" /
  1400. "HIBERNATING" / "RESOURCELIMIT" / "CONNECTFAILED" /
  1401. "OR_IDENTITY" / "OR_CONN_CLOSED" / "TIMEOUT" /
  1402. "FINISHED" / "DESTROYED" / "NOPATH" / "NOSUCHSERVICE" /
  1403. "MEASUREMENT_EXPIRED"
  1404. The path is provided only when the circuit has been extended at least one
  1405. hop.
  1406. The "BUILD_FLAGS" field is provided only in versions 0.2.3.11-alpha
  1407. and later. Clients MUST accept build flags not listed above.
  1408. Build flags are defined as follows:
  1409. ONEHOP_TUNNEL (one-hop circuit, used for tunneled directory conns)
  1410. IS_INTERNAL (internal circuit, not to be used for exiting streams)
  1411. NEED_CAPACITY (this circuit must use only high-capacity nodes)
  1412. NEED_UPTIME (this circuit must use only high-uptime nodes)
  1413. The "PURPOSE" field is provided only in versions 0.2.1.6-alpha and
  1414. later, and only if extended events are enabled (see 3.19). Clients
  1415. MUST accept purposes not listed above. Purposes are defined as
  1416. follows:
  1417. GENERAL (circuit for AP and/or directory request streams)
  1418. HS_CLIENT_INTRO (HS client-side introduction-point circuit)
  1419. HS_CLIENT_REND (HS client-side rendezvous circuit; carries AP streams)
  1420. HS_SERVICE_INTRO (HS service-side introduction-point circuit)
  1421. HS_SERVICE_REND (HS service-side rendezvous circuit)
  1422. TESTING (reachability-testing circuit; carries no traffic)
  1423. CONTROLLER (circuit built by a controller)
  1424. MEASURE_TIMEOUT (circuit being kept around to see how long it takes)
  1425. The "HS_STATE" field is provided only for hidden-service circuits,
  1426. and only in versions 0.2.3.11-alpha and later. Clients MUST accept
  1427. hidden-service circuit states not listed above. Hidden-service
  1428. circuit states are defined as follows:
  1429. HSCI_* (client-side introduction-point circuit states)
  1430. HSCI_CONNECTING (connecting to intro point)
  1431. HSCI_INTRO_SENT (sent INTRODUCE1; waiting for reply from IP)
  1432. HSCI_DONE (received reply from IP relay; closing)
  1433. HSCR_* (client-side rendezvous-point circuit states)
  1434. HSCR_CONNECTING (connecting to or waiting for reply from RP)
  1435. HSCR_ESTABLISHED_IDLE (established RP; waiting for introduction)
  1436. HSCR_ESTABLISHED_WAITING (introduction sent to HS; waiting for rend)
  1437. HSCR_JOINED (connected to HS)
  1438. HSSI_* (service-side introduction-point circuit states)
  1439. HSSI_CONNECTING (connecting to intro point)
  1440. HSSI_ESTABLISHED (established intro point)
  1441. HSSR_* (service-side rendezvous-point circuit states)
  1442. HSSR_CONNECTING (connecting to client's rend point)
  1443. HSSR_JOINED (connected to client's RP circuit)
  1444. The "SOCKS_USERNAME" and "SOCKS_PASSWORD" fields indicate the credentials
  1445. that were used by a SOCKS client to connect to Tor's SOCKS port and
  1446. initiate this circuit. (Streams for SOCKS clients connected with different
  1447. usernames and/or passwords are isolated on separate circuits if the
  1448. IsolateSOCKSAuth flag is active; see Proposal 171.)
  1449. The "REND_QUERY" field is provided only for hidden-service-related
  1450. circuits, and only in versions 0.2.3.11-alpha and later. Clients
  1451. MUST accept hidden service addresses in formats other than that
  1452. specified above.
  1453. The "TIME_CREATED" field is provided only in versions 0.2.3.11-alpha and
  1454. later. TIME_CREATED is the time at which the circuit was created or
  1455. cannibalized.
  1456. The "REASON" field is provided only for FAILED and CLOSED events, and only
  1457. if extended events are enabled (see 3.19). Clients MUST accept reasons
  1458. not listed above. Reasons are as given in tor-spec.txt, except for:
  1459. NOPATH (Not enough nodes to make circuit)
  1460. MEASUREMENT_EXPIRED (As "TIMEOUT", except that we had left the circuit
  1461. open for measurement purposes to see how long it
  1462. would take to finish.)
  1463. The "REMOTE_REASON" field is provided only when we receive a DESTROY or
  1464. TRUNCATE cell, and only if extended events are enabled. It contains the
  1465. actual reason given by the remote OR for closing the circuit. Clients MUST
  1466. accept reasons not listed above. Reasons are as listed in tor-spec.txt.
  1467. 4.1.2. Stream status changed
  1468. The syntax is:
  1469. "650" SP "STREAM" SP StreamID SP StreamStatus SP CircuitID SP Target
  1470. [SP "REASON=" Reason [ SP "REMOTE_REASON=" Reason ]]
  1471. [SP "SOURCE=" Source] [ SP "SOURCE_ADDR=" Address ":" Port ]
  1472. [SP "PURPOSE=" Purpose]
  1473. CRLF
  1474. StreamStatus =
  1475. "NEW" / ; New request to connect
  1476. "NEWRESOLVE" / ; New request to resolve an address
  1477. "REMAP" / ; Address re-mapped to another
  1478. "SENTCONNECT" / ; Sent a connect cell along a circuit
  1479. "SENTRESOLVE" / ; Sent a resolve cell along a circuit
  1480. "SUCCEEDED" / ; Received a reply; stream established
  1481. "FAILED" / ; Stream failed and not retriable
  1482. "CLOSED" / ; Stream closed
  1483. "DETACHED" ; Detached from circuit; still retriable
  1484. Target = TargetAddress ":" Port
  1485. Port = an integer from 0 to 65535 inclusive
  1486. TargetAddress = Address / "(Tor_internal)"
  1487. The circuit ID designates which circuit this stream is attached to. If
  1488. the stream is unattached, the circuit ID "0" is given. The target
  1489. indicates the address which the stream is meant to resolve or connect to;
  1490. it can be "(Tor_internal)" for a virtual stream created by the Tor program
  1491. to talk to itself.
  1492. Reason = "MISC" / "RESOLVEFAILED" / "CONNECTREFUSED" /
  1493. "EXITPOLICY" / "DESTROY" / "DONE" / "TIMEOUT" /
  1494. "NOROUTE" / "HIBERNATING" / "INTERNAL"/ "RESOURCELIMIT" /
  1495. "CONNRESET" / "TORPROTOCOL" / "NOTDIRECTORY" / "END" /
  1496. "PRIVATE_ADDR"
  1497. The "REASON" field is provided only for FAILED, CLOSED, and DETACHED
  1498. events, and only if extended events are enabled (see 3.19). Clients MUST
  1499. accept reasons not listed above. Reasons are as given in tor-spec.txt,
  1500. except for:
  1501. END (We received a RELAY_END cell from the other side of this
  1502. stream.)
  1503. PRIVATE_ADDR (The client tried to connect to a private address like
  1504. 127.0.0.1 or 10.0.0.1 over Tor.)
  1505. [XXXX document more. -NM]
  1506. The "REMOTE_REASON" field is provided only when we receive a RELAY_END
  1507. cell, and only if extended events are enabled. It contains the actual
  1508. reason given by the remote OR for closing the stream. Clients MUST accept
  1509. reasons not listed above. Reasons are as listed in tor-spec.txt.
  1510. "REMAP" events include a Source if extended events are enabled:
  1511. Source = "CACHE" / "EXIT"
  1512. Clients MUST accept sources not listed above. "CACHE" is given if
  1513. the Tor client decided to remap the address because of a cached
  1514. answer, and "EXIT" is given if the remote node we queried gave us
  1515. the new address as a response.
  1516. The "SOURCE_ADDR" field is included with NEW and NEWRESOLVE events if
  1517. extended events are enabled. It indicates the address and port
  1518. that requested the connection, and can be (e.g.) used to look up the
  1519. requesting program.
  1520. Purpose = "DIR_FETCH" / "DIR_UPLOAD" / "DNS_REQUEST" /
  1521. "USER" / "DIRPORT_TEST"
  1522. The "PURPOSE" field is provided only for NEW and NEWRESOLVE events, and
  1523. only if extended events are enabled (see 3.19). Clients MUST accept
  1524. purposes not listed above. The purposes above are defined as:
  1525. "DIR_FETCH" -- This stream is generated internally to Tor for
  1526. fetching directory information.
  1527. "DIR_UPLOAD" -- An internal stream for uploading information to
  1528. a directory authority.
  1529. "DIRPORT_TEST" -- A stream we're using to test our own directory
  1530. port to make sure it's reachable.
  1531. "DNS_REQUEST" -- A user-initiated DNS request.
  1532. "USER" -- This stream is handling user traffic, OR it's internal
  1533. to Tor, but it doesn't match one of the purposes above.
  1534. 4.1.3. OR Connection status changed
  1535. The syntax is:
  1536. "650" SP "ORCONN" SP (LongName / Target) SP ORStatus [ SP "REASON="
  1537. Reason ] [ SP "NCIRCS=" NumCircuits ] [ SP "ID=" ConnID ] CRLF
  1538. ORStatus = "NEW" / "LAUNCHED" / "CONNECTED" / "FAILED" / "CLOSED"
  1539. ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
  1540. ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, OR
  1541. ; Connection is as follows:
  1542. "650" SP "ORCONN" SP (ServerID / Target) SP ORStatus [ SP "REASON="
  1543. Reason ] [ SP "NCIRCS=" NumCircuits ] CRLF
  1544. NEW is for incoming connections, and LAUNCHED is for outgoing
  1545. connections. CONNECTED means the TLS handshake has finished (in
  1546. either direction). FAILED means a connection is being closed that
  1547. hasn't finished its handshake, and CLOSED is for connections that
  1548. have handshaked.
  1549. A LongName or ServerID is specified unless it's a NEW connection, in
  1550. which case we don't know what server it is yet, so we use Address:Port.
  1551. If extended events are enabled (see 3.19), optional reason and
  1552. circuit counting information is provided for CLOSED and FAILED
  1553. events.
  1554. Reason = "MISC" / "DONE" / "CONNECTREFUSED" /
  1555. "IDENTITY" / "CONNECTRESET" / "TIMEOUT" / "NOROUTE" /
  1556. "IOERROR" / "RESOURCELIMIT" / "PT_MISSING"
  1557. NumCircuits counts both established and pending circuits.
  1558. The ORStatus values are as follows:
  1559. NEW -- We have received a new incoming OR connection, and are starting
  1560. the server-side handshake.
  1561. LAUNCHED -- We have launched a new outgoing OR connection, and are
  1562. starting the client-side handshake.
  1563. CONNECTED -- The OR connection has been connected and the handshake is
  1564. done.
  1565. FAILED -- Our attempt to open the OR connection failed.
  1566. CLOSED -- The OR connection closed in an unremarkable way.
  1567. The Reason values for closed/failed OR connections are:
  1568. DONE -- The OR connection has shut down cleanly.
  1569. CONNECTREFUSED -- We got an ECONNREFUSED while connecting to the target
  1570. OR.
  1571. IDENTITY -- We connected to the OR, but found that its identity was
  1572. not what we expected.
  1573. CONNECTRESET -- We got an ECONNRESET or similar IO error from the
  1574. connection with the OR.
  1575. TIMEOUT -- We got an ETIMEOUT or similar IO error from the connection
  1576. with the OR, or we're closing the connection for being idle for too
  1577. long.
  1578. NOROUTE -- We got an ENOTCONN, ENETUNREACH, ENETDOWN, EHOSTUNREACH, or
  1579. similar error while connecting to the OR.
  1580. IOERROR -- We got some other IO error on our connection to the OR.
  1581. RESOURCELIMIT -- We don't have enough operating system resources (file
  1582. descriptors, buffers, etc) to connect to the OR.
  1583. PT_MISSING -- No pluggable transport was available.
  1584. MISC -- The OR connection closed for some other reason.
  1585. [First added ID parameter in 0.2.5.2-alpha]
  1586. 4.1.4. Bandwidth used in the last second
  1587. The syntax is:
  1588. "650" SP "BW" SP BytesRead SP BytesWritten *(SP Type "=" Num) CRLF
  1589. BytesRead = 1*DIGIT
  1590. BytesWritten = 1*DIGIT
  1591. Type = "DIR" / "OR" / "EXIT" / "APP" / ...
  1592. Num = 1*DIGIT
  1593. BytesRead and BytesWritten are the totals. [In a future Tor version,
  1594. we may also include a breakdown of the connection types that used
  1595. bandwidth this second (not implemented yet).]
  1596. 4.1.5. Log messages
  1597. The syntax is:
  1598. "650" SP Severity SP ReplyText CRLF
  1599. or
  1600. "650+" Severity CRLF Data 650 SP "OK" CRLF
  1601. Severity = "DEBUG" / "INFO" / "NOTICE" / "WARN"/ "ERR"
  1602. 4.1.6. New descriptors available
  1603. Syntax:
  1604. "650" SP "NEWDESC" 1*(SP LongName) CRLF
  1605. ; In Tor versions 0.1.2.2-alpha through 0.2.2.1-alpha with feature
  1606. ; VERBOSE_NAMES turned off and before version 0.1.2.2-alpha, it
  1607. ; is as follows:
  1608. "650" SP "NEWDESC" 1*(SP ServerID) CRLF
  1609. 4.1.7. New Address mapping
  1610. These events are generated when a new address mapping is entered in
  1611. Tor's address map cache, or when the answer for a RESOLVE command is
  1612. found. Entries can be created by a successful or failed DNS lookup,
  1613. a successful or failed connection attempt, a RESOLVE command,
  1614. a MAPADDRESS command, the AutomapHostsOnResolve feature, or the
  1615. TrackHostExits feature.
  1616. Syntax:
  1617. "650" SP "ADDRMAP" SP Address SP NewAddress SP Expiry
  1618. [SP "error=" ErrorCode] [SP "EXPIRES=" UTCExpiry] [SP "CACHED=" Cached]
  1619. CRLF
  1620. NewAddress = Address / "<error>"
  1621. Expiry = DQUOTE ISOTime DQUOTE / "NEVER"
  1622. ErrorCode = "yes" / "internal" / "Unable to launch resolve request"
  1623. UTCExpiry = DQUOTE IsoTime DQUOTE
  1624. Cached = DQUOTE "YES" DQUOTE / DQUOTE "NO" DQUOTE
  1625. Error and UTCExpiry are only provided if extended events are enabled.
  1626. The values for Error are mostly useless. Future values will be
  1627. chosen to match 1*(ALNUM / "_"); the "Unable to launch resolve request"
  1628. value is a bug in Tor before 0.2.4.7-alpha.
  1629. Expiry is expressed as the local time (rather than UTC). This is a bug,
  1630. left in for backward compatibility; new code should look at UTCExpiry
  1631. instead. (If Expiry is "NEVER", UTCExpiry is omitted.)
  1632. Cached indicates whether the mapping will be stored until it expires, or if
  1633. it is just a notification in response to a RESOLVE command.
  1634. 4.1.8. Descriptors uploaded to us in our role as authoritative dirserver
  1635. Tor generates this event when it's an directory authority, and
  1636. somebody has just uploaded a server descriptor.
  1637. Syntax:
  1638. "650" "+" "AUTHDIR_NEWDESCS" CRLF Action CRLF Message CRLF
  1639. Descriptor CRLF "." CRLF "650" SP "OK" CRLF
  1640. Action = "ACCEPTED" / "DROPPED" / "REJECTED"
  1641. Message = Text
  1642. The Descriptor field is the text of the server descriptor; the Action
  1643. field is "ACCEPTED" if we're accepting the descriptor as the new
  1644. best valid descriptor for its router, "REJECTED" if we aren't taking
  1645. the descriptor and we're complaining to the uploading relay about
  1646. it, and "DROPPED" if we decide to drop the descriptor without
  1647. complaining. The Message field is a human-readable string
  1648. explaining why we chose the Action. (It doesn't contain newlines.)
  1649. 4.1.9. Our descriptor changed
  1650. Syntax:
  1651. "650" SP "DESCCHANGED" CRLF
  1652. [First added in 0.1.2.2-alpha.]
  1653. 4.1.10. Status events
  1654. Status events (STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER) are sent
  1655. based on occurrences in the Tor process pertaining to the general state of
  1656. the program. Generally, they correspond to log messages of severity Notice
  1657. or higher. They differ from log messages in that their format is a
  1658. specified interface.
  1659. Syntax:
  1660. "650" SP StatusType SP StatusSeverity SP StatusAction
  1661. [SP StatusArguments] CRLF
  1662. StatusType = "STATUS_GENERAL" / "STATUS_CLIENT" / "STATUS_SERVER"
  1663. StatusSeverity = "NOTICE" / "WARN" / "ERR"
  1664. StatusAction = 1*ALPHA
  1665. StatusArguments = StatusArgument *(SP StatusArgument)
  1666. StatusArgument = StatusKeyword '=' StatusValue
  1667. StatusKeyword = 1*(ALNUM / "_")
  1668. StatusValue = 1*(ALNUM / '_') / QuotedString
  1669. StatusAction is a string, and StatusArguments is a series of
  1670. keyword=value pairs on the same line. Values may be space-terminated
  1671. strings, or quoted strings.
  1672. These events are always produced with EXTENDED_EVENTS and
  1673. VERBOSE_NAMES; see the explanations in the USEFEATURE section
  1674. for details.
  1675. Controllers MUST tolerate unrecognized actions, MUST tolerate
  1676. unrecognized arguments, MUST tolerate missing arguments, and MUST
  1677. tolerate arguments that arrive in any order.
  1678. Each event description below is accompanied by a recommendation for
  1679. controllers. These recommendations are suggestions only; no controller
  1680. is required to implement them.
  1681. Compatibility note: versions of Tor before 0.2.0.22-rc incorrectly
  1682. generated "STATUS_SERVER" as "STATUS_SEVER". To be compatible with those
  1683. versions, tools should accept both.
  1684. Actions for STATUS_GENERAL events can be as follows:
  1685. CLOCK_JUMPED
  1686. "TIME=NUM"
  1687. Tor spent enough time without CPU cycles that it has closed all
  1688. its circuits and will establish them anew. This typically
  1689. happens when a laptop goes to sleep and then wakes up again. It
  1690. also happens when the system is swapping so heavily that Tor is
  1691. starving. The "time" argument specifies the number of seconds Tor
  1692. thinks it was unconscious for (or alternatively, the number of
  1693. seconds it went back in time).
  1694. This status event is sent as NOTICE severity normally, but WARN
  1695. severity if Tor is acting as a server currently.
  1696. {Recommendation for controller: ignore it, since we don't really
  1697. know what the user should do anyway. Hm.}
  1698. DANGEROUS_VERSION
  1699. "CURRENT=version"
  1700. "REASON=NEW/OBSOLETE/UNRECOMMENDED"
  1701. "RECOMMENDED=\"version, version, ...\""
  1702. Tor has found that directory servers don't recommend its version of
  1703. the Tor software. RECOMMENDED is a comma-and-space-separated string
  1704. of Tor versions that are recommended. REASON is NEW if this version
  1705. of Tor is newer than any recommended version, OBSOLETE if
  1706. this version of Tor is older than any recommended version, and
  1707. UNRECOMMENDED if some recommended versions of Tor are newer and
  1708. some are older than this version. (The "OBSOLETE" reason was called
  1709. "OLD" from Tor 0.1.2.3-alpha up to and including 0.2.0.12-alpha.)
  1710. {Controllers may want to suggest that the user upgrade OLD or
  1711. UNRECOMMENDED versions. NEW versions may be known-insecure, or may
  1712. simply be development versions.}
  1713. TOO_MANY_CONNECTIONS
  1714. "CURRENT=NUM"
  1715. Tor has reached its ulimit -n or whatever the native limit is on file
  1716. descriptors or sockets. CURRENT is the number of sockets Tor
  1717. currently has open. The user should really do something about
  1718. this. The "current" argument shows the number of connections currently
  1719. open.
  1720. {Controllers may recommend that the user increase the limit, or
  1721. increase it for them. Recommendations should be phrased in an
  1722. OS-appropriate way and automated when possible.}
  1723. BUG
  1724. "REASON=STRING"
  1725. Tor has encountered a situation that its developers never expected,
  1726. and the developers would like to learn that it happened. Perhaps
  1727. the controller can explain this to the user and encourage her to
  1728. file a bug report?
  1729. {Controllers should log bugs, but shouldn't annoy the user in case a
  1730. bug appears frequently.}
  1731. CLOCK_SKEW
  1732. SKEW="+" / "-" SECONDS
  1733. MIN_SKEW="+" / "-" SECONDS.
  1734. SOURCE="DIRSERV:" IP ":" Port /
  1735. "NETWORKSTATUS:" IP ":" Port /
  1736. "OR:" IP ":" Port /
  1737. "CONSENSUS"
  1738. If "SKEW" is present, it's an estimate of how far we are from the
  1739. time declared in the source. (In other words, if we're an hour in
  1740. the past, the value is -3600.) "MIN_SKEW" is present, it's a lower
  1741. bound. If the source is a DIRSERV, we got the current time from a
  1742. connection to a dirserver. If the source is a NETWORKSTATUS, we
  1743. decided we're skewed because we got a v2 networkstatus from far in
  1744. the future. If the source is OR, the skew comes from a NETINFO
  1745. cell from a connection to another relay. If the source is
  1746. CONSENSUS, we decided we're skewed because we got a networkstatus
  1747. consensus from the future.
  1748. {Tor should send this message to controllers when it thinks the
  1749. skew is so high that it will interfere with proper Tor operation.
  1750. Controllers shouldn't blindly adjust the clock, since the more
  1751. accurate source of skew info (DIRSERV) is currently
  1752. unauthenticated.}
  1753. BAD_LIBEVENT
  1754. "METHOD=" libevent method
  1755. "VERSION=" libevent version
  1756. "BADNESS=" "BROKEN" / "BUGGY" / "SLOW"
  1757. "RECOVERED=" "NO" / "YES"
  1758. Tor knows about bugs in using the configured event method in this
  1759. version of libevent. "BROKEN" libevents won't work at all;
  1760. "BUGGY" libevents might work okay; "SLOW" libevents will work
  1761. fine, but not quickly. If "RECOVERED" is YES, Tor managed to
  1762. switch to a more reliable (but probably slower!) libevent method.
  1763. {Controllers may want to warn the user if this event occurs, though
  1764. generally it's the fault of whoever built the Tor binary and there's
  1765. not much the user can do besides upgrade libevent or upgrade the
  1766. binary.}
  1767. DIR_ALL_UNREACHABLE
  1768. Tor believes that none of the known directory servers are
  1769. reachable -- this is most likely because the local network is
  1770. down or otherwise not working, and might help to explain for the
  1771. user why Tor appears to be broken.
  1772. {Controllers may want to warn the user if this event occurs; further
  1773. action is generally not possible.}
  1774. CONSENSUS_ARRIVED
  1775. Tor has received and validated a new consensus networkstatus.
  1776. (This event can be delayed a little while after the consensus
  1777. is received, if Tor needs to fetch certificates.)
  1778. Actions for STATUS_CLIENT events can be as follows:
  1779. BOOTSTRAP
  1780. "PROGRESS=" num
  1781. "TAG=" Keyword
  1782. "SUMMARY=" String
  1783. ["WARNING=" String]
  1784. ["REASON=" Keyword]
  1785. ["COUNT=" num]
  1786. ["RECOMMENDATION=" Keyword]
  1787. ["HOST=" QuotedString]
  1788. ["HOSTADDR=" QuotedString]
  1789. Tor has made some progress at establishing a connection to the
  1790. Tor network, fetching directory information, or making its first
  1791. circuit; or it has encountered a problem while bootstrapping. This
  1792. status event is especially useful for users with slow connections
  1793. or with connectivity problems.
  1794. "Progress" gives a number between 0 and 100 for how far through
  1795. the bootstrapping process we are. "Summary" is a string that can
  1796. be displayed to the user to describe the *next* task that Tor
  1797. will tackle, i.e., the task it is working on after sending the
  1798. status event. "Tag" is a string that controllers can use to
  1799. recognize bootstrap phases, if they want to do something smarter
  1800. than just blindly displaying the summary string; see Section 5
  1801. for the current tags that Tor issues.
  1802. The StatusSeverity describes whether this is a normal bootstrap
  1803. phase (severity notice) or an indication of a bootstrapping
  1804. problem (severity warn).
  1805. For bootstrap problems, we include the same progress, tag, and
  1806. summary values as we would for a normal bootstrap event, but we
  1807. also include "warning", "reason", "count", and "recommendation"
  1808. key/value combos. The "count" number tells how many bootstrap
  1809. problems there have been so far at this phase. The "reason"
  1810. string lists one of the reasons allowed in the ORCONN event. The
  1811. "warning" argument string with any hints Tor has to offer about
  1812. why it's having troubles bootstrapping.
  1813. The "reason" values are long-term-stable controller-facing tags to
  1814. identify particular issues in a bootstrapping step. The warning
  1815. strings, on the other hand, are human-readable. Controllers
  1816. SHOULD NOT rely on the format of any warning string. Currently
  1817. the possible values for "recommendation" are either "ignore" or
  1818. "warn" -- if ignore, the controller can accumulate the string in
  1819. a pile of problems to show the user if the user asks; if warn,
  1820. the controller should alert the user that Tor is pretty sure
  1821. there's a bootstrapping problem.
  1822. The "host" value is the identity digest (in hex) of the node we're
  1823. trying to connect to; the "hostaddr" is an address:port combination,
  1824. where 'address' is an ipv4 or ipv6 address.
  1825. Currently Tor uses recommendation=ignore for the first
  1826. nine bootstrap problem reports for a given phase, and then
  1827. uses recommendation=warn for subsequent problems at that
  1828. phase. Hopefully this is a good balance between tolerating
  1829. occasional errors and reporting serious problems quickly.
  1830. ENOUGH_DIR_INFO
  1831. Tor now knows enough network-status documents and enough server
  1832. descriptors that it's going to start trying to build circuits now.
  1833. [Newer versions of Tor (0.2.6.2-alpha and later):
  1834. If the consensus contains Exits (the typical case), Tor will build
  1835. both exit and internal circuits. If not, Tor will only build internal
  1836. circuits.]
  1837. {Controllers may want to use this event to decide when to indicate
  1838. progress to their users, but should not interrupt the user's browsing
  1839. to tell them so.}
  1840. NOT_ENOUGH_DIR_INFO
  1841. We discarded expired statuses and server descriptors to fall
  1842. below the desired threshold of directory information. We won't
  1843. try to build any circuits until ENOUGH_DIR_INFO occurs again.
  1844. {Controllers may want to use this event to decide when to indicate
  1845. progress to their users, but should not interrupt the user's browsing
  1846. to tell them so.}
  1847. CIRCUIT_ESTABLISHED
  1848. Tor is able to establish circuits for client use. This event will
  1849. only be sent if we just built a circuit that changed our mind --
  1850. that is, prior to this event we didn't know whether we could
  1851. establish circuits.
  1852. {Suggested use: controllers can notify their users that Tor is
  1853. ready for use as a client once they see this status event. [Perhaps
  1854. controllers should also have a timeout if too much time passes and
  1855. this event hasn't arrived, to give tips on how to troubleshoot.
  1856. On the other hand, hopefully Tor will send further status events
  1857. if it can identify the problem.]}
  1858. CIRCUIT_NOT_ESTABLISHED
  1859. "REASON=" "EXTERNAL_ADDRESS" / "DIR_ALL_UNREACHABLE" / "CLOCK_JUMPED"
  1860. We are no longer confident that we can build circuits. The "reason"
  1861. keyword provides an explanation: which other status event type caused
  1862. our lack of confidence.
  1863. {Controllers may want to use this event to decide when to indicate
  1864. progress to their users, but should not interrupt the user's browsing
  1865. to do so.}
  1866. [Note: only REASON=CLOCK_JUMPED is implemented currently.]
  1867. DANGEROUS_PORT
  1868. "PORT=" port
  1869. "RESULT=" "REJECT" / "WARN"
  1870. A stream was initiated to a port that's commonly used for
  1871. vulnerable-plaintext protocols. If the Result is "reject", we
  1872. refused the connection; whereas if it's "warn", we allowed it.
  1873. {Controllers should warn their users when this occurs, unless they
  1874. happen to know that the application using Tor is in fact doing so
  1875. correctly (e.g., because it is part of a distributed bundle). They
  1876. might also want some sort of interface to let the user configure
  1877. their RejectPlaintextPorts and WarnPlaintextPorts config options.}
  1878. DANGEROUS_SOCKS
  1879. "PROTOCOL=" "SOCKS4" / "SOCKS5"
  1880. "ADDRESS=" IP:port
  1881. A connection was made to Tor's SOCKS port using one of the SOCKS
  1882. approaches that doesn't support hostnames -- only raw IP addresses.
  1883. If the client application got this address from gethostbyname(),
  1884. it may be leaking target addresses via DNS.
  1885. {Controllers should warn their users when this occurs, unless they
  1886. happen to know that the application using Tor is in fact doing so
  1887. correctly (e.g., because it is part of a distributed bundle).}
  1888. SOCKS_UNKNOWN_PROTOCOL
  1889. "DATA=string"
  1890. A connection was made to Tor's SOCKS port that tried to use it
  1891. for something other than the SOCKS protocol. Perhaps the user is
  1892. using Tor as an HTTP proxy? The DATA is the first few characters
  1893. sent to Tor on the SOCKS port.
  1894. {Controllers may want to warn their users when this occurs: it
  1895. indicates a misconfigured application.}
  1896. SOCKS_BAD_HOSTNAME
  1897. "HOSTNAME=QuotedString"
  1898. Some application gave us a funny-looking hostname. Perhaps
  1899. it is broken? In any case it won't work with Tor and the user
  1900. should know.
  1901. {Controllers may want to warn their users when this occurs: it
  1902. usually indicates a misconfigured application.}
  1903. Actions for STATUS_SERVER can be as follows:
  1904. EXTERNAL_ADDRESS
  1905. "ADDRESS=IP"
  1906. "HOSTNAME=NAME"
  1907. "METHOD=CONFIGURED/DIRSERV/RESOLVED/INTERFACE/GETHOSTNAME"
  1908. Our best idea for our externally visible IP has changed to 'IP'.
  1909. If 'HOSTNAME' is present, we got the new IP by resolving 'NAME'. If the
  1910. method is 'CONFIGURED', the IP was given verbatim as a configuration
  1911. option. If the method is 'RESOLVED', we resolved the Address
  1912. configuration option to get the IP. If the method is 'GETHOSTNAME',
  1913. we resolved our hostname to get the IP. If the method is 'INTERFACE',
  1914. we got the address of one of our network interfaces to get the IP. If
  1915. the method is 'DIRSERV', a directory server told us a guess for what
  1916. our IP might be.
  1917. {Controllers may want to record this info and display it to the user.}
  1918. CHECKING_REACHABILITY
  1919. "ORADDRESS=IP:port"
  1920. "DIRADDRESS=IP:port"
  1921. We're going to start testing the reachability of our external OR port
  1922. or directory port.
  1923. {This event could affect the controller's idea of server status, but
  1924. the controller should not interrupt the user to tell them so.}
  1925. REACHABILITY_SUCCEEDED
  1926. "ORADDRESS=IP:port"
  1927. "DIRADDRESS=IP:port"
  1928. We successfully verified the reachability of our external OR port or
  1929. directory port (depending on which of ORADDRESS or DIRADDRESS is
  1930. given.)
  1931. {This event could affect the controller's idea of server status, but
  1932. the controller should not interrupt the user to tell them so.}
  1933. GOOD_SERVER_DESCRIPTOR
  1934. We successfully uploaded our server descriptor to at least one
  1935. of the directory authorities, with no complaints.
  1936. {Originally, the goal of this event was to declare "every authority
  1937. has accepted the descriptor, so there will be no complaints
  1938. about it." But since some authorities might be offline, it's
  1939. harder to get certainty than we had thought. As such, this event
  1940. is equivalent to ACCEPTED_SERVER_DESCRIPTOR below. Controllers
  1941. should just look at ACCEPTED_SERVER_DESCRIPTOR and should ignore
  1942. this event for now.}
  1943. SERVER_DESCRIPTOR_STATUS
  1944. "STATUS=" "LISTED" / "UNLISTED"
  1945. We just got a new networkstatus consensus, and whether we're in
  1946. it or not in it has changed. Specifically, status is "listed"
  1947. if we're listed in it but previous to this point we didn't know
  1948. we were listed in a consensus; and status is "unlisted" if we
  1949. thought we should have been listed in it (e.g. we were listed in
  1950. the last one), but we're not.
  1951. {Moving from listed to unlisted is not necessarily cause for
  1952. alarm. The relay might have failed a few reachability tests,
  1953. or the Internet might have had some routing problems. So this
  1954. feature is mainly to let relay operators know when their relay
  1955. has successfully been listed in the consensus.}
  1956. [Not implemented yet. We should do this in 0.2.2.x. -RD]
  1957. NAMESERVER_STATUS
  1958. "NS=addr"
  1959. "STATUS=" "UP" / "DOWN"
  1960. "ERR=" message
  1961. One of our nameservers has changed status.
  1962. {This event could affect the controller's idea of server status, but
  1963. the controller should not interrupt the user to tell them so.}
  1964. NAMESERVER_ALL_DOWN
  1965. All of our nameservers have gone down.
  1966. {This is a problem; if it happens often without the nameservers
  1967. coming up again, the user needs to configure more or better
  1968. nameservers.}
  1969. DNS_HIJACKED
  1970. Our DNS provider is providing an address when it should be saying
  1971. "NOTFOUND"; Tor will treat the address as a synonym for "NOTFOUND".
  1972. {This is an annoyance; controllers may want to tell admins that their
  1973. DNS provider is not to be trusted.}
  1974. DNS_USELESS
  1975. Our DNS provider is giving a hijacked address instead of well-known
  1976. websites; Tor will not try to be an exit node.
  1977. {Controllers could warn the admin if the relay is running as an
  1978. exit node: the admin needs to configure a good DNS server.
  1979. Alternatively, this happens a lot in some restrictive environments
  1980. (hotels, universities, coffeeshops) when the user hasn't registered.}
  1981. BAD_SERVER_DESCRIPTOR
  1982. "DIRAUTH=addr:port"
  1983. "REASON=string"
  1984. A directory authority rejected our descriptor. Possible reasons
  1985. include malformed descriptors, incorrect keys, highly skewed clocks,
  1986. and so on.
  1987. {Controllers should warn the admin, and try to cope if they can.}
  1988. ACCEPTED_SERVER_DESCRIPTOR
  1989. "DIRAUTH=addr:port"
  1990. A single directory authority accepted our descriptor.
  1991. // actually notice
  1992. {This event could affect the controller's idea of server status, but
  1993. the controller should not interrupt the user to tell them so.}
  1994. REACHABILITY_FAILED
  1995. "ORADDRESS=IP:port"
  1996. "DIRADDRESS=IP:port"
  1997. We failed to connect to our external OR port or directory port
  1998. successfully.
  1999. {This event could affect the controller's idea of server status. The
  2000. controller should warn the admin and suggest reasonable steps to take.}
  2001. HIBERNATION_STATUS
  2002. "STATUS=" "AWAKE" | "SOFT" | "HARD"
  2003. Our bandwidth based accounting status has changed, and we are now
  2004. relaying traffic/rejecting new connections/hibernating.
  2005. {This event could affect the controller's idea of server status. The
  2006. controller MAY inform the admin, though presumably the accounting was
  2007. explicitly enabled for a reason.}
  2008. [This event was added in tor 0.2.9.0-alpha.]
  2009. 4.1.11. Our set of guard nodes has changed
  2010. Syntax:
  2011. "650" SP "GUARD" SP Type SP Name SP Status ... CRLF
  2012. Type = "ENTRY"
  2013. Name = ServerSpec
  2014. (Identifies the guard affected)
  2015. Status = "NEW" | "UP" | "DOWN" | "BAD" | "GOOD" | "DROPPED"
  2016. The ENTRY type indicates a guard used for connections to the Tor
  2017. network.
  2018. The Status values are:
  2019. "NEW" -- This node was not previously used as a guard; now we have
  2020. picked it as one.
  2021. "DROPPED" -- This node is one we previously picked as a guard; we
  2022. no longer consider it to be a member of our guard list.
  2023. "UP" -- The guard now seems to be reachable.
  2024. "DOWN" -- The guard now seems to be unreachable.
  2025. "BAD" -- Because of flags set in the consensus and/or values in the
  2026. configuration, this node is now unusable as a guard.
  2027. "GOOD" -- Because of flags set in the consensus and/or values in the
  2028. configuration, this node is now usable as a guard.
  2029. Controllers must accept unrecognized types and unrecognized statuses.
  2030. 4.1.12. Network status has changed
  2031. Syntax:
  2032. "650" "+" "NS" CRLF 1*NetworkStatus "." CRLF "650" SP "OK" CRLF
  2033. The event is used whenever our local view of a relay status changes.
  2034. This happens when we get a new v3 consensus (in which case the entries
  2035. we see are a duplicate of what we see in the NEWCONSENSUS event,
  2036. below), but it also happens when we decide to mark a relay as up or
  2037. down in our local status, for example based on connection attempts.
  2038. [First added in 0.1.2.3-alpha]
  2039. 4.1.13. Bandwidth used on an application stream
  2040. The syntax is:
  2041. "650" SP "STREAM_BW" SP StreamID SP BytesWritten SP BytesRead CRLF
  2042. BytesWritten = 1*DIGIT
  2043. BytesRead = 1*DIGIT
  2044. BytesWritten and BytesRead are the number of bytes written and read
  2045. by the application since the last STREAM_BW event on this stream.
  2046. Note that from Tor's perspective, *reading* a byte on a stream means
  2047. that the application *wrote* the byte. That's why the order of "written"
  2048. vs "read" is opposite for stream_bw events compared to bw events.
  2049. These events are generated about once per second per stream; no events
  2050. are generated for streams that have not written or read. These events
  2051. apply only to streams entering Tor (such as on a SOCKSPort, TransPort,
  2052. or so on). They are not generated for exiting streams.
  2053. 4.1.14. Per-country client stats
  2054. The syntax is:
  2055. "650" SP "CLIENTS_SEEN" SP TimeStarted SP CountrySummary SP
  2056. IPVersions CRLF
  2057. We just generated a new summary of which countries we've seen clients
  2058. from recently. The controller could display this for the user, e.g.
  2059. in their "relay" configuration window, to give them a sense that they
  2060. are actually being useful.
  2061. Currently only bridge relays will receive this event, but once we figure
  2062. out how to sufficiently aggregate and sanitize the client counts on
  2063. main relays, we might start sending these events in other cases too.
  2064. TimeStarted is a quoted string indicating when the reported summary
  2065. counts from (in UTCS).
  2066. The CountrySummary keyword has as its argument a comma-separated,
  2067. possibly empty set of "countrycode=count" pairs. For example (without
  2068. linebreak),
  2069. 650-CLIENTS_SEEN TimeStarted="2008-12-25 23:50:43"
  2070. CountrySummary=us=16,de=8,uk=8
  2071. The IPVersions keyword has as its argument a comma-separated set of
  2072. "protocol-family=count" pairs. For example,
  2073. IPVersions=v4=16,v6=40
  2074. 4.1.15. New consensus networkstatus has arrived
  2075. The syntax is:
  2076. "650" "+" "NEWCONSENSUS" CRLF 1*NetworkStatus "." CRLF "650" SP
  2077. "OK" CRLF
  2078. A new consensus networkstatus has arrived. We include NS-style lines for
  2079. every relay in the consensus. NEWCONSENSUS is a separate event from the
  2080. NS event, because the list here represents every usable relay: so any
  2081. relay *not* mentioned in this list is implicitly no longer recommended.
  2082. [First added in 0.2.1.13-alpha]
  2083. 4.1.16. New circuit buildtime has been set
  2084. The syntax is:
  2085. "650" SP "BUILDTIMEOUT_SET" SP Type SP "TOTAL_TIMES=" Total SP
  2086. "TIMEOUT_MS=" Timeout SP "XM=" Xm SP "ALPHA=" Alpha SP
  2087. "CUTOFF_QUANTILE=" Quantile SP "TIMEOUT_RATE=" TimeoutRate SP
  2088. "CLOSE_MS=" CloseTimeout SP "CLOSE_RATE=" CloseRate
  2089. CRLF
  2090. Type = "COMPUTED" / "RESET" / "SUSPENDED" / "DISCARD" / "RESUME"
  2091. Total = Integer count of timeouts stored
  2092. Timeout = Integer timeout in milliseconds
  2093. Xm = Estimated integer Pareto parameter Xm in milliseconds
  2094. Alpha = Estimated floating point Paredo paremter alpha
  2095. Quantile = Floating point CDF quantile cutoff point for this timeout
  2096. TimeoutRate = Floating point ratio of circuits that timeout
  2097. CloseTimeout = How long to keep measurement circs in milliseconds
  2098. CloseRate = Floating point ratio of measurement circuits that are closed
  2099. A new circuit build timeout time has been set. If Type is "COMPUTED",
  2100. Tor has computed the value based on historical data. If Type is "RESET",
  2101. initialization or drastic network changes have caused Tor to reset
  2102. the timeout back to the default, to relearn again. If Type is
  2103. "SUSPENDED", Tor has detected a loss of network connectivity and has
  2104. temporarily changed the timeout value to the default until the network
  2105. recovers. If type is "DISCARD", Tor has decided to discard timeout
  2106. values that likely happened while the network was down. If type is
  2107. "RESUME", Tor has decided to resume timeout calculation.
  2108. The Total value is the count of circuit build times Tor used in
  2109. computing this value. It is capped internally at the maximum number
  2110. of build times Tor stores (NCIRCUITS_TO_OBSERVE).
  2111. The Timeout itself is provided in milliseconds. Internally, Tor rounds
  2112. this value to the nearest second before using it.
  2113. [First added in 0.2.2.7-alpha]
  2114. 4.1.17. Signal received
  2115. The syntax is:
  2116. "650" SP "SIGNAL" SP Signal CRLF
  2117. Signal = "RELOAD" / "DUMP" / "DEBUG" / "NEWNYM" / "CLEARDNSCACHE"
  2118. A signal has been received and actions taken by Tor. The meaning of each
  2119. signal, and the mapping to Unix signals, is as defined in section 3.7.
  2120. Future versions of Tor MAY generate signals other than those listed here;
  2121. controllers MUST be able to accept them.
  2122. If Tor chose to ignore a signal (such as NEWNYM), this event will not be
  2123. sent. Note that some options (like ReloadTorrcOnSIGHUP) may affect the
  2124. semantics of the signals here.
  2125. Note that the HALT (SIGTERM) and SHUTDOWN (SIGINT) signals do not currently
  2126. generate any event.
  2127. [First added in 0.2.3.1-alpha]
  2128. 4.1.18. Configuration changed
  2129. The syntax is:
  2130. StartReplyLine *(MidReplyLine) EndReplyLine
  2131. StartReplyLine = "650-CONF_CHANGED" CRLF
  2132. MidReplyLine = "650-" KEYWORD ["=" VALUE] CRLF
  2133. EndReplyLine = "650 OK"
  2134. Tor configuration options have changed (such as via a SETCONF or RELOAD
  2135. signal). KEYWORD and VALUE specify the configuration option that was changed.
  2136. Undefined configuration options contain only the KEYWORD.
  2137. 4.1.19. Circuit status changed slightly
  2138. The syntax is:
  2139. "650" SP "CIRC_MINOR" SP CircuitID SP CircEvent [SP Path]
  2140. [SP "BUILD_FLAGS=" BuildFlags] [SP "PURPOSE=" Purpose]
  2141. [SP "HS_STATE=" HSState] [SP "REND_QUERY=" HSAddress]
  2142. [SP "TIME_CREATED=" TimeCreated]
  2143. [SP "OLD_PURPOSE=" Purpose [SP "OLD_HS_STATE=" HSState]] CRLF
  2144. CircEvent =
  2145. "PURPOSE_CHANGED" / ; circuit purpose or HS-related state changed
  2146. "CANNIBALIZED" ; circuit cannibalized
  2147. Clients MUST accept circuit events not listed above.
  2148. The "OLD_PURPOSE" field is provided for both PURPOSE_CHANGED and
  2149. CANNIBALIZED events. The "OLD_HS_STATE" field is provided whenever
  2150. the "OLD_PURPOSE" field is provided and is a hidden-service-related
  2151. purpose.
  2152. Other fields are as specified in section 4.1.1 above.
  2153. [First added in 0.2.3.11-alpha]
  2154. 4.1.20. Pluggable transport launched
  2155. The syntax is:
  2156. "650" SP "TRANSPORT_LAUNCHED" SP Type SP Name SP TransportAddress SP Port
  2157. Type = "server" | "client"
  2158. Name = The name of the pluggable transport
  2159. TransportAddress = An IPv4 or IPv6 address on which the pluggable
  2160. transport is listening for connections
  2161. Port = The TCP port on which it is listening for connections.
  2162. A pluggable transport called 'Name' of type 'Type' was launched
  2163. successfully and is now listening for connections on 'Address':'Port'.
  2164. 4.1.21. Bandwidth used on an OR or DIR or EXIT connection
  2165. The syntax is:
  2166. "650" SP "CONN_BW" SP "ID=" ConnID SP "TYPE=" ConnType
  2167. SP "READ=" BytesRead SP "WRITTEN=" BytesWritten CRLF
  2168. ConnType = "OR" / ; Carrying traffic within the tor network. This can
  2169. either be our own (client) traffic or traffic we're
  2170. relaying within the network.
  2171. "DIR" / ; Fetching tor descriptor data, or transmitting
  2172. descriptors we're mirroring.
  2173. "EXIT" ; Carrying traffic between the tor network and an
  2174. external destination.
  2175. BytesRead = 1*DIGIT
  2176. BytesWritten = 1*DIGIT
  2177. Controllers MUST tolerate unrecognized connection types.
  2178. BytesWritten and BytesRead are the number of bytes written and read
  2179. by Tor since the last CONN_BW event on this connection.
  2180. These events are generated about once per second per connection; no
  2181. events are generated for connections that have not read or written.
  2182. These events are only generated if TestingTorNetwork is set.
  2183. [First added in 0.2.5.2-alpha]
  2184. 4.1.22. Bandwidth used by all streams attached to a circuit
  2185. The syntax is:
  2186. "650" SP "CIRC_BW" SP "ID=" CircuitID SP "READ=" BytesRead SP
  2187. "WRITTEN=" BytesWritten CRLF
  2188. BytesRead = 1*DIGIT
  2189. BytesWritten = 1*DIGIT
  2190. BytesRead and BytesWritten are the number of bytes read and written by
  2191. all applications with streams attached to this circuit since the last
  2192. CIRC_BW event.
  2193. These events are generated about once per second per circuit; no events
  2194. are generated for circuits that had no attached stream writing or
  2195. reading.
  2196. [First added in 0.2.5.2-alpha]
  2197. 4.1.23. Per-circuit cell stats
  2198. The syntax is:
  2199. "650" SP "CELL_STATS"
  2200. [ SP "ID=" CircuitID ]
  2201. [ SP "InboundQueue=" QueueID SP "InboundConn=" ConnID ]
  2202. [ SP "InboundAdded=" CellsByType ]
  2203. [ SP "InboundRemoved=" CellsByType SP
  2204. "InboundTime=" MsecByType ]
  2205. [ SP "OutboundQueue=" QueueID SP "OutboundConn=" ConnID ]
  2206. [ SP "OutboundAdded=" CellsByType ]
  2207. [ SP "OutboundRemoved=" CellsByType SP
  2208. "OutboundTime=" MsecByType ] CRLF
  2209. CellsByType, MsecByType = CellType ":" 1*DIGIT
  2210. 0*( "," CellType ":" 1*DIGIT )
  2211. CellType = 1*( "a" - "z" / "0" - "9" / "_" )
  2212. Examples are:
  2213. 650 CELL_STATS ID=14 OutboundQueue=19403 OutboundConn=15
  2214. OutboundAdded=create_fast:1,relay_early:2
  2215. OutboundRemoved=create_fast:1,relay_early:2
  2216. OutboundTime=create_fast:0,relay_early:0
  2217. 650 CELL_STATS InboundQueue=19403 InboundConn=32
  2218. InboundAdded=relay:1,created_fast:1
  2219. InboundRemoved=relay:1,created_fast:1
  2220. InboundTime=relay:0,created_fast:0
  2221. OutboundQueue=6710 OutboundConn=18
  2222. OutboundAdded=create:1,relay_early:1
  2223. OutboundRemoved=create:1,relay_early:1
  2224. OutboundTime=create:0,relay_early:0
  2225. ID is the locally unique circuit identifier that is only included if the
  2226. circuit originates at this node.
  2227. Inbound and outbound refer to the direction of cell flow through the
  2228. circuit which is either to origin (inbound) or from origin (outbound).
  2229. InboundQueue and OutboundQueue are identifiers of the inbound and
  2230. outbound circuit queues of this circuit. These identifiers are only
  2231. unique per OR connection. OutboundQueue is chosen by this node and
  2232. matches InboundQueue of the next node in the circuit.
  2233. InboundConn and OutboundConn are locally unique IDs of inbound and
  2234. outbound OR connection. OutboundConn does not necessarily match
  2235. InboundConn of the next node in the circuit.
  2236. InboundQueue and InboundConn are not present if the circuit originates
  2237. at this node. OutboundQueue and OutboundConn are not present if the
  2238. circuit (currently) ends at this node.
  2239. InboundAdded and OutboundAdded are total number of cells by cell type
  2240. added to inbound and outbound queues. Only present if at least one cell
  2241. was added to a queue.
  2242. InboundRemoved and OutboundRemoved are total number of cells by
  2243. cell type processed from inbound and outbound queues. InboundTime and
  2244. OutboundTime are total waiting times in milliseconds of all processed
  2245. cells by cell type. Only present if at least one cell was removed from
  2246. a queue.
  2247. These events are generated about once per second per circuit; no
  2248. events are generated for circuits that have not added or processed any
  2249. cell. These events are only generated if TestingTorNetwork is set.
  2250. [First added in 0.2.5.2-alpha]
  2251. 4.1.24. Token buckets refilled
  2252. The syntax is:
  2253. "650" SP "TB_EMPTY" SP BucketName [ SP "ID=" ConnID ] SP
  2254. "READ=" ReadBucketEmpty SP "WRITTEN=" WriteBucketEmpty SP
  2255. "LAST=" LastRefill CRLF
  2256. BucketName = "GLOBAL" / "RELAY" / "ORCONN"
  2257. ReadBucketEmpty = 1*DIGIT
  2258. WriteBucketEmpty = 1*DIGIT
  2259. LastRefill = 1*DIGIT
  2260. Examples are:
  2261. 650 TB_EMPTY ORCONN ID=16 READ=0 WRITTEN=0 LAST=100
  2262. 650 TB_EMPTY GLOBAL READ=93 WRITTEN=93 LAST=100
  2263. 650 TB_EMPTY RELAY READ=93 WRITTEN=93 LAST=100
  2264. This event is generated when refilling a previously empty token
  2265. bucket. BucketNames "GLOBAL" and "RELAY" keywords are used for the
  2266. global or relay token buckets, BucketName "ORCONN" is used for the
  2267. token buckets of an OR connection. Controllers MUST tolerate
  2268. unrecognized bucket names.
  2269. ConnID is only included if the BucketName is "ORCONN".
  2270. If both global and relay buckets and/or the buckets of one or more OR
  2271. connections run out of tokens at the same time, multiple separate
  2272. events are generated.
  2273. ReadBucketEmpty (WriteBucketEmpty) is the time in millis that the read
  2274. (write) bucket was empty since the last refill. LastRefill is the
  2275. time in millis since the last refill.
  2276. If a bucket went negative and if refilling tokens didn't make it go
  2277. positive again, there will be multiple consecutive TB_EMPTY events for
  2278. each refill interval during which the bucket contained zero tokens or
  2279. less. In such a case, ReadBucketEmpty or WriteBucketEmpty are capped
  2280. at LastRefill in order not to report empty times more than once.
  2281. These events are only generated if TestingTorNetwork is set.
  2282. [First added in 0.2.5.2-alpha]
  2283. 4.1.25. HiddenService descriptors
  2284. The syntax is:
  2285. "650" SP "HS_DESC" SP Action SP HSAddress SP AuthType SP HsDir
  2286. [SP DescriptorID] [SP "REASON=" Reason] [SP "REPLICA=" Replica]
  2287. Action = "REQUESTED" / "UPLOAD" / "RECEIVED" / "UPLOADED" / "IGNORE" /
  2288. "FAILED" / "CREATED"
  2289. HSAddress = 16*Base32Character / "UNKNOWN"
  2290. AuthType = "NO_AUTH" / "BASIC_AUTH" / "STEALTH_AUTH" / "UNKNOWN"
  2291. HsDir = LongName / Fingerprint / "UNKNOWN"
  2292. DescriptorID = 32*Base32Character
  2293. Reason = "BAD_DESC" / "QUERY_REJECTED" / "UPLOAD_REJECTED" / "NOT_FOUND" /
  2294. "UNEXPECTED" / "QUERY_NO_HSDIR"
  2295. Replica = 1*DIGIT
  2296. These events will be triggered when required HiddenService descriptor is
  2297. not found in the cache and a fetch or upload with the network is performed.
  2298. If the fetch was triggered with only a DescriptorID (using the HSFETCH
  2299. command for instance), the HSAddress only appears in the Action=RECEIVED
  2300. since there is no way to know the HSAddress from the DescriptorID thus
  2301. the value will be "UNKNOWN".
  2302. If we already had the v0 descriptor, the newly fetched v2 descriptor
  2303. will be ignored and a "HS_DESC" event with "IGNORE" action will be
  2304. generated.
  2305. For HsDir, LongName is always prefered. If HsDir cannot be found in node
  2306. list at the time event is sent, Fingerprint will be used instead.
  2307. If Action is "FAILED", Tor SHOULD send Reason field as well. Possible
  2308. values of Reason are:
  2309. - "BAD_DESC" - descriptor was retrieved, but found to be unparsable.
  2310. - "QUERY_REJECTED" - query was rejected by HS directory.
  2311. - "UPLOAD_REJECTED" - descriptor was rejected by HS directory.
  2312. - "NOT_FOUND" - HS descriptor with given identifier was not found.
  2313. - "UNEXPECTED" - nature of failure is unknown.
  2314. - "QUERY_NO_HSDIR" - No suitable HSDir were found for the query.
  2315. For "QUERY_NO_HSDIR", the HsDir will be set to "UNKNOWN" which was
  2316. introduced in tor 0.3.1.0-alpha.
  2317. If Action is "CREATED", Tor SHOULD send Replica field as well. The Replica
  2318. field contains the replica number of the generated descriptor. The Replica
  2319. number is specified in rend-spec.txt section 1.3 and determines the
  2320. descriptor ID of the descriptor.
  2321. 4.1.26. HiddenService descriptors content
  2322. The syntax is:
  2323. "650" "+" "HS_DESC_CONTENT" SP HSAddress SP DescId SP HsDir CRLF
  2324. Descriptor CRLF "." CRLF "650" SP "OK" CRLF
  2325. HSAddress = 16*Base32Character / "UNKNOWN"
  2326. DescId = 32*Base32Character
  2327. HsDir = LongName / "UNKNOWN"
  2328. Descriptor = The text of the descriptor formatted as specified in
  2329. rend-spec.txt section 1.3 or empty string on failure.
  2330. This event is triggered when a successfully fetched HS descriptor is
  2331. received. The text of that descriptor is then replied. If the HS_DESC
  2332. event is enabled, it is replied just after the RECEIVED action.
  2333. If a fetch fails, the Descriptor is an empty string and HSAddress is set
  2334. to "UNKNOWN". The HS_DESC event should be used to get more information on
  2335. the failed request.
  2336. If the fetch fails for the QUERY_NO_HSDIR reason from the HS_DESC event, the
  2337. HsDir is set to "UNKNOWN". This was introduced in 0.3.1.0-alpha.
  2338. It's expected to receive a reply relatively fast as in it's the time it
  2339. takes to fetch something over the Tor network. This can be between a
  2340. couple of seconds up to 60 seconds (not a hard limit). But, in any cases,
  2341. this event will reply either the descriptor's content or an empty one.
  2342. [HS_DESC_CONTENT was added in Tor 0.2.7.1-alpha]
  2343. 4.1.27. Network liveness has changed
  2344. Syntax:
  2345. "650" SP "NETWORK_LIVENESS" SP Status CRLF
  2346. Status = "UP" / ; The network now seems to be reachable.
  2347. "DOWN" / ; The network now seems to be unreachable.
  2348. Controllers MUST tolerate unrecognized status types.
  2349. [NETWORK_LIVENESS was added in Tor 0.2.7.2-alpha]
  2350. 5. Implementation notes
  2351. 5.1. Authentication
  2352. If the control port is open and no authentication operation is enabled, Tor
  2353. trusts any local user that connects to the control port. This is generally
  2354. a poor idea.
  2355. If the 'CookieAuthentication' option is true, Tor writes a "magic
  2356. cookie" file named "control_auth_cookie" into its data directory (or
  2357. to another file specified in the 'CookieAuthFile' option). To
  2358. authenticate, the controller must demonstrate that it can read the
  2359. contents of the cookie file:
  2360. * Current versions of Tor support cookie authentication
  2361. using the "COOKIE" authentication method: the controller sends the
  2362. contents of the cookie file, encoded in hexadecimal. This
  2363. authentication method exposes the user running a controller to an
  2364. unintended information disclosure attack whenever the controller
  2365. has greater filesystem read access than the process that it has
  2366. connected to. (Note that a controller may connect to a process
  2367. other than Tor.) It is almost never safe to use, even if the
  2368. controller's user has explicitly specified which filename to read
  2369. an authentication cookie from. For this reason, the COOKIE
  2370. authentication method has been deprecated and will be removed from
  2371. Tor before some future version of Tor.
  2372. * 0.2.2.x versions of Tor starting with 0.2.2.36, and all versions of
  2373. Tor after 0.2.3.12-alpha, support cookie authentication using the
  2374. "SAFECOOKIE" authentication method, which discloses much less
  2375. information about the contents of the cookie file.
  2376. If the 'HashedControlPassword' option is set, it must contain the salted
  2377. hash of a secret password. The salted hash is computed according to the
  2378. S2K algorithm in RFC 2440 (OpenPGP), and prefixed with the s2k specifier.
  2379. This is then encoded in hexadecimal, prefixed by the indicator sequence
  2380. "16:". Thus, for example, the password 'foo' could encode to:
  2381. 16:660537E3E1CD49996044A3BF558097A981F539FEA2F9DA662B4626C1C2
  2382. ++++++++++++++++**^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2383. salt hashed value
  2384. indicator
  2385. You can generate the salt of a password by calling
  2386. 'tor --hash-password <password>'
  2387. or by using the example code in the Python and Java controller libraries.
  2388. To authenticate under this scheme, the controller sends Tor the original
  2389. secret that was used to generate the password, either as a quoted string
  2390. or encoded in hexadecimal.
  2391. 5.2. Don't let the buffer get too big.
  2392. If you ask for lots of events, and 16MB of them queue up on the buffer,
  2393. the Tor process will close the socket.
  2394. 5.3. Backward compatibility with v0 control protocol.
  2395. The 'version 0' control protocol was replaced in Tor 0.1.1.x. Support
  2396. was removed in Tor 0.2.0.x. Every non-obsolete version of Tor now
  2397. supports the version 1 control protocol.
  2398. For backward compatibility with the "version 0" control protocol,
  2399. Tor used to check whether the third octet of the first command is zero.
  2400. (If it was, Tor assumed that version 0 is in use.)
  2401. This compatibility was removed in Tor 0.1.2.16 and 0.2.0.4-alpha.
  2402. 5.4. Tor config options for use by controllers
  2403. Tor provides a few special configuration options for use by controllers.
  2404. These options can be set and examined by the SETCONF and GETCONF commands,
  2405. but are not saved to disk by SAVECONF.
  2406. Generally, these options make Tor unusable by disabling a portion of Tor's
  2407. normal operations. Unless a controller provides replacement functionality
  2408. to fill this gap, Tor will not correctly handle user requests.
  2409. __AllDirActionsPrivate
  2410. If true, Tor will try to launch all directory operations through
  2411. anonymous connections. (Ordinarily, Tor only tries to anonymize
  2412. requests related to hidden services.) This option will slow down
  2413. directory access, and may stop Tor from working entirely if it does not
  2414. yet have enough directory information to build circuits.
  2415. (Boolean. Default: "0".)
  2416. __DisablePredictedCircuits
  2417. If true, Tor will not launch preemptive "general-purpose" circuits for
  2418. streams to attach to. (It will still launch circuits for testing and
  2419. for hidden services.)
  2420. (Boolean. Default: "0".)
  2421. __LeaveStreamsUnattached
  2422. If true, Tor will not automatically attach new streams to circuits;
  2423. instead, the controller must attach them with ATTACHSTREAM. If the
  2424. controller does not attach the streams, their data will never be routed.
  2425. (Boolean. Default: "0".)
  2426. __HashedControlSessionPassword
  2427. As HashedControlPassword, but is not saved to the torrc file by
  2428. SAVECONF. Added in Tor 0.2.0.20-rc.
  2429. __ReloadTorrcOnSIGHUP
  2430. If this option is true (the default), we reload the torrc from disk
  2431. every time we get a SIGHUP (from the controller or via a signal).
  2432. Otherwise, we don't. This option exists so that controllers can keep
  2433. their options from getting overwritten when a user sends Tor a HUP for
  2434. some other reason (for example, to rotate the logs).
  2435. (Boolean. Default: "1")
  2436. __OwningControllerProcess
  2437. If this option is set to a process ID, Tor will periodically check
  2438. whether a process with the specified PID exists, and exit if one
  2439. does not. Added in Tor 0.2.2.28-beta. This option's intended use
  2440. is documented in section 3.23 with the related TAKEOWNERSHIP
  2441. command.
  2442. Note that this option can only specify a single process ID, unlike
  2443. the TAKEOWNERSHIP command which can be sent along multiple control
  2444. connections.
  2445. (String. Default: unset.)
  2446. 5.5. Phases from the Bootstrap status event.
  2447. This section describes the various bootstrap phases currently reported
  2448. by Tor. Controllers should not assume that the percentages and tags
  2449. listed here will continue to match up, or even that the tags will stay
  2450. in the same order. Some phases might also be skipped (not reported)
  2451. if the associated bootstrap step is already complete, or if the phase
  2452. no longer is necessary. Only "starting" and "done" are guaranteed to
  2453. exist in all future versions.
  2454. Current Tor versions enter these phases in order, monotonically.
  2455. Future Tors MAY revisit earlier stages.
  2456. [XXXX: do we revisit earlier stages if the network fails?]
  2457. [Newer versions of Tor (0.2.6.2-alpha and later):
  2458. If the consensus contains Exits (the typical case), Tor will build both
  2459. exit and internal circuits. When bootstrap completes, Tor will be ready
  2460. to handle an application requesting an exit circuit to services like the
  2461. World Wide Web.
  2462. If the consensus does not contain Exits, Tor will only build internal
  2463. circuits. In this case, earlier statuses will have included "internal"
  2464. as indicated above. When bootstrap completes, Tor will be ready to handle
  2465. an application requesting an internal circuit to hidden services at
  2466. ".onion" addresses.
  2467. If a future consensus contains Exits, exit circuits may become available.]
  2468. Phase 0:
  2469. tag=starting summary="Starting"
  2470. Tor starts out in this phase.
  2471. Phase 5:
  2472. tag=conn_dir summary="Connecting to directory server"
  2473. Tor sends this event as soon as Tor has chosen a directory server --
  2474. e.g. one of the authorities if bootstrapping for the first time or
  2475. after a long downtime, or one of the relays listed in its cached
  2476. directory information otherwise.
  2477. Tor will stay at this phase until it has successfully established
  2478. a TCP connection with some directory server. Problems in this phase
  2479. generally happen because Tor doesn't have a network connection, or
  2480. because the local firewall is dropping SYN packets.
  2481. Phase 10:
  2482. tag=handshake_dir summary="Finishing handshake with directory server"
  2483. This event occurs when Tor establishes a TCP connection with a relay or
  2484. authority used as a directory server (or its https proxy if it's using
  2485. one). Tor remains in this phase until the TLS handshake with the relay
  2486. or authority is finished.
  2487. Problems in this phase generally happen because Tor's firewall is
  2488. doing more sophisticated MITM attacks on it, or doing packet-level
  2489. keyword recognition of Tor's handshake.
  2490. Phase 15:
  2491. tag=onehop_create summary="Establishing an encrypted directory connection"
  2492. Once TLS is finished with a relay, Tor will send a CREATE_FAST cell
  2493. to establish a one-hop circuit for retrieving directory information.
  2494. It will remain in this phase until it receives the CREATED_FAST cell
  2495. back, indicating that the circuit is ready.
  2496. Phase 20:
  2497. tag=requesting_status summary="Asking for networkstatus consensus"
  2498. Once we've finished our one-hop circuit, we will start a new stream
  2499. for fetching the networkstatus consensus. We'll stay in this phase
  2500. until we get the 'connected' relay cell back, indicating that we've
  2501. established a directory connection.
  2502. Phase 25:
  2503. tag=loading_status summary="Loading networkstatus consensus"
  2504. Once we've established a directory connection, we will start fetching
  2505. the networkstatus consensus document. This could take a while; this
  2506. phase is a good opportunity for using the "progress" keyword to indicate
  2507. partial progress.
  2508. This phase could stall if the directory server we picked doesn't
  2509. have a copy of the networkstatus consensus so we have to ask another,
  2510. or it does give us a copy but we don't find it valid.
  2511. Phase 40:
  2512. tag=loading_keys summary="Loading authority key certs"
  2513. Sometimes when we've finished loading the networkstatus consensus,
  2514. we find that we don't have all the authority key certificates for the
  2515. keys that signed the consensus. At that point we put the consensus we
  2516. fetched on hold and fetch the keys so we can verify the signatures.
  2517. Phase 45
  2518. tag=requesting_descriptors summary="Asking for relay descriptors
  2519. [ for internal paths]"
  2520. Once we have a valid networkstatus consensus and we've checked all
  2521. its signatures, we start asking for relay descriptors. We stay in this
  2522. phase until we have received a 'connected' relay cell in response to
  2523. a request for descriptors.
  2524. [Newer versions of Tor (0.2.6.2-alpha and later):
  2525. If the consensus contains Exits (the typical case), Tor will ask for
  2526. descriptors for both exit and internal paths. If not, Tor will only ask
  2527. for descriptors for internal paths. In this case, this status will
  2528. include "internal" as indicated above.]
  2529. Phase 50:
  2530. tag=loading_descriptors summary="Loading relay descriptors[ for internal
  2531. paths]"
  2532. We will ask for relay descriptors from several different locations,
  2533. so this step will probably make up the bulk of the bootstrapping,
  2534. especially for users with slow connections. We stay in this phase until
  2535. we have descriptors for a significant fraction of the usable relays
  2536. listed in the networkstatus consensus (this can be between 25% and 95%
  2537. depending on Tor's configuration and network consensus parameters).
  2538. This phase is also a good opportunity to use the "progress" keyword to
  2539. indicate partial steps.
  2540. [Newer versions of Tor (0.2.6.2-alpha and later):
  2541. If the consensus contains Exits (the typical case), Tor will download
  2542. descriptors for both exit and internal paths. If not, Tor will only
  2543. download descriptors for internal paths. In this case, this status will
  2544. include "internal" as indicated above.]
  2545. Phase 80:
  2546. tag=conn_or summary="Connecting to the Tor network[ internally]"
  2547. Once we have a valid consensus and enough relay descriptors, we choose
  2548. entry guard(s) and start trying to build some circuits. This step
  2549. is similar to the "conn_dir" phase above; the only difference is
  2550. the context.
  2551. If a Tor starts with enough recent cached directory information,
  2552. its first bootstrap status event will be for the conn_or phase.
  2553. [Newer versions of Tor (0.2.6.2-alpha and later):
  2554. If the consensus contains Exits (the typical case), Tor will build both
  2555. exit and internal circuits. If not, Tor will only build internal circuits.
  2556. In this case, this status will include "internal(ly)" as indicated above.]
  2557. Phase 85:
  2558. tag=handshake_or summary="Finishing handshake with first hop[ of internal
  2559. circuit]"
  2560. This phase is similar to the "handshake_dir" phase, but it gets reached
  2561. if we finish a TCP connection to a Tor relay and we have already reached
  2562. the "conn_or" phase. We'll stay in this phase until we complete a TLS
  2563. handshake with a Tor relay.
  2564. [Newer versions of Tor (0.2.6.2-alpha and later):
  2565. If the consensus contains Exits (the typical case), Tor may be finishing
  2566. a handshake with the first hop if either an exit or internal circuit. In
  2567. this case, it won't specify which type. If the consensus contains no Exits,
  2568. Tor will only build internal circuits. In this case, this status will
  2569. include "internal" as indicated above.]
  2570. Phase 90:
  2571. tag=circuit_create summary="Establishing a[n internal] Tor circuit"
  2572. Once we've finished our TLS handshake with the first hop of a circuit,
  2573. we will set about trying to make some 3-hop circuits in case we need them
  2574. soon.
  2575. [Newer versions of Tor (0.2.6.2-alpha and later):
  2576. If the consensus contains Exits (the typical case), Tor will build both
  2577. exit and internal circuits. If not, Tor will only build internal circuits.
  2578. In this case, this status will include "internal" as indicated above.]
  2579. Phase 100:
  2580. tag=done summary="Done"
  2581. A full 3-hop circuit has been established. Tor is ready to handle
  2582. application connections now.
  2583. [Newer versions of Tor (0.2.6.2-alpha and later):
  2584. If the consensus contains Exits (the typical case), Tor will build both
  2585. exit and internal circuits. At this stage, Tor will be ready to handle
  2586. an application requesting an exit circuit to services like the World
  2587. Wide Web.
  2588. If the consensus does not contain Exits, Tor will only build internal
  2589. circuits. In this case, earlier statuses will have included "internal"
  2590. as indicated above. At this stage, Tor will be ready to handle an
  2591. application requesting an internal circuit to hidden services at ".onion"
  2592. addresses.
  2593. If a future consensus contains Exits, exit circuits may become available.]