1. This is chutney. It doesn't do much so far. It isn't ready for prime-time.
  2. If it breaks, you get to keep all the pieces.
  3. It is supposed to be a good tool for:
  4. - Configuring a testing tor network
  5. - Launching and monitoring a testing tor network
  6. - Running tests on a testing tor network
  7. Right now it only sorta does these things.
  8. You will need:
  9. - Python 2.7 or later (Python 3 support is an ongoing work), and
  10. - Tor binaries.
  11. Chutney checks for Tor binaries in this order:
  12. - If you run chutney's tools/ from a tor build directory,
  13. (or set the environment variable $TOR_DIR to a tor build directory,)
  14. chutney will automatically detect the tor binaries, or
  15. - If you put the location of the 'tor' and 'tor-gencert' binaries in the
  16. environment variables $CHUTNEY_TOR and $CHUTNEY_TOR_GENCERT, respectively,
  17. chutney will use those binaries, or
  18. - You will need tor and tor-gencert installed somewhere in your path.
  19. Stuff to try:
  20. Automated Setup, Verification, and Shutdown:
  21. ./tools/ --flavor basic-min
  22. ./tools/ --coverage
  23. ./tools/ --tor-path <tor-build-directory>
  24. ./tools/ --tor <name-or-path> --tor-gencert <name-or-path>
  25. (--tor-path and $TOR_DIR override --tor and --tor-gencert.)
  26. (The script tries hard to find tor.)
  27. ./tools/ --chutney-path <chutney-directory>
  28. (The script is pretty good at finding chutney.)
  29. looks for some tor binaries (either in a nearby build
  30. directory or in your $PATH), configures a comprehensive tor test network,
  31. launches it, then verifies data transmission through it, and cleans up after
  32. itself. Relative paths are supported.
  33. You can modify its configuration using command-line arguments, or use the
  34. chutney environmental variables documented below:
  35. Timing Options:
  36. --start-time CHUTNEY_START_TIME=N
  37. --bootstrap-time CHUTNEY_BOOTSTRAP_TIME=N
  38. --stop-time CHUTNEY_STOP_TIME=N
  39. Traffic Options:
  41. # connections are simultaneous, rounds are sequential
  42. --connections CHUTNEY_CONNECTIONS=N
  43. --rounds CHUTNEY_ROUNDS=N
  44. --hs-multi-client CHUTNEY_HS_MULTI_CLIENT=N
  45. Address/DNS Options:
  48. # Chutney uses /etc/resolv.conf if none of these options are set
  49. --dns-conf CHUTNEY_DNS_CONF=PATH
  50. --offline CHUTNEY_DNS_CONF=/dev/null
  51. # Use tor's compile-time default for ServerDNSResolvConfFile
  52. --dns-conf-default CHUTNEY_DNS_CONF=""
  53. Warning Options:
  54. --all-warnings CHUTNEY_WARNINGS_IGNORE_EXPECTED=false
  56. --no-warnings CHUTNEY_WARNINGS_SKIP=true
  57. --only-warnings CHUTNEY_WARNINGS_ONLY=true
  58. Expert Options:
  59. --debug CHUTNEY_DEBUG=true
  60. --coverage USE_COVERAGE_BINARY=true
  61. --dry-run NETWORK_DRY_RUN=true
  62. --quiet ECHO=true
  63. --controlling-pid CHUTNEY_CONTROLLING_PID=N
  64. --net-dir CHUTNEY_DATA_DIR=PATH
  65. (These are advanced options: in the past, they have had long-standing bugs.)
  66. Standard Actions:
  67. ./chutney configure networks/basic
  68. ./chutney start networks/basic
  69. ./chutney status networks/basic
  70. ./chutney verify networks/basic
  71. ./chutney hup networks/basic
  72. ./chutney stop networks/basic
  73. Bandwidth Tests:
  74. ./chutney configure networks/basic-min
  75. ./chutney start networks/basic-min
  76. ./chutney status networks/basic-min
  77. CHUTNEY_DATA_BYTES=104857600 ./chutney verify networks/basic-min
  78. # Send 100MB of data per client connection
  79. # verify produces performance figures for:
  80. # Single Stream Bandwidth: the speed of the slowest stream, end-to-end
  81. # Overall tor Bandwidth: the sum of the bandwidth across each tor instance
  82. # This approximates the CPU-bound tor performance on the current machine,
  83. # assuming everything is multithreaded and network performance is infinite.
  84. ./chutney stop networks/basic-min
  85. Connection Tests:
  86. ./chutney configure networks/basic-025
  87. ./chutney start networks/basic-025
  88. ./chutney status networks/basic-025
  89. # Make 5 simultaneous connections from each client through a random exit
  90. CHUTNEY_CONNECTIONS=5 ./chutney verify networks/basic-025
  91. ./chutney stop networks/basic-025
  92. # Run 5 sequential verification rounds
  93. CHUTNEY_ROUNDS=5 ./tools/ --flavour basic
  94. HS Connection Tests:
  95. ./chutney configure networks/hs-025
  96. ./chutney start networks/hs-025
  97. ./chutney status networks/hs-025
  98. CHUTNEY_HS_MULTI_CLIENT=1 ./chutney verify networks/hs-025
  99. # Make a connection from each client to each hs
  100. # Default behavior is one client connects to each HS
  101. ./chutney stop networks/hs-025
  102. Bandwidth File Tests:
  103. ./tools/ --flavour bwfile
  104. # Warning: Can't open bandwidth file at configured location: /tmp/bwfile
  105. # Create a bwfile with no bandwidths, that is valid for a few days
  106. date +%s > /tmp/bwfile
  107. ./tools/ --flavour bwfile
  108. Waiting for the network:
  109. The tools/ script waits CHUTNEY_START_TIME seconds
  110. (default: 20) before calling chutney verify, because that's the minimum
  111. amount of time it takes to bootstrap a consensus containing relays.
  112. (It takes 5-10 seconds for the authorities to create the first consensus,
  113. then 10 seconds for relays to bootstrap, submit their descriptors, and be
  114. included in the next consensus.) If CHUTNEY_START_TIME is negative, the
  115. script leaves the network running, and exits immediately (without verifying).
  116. Commands like "chutney verify" start immediately, and keep trying for
  117. CHUTNEY_BOOTSTRAP_TIME seconds (default: 60). If it hasn't been
  118. successful after that time, it fails. If CHUTNEY_BOOTSTRAP_TIME is negative,
  119. the script leaves the network running, and exits after CHUTNEY_START_TIME
  120. (without verifying).
  121. The tools/ script waits CHUTNEY_STOP_TIME seconds
  122. after verifying, then exits (default: immediately). If CHUTNEY_STOP_TIME is
  123. negative, the script leaves the network running, and exits after verifying.
  124. If none of these options are negative, tells the tor
  125. processes to exit after it exits, using CHUTNEY_CONTROLLING_PID. To disable
  126. this functionality, set CHUTNEY_CONTROLLING_PID to 1 or less.
  127. Changing the network address:
  128. Chutney defaults to binding to localhost. To change the IPv4 bind address,
  129. set the CHUTNEY_LISTEN_ADDRESS environment variable. Similarly, change
  130. CHUTNEY_LISTEN_ADDRESS_V6 for IPv6: it defaults to "no IPv6 address".
  131. Setting it to some interface's IP address allows us to make the simulated
  132. Tor network available on the network.
  133. IPv6 support for both Tor and Chutney is a work in progress. Currently,
  134. chutney verifies IPv6 client, bridge client (?), hidden service, and exit
  135. connections. It does not use IPv6 SOCKSPorts or HiddenServicePorts.
  136. Using DNS:
  137. Chutney verify uses IP addresses by default. It does not need to look up
  138. any hostnames. We recommend that chutney users disable DNS using --offline
  139. or CHUTNEY_DNS_CONF=/dev/null , because any DNS failures causes tests to
  140. fail. Chutney's DNS queries also produce external traffic in a predictable
  141. pattern.
  142. If you want to use a hostname with CHUTNEY_LISTEN_ADDRESS[_V6], or you want
  143. to run tests that use DNS, set CHUTNEY_DNS_CONF to the path to a file in
  144. resolv.conf format. Chutney's default of /etc/resolv.conf should be fine for
  145. most UNIX-based operating systems. If your tor is compiled with a different
  146. default, use --dns-resolv-conf-default or CHUTNEY_DNS_CONF="".
  147. When the CHUTNEY_DNS_CONF file does not exist, or is a broken symlink,
  148. chutney uses /dev/null instead. This is a workaround for bugs in tor's
  149. use of eventdns. For example, macOS deletes the resolv.conf file when it
  150. thinks the network is down: this can make tor exits reject all traffic,
  151. even if a working DNS server is running on
  152. When tor has no working name servers (including --offline mode), it can
  153. crash on SETCONF. (Chutney does not use SETCONF, but some external tor
  154. controllers do.) To avoid this crash, set CHUTNEY_DNS_CONF to a file
  155. containing a working name server address. For your convenience, chutney
  156. provides a local resolv.conf file containing IPv4, IPv6, and "localhost".
  157. Use --dns-conf resolv.conf (relative paths work).
  158. The configuration files:
  159. networks/basic holds the configuration for the network you're configuring
  160. above. It refers to some torrc template files in torrc_templates/.
  161. The working files:
  162. chutney sticks its working files, including all data directories, log
  163. files, etc, in ./net/. Each tor instance gets a subdirectory of net/nodes.
  164. You can override the directory "./net" with the CHUTNEY_DATA_DIR
  165. environment variable.
  166. Test scripts:
  167. The test scripts are stored in the "scripts/chutney_tests" directory. These
  168. Python files must define a "run_test(network)" function. Files starting with
  169. an underscore ("_") are ignored.
  170. Test scripts can be run using the following syntax:
  171. ./chutney <script-name> networks/<network-name>
  172. The chutney verify command is implemented using a test script.
  173. Test scripts in the test directory with the same name as standard commands
  174. are run instead of that standard command. This allows expert users to replace
  175. the standard chutney commands with modified versions.