dir-spec.txt 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344
  1. $Id$
  2. Tor directory protocol, version 3
  3. 0. Scope and preliminaries
  4. This directory protocol is used by Tor version 0.2.0.x-alpha and later.
  5. See dir-spec-v1.txt for information on the protocol used up to the
  6. 0.1.0.x series, and dir-spec-v2.txt for information on the protocol
  7. used by the 0.1.1.x and 0.1.2.x series.
  8. Caches and authorities must still support older versions of the
  9. directory protocols, until the versions of Tor that require them are
  10. finally out of commission. See Section XXXX on backward compatibility.
  11. This document merges and supersedes the following proposals:
  12. 101 Voting on the Tor Directory System
  13. 103 Splitting identity key from regularly used signing key
  14. 104 Long and Short Router Descriptors
  15. AS OF 3 MAY 2007, THIS SPECIFICATION HAS NOT YET BEEN COMPLETELY
  16. IMPLEMENTED.
  17. 0.1. History
  18. The earliest versions of Onion Routing shipped with a list of known
  19. routers and their keys. When the set of routers changed, users needed to
  20. fetch a new list.
  21. The Version 1 Directory protocol
  22. --------------------------------
  23. [XXX say which versions added what.]
  24. Early versions of Tor introduced "Directory authorities": servers that
  25. served signed "directory" documents containing a list of signed "router
  26. descriptors", along with short summary of the status of each router.
  27. Thus, clients could get up-to-date information on the state of the
  28. network automatically, and be certain that they list they were getting
  29. was attested by a trusted directory authority.
  30. Later versions added directory caches, which download directories from
  31. the authorities and serve them to clients. Non-caches fetch from the
  32. caches in preference to fetching from the authorities, thus distributing
  33. bandwidth requirements.
  34. Also added during the version 1 directory protocol were "router status"
  35. documents: short documents that listed only the up/down status of the
  36. routers on the network, rather than a complete list of all the
  37. descriptors. Clients and caches would fetch these documents far more
  38. frequently than they would fetch full directories.
  39. The Version 2 Directory Protocol
  40. --------------------------------
  41. During the Tor 0.1.1.x series, Tor revised its handling of directory
  42. documents in order to address two major problems:
  43. * Directories had grown quite large (over 1MB), and most directory
  44. downloads consisted mainly of router descriptors that clients
  45. already had.
  46. * Every directory authorities was a trust bottleneck: if a single
  47. directory authority lied, it could make clients believe for a time
  48. an arbitrarily distorted view of the Tor network. (Clients
  49. trusted the most recent signed document they downloaded.) Thus,
  50. adding more authorities would make the system less secure, not
  51. more.
  52. To address these, we extended the directory protocol so that
  53. authorities now published signed "network status" documents. Each
  54. network status listed, for every router in the network: a hash of its
  55. identity key, a hash of its most recent descriptor, and a summary of
  56. what the authority believed about its status. Clients would download
  57. the authorities' network status documents in turn, and believe
  58. statements about routers iff they were attested to by more than half of
  59. the authorities.
  60. Instead of downloading all router descriptors at once, clients
  61. downloaded only the descriptors that they did not have. Descriptors
  62. were indexed by their digests, in order to prevent malicious caches
  63. from giving different versions of a router descriptor to different
  64. clients.
  65. Routers began working harder to upload new descriptors only when their
  66. contents were substantially changed.
  67. 0.2. Goals of the version 3 protocol
  68. Version 3 of the Tor directory protocol tries to solve the following
  69. issues:
  70. * A great deal of bandwidth used to transmit router descriptors was
  71. used by two fields that are not actually used by Tor routers. We
  72. save about 60% by moving them into a separate document that most
  73. clients do not fetch or use.
  74. * It was possible under certain perverse circumstances for clients
  75. to download an unusual set of network status documents, thus
  76. partitioning themselves from clients who have a more recent and/or
  77. typical set of documents. Even under the best of circumstances,
  78. clients were sensitive to the ages of the network status documents
  79. they downloaded. Therefore, instead of having the clients
  80. correlate multiple network status documents, we have the
  81. authorities collectively vote on a single consensus network status
  82. document.
  83. * The most sensitive data in the entire network (the identity keys
  84. of the directory authorities) needed to be stored unencrypted so
  85. that the authorities can sign network-status documents on the fly.
  86. Now, the authorities' identity keys are stored offline, and used
  87. to certify medium-term signing keys that can be rotated.
  88. 0.3. Some Remaining questions
  89. Things we could solve on a v3 timeframe:
  90. The SHA-1 hash is showing its age. We should do something about our
  91. dependency on it. We could probably future-proof ourselves here in
  92. this revision, at least so far as documents from the authorities are
  93. concerned.
  94. Too many things about the authorities are hardcoded by IP.
  95. Perhaps we should start accepting longer identity keys for routers
  96. too.
  97. Things to solve eventually:
  98. Requiring every client to know about every router won't scale forever.
  99. Requiring every directory cache to know every router won't scale
  100. forever.
  101. 1. Outline
  102. There is a small set (say, around 5-10) of semi-trusted directory
  103. authorities. A default list of authorities is shipped with the Tor
  104. software. Users can change this list, but are encouraged not to do so,
  105. in order to avoid partitioning attacks.
  106. Every authority has a very-secret, long-term "Authority Identity Key".
  107. This is stored encrypted and/or offline, and is used to sign "key
  108. certificate" documents. Every key certificate contains a medium-term
  109. (3-12 months) "authority signing key", that is used by the authority to
  110. sign other directory information. (Note that the authority identity
  111. key is distinct from the router identity key that the authority uses
  112. in its role as an ordinary router.)
  113. Routers periodically upload signed "routers descriptors" to the
  114. directory authorities describing their keys, capabilities, and other
  115. information. Routers may also upload signed "extra info documents"
  116. containing information that is not required for the Tor protocol.
  117. Directory authorities serve router descriptors indexed by router
  118. identity, or by hash of the descriptor.
  119. Routers may act as directory caches to reduce load on the directory
  120. authorities. They announce this in their descriptors.
  121. Periodically, each directory authority periodically generates a view of
  122. the current descriptors and status for known routers. They send a
  123. signed summary of this view (a "status vote") to the other
  124. authorities. The authorities compute the result of this vote, and sign
  125. a "consensus status" document containing the result of the vote.
  126. Directory caches download, cache, and re-serve consensus documents.
  127. Clients, directory caches, and directory authorities all use consensus
  128. documents to find out when their list of routers is out-of-date.
  129. (Directory authorities also use vote statuses.) If it is, they download
  130. any missing router descriptors. Clients download missing descriptors
  131. from mirrors; mirrors and authorities download from authorities.
  132. Descriptors are downloaded by the hash of the descriptor, not by the
  133. server's identity key: this prevents servers from attacking clients by
  134. giving them descriptors nobody else uses.
  135. All directory information is uploaded and downloaded with HTTP.
  136. [Authorities also generate and caches also cache documents produced and
  137. used by earlier versions of this protocol; see section XXX for notes.]
  138. 1.1. What's different from version 2?
  139. Clients used to download a multiple network status documents,
  140. corresponding roughly to "status votes" above. They would compute the
  141. result of the vote on the client side.
  142. Authorities used sign documents using the same private keys they used
  143. for their roles as routers. This forced them to keep these extremely
  144. sensitive keys in memory unencrypted.
  145. All of the information in extra-info documents used to be kept in the
  146. main descriptors.
  147. 1.2. Document meta-format
  148. Router descriptors, directories, and running-routers documents all obey the
  149. following lightweight extensible information format.
  150. The highest level object is a Document, which consists of one or more
  151. Items. Every Item begins with a KeywordLine, followed by one or more
  152. Objects. A KeywordLine begins with a Keyword, optionally followed by
  153. whitespace and more non-newline characters, and ends with a newline. A
  154. Keyword is a sequence of one or more characters in the set [A-Za-z0-9-].
  155. An Object is a block of encoded data in pseudo-Open-PGP-style
  156. armor. (cf. RFC 2440)
  157. More formally:
  158. Document ::= (Item | NL)+
  159. Item ::= KeywordLine Object*
  160. KeywordLine ::= Keyword NL | Keyword WS ArgumentsChar+ NL
  161. Keyword = KeywordChar+
  162. KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'
  163. ArgumentChar ::= any printing ASCII character except NL.
  164. WS = (SP | TAB)+
  165. Object ::= BeginLine Base-64-encoded-data EndLine
  166. BeginLine ::= "-----BEGIN " Keyword "-----" NL
  167. EndLine ::= "-----END " Keyword "-----" NL
  168. The BeginLine and EndLine of an Object must use the same keyword.
  169. When interpreting a Document, software MUST ignore any KeywordLine that
  170. starts with a keyword it doesn't recognize; future implementations MUST NOT
  171. require current clients to understand any KeywordLine not currently
  172. described.
  173. The "opt" keyword was used until Tor 0.1.2.5-alpha for non-critical future
  174. extensions. All implementations MUST ignore any item of the form "opt
  175. keyword ....." when they would not recognize "keyword ....."; and MUST
  176. treat "opt keyword ....." as synonymous with "keyword ......" when keyword
  177. is recognized.
  178. Implementations before 0.1.2.5-alpha rejected any document with a
  179. KeywordLine that started with a keyword that they didn't recognize.
  180. When generating documents that need to be read by older versions of Tor,
  181. implementations MUST prefix items not recognized by older versions of
  182. Tor with an "opt" until those versions of Tor are obsolete. [Note that
  183. key certificates, status vote documents, extra info documents, and
  184. status consensus documents will never by read by older versions of Tor.]
  185. Other implementations that want to extend Tor's directory format MAY
  186. introduce their own items. The keywords for extension items SHOULD start
  187. with the characters "x-" or "X-", to guarantee that they will not conflict
  188. with keywords used by future versions of Tor.
  189. In our document descriptions below, we tag Items with a multiplicity in
  190. brackets. Possible tags are:
  191. "At start, exactly once": These items MUST occur in every instance of
  192. the document type, and MUST appear exactly once, and MUST be the
  193. first item in their documents.
  194. "Exactly once": These items MUST occur exactly one time in every
  195. instance of the document type.
  196. "At end, exactly once": These items MUST occur in every instance of
  197. the document type, and MUST appear exactly once, and MUST be the
  198. last item in their documents.
  199. "At most once": These items MAY occur zero or one times in any
  200. instance of the document type, but MUST NOT occur more than once.
  201. "Any number": These items MAY occur zero, one, or more times in any
  202. instance of the document type.
  203. "Once or more": These items MUST occur at least once in any instance
  204. of the document type, and MAY occur more.
  205. 1.3. Signing documents
  206. Every signable document below is signed in a similar manner, using a
  207. given "Initial Item", a final "Signature Item", a digest algorithm, and
  208. a signing key.
  209. The Initial Item must be the first item in the document.
  210. The Signature Item has the following format:
  211. <signature item keyword> [arguments] NL SIGNATURE NL
  212. The "SIGNATURE" Object contains a signature (using the signing key) of
  213. the PKCS1-padded digest of the entire document, taken from the
  214. beginning of the Initial item, through the newline after the Signature
  215. Item's keyword and its arguments.
  216. Unless otherwise, the digest algorithm is SHA-1.
  217. All documents are invalid unless signed with the correct signing key.
  218. The "Digest" of a document, unless stated otherwise, is its digest *as
  219. signed by this signature scheme*.
  220. 2. Router operation and formats
  221. ORs SHOULD generate a new router descriptor and a new extra-info
  222. document whenever any of the following events have occurred:
  223. - A period of time (18 hrs by default) has passed since the last
  224. time a descriptor was generated.
  225. - A descriptor field other than bandwidth or uptime has changed.
  226. - Bandwidth has changed by more than +/- 50% from the last time a
  227. descriptor was generated, and at least a given interval of time
  228. (20 mins by default) has passed since then.
  229. - Its uptime has been reset (by restarting).
  230. After generating a descriptor, ORs upload them to every directory
  231. authority they know, by posting them (in order) to the URL
  232. http://<hostname:port>/tor/
  233. 2.1. Router descriptor format
  234. Router descriptors consist of the following items. For backward
  235. compatibility, there should be an extra NL at the end of each router
  236. descriptor.
  237. In lines that take multiple arguments, extra arguments SHOULD be
  238. accepted and ignored.
  239. "router" nickname address ORPort SOCKSPort DirPort NL
  240. [At start, exactly once.]
  241. Indicates the beginning of a router descriptor. "address" must be an
  242. IPv4 address in dotted-quad format. The last three numbers indicate
  243. the TCP ports at which this OR exposes functionality. ORPort is a port
  244. at which this OR accepts TLS connections for the main OR protocol;
  245. SOCKSPort is deprecated and should always be 0; and DirPort is the
  246. port at which this OR accepts directory-related HTTP connections. If
  247. any port is not supported, the value 0 is given instead of a port
  248. number.
  249. "bandwidth" bandwidth-avg bandwidth-burst bandwidth-observed NL
  250. [Exactly once]
  251. Estimated bandwidth for this router, in bytes per second. The
  252. "average" bandwidth is the volume per second that the OR is willing to
  253. sustain over long periods; the "burst" bandwidth is the volume that
  254. the OR is willing to sustain in very short intervals. The "observed"
  255. value is an estimate of the capacity this server can handle. The
  256. server remembers the max bandwidth sustained output over any ten
  257. second period in the past day, and another sustained input. The
  258. "observed" value is the lesser of these two numbers.
  259. "platform" string NL
  260. [At most once]
  261. A human-readable string describing the system on which this OR is
  262. running. This MAY include the operating system, and SHOULD include
  263. the name and version of the software implementing the Tor protocol.
  264. "published" YYYY-MM-DD HH:MM:SS NL
  265. [Exactly once]
  266. The time, in GMT, when this descriptor (and its corresponding
  267. extra-info document if any) was generated.
  268. "fingerprint" fingerprint NL
  269. [At most once]
  270. A fingerprint (a HASH_LEN-byte of asn1 encoded public key, encoded in
  271. hex, with a single space after every 4 characters) for this router's
  272. identity key. A descriptor is considered invalid (and MUST be
  273. rejected) if the fingerprint line does not match the public key.
  274. [We didn't start parsing this line until Tor 0.1.0.6-rc; it should
  275. be marked with "opt" until earlier versions of Tor are obsolete.]
  276. "hibernating" bool NL
  277. [At most once]
  278. If the value is 1, then the Tor server was hibernating when the
  279. descriptor was published, and shouldn't be used to build circuits.
  280. [We didn't start parsing this line until Tor 0.1.0.6-rc; it should be
  281. marked with "opt" until earlier versions of Tor are obsolete.]
  282. "uptime" number NL
  283. [At most once]
  284. The number of seconds that this OR process has been running.
  285. "onion-key" NL a public key in PEM format
  286. [Exactly once]
  287. This key is used to encrypt EXTEND cells for this OR. The key MUST be
  288. accepted for at least 1 week after any new key is published in a
  289. subsequent descriptor. It MUST be 1024 bits.
  290. "signing-key" NL a public key in PEM format
  291. [Exactly once]
  292. The OR's long-term identity key. It MUST be 1024 bits.
  293. "accept" exitpattern NL
  294. "reject" exitpattern NL
  295. [Any number]
  296. These lines describe the rules that an OR follows when
  297. deciding whether to allow a new stream to a given address. The
  298. 'exitpattern' syntax is described below. The rules are considered in
  299. order; if no rule matches, the address will be accepted. For clarity,
  300. the last such entry SHOULD be accept *:* or reject *:*.
  301. "router-signature" NL Signature NL
  302. [At end, exactly once]
  303. The "SIGNATURE" object contains a signature of the PKCS1-padded
  304. hash of the entire router descriptor, taken from the beginning of the
  305. "router" line, through the newline after the "router-signature" line.
  306. The router descriptor is invalid unless the signature is performed
  307. with the router's identity key.
  308. "contact" info NL
  309. [At most once]
  310. Describes a way to contact the server's administrator, preferably
  311. including an email address and a PGP key fingerprint.
  312. "family" names NL
  313. [At most once]
  314. 'Names' is a space-separated list of server nicknames or
  315. hexdigests. If two ORs list one another in their "family" entries,
  316. then OPs should treat them as a single OR for the purpose of path
  317. selection.
  318. For example, if node A's descriptor contains "family B", and node B's
  319. descriptor contains "family A", then node A and node B should never
  320. be used on the same circuit.
  321. "read-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  322. [At most once]
  323. "write-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  324. [At most once]
  325. Declare how much bandwidth the OR has used recently. Usage is divided
  326. into intervals of NSEC seconds. The YYYY-MM-DD HH:MM:SS field
  327. defines the end of the most recent interval. The numbers are the
  328. number of bytes used in the most recent intervals, ordered from
  329. oldest to newest.
  330. [We didn't start parsing these lines until Tor 0.1.0.6-rc; they should
  331. be marked with "opt" until earlier versions of Tor are obsolete.]
  332. [See also migration notes in section 2.2.1.]
  333. "eventdns" bool NL
  334. [At most once]
  335. Declare whether this version of Tor is using the newer enhanced
  336. dns logic. Versions of Tor without eventdns SHOULD NOT be used for
  337. reverse hostname lookups.
  338. [All versions of Tor before 0.1.2.2-alpha should be assumed to have
  339. this option set to 0 if it is not present. All Tor versions at
  340. 0.1.2.2-alpha or later should be assumed to have this option set to
  341. 1 if it is not present. Until 0.1.2.1-alpha-dev, this option was
  342. not generated, even when eventdns was in use. Versions of Tor
  343. before 0.1.2.1-alpha-dev did not parse this option, so it should be
  344. marked "opt". With some future version, the old 'dnsworker' logic
  345. will be removed, rendering this option of historical interest
  346. only.]
  347. "caches-extra-info" 0|1 NL
  348. [At most once.]
  349. True if this router is a directory cache that provides extra-info
  350. documents. If absent, the value should be treated as false.
  351. [Versions before 0.2.0.1-alpha don't recognize this, and versions
  352. before 0.1.2.5-alpha will reject descriptors containing it unless
  353. it is prefixed with "opt"; it should be so prefixed until these
  354. versions are obsolete.]
  355. "extra-info-digest" digest NL
  356. [At most once]
  357. "Digest" is a hex-encoded digest (using upper-case characters)
  358. of the router's extra-info document, as signed in the router's
  359. extra-info. (If this field is absent, the router is not uploading
  360. a corresponding extra-info document.)
  361. [Versions before 0.2.0.1-alpha don't recognize this, and versions
  362. before 0.1.2.5-alpha will reject descriptors containing it unless
  363. it is prefixed with "opt"; it should be so prefixed until these
  364. versions are obsolete.]
  365. 2.2. Extra-info documents
  366. Extra-info documents consist of the following items:
  367. "extra-info" Nickname Fingerprint NL
  368. [At start, exactly once.]
  369. Identifies what router this is an extra info descriptor for.
  370. Fingerprint is encoded in hex (using upper-case letters), with
  371. no spaces.
  372. "published"
  373. [Exactly once.]
  374. The time, in GMT, when this document (and its corresponding router
  375. descriptor if any) was generated. It MUST match the published time
  376. in the corresponding router descriptor.
  377. "read-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  378. [At most once.]
  379. "write-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  380. [At most once.]
  381. As documented in 2.1 above. See migration notes in section 2.2.1.
  382. "router-signature" NL Signature NL
  383. [At end, exactly once.]
  384. A document signature as documented in section 1.3, using the
  385. initial item "extra-info" and the final item "router-signature",
  386. signed with the router's identity key.
  387. 2.2.1. Moving history fields to extra-info documents.
  388. Tools that want to use the read-history and write-history values SHOULD
  389. download extra-info documents as well as router descriptors. Such
  390. tools SHOULD accept history values from both sources; if they appear in
  391. both documents, the values in the extra-info documents are authoritative.
  392. At some future time, to save space, new versions of Tor will no longer
  393. generate router descriptors containing read-history or write-history.
  394. Tools should continue to accept read-history and write-history values
  395. in router descriptors produced by older versions of Tor.
  396. 2.3. Nonterminals in router descriptors
  397. nickname ::= between 1 and 19 alphanumeric characters, case-insensitive.
  398. hexdigest ::= a '$', followed by 20 hexadecimal characters.
  399. [Represents a server by the digest of its identity key.]
  400. exitpattern ::= addrspec ":" portspec
  401. portspec ::= "*" | port | port "-" port
  402. port ::= an integer between 1 and 65535, inclusive.
  403. [Some implementations incorrectly generate ports with value 0.
  404. Implementations SHOULD accept this, and SHOULD NOT generate it.]
  405. addrspec ::= "*" | ip4spec | ip6spec
  406. ipv4spec ::= ip4 | ip4 "/" num_ip4_bits | ip4 "/" ip4mask
  407. ip4 ::= an IPv4 address in dotted-quad format
  408. ip4mask ::= an IPv4 mask in dotted-quad format
  409. num_ip4_bits ::= an integer between 0 and 32
  410. ip6spec ::= ip6 | ip6 "/" num_ip6_bits
  411. ip6 ::= an IPv6 address, surrounded by square brackets.
  412. num_ip6_bits ::= an integer between 0 and 128
  413. bool ::= "0" | "1"
  414. 3. Formats produced by directory authorities.
  415. Every authority has two keys used in this protocol: a signing key, and
  416. an authority identity key. (Authorities also have a router identity
  417. key used in their role as a router and by earlier versions of the
  418. directory protocol.) The identity key is used from time to time to
  419. sign new key certificates using new signing keys; it is very sensitive.
  420. The signing key is used to sign key certificates and status documents.
  421. There are three kinds of documents generated by directory authorities:
  422. Key certificates
  423. Status votes
  424. Status consensuses
  425. Each is discussed below.
  426. 3.1. Key certificates
  427. Key certificates consist of the following items:
  428. "dir-key-certificate-version" version NL
  429. [At start, exactly once.]
  430. Determines the version of the key certificate. MUST be "3" for
  431. the protocol described in this document. Implementations MUST
  432. reject formats they don't understand.
  433. "fingerprint" fingerprint NL
  434. [Exactly once.]
  435. Hexadecimal encoding without spaces based on the authority's
  436. identity key.
  437. "dir-identity-key" NL a public key in PEM format
  438. [Exactly once.]
  439. The long-term authority identity key for this authority. This key
  440. SHOULD be at least 2048 bits long; it MUST NOT be shorter than
  441. 1024 bits.
  442. "dir-key-published" YYYY-MM-DD HH:MM:SS NL
  443. [Exactly once.]
  444. The time (in GMT) when this document and corresponding key were
  445. last generated.
  446. "dir-key-expires" YYYY-MM-DD HH:MM:SS NL
  447. [Exactly once.]
  448. A time (in GMT) after which this key is no longer valid.
  449. "dir-signing-key" NL a key in PEM format
  450. [Exactly once.]
  451. The directory server's public signing key. This key MUST be at
  452. least 1024 bits, and MAY be longer.
  453. "dir-key-certification" NL Signature NL
  454. [At end, exactly once.]
  455. A document signature as documented in section 1.3, using the
  456. initial item "dir-key-certificate-version" and the final item
  457. "dir-key-certification", signed with the authority identity key.
  458. Authorities MUST generate a new signing key and corresponding
  459. certificate before the key expires.
  460. 3.2. Vote and consensus status documents
  461. Votes and consensuses are more strictly formatted then other documents
  462. in this specification, since different authorities must be able to
  463. generate exactly the same consensus given the same set of votes.
  464. The procedure for deciding when to generate vote and consensus status
  465. documents are described in section XXX below.
  466. Status documents contain a preamble, an authority section, a list of
  467. router status entries, and one more footers signature, in that order.
  468. Unlike other formats described above, a SP in these documents must be a
  469. single space character (hex 20).
  470. Some items appear only in votes, and some items appear only in
  471. consensuses. Unless specified, items occur in both.
  472. The preamble contains the following items. They MUST occur in the
  473. order given here:
  474. "network-status-version" SP version NL.
  475. [At start, exactly once.]
  476. A document format version. For this specification, the version is
  477. "3".
  478. "vote-status" SP type NL
  479. [Exactly once.]
  480. The status MUST be "vote" or "consensus", depending on the type of
  481. the document.
  482. "published" SP YYYY-MM-DD SP HH:MM:SS NL
  483. [Exactly once.]
  484. The publication time for this status document (if a vote), or the
  485. start of the period for this vote (if a consensus).
  486. "valid-until"
  487. [Exactly once.]
  488. A time after which this vote or consensus will no longer be valid.
  489. "client-versions" SP VersionList NL
  490. [At most once.]
  491. A comma-separated list of recommended client versions, in
  492. ascending order. If absent, no opinion is held about client
  493. versions.
  494. "server-versions" SP VersionList NL
  495. [At most once.]
  496. A comma-separated list of recommended server versions, in
  497. ascending order. If absent, no opinion is held about server
  498. versions.
  499. "known-flags" SP FlagList NL
  500. [Exactly once.]
  501. A space-separated list of all of the flags that this document
  502. might contain. A flag is "known" either because the authority
  503. knows about them and might set them (if in a vote), or because
  504. enough votes were counted for the consensus for an authoritative
  505. opinion to have been formed about their status.
  506. The authority section of a vote contains the following items, followed
  507. in turn by the authority's current key certificate:
  508. "dir-source" SP nickname SP identity SP address SP IP SP dirport NL
  509. [Exactly once, at start]
  510. Describes this authority. The nickname is a convenient identifier
  511. for the authority. The identity is a hex fingerprint of the
  512. authority's current identity key. The address is the server's
  513. hostname. The IP is the server's current IP address, and dirport
  514. is its current directory port.
  515. "contact" SP string NL
  516. [At most once.]
  517. An arbitrary string describing how to contact the directory
  518. server's administrator. Administrators should include at least an
  519. email address and a PGP fingerprint.
  520. The authority section of a consensus contains groups the following
  521. items, in the order given, with one group for each authority that
  522. contributed to the consensus:
  523. "dir-source" SP nickname SP address SP IP SP dirport NL
  524. [Exactly once, at start]
  525. As in the authority section of a vote.
  526. "contact" SP string NL
  527. [At most once.]
  528. As in the authority section of a vote.
  529. "fingerprint" SP fingerprint NL
  530. [Exactly once.]
  531. A hex fingerprint, without spaces, of the authority's current
  532. identity key.
  533. "vote-digest" SP digest NL
  534. [Exactly once.]
  535. A digest of the vote from the authority that contributed to this
  536. consensus.
  537. Each router status entry contains the following items. Router status
  538. entries are sorted in ascending order by identity digest.
  539. "r" SP nickname SP identity SP digest SP publication SP IP SP ORPort
  540. SP DirPort NL
  541. [At start, exactly once.]
  542. "Nickname" is the OR's nickname. "Identity" is a hash of its
  543. identity key, encoded in base64, with trailing equals sign(s)
  544. removed. "Digest" is a hash of its most recent descriptor (as
  545. signed), encoded in base64 as "identity". "Publication" is the
  546. publication time of its most recent descriptor, in the form
  547. YYYY-MM-DD HH:MM:SS, in GMT. "IP" is its current IP address;
  548. ORPort is its current OR port, "DirPort" is it's current directory
  549. port, or "0" for "none".
  550. "s" SP Flags NL
  551. [At most once.]
  552. A series of space-separated status flags, in alphabetical order.
  553. Currently documented flags are:
  554. "Authority" if the router is a directory authority.
  555. "BadExit" if the router is believed to be useless as an exit node
  556. (because its ISP censors it, because it is behind a restrictive
  557. proxy, or for some similar reason).
  558. "BadDirectory" if the router is believed to be useless as a
  559. directory cache (because its directory port isn't working,
  560. its bandwidth is always throttled, or for some similar
  561. reason).
  562. "Exit" if the router is useful for building general-purpose exit
  563. circuits.
  564. "Fast" if the router is suitable for high-bandwidth circuits.
  565. "Guard" if the router is suitable for use as an entry guard.
  566. "Named" if the router's identity-nickname mapping is canonical,
  567. and this authority binds names.
  568. "Stable" if the router is suitable for long-lived circuits.
  569. "Running" if the router is currently usable.
  570. "Valid" if the router has been 'validated'.
  571. "V2Dir" if the router implements this protocol.
  572. "v" SP version NL
  573. [At most once.]
  574. The version of the Tor protocol that this server is running. If
  575. the value begins with "Tor" SP, the rest of the string is a Tor
  576. version number, and the protocol is "The Tor protocol as supported
  577. by the given version of Tor." Otherwise, if the value begins with
  578. some other string, Tor has upgraded to a more sophisticated
  579. protocol versioning system, and the protocol is "a version of the
  580. Tor protocol more recent than any we recognize."
  581. The signature section contains the following item, which appears
  582. Exactly Once for a vote, and At Least Once for a consensus.
  583. "directory-signature" SP identity SP digest NL Signature
  584. This is a signature of the status document, with the initial item
  585. "network-status-version", and the signature item
  586. "directory-signature", using the signing key. (In this case, we
  587. take the hash through the _space_ after directory-signature, not
  588. the newline: this ensures that all authorities sign the same
  589. thing.) "identity" is the hex-encoded digest of the authority
  590. identity key of the signing authority, and "digest" is the
  591. hex-encoded digest of the current authority signing key of the
  592. signing authority.
  593. 3.3. Deciding how to vote.
  594. (This section describes how directory authorities choose which status
  595. flags to apply to routers, as of Tor 0.2.0.0-alpha-dev. Later directory
  596. authorities MAY do things differently, so long as clients keep working
  597. well. Clients MUST NOT depend on the exact behaviors in this section.)
  598. In the below definitions, a router is considered "active" if it is
  599. running, valid, and not hibernating.
  600. "Valid" -- a router is 'Valid' if it is running a version of Tor not
  601. known to be broken, and the directory authority has not blacklisted
  602. it as suspicious.
  603. "Named" -- Directory authority administrators may decide to support name
  604. binding. If they do, then they must maintain a file of
  605. nickname-to-identity-key mappings, and try to keep this file consistent
  606. with other directory authorities. If they don't, they act as clients, and
  607. report bindings made by other directory authorities (name X is bound to
  608. identity Y if at least one binding directory lists it, and no directory
  609. binds X to some other Y'.) A router is called 'Named' if the router
  610. believes the given name should be bound to the given key.
  611. "Running" -- A router is 'Running' if the authority managed to connect to
  612. it successfully within the last 30 minutes.
  613. "Stable" -- A router is 'Stable' if it is active, and either its
  614. uptime is at least the median uptime for known active routers, or
  615. its uptime is at least 30 days. Routers are never called stable if
  616. they are running a version of Tor known to drop circuits stupidly.
  617. (0.1.1.10-alpha through 0.1.1.16-rc are stupid this way.)
  618. "Fast" -- A router is 'Fast' if it is active, and its bandwidth is
  619. in the top 7/8ths for known active routers.
  620. "Guard" -- A router is a possible 'Guard' if it is 'Stable' and its
  621. bandwidth is above median for known active routers. If the total
  622. bandwidth of active non-BadExit Exit servers is less than one third
  623. of the total bandwidth of all active servers, no Exit is listed as
  624. a Guard.
  625. "Authority" -- A router is called an 'Authority' if the authority
  626. generating the network-status document believes it is an authority.
  627. "V2Dir" -- A router supports the v2 directory protocol if it has an open
  628. directory port, and it is running a version of the directory protocol that
  629. supports the functionality clients need. (Currently, this is
  630. 0.1.1.9-alpha or later.)
  631. Directory server administrators may label some servers or IPs as
  632. blacklisted, and elect not to include them in their network-status lists.
  633. Thus, the network-status list includes all non-blacklisted,
  634. non-expired, non-superseded descriptors.
  635. 3.4. Computing a consensus from a set of votes
  636. Given a set of votes, authorities compute the contents of the consensus
  637. document as follows:
  638. The "published" is the latest of all published times on the votes.
  639. The "valid-until" is the earliest of all valid-until times on the
  640. votes.
  641. "client-versions" and "server-versions" are sorted in ascending
  642. order; A version is recommended in the consensus if it is recommended
  643. by more than half of the voting authorities that included a
  644. client-versions or server-versions lines in their votes.
  645. The authority item groups (dir-source, contact, fignerprint,
  646. vote-digest) are taken from the votes of the voting
  647. authorities. These groups are sorted by the digests of the
  648. authorities identity keys, in ascending order.
  649. A router status entry is included in the result if it is included by more
  650. than half of the authorities (total authorities, not just those whose
  651. votes we have). A router entry has a flag set if it is included by
  652. more than half of the authorities who care about that flag. Two
  653. router entries are "the same" if they have the same identity digest.
  654. We use whatever descriptor digest is attested to by the most
  655. authorities among the voters, breaking ties in favor of the one with
  656. the most recent publication time.
  657. The signatures at the end of the document appear are sorted in
  658. ascending order by identity digest.
  659. [CUTOFF HERE. STUFF BELOW THIS POINT HAS NOT YET BEEN UPDATED FROM V2.]
  660. 4. Directory server operation
  661. All directory authorities and directory mirrors ("directory servers")
  662. implement this section, except as noted.
  663. 4.1. Accepting uploads (authorities only)
  664. When a router posts a signed descriptor to a directory authority, the
  665. authority first checks whether it is well-formed and correctly
  666. self-signed. If it is, the authority next verifies that the nickname
  667. question is already assigned to a router with a different public key.
  668. Finally, the authority MAY check that the router is not blacklisted
  669. because of its key, IP, or another reason.
  670. If the descriptor passes these tests, and the authority does not already
  671. have a descriptor for a router with this public key, it accepts the
  672. descriptor and remembers it.
  673. If the authority _does_ have a descriptor with the same public key, the
  674. newly uploaded descriptor is remembered if its publication time is more
  675. recent than the most recent old descriptor for that router, and either:
  676. - There are non-cosmetic differences between the old descriptor and the
  677. new one.
  678. - Enough time has passed between the descriptors' publication times.
  679. (Currently, 12 hours.)
  680. Differences between router descriptors are "non-cosmetic" if they would be
  681. sufficient to force an upload as described in section 2 above.
  682. Note that the "cosmetic difference" test only applies to uploaded
  683. descriptors, not to descriptors that the authority downloads from other
  684. authorities.
  685. 4.2. Downloading network-status documents (authorities and caches)
  686. All directory servers (authorities and mirrors) try to keep a fresh
  687. set of network-status documents from every authority. To do so,
  688. every 5 minutes, each authority asks every other authority for its
  689. most recent network-status document. Every 15 minutes, each mirror
  690. picks a random authority and asks it for the most recent network-status
  691. documents for all the authorities the authority knows about (including
  692. the chosen authority itself).
  693. Directory servers and mirrors remember and serve the most recent
  694. network-status document they have from each authority. Other
  695. network-status documents don't need to be stored. If the most recent
  696. network-status document is over 10 days old, it is discarded anyway.
  697. Mirrors SHOULD store and serve network-status documents from authorities
  698. they don't recognize, but SHOULD NOT use such documents for any other
  699. purpose. Mirrors SHOULD discard network-status documents older than 48
  700. hours.
  701. 4.3. Downloading and storing router descriptors (authorities and caches)
  702. Periodically (currently, every 10 seconds), directory servers check
  703. whether there are any specific descriptors (as identified by descriptor
  704. hash in a network-status document) that they do not have and that they
  705. are not currently trying to download.
  706. If so, the directory server launches requests to the authorities for these
  707. descriptors, such that each authority is only asked for descriptors listed
  708. in its most recent network-status. When more than one authority lists the
  709. descriptor, we choose which to ask at random.
  710. If one of these downloads fails, we do not try to download that descriptor
  711. from the authority that failed to serve it again unless we receive a newer
  712. network-status from that authority that lists the same descriptor.
  713. Directory servers must potentially cache multiple descriptors for each
  714. router. Servers must not discard any descriptor listed by any current
  715. network-status document from any authority. If there is enough space to
  716. store additional descriptors, servers SHOULD try to hold those which
  717. clients are likely to download the most. (Currently, this is judged
  718. based on the interval for which each descriptor seemed newest.)
  719. Authorities SHOULD NOT download descriptors for routers that they would
  720. immediately reject for reasons listed in 3.1.
  721. 4.4. HTTP URLs
  722. "Fingerprints" in these URLs are base-16-encoded SHA1 hashes.
  723. The authoritative network-status published by a host should be available at:
  724. http://<hostname>/tor/status/authority.z
  725. The network-status published by a host with fingerprint
  726. <F> should be available at:
  727. http://<hostname>/tor/status/fp/<F>.z
  728. The network-status documents published by hosts with fingerprints
  729. <F1>,<F2>,<F3> should be available at:
  730. http://<hostname>/tor/status/fp/<F1>+<F2>+<F3>.z
  731. The most recent network-status documents from all known authorities,
  732. concatenated, should be available at:
  733. http://<hostname>/tor/status/all.z
  734. The most recent descriptor for a server whose identity key has a
  735. fingerprint of <F> should be available at:
  736. http://<hostname>/tor/server/fp/<F>.z
  737. The most recent descriptors for servers with identity fingerprints
  738. <F1>,<F2>,<F3> should be available at:
  739. http://<hostname>/tor/server/fp/<F1>+<F2>+<F3>.z
  740. (NOTE: Implementations SHOULD NOT download descriptors by identity key
  741. fingerprint. This allows a corrupted server (in collusion with a cache) to
  742. provide a unique descriptor to a client, and thereby partition that client
  743. from the rest of the network.)
  744. The server descriptor with (descriptor) digest <D> (in hex) should be
  745. available at:
  746. http://<hostname>/tor/server/d/<D>.z
  747. The most recent descriptors with digests <D1>,<D2>,<D3> should be
  748. available at:
  749. http://<hostname>/tor/server/d/<D1>+<D2>+<D3>.z
  750. The most recent descriptor for this server should be at:
  751. http://<hostname>/tor/server/authority.z
  752. [Nothing in the Tor protocol uses this resource yet, but it is useful
  753. for debugging purposes. Also, the official Tor implementations
  754. (starting at 0.1.1.x) use this resource to test whether a server's
  755. own DirPort is reachable.]
  756. A concatenated set of the most recent descriptors for all known servers
  757. should be available at:
  758. http://<hostname>/tor/server/all.z
  759. For debugging, directories SHOULD expose non-compressed objects at URLs like
  760. the above, but without the final ".z".
  761. Clients MUST handle compressed concatenated information in two forms:
  762. - A concatenated list of zlib-compressed objects.
  763. - A zlib-compressed concatenated list of objects.
  764. Directory servers MAY generate either format: the former requires less
  765. CPU, but the latter requires less bandwidth.
  766. Clients SHOULD use upper case letters (A-F) when base16-encoding
  767. fingerprints. Servers MUST accept both upper and lower case fingerprints
  768. in requests.
  769. 5. Client operation: downloading information
  770. Every Tor that is not a directory server (that is, those that do
  771. not have a DirPort set) implements this section.
  772. 5.1. Downloading network-status documents
  773. Each client maintains an ordered list of directory authorities.
  774. Insofar as possible, clients SHOULD all use the same ordered list.
  775. For each network-status document a client has, it keeps track of its
  776. publication time *and* the time when the client retrieved it. Clients
  777. consider a network-status document "live" if it was published within the
  778. last 24 hours.
  779. Clients try to have a live network-status document hours from *every*
  780. authority, and try to periodically get new network-status documents from
  781. each authority in rotation as follows:
  782. If a client is missing a live network-status document for any
  783. authority, it tries to fetch it from a directory cache. On failure,
  784. the client waits briefly, then tries that network-status document
  785. again from another cache. The client does not build circuits until it
  786. has live network-status documents from more than half the authorities
  787. it trusts, and it has descriptors for more than 1/4 of the routers
  788. that it believes are running.
  789. If the most recently _retrieved_ network-status document is over 30
  790. minutes old, the client attempts to download a network-status document.
  791. When choosing which documents to download, clients treat their list of
  792. directory authorities as a circular ring, and begin with the authority
  793. appearing immediately after the authority for their most recently
  794. retrieved network-status document. If this attempt fails, the client
  795. retries at other caches several times, before moving on to the next
  796. network-status document in sequence.
  797. Clients discard all network-status documents over 24 hours old.
  798. If enough mirrors (currently 4) claim not to have a given network status,
  799. we stop trying to download that authority's network-status, until we
  800. download a new network-status that makes us believe that the authority in
  801. question is running. Clients should wait a little longer after each
  802. failure.
  803. Clients SHOULD try to batch as many network-status requests as possible
  804. into each HTTP GET.
  805. (Note: clients can and should pick caches based on the network-status
  806. information they have: once they have first fetched network-status info
  807. from an authority, they should not need to go to the authority directly
  808. again.)
  809. 5.2. Downloading and storing router descriptors
  810. Clients try to have the best descriptor for each router. A descriptor is
  811. "best" if:
  812. * It is the most recently published descriptor listed for that router
  813. by at least two network-status documents.
  814. OR,
  815. * No descriptor for that router is listed by two or more
  816. network-status documents, and it is the most recently published
  817. descriptor listed by any network-status document.
  818. Periodically (currently every 10 seconds) clients check whether there are
  819. any "downloadable" descriptors. A descriptor is downloadable if:
  820. - It is the "best" descriptor for some router.
  821. - The descriptor was published at least 10 minutes in the past.
  822. (This prevents clients from trying to fetch descriptors that the
  823. mirrors have probably not yet retrieved and cached.)
  824. - The client does not currently have it.
  825. - The client is not currently trying to download it.
  826. - The client would not discard it immediately upon receiving it.
  827. - The client thinks it is running and valid (see 6.1 below).
  828. If at least 16 known routers have downloadable descriptors, or if
  829. enough time (currently 10 minutes) has passed since the last time the
  830. client tried to download descriptors, it launches requests for all
  831. downloadable descriptors, as described in 5.3 below.
  832. When a descriptor download fails, the client notes it, and does not
  833. consider the descriptor downloadable again until a certain amount of time
  834. has passed. (Currently 0 seconds for the first failure, 60 seconds for the
  835. second, 5 minutes for the third, 10 minutes for the fourth, and 1 day
  836. thereafter.) Periodically (currently once an hour) clients reset the
  837. failure count.
  838. No descriptors are downloaded until the client has downloaded more than
  839. half of the network-status documents.
  840. Clients retain the most recent descriptor they have downloaded for each
  841. router so long as it is not too old (currently, 48 hours), OR so long as
  842. it is recommended by at least one networkstatus AND no "better"
  843. descriptor has been downloaded. [Versions of Tor before 0.1.2.3-alpha
  844. would discard descriptors simply for being published too far in the past.]
  845. [The code seems to discard descriptors in all cases after they're 5
  846. days old. True? -RD]
  847. 5.3. Managing downloads
  848. When a client has no live network-status documents, it downloads
  849. network-status documents from a randomly chosen authority. In all other
  850. cases, the client downloads from mirrors randomly chosen from among those
  851. believed to be V2 directory servers. (This information comes from the
  852. network-status documents; see 6 below.)
  853. When downloading multiple router descriptors, the client chooses multiple
  854. mirrors so that:
  855. - At least 3 different mirrors are used, except when this would result
  856. in more than one request for under 4 descriptors.
  857. - No more than 128 descriptors are requested from a single mirror.
  858. - Otherwise, as few mirrors as possible are used.
  859. After choosing mirrors, the client divides the descriptors among them
  860. randomly.
  861. After receiving any response client MUST discard any network-status
  862. documents and descriptors that it did not request.
  863. 6. Using directory information
  864. Everyone besides directory authorities uses the approaches in this section
  865. to decide which servers to use and what their keys are likely to be.
  866. (Directory authorities just believe their own opinions, as in 3.1 above.)
  867. 6.1. Choosing routers for circuits.
  868. Tor implementations only pay attention to "live" network-status documents.
  869. A network status is "live" if it is the most recently downloaded network
  870. status document for a given directory server, and the server is a
  871. directory server trusted by the client, and the network-status document is
  872. no more than 1 day old.
  873. For time-sensitive information, Tor implementations focus on "recent"
  874. network-status documents. A network status is "recent" if it is live, and
  875. if it was published in the last 60 minutes. If there are fewer
  876. than 3 such documents, the most recently published 3 are "recent." If
  877. there are fewer than 3 in all, all are "recent.")
  878. Circuits SHOULD NOT be built until the client has enough directory
  879. information: network-statuses (or failed attempts to download
  880. network-statuses) for all authorities, network-statuses for at more than
  881. half of the authorites, and descriptors for at least 1/4 of the servers
  882. believed to be running.
  883. A server is "listed" if it is included by more than half of the live
  884. network status documents. Clients SHOULD NOT use unlisted servers.
  885. Clients believe the flags "Valid", "Exit", "Fast", "Guard", "Stable", and
  886. "V2Dir" about a given router when they are asserted by more than half of
  887. the live network-status documents. Clients believe the flag "Running" if
  888. it is listed by more than half of the recent network-status documents.
  889. These flags are used as follows:
  890. - Clients SHOULD NOT use non-'Valid' or non-'Running' routers unless
  891. requested to do so.
  892. - Clients SHOULD NOT use non-'Fast' routers for any purpose other than
  893. very-low-bandwidth circuits (such as introduction circuits).
  894. - Clients SHOULD NOT use non-'Stable' routers for circuits that are
  895. likely to need to be open for a very long time (such as those used for
  896. IRC or SSH connections).
  897. - Clients SHOULD NOT choose non-'Guard' nodes when picking entry guard
  898. nodes.
  899. - Clients SHOULD NOT download directory information from non-'V2Dir'
  900. caches.
  901. 6.2. Managing naming
  902. In order to provide human-memorable names for individual server
  903. identities, some directory servers bind names to IDs. Clients handle
  904. names in two ways:
  905. When a client encounters a name it has not mapped before:
  906. If all the live "Naming" network-status documents the client has
  907. claim that the name binds to some identity ID, and the client has at
  908. least three live network-status documents, the client maps the name to
  909. ID.
  910. When a user tries to refer to a router with a name that does not have a
  911. mapping under the above rules, the implementation SHOULD warn the user.
  912. After giving the warning, the implementation MAY use a router that at
  913. least one Naming authority maps the name to, so long as no other naming
  914. authority maps that name to a different router. If no Naming authority
  915. maps the name to a router, the implementation MAY use any router that
  916. advertises the name.
  917. Not every router needs a nickname. When a router doesn't configure a
  918. nickname, it publishes with the default nickname "Unnamed". Authorities
  919. SHOULD NOT ever mark a router with this nickname as Named; client software
  920. SHOULD NOT ever use a router in response to a user request for a router
  921. called "Unnamed".
  922. 6.3. Software versions
  923. An implementation of Tor SHOULD warn when it has fetched (or has
  924. attempted to fetch and failed four consecutive times) a network-status
  925. for each authority, and it is running a software version
  926. not listed on more than half of the live "Versioning" network-status
  927. documents.
  928. 6.4. Warning about a router's status.
  929. If a router tries to publish its descriptor to a Naming authority
  930. that has its nickname mapped to another key, the router SHOULD
  931. warn the operator that it is either using the wrong key or is using
  932. an already claimed nickname.
  933. If a router has fetched (or attempted to fetch and failed four
  934. consecutive times) a network-status for every authority, and at
  935. least one of the authorities is "Naming", and no live "Naming"
  936. authorities publish a binding for the router's nickname, the
  937. router MAY remind the operator that the chosen nickname is not
  938. bound to this key at the authorities, and suggest contacting the
  939. authority operators.
  940. ...
  941. 6.5. Router protocol versions
  942. A client should believe that a router supports a given feature if that
  943. feature is supported by the router or protocol versions in more than half
  944. of the live networkstatus's "v" entries for that router. In other words,
  945. if the "v" entries for some router are:
  946. v Tor 0.0.8pre1 (from authority 1)
  947. v Tor 0.1.2.11 (from authority 2)
  948. v FutureProtocolDescription 99 (from authority 3)
  949. then the client should believe that the router supports any feature
  950. supported by 0.1.2.11.
  951. This is currently equivalent to believing the median declared version for
  952. a router in all live networkstatuses.
  953. 7. Standards compliance
  954. All clients and servers MUST support HTTP 1.0.
  955. 7.1. HTTP headers
  956. Servers MAY set the Content-Length: header. Servers SHOULD set
  957. Content-Encoding to "deflate" or "identity".
  958. Servers MAY include an X-Your-Address-Is: header, whose value is the
  959. apparent IP address of the client connecting to them (as a dotted quad).
  960. For directory connections tunneled over a BEGIN_DIR stream, servers SHOULD
  961. report the IP from which the circuit carrying the BEGIN_DIR stream reached
  962. them. [Servers before version 0.1.2.5-alpha reported 127.0.0.1 for all
  963. BEGIN_DIR-tunneled connections.]
  964. Servers SHOULD disable caching of multiple network statuses or multiple
  965. router descriptors. Servers MAY enable caching of single descriptors,
  966. single network statuses, the list of all router descriptors, a v1
  967. directory, or a v1 running routers document. XXX mention times.
  968. 7.2. HTTP status codes
  969. XXX We should write down what return codes dirservers send in what situations.
  970. 8. Backward compatibility and migration plans