135-private-tor-networks.txt 11 KB

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