Commit d4d26ad0 authored by George Kadianakis's avatar George Kadianakis
Browse files

Introduce a script to setup chutney for v3 onions.

This does nothing without the corresponding v3 functional tests tho.

It also assumes a v3 chutney network template that looks like this:

	# By default, Authorities are not configured as exits
	Authority = Node(tag="a", authority=1, relay=1, torrc="authority.tmpl")
	ExitRelay = Node(tag="r", relay=1, exit=1, torrc="relay.tmpl")
	Client = Node(tag="c", client=1, torrc="client.tmpl")
	HS = Node(tag="h", hs=1, torrc="hs-v3.tmpl")

	# We need 5 authorities/relays/exits to ensure we can build HS connections
	NODES = Authority.getN(3) + ExitRelay.getN(5) + \
	        Client.getN(2) + HS.getN(4)
parent 6ee8eaf7
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
#!/bin/bash
# Script to install Chutney, configure a Tor network and wait for the hidden
# service system to be available.
git clone https://git.torproject.org/chutney.git
cd chutney
# Stop chutney network if it is already running
./chutney stop networks/hs-ob-v3
./chutney configure networks/hs-ob-v3
./chutney start networks/hs-ob-v3
./chutney status networks/hs-ob-v3

# Retry verify until hidden service subsystem is working
n=0
until [ $n -ge 20 ]
do
  output=$(./chutney verify networks/hs-v3)
  # Check if chutney output included 'Transmission: Success'.
  if [[ $output == *"Transmission: Success"* ]]; then
    hs_address=$(echo $output | grep -Po "([a-z2-7]{56}.onion:\d{2,5})")
    client_address=$(echo $output | grep -Po -m 1 "(localhost:\d{2,5})" | head -n1)
    echo "HS system running with service available at $hs_address"
    export CHUTNEY_ONION_ADDRESS="$hs_address"
    export CHUTNEY_CLIENT_PORT="$client_address"
    break
  else
    echo "HS system not running yet. Sleeping 15 seconds"
    n=$[$n+1]
    sleep 15
  fi
done
cd ..