github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/apps/mixnet/scripts/run_random.sh (about) 1 #!/bin/bash 2 source ./define.sh 3 4 # These should be run as root. 5 $GOPATH/bin/tao host init -tao_domain $DOMAIN -hosting process -root -pass $PASSWORD 6 sudo -E $GOPATH/bin/tao host start -tao_domain $DOMAIN -host linux_tao_host -pass $PASSWORD & 7 sleep 2 8 9 # 10 # Starting the programs should be done as the unprivileged user it runs for 11 # to provide isolation. 12 # We run as root for conveniencea to avoid script clutter. 13 # 14 dir_addr="127.0.0.1:8000" 15 start_port=8001 16 echo "Starting directory..." 17 $GOPATH/bin/tao run -tao_domain $DOMAIN $DOMAINROOT/mixnet_directory --addr $dir_addr --config $DOMAIN/tao.config & 18 sleep 0.5 19 20 directory_file=/tmp/directories 21 echo $dir_addr > $directory_file 22 23 # Start 6 routers 24 router_pids="" 25 echo "Starting routers..." 26 for i in `seq 0 5`; 27 do 28 port=$[$start_port+$i] 29 $GOPATH/bin/tao run -tao_domain $DOMAIN $DOMAINROOT/mixnet_router --addr 127.0.0.1:$port --dirs $directory_file --config $DOMAIN/tao.config --batch 2 & 30 router_pids="$router_pids $!" 31 sleep 0.3 32 done 33 34 # Start mixnet proxies; proxies will pick one of 4 paths 35 proxy_start_port=9000 36 proxy_pids="" 37 echo "Starting proxies..." 38 for i in `seq 0 15`; 39 do 40 port=$[$proxy_start_port+$i] 41 $GOPATH/bin/tao run -tao_domain $DOMAIN $DOMAINROOT/mixnet_proxy --addr :$port --dirs $directory_file --config $DOMAIN/tao.config --hops 3 & 42 proxy_pids="$proxy_pids $!" 43 sleep 0.3 44 done 45 46 # Start echo TLS server 47 dest_port=10000 48 echo "Starting echo TLS server..." 49 $DOMAINROOT/mixnet_simpleserver --addr :$dest_port --cert $DOMAIN/mixnet_simpleserver/cert.pem --key $DOMAIN/mixnet_simpleserver/key.pem & 50 dest_pid=$! 51 sleep 0.3 52 53 # Start all the clients 54 clients_pids="" 55 echo "Starting simpleclients..." 56 for i in `seq 0 15`; 57 do 58 port=$[$proxy_start_port+$i] 59 $DOMAINROOT/mixnet_simpleclient --proxy_addr 127.0.0.1:$port --dest_addr 127.0.0.1:$dest_port --id $i& 60 clients_pids="$clients_pids $!" 61 done 62 63 for pid in $clients_pids; do 64 wait $pid 65 done 66 67 for pid in $proxy_pids; do 68 kill $pid 69 done 70 71 for pid in $router_pids; do 72 kill $pid 73 done 74 75 kill $dest_pid 76 77 #sudo pkill -f "$DOMAIN"