README 6.3 KB

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