README 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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, at the moment:
  9. - Tor installed somewhere in your path, or
  10. - The location of the 'tor' and 'tor-gencert' binaries specified through the
  11. environment variables CHUTNEY_TOR and CHUTNEY_TOR_GENCERT, respectively, or
  12. - To run chutney's tools/test-network.sh from a tor build directory, and
  13. - Python 2.7 or later (Python 3 support is an ongoing work)
  14. Stuff to try:
  15. Automated Setup, Verification, and Shutdown:
  16. ./tools/test-network.sh --flavor basic-min
  17. ./tools/test-network.sh --coverage
  18. ./tools/test-network.sh --tor-path <tor-build-directory>
  19. ./tools/test-network.sh --tor <name-or-path> --tor-gencert <name-or-path>
  20. (--tor-path and $TOR_DIR override --tor and --tor-gencert.)
  21. (The script tries hard to find tor.)
  22. ./tools/test-network.sh --chutney-path <chutney-directory>
  23. (The script is pretty good at finding chutney.)
  24. test-network.sh looks for some tor binaries (either in a nearby build
  25. directory or in your $PATH), configures a comprehensive tor test network,
  26. launches it, then verifies data transmission through it, and cleans up after
  27. itself. Relative paths are supported.
  28. You can modify its configuration using command-line arguments, or use the
  29. chutney environmental variables documented below:
  30. Timing Options:
  31. --start-time CHUTNEY_START_TIME
  32. --bootstrap-time CHUTNEY_BOOTSTRAP_TIME
  33. --stop-time CHUTNEY_STOP_TIME
  34. Traffic Options:
  35. --data CHUTNEY_DATA_BYTES=N
  36. # connections are simultaneous, rounds are sequential
  37. --connections CHUTNEY_CONNECTIONS=N
  38. --rounds CHUTNEY_ROUNDS=N
  39. --hs-multi-client CHUTNEY_HS_MULTI_CLIENT=N
  40. Address Options:
  41. --ipv4 CHUTNEY_LISTEN_ADDRESS
  42. --ipv6 CHUTNEY_LISTEN_ADDRESS_V6
  43. Warning Options:
  44. --all-warnings CHUTNEY_WARNINGS_IGNORE_EXPECTED=false
  45. CHUTNEY_WARNINGS_SUMMARY=false
  46. --no-warnings CHUTNEY_WARNINGS_SKIP=true
  47. --only-warnings CHUTNEY_WARNINGS_ONLY=true
  48. Expert Options:
  49. --debug CHUTNEY_DEBUG=true
  50. --coverage USE_COVERAGE_BINARY=true
  51. --dry-run NETWORK_DRY_RUN=true
  52. --quiet ECHO=true
  53. --controlling-pid CHUTNEY_CONTROLLING_PID
  54. --net-dir CHUTNEY_DATA_DIR
  55. (These are advanced options: in the past, they have had long-standing bugs.)
  56. Standard Actions:
  57. ./chutney configure networks/basic
  58. ./chutney start networks/basic
  59. ./chutney status networks/basic
  60. ./chutney verify networks/basic
  61. ./chutney hup networks/basic
  62. ./chutney stop networks/basic
  63. Bandwidth Tests:
  64. ./chutney configure networks/basic-min
  65. ./chutney start networks/basic-min
  66. ./chutney status networks/basic-min
  67. CHUTNEY_DATA_BYTES=104857600 ./chutney verify networks/basic-min
  68. # Send 100MB of data per client connection
  69. # verify produces performance figures for:
  70. # Single Stream Bandwidth: the speed of the slowest stream, end-to-end
  71. # Overall tor Bandwidth: the sum of the bandwidth across each tor instance
  72. # This approximates the CPU-bound tor performance on the current machine,
  73. # assuming everything is multithreaded and network performance is infinite.
  74. ./chutney stop networks/basic-min
  75. Connection Tests:
  76. ./chutney configure networks/basic-025
  77. ./chutney start networks/basic-025
  78. ./chutney status networks/basic-025
  79. # Make 5 simultaneous connections from each client through a random exit
  80. CHUTNEY_CONNECTIONS=5 ./chutney verify networks/basic-025
  81. ./chutney stop networks/basic-025
  82. # Run 5 sequential verification rounds
  83. CHUTNEY_ROUNDS=5 ./tools/test-network.sh --flavour basic
  84. Note: If you create 7 or more connections to a hidden service from a single
  85. Tor 0.2.7 client, you'll likely get a verification failure due to #15937.
  86. This is fixed in 0.2.8.
  87. HS Connection Tests:
  88. ./chutney configure networks/hs-025
  89. ./chutney start networks/hs-025
  90. ./chutney status networks/hs-025
  91. CHUTNEY_HS_MULTI_CLIENT=1 ./chutney verify networks/hs-025
  92. # Make a connection from each client to each hs
  93. # Default behavior is one client connects to each HS
  94. ./chutney stop networks/hs-025
  95. Waiting for the network:
  96. The tools/test-network.sh script waits CHUTNEY_START_TIME seconds
  97. (default: 20) before calling chutney verify, because that's the minimum
  98. amount of time it takes to bootstrap a consensus containing relays.
  99. (It takes 5-10 seconds for the authorities to create the first consensus,
  100. then 10 seconds for relays to bootstrap, submit their descriptors, and be
  101. included in the next consensus.) If CHUTNEY_START_TIME is negative, the
  102. script leaves the network running, and exits immediately (without verifying).
  103. Commands like "chutney verify" start immediately, and keep trying for
  104. CHUTNEY_BOOTSTRAP_TIME seconds (default: 60). If it hasn't been
  105. successful after that time, it fails. If CHUTNEY_BOOTSTRAP_TIME is negative,
  106. the script leaves the network running, and exits after CHUTNEY_START_TIME
  107. (without verifying).
  108. The tools/test-network.sh script waits CHUTNEY_STOP_TIME seconds
  109. after verifying, then exits (default: immediately). If CHUTNEY_STOP_TIME is
  110. negative, the script leaves the network running, and exits after verifying.
  111. If none of these options are negative, test-network.sh tells the tor
  112. processes to exit after it exits, using CHUTNEY_CONTROLLING_PID. To disable
  113. this functionality, set CHUTNEY_CONTROLLING_PID to 1 or less.
  114. Changing the network address:
  115. Chutney defaults to binding to localhost. To change the IPv4 bind address,
  116. set the CHUTNEY_LISTEN_ADDRESS environment variable. Similarly, change
  117. CHUTNEY_LISTEN_ADDRESS_V6 for IPv6: it defaults to "no IPv6 address".
  118. Setting it to some interface's IP address allows us to make the simulated
  119. Tor network available on the network.
  120. IPv6 support for both Tor and Chutney is a work in progress. Currently,
  121. chutney verifies IPv6 client, bridge client (?), hidden service, and exit
  122. connections. It does not use IPv6 SOCKSPorts or HiddenServicePorts.
  123. The configuration files:
  124. networks/basic holds the configuration for the network you're configuring
  125. above. It refers to some torrc template files in torrc_templates/.
  126. The working files:
  127. chutney sticks its working files, including all data directories, log
  128. files, etc, in ./net/. Each tor instance gets a subdirectory of net/nodes.
  129. You can override the directory "./net" with the CHUTNEY_DATA_DIR
  130. environment variable.
  131. Test scripts:
  132. The test scripts are stored in the "scripts/chutney_tests" directory. These
  133. Python files must define a "run_test(network)" function. Files starting with
  134. an underscore ("_") are ignored.
  135. Test scripts can be run using the following syntax:
  136. ./chutney <script-name> networks/<network-name>
  137. The chutney verify command is implemented using a test script.
  138. Test scripts in the test directory with the same name as standard commands
  139. are run instead of that standard command. This allows expert users to replace
  140. the standard chutney commands with modified versions.