135-private-tor-networks.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. Filename: 135-private-tor-networks.txt
  2. Title: Simplify Configuration of Private Tor Networks
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Karsten Loesing
  6. Created: 29-Apr-2008
  7. Status: Accepted
  8. Target: 0.2.1.x
  9. Change history:
  10. 29-Apr-2008 Initial proposal for or-dev
  11. 19-May-2008 Included changes based on comments by Nick to or-dev and
  12. added a section for test cases.
  13. 18-Jun-2008 Changed testing-network-only configuration option names.
  14. Overview:
  15. Configuring a private Tor network has become a time-consuming and
  16. error-prone task with the introduction of the v3 directory protocol. In
  17. addition to that, operators of private Tor networks need to set an
  18. increasing number of non-trivial configuration options, and it is hard
  19. to keep FAQ entries describing this task up-to-date. In this proposal we
  20. (1) suggest to (optionally) accelerate timing of the v3 directory voting
  21. process and (2) introduce an umbrella config option specifically aimed at
  22. creating private Tor networks.
  23. Design:
  24. 1. Accelerate Timing of v3 Directory Voting Process
  25. Tor has reasonable defaults for setting up a large, Internet-scale
  26. network with comparably high latencies and possibly wrong server clocks.
  27. However, those defaults are bad when it comes to quickly setting up a
  28. private Tor network for testing, either on a single node or LAN (things
  29. might be different when creating a test network on PlanetLab or
  30. something). Some time constraints should be made configurable for private
  31. networks. The general idea is to accelerate everything that has to do
  32. with propagation of directory information, but nothing else, so that a
  33. private network is available as soon as possible. (As a possible
  34. safeguard, changing these configuration values could be made dependent on
  35. the umbrella configuration option introduced in 2.)
  36. 1.1. Initial Voting Schedule
  37. When a v3 directory does not know any consensus, it assumes an initial,
  38. hard-coded VotingInterval of 30 minutes, VoteDelay of 5 minutes, and
  39. DistDelay of 5 minutes. This is important for multiple, simultaneously
  40. restarted directory authorities to meet at a common time and create an
  41. initial consensus. Unfortunately, this means that it may take up to half
  42. an hour (or even more) for a private Tor network to bootstrap.
  43. We propose to make these three time constants configurable (note that
  44. V3AuthVotingInterval, V3AuthVoteDelay, and V3AuthDistDelay do not have an
  45. effect on the _initial_ voting schedule, but only on the schedule that a
  46. directory authority votes for). This can be achieved by introducing three
  47. new configuration options: TestingV3AuthInitialVotingInterval,
  48. TestingV3AuthInitialVoteDelay, and TestingV3AuthInitialDistDelay.
  49. As first safeguards, Tor should only accept configuration values for
  50. TestingV3AuthInitialVotingInterval that divide evenly into the default
  51. value of 30 minutes. The effect is that even if people misconfigured
  52. their directory authorities, they would meet at the default values at the
  53. latest. The second safeguard is to allow configuration only when the
  54. umbrella configuration option TestingTorNetwork is set.
  55. 1.2. Immediately Provide Reachability Information (Running flag)
  56. The default behavior of a directory authority is to provide the Running
  57. flag only after the authority is available for at least 30 minutes. The
  58. rationale is that before that time, an authority simply cannot deliver
  59. useful information about other running nodes. But for private Tor
  60. networks this may be different. This is currently implemented in the code
  61. as:
  62. /** If we've been around for less than this amount of time, our
  63. * reachability information is not accurate. */
  64. #define DIRSERV_TIME_TO_GET_REACHABILITY_INFO (30*60)
  65. There should be another configuration option
  66. TestingAuthDirTimeToLearnReachability with a default value of 30 minutes
  67. that can be changed when running testing Tor networks, e.g. to 0 minutes.
  68. The configuration value would simply replace the quoted constant. Again,
  69. changing this option could be safeguarded by requiring the umbrella
  70. configuration option TestingTorNetwork to be set.
  71. 1.3. Reduce Estimated Descriptor Propagation Time
  72. Tor currently assumes that it takes up to 10 minutes until router
  73. descriptors are propagated from the authorities to directory caches.
  74. This is not very useful for private Tor networks, and we want to be able
  75. to reduce this time, so that clients can download router descriptors in a
  76. timely manner.
  77. /** Clients don't download any descriptor this recent, since it will
  78. * probably not have propagated to enough caches. */
  79. #define ESTIMATED_PROPAGATION_TIME (10*60)
  80. We suggest to introduce a new config option
  81. TestingEstimatedDescriptorPropagationTime which defaults to 10 minutes,
  82. but that can be set to any lower non-negative value, e.g. 0 minutes. The
  83. same safeguards as in 1.2 could be used here, too.
  84. 2. Umbrella Option for Setting Up Private Tor Networks
  85. Setting up a private Tor network requires a number of specific settings
  86. that are not required or useful when running Tor in the public Tor
  87. network. Instead of writing down these options in a FAQ entry, there
  88. should be a single configuration option, e.g. TestingTorNetwork, that
  89. changes all required settings at once. Newer Tor versions would keep the
  90. set of configuration options up-to-date. It should still remain possible
  91. to manually overwrite the settings that the umbrella configuration option
  92. affects.
  93. The following configuration options are set by TestingTorNetwork:
  94. - ServerDNSAllowBrokenResolvConf 1
  95. Ignore the situation that private relays are not aware of any name
  96. servers.
  97. - DirAllowPrivateAddresses 1
  98. Allow router descriptors containing private IP addresses.
  99. - EnforceDistinctSubnets 0
  100. Permit building circuits with relays in the same subnet.
  101. - AssumeReachable 1
  102. Omit self-testing for reachability.
  103. - AuthDirMaxServersPerAddr 0
  104. - AuthDirMaxServersPerAuthAddr 0
  105. Permit an unlimited number of nodes on the same IP address.
  106. - ClientDNSRejectInternalAddresses 0
  107. Believe in DNS responses resolving to private IP addresses.
  108. - ExitPolicyRejectPrivate 0
  109. Allow exiting to private IP addresses. (This one is a matter of
  110. taste---it might be dangerous to make this a default in a private
  111. network, although people setting up private Tor networks should know
  112. what they are doing.)
  113. - V3AuthVotingInterval 5 minutes
  114. - V3AuthVoteDelay 20 seconds
  115. - V3AuthDistDelay 20 seconds
  116. Accelerate voting schedule after first consensus has been reached.
  117. - TestingV3AuthInitialVotingInterval 5 minutes
  118. - TestingV3AuthInitialVoteDelay 20 seconds
  119. - TestingV3AuthInitialDistDelay 20 seconds
  120. Accelerate initial voting schedule until first consensus is reached.
  121. - TestingAuthDirTimeToLearnReachability 0 minutes
  122. Consider routers as Running from the start of running an authority.
  123. - TestingEstimatedDescriptorPropagationTime 0 minutes
  124. Clients try downloading router descriptors from directory caches,
  125. even when they are not 10 minutes old.
  126. In addition to changing the defaults for these configuration options,
  127. TestingTorNetwork can only be set when a user has manually configured
  128. DirServer lines.
  129. Test:
  130. The implementation of this proposal must pass the following tests:
  131. 1. Set TestingTorNetwork and see if dependent configuration options are
  132. correctly changed.
  133. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1 DirServer \
  134. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  135. telnet 127.0.0.1 9051
  136. AUTHENTICATE
  137. GETCONF TestingTorNetwork TestingAuthDirTimeToLearnReachability
  138. 250-TestingTorNetwork=1
  139. 250 TestingAuthDirTimeToLearnReachability=0
  140. QUIT
  141. 2. Set TestingTorNetwork and a dependent configuration value to see if
  142. the provided value is used for the dependent option.
  143. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1 DirServer \
  144. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000" \
  145. TestingAuthDirTimeToLearnReachability 5
  146. telnet 127.0.0.1 9051
  147. AUTHENTICATE
  148. GETCONF TestingTorNetwork TestingAuthDirTimeToLearnReachability
  149. 250-TestingTorNetwork=1
  150. 250 TestingAuthDirTimeToLearnReachability=5
  151. QUIT
  152. 3. Start with TestingTorNetwork set and change a dependent configuration
  153. option later on.
  154. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1 DirServer \
  155. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  156. telnet 127.0.0.1 9051
  157. AUTHENTICATE
  158. SETCONF TestingAuthDirTimeToLearnReachability=5
  159. GETCONF TestingAuthDirTimeToLearnReachability
  160. 250 TestingAuthDirTimeToLearnReachability=5
  161. QUIT
  162. 4. Start with TestingTorNetwork set and a dependent configuration value,
  163. and reset that dependent configuration value. The result should be
  164. the testing-network specific default value.
  165. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1 DirServer \
  166. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000" \
  167. TestingAuthDirTimeToLearnReachability 5
  168. telnet 127.0.0.1 9051
  169. AUTHENTICATE
  170. GETCONF TestingAuthDirTimeToLearnReachability
  171. 250 TestingAuthDirTimeToLearnReachability=5
  172. RESETCONF TestingAuthDirTimeToLearnReachability
  173. GETCONF TestingAuthDirTimeToLearnReachability
  174. 250 TestingAuthDirTimeToLearnReachability=0
  175. QUIT
  176. 5. Leave TestingTorNetwork unset and check if dependent configuration
  177. options are left unchanged.
  178. tor DataDirectory . ControlPort 9051 DirServer \
  179. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  180. telnet 127.0.0.1 9051
  181. AUTHENTICATE
  182. GETCONF TestingTorNetwork TestingAuthDirTimeToLearnReachability
  183. 250-TestingTorNetwork=0
  184. 250 TestingAuthDirTimeToLearnReachability=1800
  185. QUIT
  186. 6. Leave TestingTorNetwork unset, but set dependent configuration option
  187. which should fail.
  188. tor DataDirectory . ControlPort 9051 DirServer \
  189. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000" \
  190. TestingAuthDirTimeToLearnReachability 0
  191. [warn] Failed to parse/validate config:
  192. TestingAuthDirTimeToLearnReachability may only be changed in testing
  193. Tor networks!
  194. 7. Start with TestingTorNetwork unset and change dependent configuration
  195. option later on which should fail.
  196. tor DataDirectory . ControlPort 9051 DirServer \
  197. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  198. telnet 127.0.0.1 9051
  199. AUTHENTICATE
  200. SETCONF TestingAuthDirTimeToLearnReachability=0
  201. 513 Unacceptable option value: TestingAuthDirTimeToLearnReachability
  202. may only be changed in testing Tor networks!
  203. 8. Start with TestingTorNetwork unset and set it later on which should
  204. fail.
  205. tor DataDirectory . ControlPort 9051 DirServer \
  206. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  207. telnet 127.0.0.1 9051
  208. AUTHENTICATE
  209. SETCONF TestingTorNetwork=1
  210. 553 Transition not allowed: While Tor is running, changing
  211. TestingTorNetwork is not allowed.
  212. 9. Start with TestingTorNetwork set and unset it later on which should
  213. fail.
  214. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1 DirServer \
  215. "mydir 127.0.0.1:1234 0000000000000000000000000000000000000000"
  216. telnet 127.0.0.1 9051
  217. AUTHENTICATE
  218. RESETCONF TestingTorNetwork
  219. 513 Unacceptable option value: TestingV3AuthInitialVotingInterval may
  220. only be changed in testing Tor networks!
  221. 10. Set TestingTorNetwork, but do not provide an alternate DirServer
  222. which should fail.
  223. tor DataDirectory . ControlPort 9051 TestingTorNetwork 1
  224. [warn] Failed to parse/validate config: TestingTorNetwork may only be
  225. configured in combination with a non-default set of DirServers.