control-spec.txt 166 KB

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