154-automatic-updates.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. Filename: 154-automatic-updates.txt
  2. Title: Automatic Software Update Protocol
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Matt Edman
  6. Created: 30-July-2008
  7. Status: Open
  8. Target: 0.2.1.x
  9. Scope
  10. This proposal specifies the method by which an automatic update client can
  11. determine the most recent recommended Tor installation package for the
  12. user's platform, download the package, and then verify that the package was
  13. downloaded successfully. While this proposal focuses on only the Tor
  14. software, the protocol defined is sufficiently extensible such that other
  15. components of the Tor bundles, like Vidalia, Polipo, and Torbutton, can be
  16. managed and updated by the automatic update client as well.
  17. The initial target platform for the automatic update framework is Windows,
  18. given that's the platform used by a majority of our users and that it lacks
  19. a sane package management system that many Linux distributions already have.
  20. Our second target platform will be Mac OS X, and so the protocol will be
  21. designed with this near-future direction in mind.
  22. Other client-side aspects of the automatic update process, such as user
  23. interaction, the interface presented, and actual package installation
  24. procedure, are outside the scope of this proposal.
  25. Motivation
  26. Tor releases new versions frequently, often with important security,
  27. anonymity, and stability fixes. Thus, it is important for users to be able
  28. to promptly recognize when new versions are available and to easily
  29. download, authenticate, and install updated Tor and Tor-related software
  30. packages.
  31. Tor's control protocol [2] provides a method by which controllers can
  32. identify when the user's Tor software is obsolete or otherwise no longer
  33. recommended. Currently, however, no mechanism exists for clients to
  34. automatically download and install updated Tor and Tor-related software for
  35. the user.
  36. Design Overview
  37. The core of the automatic update framework is a well-defined file called a
  38. "recommended-packages" file. The recommended-packages file is accessible via
  39. HTTP[S] at one or more well-defined URLs. An example recommended-packages
  40. URL may be:
  41. https://updates.torproject.org/recommended-packages
  42. The recommended-packages document is formatted according to Section 1.2
  43. below and specifies the most recent recommended installation package
  44. versions for Tor or Tor-related software, as well as URLs at which the
  45. packages and their signatures can be downloaded.
  46. An automatic update client process runs on the Tor user's computer and
  47. periodically retrieves the recommended-packages file according to the method
  48. described in Section 2.0. As described further in Section 1.2, the
  49. recommended-packages file is signed and can be verified by the automatic
  50. update client with one or more public keys included in the client software.
  51. Since it is signed, the recommended-packages file can be mirrored by
  52. multiple hosts (e.g., Tor directory authorities), whose URLs are included in
  53. the automatic update client's configuration.
  54. After retrieving and verifying the recommended-packages file, the automatic
  55. update client compares the versions of the recommended software packages
  56. listed in the file with those currently installed on the end-user's
  57. computer. If one or more of the installed packages is determined to be out
  58. of date, an updated package and its signature will be downloaded from one of
  59. the package URLs listed in the recommended-packages file as described in
  60. Section 2.2.
  61. The automatic update system uses a multilevel signing key scheme for package
  62. signatures. There are a small number of entities we call "packaging
  63. authorities" that each have their own signing key. A packaging authority is
  64. responsible for signing and publishing the recommended-packages file.
  65. Additionally, each individual packager responsible for producing an
  66. installation package for one or more platforms has their own signing key.
  67. Every packager's signing key must be signed by at least one of the packaging
  68. authority keys.
  69. Specification
  70. 1. recommended-packages Specification
  71. In this section we formally specify the format of the published
  72. recommended-packages file.
  73. 1.1. Document Meta-format
  74. The recommended-packages document follows the lightweight extensible
  75. information format defined in Tor's directory protocol specification [1]. In
  76. the interest of self-containment, we have reproduced the relevant portions
  77. of that format's specification in this Section. (Credits to Nick Mathewson
  78. for much of the original format definition language.)
  79. The highest level object is a Document, which consists of one or more
  80. Items. Every Item begins with a KeywordLine, followed by zero or more
  81. Objects. A KeywordLine begins with a Keyword, optionally followed by
  82. whitespace and more non-newline characters, and ends with a newline. A
  83. Keyword is a sequence of one or more characters in the set [A-Za-z0-9-].
  84. An Object is a block of encoded data in pseudo-Open-PGP-style
  85. armor. (cf. RFC 2440)
  86. More formally:
  87. Document ::= (Item | NL)+
  88. Item ::= KeywordLine Object*
  89. KeywordLine ::= Keyword NL | Keyword WS ArgumentChar+ NL
  90. Keyword ::= KeywordChar+
  91. KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'
  92. ArgumentChar ::= any printing ASCII character except NL.
  93. WS ::= (SP | TAB)+
  94. Object ::= BeginLine Base-64-encoded-data EndLine
  95. BeginLine ::= "-----BEGIN " Keyword "-----" NL
  96. EndLine ::= "-----END " Keyword "-----" NL
  97. The BeginLine and EndLine of an Object must use the same keyword.
  98. In our Document description below, we also tag Items with a multiplicity in
  99. brackets. Possible tags are:
  100. "At start, exactly once": These items MUST occur in every instance of the
  101. document type, and MUST appear exactly once, and MUST be the first item in
  102. their documents.
  103. "Exactly once": These items MUST occur exactly one time in every
  104. instance of the document type.
  105. "Once or more": These items MUST occur at least once in any instance
  106. of the document type, and MAY occur more than once.
  107. "At end, exactly once": These items MUST occur in every instance of
  108. the document type, and MUST appear exactly once, and MUST be the
  109. last item in their documents.
  110. 1.2. recommended-packages Document Format
  111. When interpreting a recommended-packages Document, software MUST ignore
  112. any KeywordLine that starts with a keyword it doesn't recognize; future
  113. implementations MUST NOT require current automatic update clients to
  114. understand any KeywordLine not currently described.
  115. In lines that take multiple arguments, extra arguments SHOULD be
  116. accepted and ignored.
  117. The currently defined Items contained in a recommended-packages document
  118. are:
  119. "recommended-packages-format" SP number NL
  120. [Exactly once]
  121. This Item specifies the version of the recommended-packages format that
  122. is contained in the subsequent document. The version defined in this
  123. proposal is version "1". Subsequent iterations of this protocol MUST
  124. increment this value if they introduce incompatible changes to the
  125. document format and MAY increment this value if they only introduce
  126. additional Keywords.
  127. "published" SP YYYY-MM-DD SP HH:MM:SS NL
  128. [Exactly once]
  129. The time, in GMT, when this recommended-packages document was generated.
  130. Automatic update clients SHOULD ignore Documents over 60 days old.
  131. "tor-stable-win32-version" SP TorVersion NL
  132. [Exactly once]
  133. This keyword specifies the latest recommended release of Tor's "stable"
  134. branch for the Windows platform that has an installation package
  135. available. Note that this version does not necessarily correspond to the
  136. most recently tagged stable Tor version, since that version may not yet
  137. have an installer package available, or may have known issues on
  138. Windows.
  139. The TorVersion field is formatted according to Section 2 of Tor's
  140. version specification [3].
  141. "tor-stable-win32-package" SP Url NL
  142. [Once or more]
  143. This Item specifies the location from which the most recent
  144. recommended Windows installation package for Tor's stable branch can be
  145. downloaded.
  146. When this Item appears multiple times within the Document, automatic
  147. update clients SHOULD select randomly from the available package
  148. mirrors.
  149. "tor-dev-win32-version" SP TorVersion NL
  150. [Exactly once]
  151. This Item specifies the latest recommended release of Tor's
  152. "development" branch for the Windows platform that has an installation
  153. package available. The same caveats from the description of
  154. "tor-stable-win32-version" also apply to this keyword.
  155. The TorVersion field is formatted according to Section 2 of Tor's
  156. version specification [3].
  157. "tor-dev-win32-package" SP Url NL
  158. [Once or more]
  159. This Item specifies the location from which the most recent recommended
  160. Windows installation package and its signature for Tor's development
  161. branch can be downloaded.
  162. When this Keyword appears multiple times within the Document, automatic
  163. update clients SHOULD select randomly from the available package
  164. mirrors.
  165. "signature" NL SIGNATURE NL
  166. [At end, exactly once]
  167. The "SIGNATURE" Object contains a PGP signature (using a packaging
  168. authority signing key) of the entire document, taken from the beginning
  169. of the "recommended-packages-format" keyword, through the newline after
  170. the "signature" Keyword.
  171. 2. Automatic Update Client Behavior
  172. The client-side component of the automatic update framework is an
  173. application that runs on the end-user's machine. It is responsible for
  174. fetching and verifying a recommended-packages document, as well as
  175. downloading, verifying, and subsequently installing any necessary updated
  176. software packages.
  177. 2.1. Download and verify a recommended-packages document
  178. The first step in the automatic update process is for the client to download
  179. a copy of the recommended-packages file. The automatic update client
  180. contains a (hardcoded and/or user-configurable) list of URLs from which it
  181. will attempt to retrieve a recommended-packages file.
  182. Connections to each of the recommended-packages URLs SHOULD be attempted in
  183. the following order:
  184. 1) HTTPS over Tor
  185. 2) HTTP over Tor
  186. 3) Direct HTTPS
  187. 4) Direct HTTP
  188. If the client fails to retrieve a recommended-packages document via any of
  189. the above connection methods from any of the configured URLs, the client
  190. SHOULD retry its download attempts following an exponential back-off
  191. algorithm. After the first failed attempt, the client SHOULD delay one hour
  192. before attempting again, up to a maximum of 24 hours delay between retry
  193. attempts.
  194. After successfully downloading a recommended-packages file, the automatic
  195. update client will verify the signature using one of the public keys
  196. distributed with the client software. If more than one recommended-packages
  197. file is downloaded and verified, the file with the most recent "published"
  198. date that is verified will be retained and the rest discarded.
  199. 2.2. Download and verify the updated packages
  200. The automatic update client next compares the latest recommended package
  201. version from the recommended-packages document with the currently installed
  202. Tor version. If the user currently has installed a Tor version from Tor's
  203. "development" branch, then the version specified in "tor-dev-*-version" Item
  204. is used for comparison. Similarly, if the user currently has installed a Tor
  205. version from Tor's "stable" branch, then the version specified in the
  206. "tor-stable-*version" Item is used for comparison. Version comparisons are
  207. done according to Tor's version specification [3].
  208. If the automatic update client determines an installation package newer than
  209. the user's currently installed version is available, it will attempt to
  210. download a package appropriate for the user's platform and Tor branch from a
  211. URL specified by a "tor-[branch]-[platform]-package" Item. If more than one
  212. mirror for the selected package is available, a mirror will be chosen at
  213. random from all those available.
  214. The automatic update client must also download a ".asc" signature file for
  215. the retrieved package. The URL for the package signature is the same as that
  216. for the package itself, except with the extension ".asc" appended to the
  217. package URL.
  218. Connections to download the updated package and its signature SHOULD be
  219. attempted in the same order described in Section 2.1.
  220. After completing the steps described in Sections 2.1 and 2.2, the automatic
  221. update client will have downloaded and verified a copy of the latest Tor
  222. installation package. It can then take whatever subsequent platform-specific
  223. steps are necessary to install the downloaded software updates.
  224. 2.3. Periodic checking for updates
  225. The automatic update client SHOULD maintain a local state file in which it
  226. records (at a minimum) the timestamp at which it last retrieved a
  227. recommended-packages file and the timestamp at which the client last
  228. successfully downloaded and installed a software update.
  229. Automatic update clients SHOULD check for an updated recommended-packages
  230. document at most once per day but at least once every 30 days.
  231. 3. Future Extensions
  232. There are several possible areas for future extensions of this framework.
  233. The extensions below are merely suggestions and should be the subject of
  234. their own proposal before being implemented.
  235. 3.1. Additional Software Updates
  236. There are several software packages often included in Tor bundles besides
  237. Tor, such as Vidalia, Privoxy or Polipo, and Torbutton. The versions and
  238. download locations of updated installation packages for these bundle
  239. components can be easily added to the recommended-packages document
  240. specification above.
  241. 3.2. Including ChangeLog Information
  242. It may be useful for automatic update clients to be able to display for
  243. users a summary of the changes made in the latest Tor or Tor-related
  244. software release, before the user chooses to install the update. In the
  245. future, we can add keywords to the specification in Section 1.2 that specify
  246. the location of a ChangeLog file for the latest recommended package
  247. versions. It may also be desirable to allow localized ChangeLog information,
  248. so that the automatic update client can fetch release notes in the
  249. end-user's preferred language.
  250. 3.3. Weighted Package Mirror Selection
  251. We defined in Section 1.2 a method by which automatic update clients can
  252. select from multiple available package mirrors. We may want to add a Weight
  253. argument to the "*-package" Items that allows the recommended-packages file
  254. to suggest to clients the probability with which a package mirror should be
  255. chosen. This will allow clients to more appropriately distribute package
  256. downloads across available mirrors proportional to their approximate
  257. bandwidth.
  258. Implementation
  259. Implementation of this proposal will consist of two separate components.
  260. The first component is a small "au-publish" tool that takes as input a
  261. configuration file specifying the information described in Section 1.2 and a
  262. private key. The tool is run by a "packaging authority" (someone responsible
  263. for publishing updated installation packages), who will be prompted to enter
  264. the passphrase for the private key used to sign the recommended-packages
  265. document. The output of the tool is a document formatted according to
  266. Section 1.2, with a signature appended at the end. The resulting document
  267. can then be published to any of the update mirrors.
  268. The second component is an "au-client" tool that is run on the end-user's
  269. machine. It periodically checks for updated installation packages according
  270. to Section 2 and fetches the packages if necessary. The public keys used
  271. to sign the recommended-packages file and any of the published packages are
  272. included in the "au-client" tool.
  273. References
  274. [1] Tor directory protocol (version 3),
  275. https://tor-svn.freehaven.net/svn/tor/trunk/doc/spec/dir-spec.txt
  276. [2] Tor control protocol (version 2),
  277. https://tor-svn.freehaven.net/svn/tor/trunk/doc/spec/control-spec.txt
  278. [3] Tor version specification,
  279. https://tor-svn.freehaven.net/svn/tor/trunk/doc/spec/version-spec.txt