135-private-tor-networks.txt 12 KB

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