Skip to content
Snippets Groups Projects
Select Git revision
  • d0540d44c062263192534096a781225c493b6164
  • release default protected
  • master protected
  • hotfix/GrpcParameters
  • XX-4441
  • tls-websockets
  • hotfix/allow-web-creds
  • hotfix/nilCert
  • XX-3566_const_time_token_compare
  • AceVentura/AccountBackup
  • dev
  • waitingRoundsRewrite
  • fullRateLimit
  • XX-3564/TlsCipherSuite
  • XX-3563/DisableTlsCheck
  • notls
  • url-repo-rename
  • perftuning
  • Anne/CI2
  • AddedGossipLogging
  • hotfix/connectionReduction
  • v0.0.6
  • v0.0.4
  • v0.0.5
  • v0.0.3
  • v0.0.2
  • v0.0.1
27 results

host.go

Blame
  • run.sh 5.23 KiB
    #!/bin/bash
    
    set -e
    
    rm -fr results.bak || true
    mv results results.bak || rm -fr results || true
    rm -fr blob* || true
    rm *-contact.json || true
    
    if [ $# -gt 3 ]
    then
        echo "usage: $0 [gatewayip:port] [sleepTime] [numSends]"
        exit
    fi
    
    NETWORKENTRYPOINT=$1
    
    SLEEPTIME=$2
    
    NUMSENDS=$3
    
    DEBUGLEVEL=${DEBUGLEVEL-1}
    
    SERVERLOGS=results/servers
    GATEWAYLOGS=results/gateways
    CLIENTOUT=results/clients
    UDBOUT=results/udb-console.txt
    CLIENTCLEAN=results/clients-cleaned
    
    CLIENTOPTS="--password hello --ndf results/ndf.json --waitTimeout 240 --unsafe-channel-creation -v $DEBUGLEVEL"
    CLIENTUDOPTS="--password hello --ndf results/ndf.json -v $DEBUGLEVEL"
    CLIENTSINGLEOPTS="--password hello --ndf results/ndf.json -v $DEBUGLEVEL"
    CLIENTGROUPOPTS="--password hello --ndf results/ndf.json -v $DEBUGLEVEL"
    CLIENTFILETRANSFEROPTS="--password hello --ndf results/ndf.json -v $DEBUGLEVEL"
    
    mkdir -p $SERVERLOGS
    mkdir -p $GATEWAYLOGS
    mkdir -p $CLIENTOUT
    mkdir -p $CLIENTCLEAN
    
    echo "Connecting to network defined at $NETWORKENTRYPOINT"
    echo $NETWORKENTRYPOINT > results/startgwserver.txt
    echo "Sleep time $SLEEPTIME"
    echo "Num sends $NUMSENDS"
    
    echo "DOWNLOADING TLS Cert..."
    CMD="openssl s_client -showcerts -connect $(cat results/startgwserver.txt)"
    echo $CMD
    eval $CMD < /dev/null 2>&1 > "results/startgwcert.bin"
    CMD="cat results/startgwcert.bin | openssl x509 -outform PEM"
    echo $CMD
    eval $CMD > "results/startgwcert.pem"
    head "results/startgwcert.pem"
    
    echo "DOWNLOADING NDF..."
    CLIENTCMD="../bin/client getndf --gwhost $(cat results/startgwserver.txt) --cert results/startgwcert.pem"
    eval $CLIENTCMD >> results/ndf.json 2>&1 &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    
    cat results/ndf.json | jq . | head -5
    
    file results/ndf.json
    
    if [ ! -s results/ndf.json ]
    then
        echo "results/ndf.json is empty, cannot proceed"
        exit -1
    fi
    
    #export GRPC_GO_LOG_VERBOSITY_LEVEL=99
    #export GRPC_GO_LOG_SEVERITY_LEVEL=info
    
    # Non-precanned E2E user messaging
    echo "SENDING E2E MESSAGES TO NEW USERS..."
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client42.log -s blob42 --writeContact $CLIENTOUT/rick42-contact.bin --unsafe -m \"Hello from Rick42 to myself, without E2E Encryption\""
    eval $CLIENTCMD >> $CLIENTOUT/client42.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client43.log -s blob43 --writeContact $CLIENTOUT/ben43-contact.bin --destfile $CLIENTOUT/rick42-contact.bin --send-auth-request --sendCount 0 --receiveCount 0"
    eval $CLIENTCMD >> $CLIENTOUT/client43.txt || true &
    PIDVAL2=$!
    echo "$CLIENTCMD -- $PIDVAL"
    
    while [ ! -s $CLIENTOUT/ben43-contact.bin ]; do
        sleep 1
        echo -n "."
    done
    
    TMPID=$(cat $CLIENTOUT/client42.log | grep -a "User\:" | awk -F' ' '{print $5}')
    RICKID=${TMPID}
    echo "RICK ID: $RICKID"
    TMPID=$(cat $CLIENTOUT/client43.log | grep -a "User\:" | awk -F' ' '{print $5}')
    BENID=${TMPID}
    echo "BEN ID: $BENID"
    
    # Client 42 will now wait for client 43's E2E Auth channel request and confirm
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client42.log -s blob42 --destfile $CLIENTOUT/ben43-contact.bin --sendCount 0 --receiveCount 0"
    eval $CLIENTCMD >> $CLIENTOUT/client42.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    wait $PIDVAL2
    
    
    # Do some basic e2e sending to make sure everything is set up properly
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS --verify-sends -l $CLIENTOUT/client42.log -s blob42  --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\""
    eval $CLIENTCMD >> $CLIENTOUT/client42.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS --verify-sends -l $CLIENTOUT/client43.log -s blob43  --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\""
    eval $CLIENTCMD >> $CLIENTOUT/client43.txt || true &
    PIDVAL2=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    wait $PIDVAL2
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS --verify-sends -l $CLIENTOUT/client42.log -s blob42  --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\""
    eval $CLIENTCMD >> $CLIENTOUT/client42.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS --verify-sends -l $CLIENTOUT/client43.log -s blob43  --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\""
    eval $CLIENTCMD >> $CLIENTOUT/client43.txt || true &
    PIDVAL2=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    wait $PIDVAL2
    
    sleep 15
    
    # Client 42 sends to client 43 with verified-sends on
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client42-wv.log -s blob42  --destid b64:$BENID --sendCount $NUMSENDS --receiveCount 0 --verify-sends -m \"Hello from Rick42, but verified this time\""
    eval $CLIENTCMD >> $CLIENTOUT/client42-wv.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL
    
    # Wait the specified duration
    sleep $SLEEPTIME
    
    # Client 43 runs and looks for the messages from client 42
    CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client43-wv.log -s blob43  --destid b64:$RICKID --sendCount 0 --receiveCount $NUMSENDS"
    eval $CLIENTCMD >> $CLIENTOUT/client43-wv.txt || true &
    PIDVAL=$!
    echo "$CLIENTCMD -- $PIDVAL"
    wait $PIDVAL