diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1f85d650a90d8a93712d8c6c262c38c5c83e210..b55028c39f7b00c6b378a2206e3efbcc5cd708e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,24 +94,27 @@ basice2e: - basice2e/results/ - bin/ -basice2eTLS: - stage: tests - image: $DOCKER_IMAGE - script: - - mkdir -p ~/.elixxir - - echo $PWD - - cd basice2e - - for CONFIG in $(echo *.yaml); do echo $CONFIG; sed -i 's/cert\:\ \"\"/cert\:\ \"\.\.\/keys\/cmix\.rip\.crt\"/g' $CONFIG; sed -i 's/key\:\ \ \"\"/key\:\ \ \"\.\.\/keys\/cmix\.rip\.key\"/g' $CONFIG; done - - for CONFIG in $(echo *.yaml); do echo $CONFIG; sed -i 's/ertPath\:\ \"\"/ertPath\:\ \"\.\.\/keys\/cmix\.rip\.crt\"/g' $CONFIG; sed -i 's/keyPath\:\ \"\"/keyPath\:\ \"\.\.\/keys\/cmix\.rip\.key\"/g' $CONFIG; done - - sed -i "s/\"Tls\_certificate\"\:\ \"\"/\"Tls\_certificate\"\:\ \"$(awk -v ORS='\\n' '1' ../keys/cmix.rip.crt | sed -e 's/[\/&]/\\&/g')\"/g" ndf.json - - sed -i 's/\-\-noTLS//g' run.sh - - ./run.sh - - cd .. - artifacts: - when: always - paths: - - basice2e/ - - bin/ + +# NOTE: This was removed because of port conflicts with the base test. Instead +# we run in TLS mode by default and disable this version +# basice2eTLS: +# stage: tests +# image: $DOCKER_IMAGE +# script: +# - mkdir -p ~/.elixxir +# - echo $PWD +# - cd basice2e +# - for CONFIG in $(echo *.yaml); do echo $CONFIG; sed -i 's/cert\:\ \"\"/cert\:\ \"\.\.\/keys\/cmix\.rip\.crt\"/g' $CONFIG; sed -i 's/key\:\ \ \"\"/key\:\ \ \"\.\.\/keys\/cmix\.rip\.key\"/g' $CONFIG; done +# - for CONFIG in $(echo *.yaml); do echo $CONFIG; sed -i 's/ertPath\:\ \"\"/ertPath\:\ \"\.\.\/keys\/cmix\.rip\.crt\"/g' $CONFIG; sed -i 's/keyPath\:\ \"\"/keyPath\:\ \"\.\.\/keys\/cmix\.rip\.key\"/g' $CONFIG; done +# - sed -i "s/\"Tls\_certificate\"\:\ \"\"/\"Tls\_certificate\"\:\ \"$(awk -v ORS='\\n' '1' ../keys/cmix.rip.crt | sed -e 's/[\/&]/\\&/g')\"/g" ndf.json +# - sed -i 's/\-\-noTLS//g' run.sh +# - ./run.sh +# - cd .. +# artifacts: +# when: always +# paths: +# - basice2e/ +# - bin/ smokeinfra: stage: tests diff --git a/basice2e/clients.goldoutput/client42.txt b/basice2e/clients.goldoutput/client42.txt new file mode 100644 index 0000000000000000000000000000000000000000..e703c23d243adbf24187090d70e4b0d64977218f --- /dev/null +++ b/basice2e/clients.goldoutput/client42.txt @@ -0,0 +1,2 @@ +Received: Hello from Ben43, with E2E Encryption +Sending Message to 0, : Hello from Rick42, with E2E Encryption diff --git a/basice2e/clients.goldoutput/client43.txt b/basice2e/clients.goldoutput/client43.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f39f09a51e12165f52414eec0d5186b50fa0d46 --- /dev/null +++ b/basice2e/clients.goldoutput/client43.txt @@ -0,0 +1,2 @@ +Received: Hello from Rick42, with E2E Encryption +Sending Message to 0, : Hello from Ben43, with E2E Encryption diff --git a/basice2e/run.sh b/basice2e/run.sh index bad0394dd1d950a49fc42e3acc3741946f1c3a93..058c982273ee7fa7bfb105cb8644ec1c1e94cb8d 100755 --- a/basice2e/run.sh +++ b/basice2e/run.sh @@ -16,16 +16,24 @@ DUMMYOUT=results/dummy-console.txt UDBOUT=results/udb-console.txt CLIENTCLEAN=results/clients-cleaned -CLIENTOPTS="-v -n ndf.json --skipNDFVerification -P dummypassword --noTLS" +CLIENTOPTS="-v -n ndf.json --skipNDFVerification -P dummypassword " mkdir -p $SERVERLOGS mkdir -p $GATEWAYLOGS mkdir -p $CLIENTOUT mkdir -p $CLIENTCLEAN +# Start a user discovery bot server +echo "STARTING UDB..." +UDBCMD="../bin/udb -v --config udb.yaml " +$UDBCMD >> $UDBOUT 2>&1 & +PIDVAL=$! +echo $PIDVAL >> results/serverpids +echo "$UDBCMD -- $PIDVAL" + echo "STARTING SERVERS..." -PERMCMD="../bin/permissioning -c permissioning.yaml --noTLS" +PERMCMD="../bin/permissioning -c permissioning.yaml " $PERMCMD > $SERVERLOGS/permissioning.log 2>&1 & PIDVAL=$! echo "$PERMCMD -- $PIDVAL" @@ -33,7 +41,7 @@ echo "$PERMCMD -- $PIDVAL" for SERVERID in $(seq 5 -1 1) do IDX=$(($SERVERID - 1)) - SERVERCMD="../bin/server --disablePermissioning --noTLS -v -i $IDX --roundBufferTimeout 300s --config server-$SERVERID.yaml" + SERVERCMD="../bin/server --disablePermissioning -v -i $IDX --roundBufferTimeout 300s --config server-$SERVERID.yaml" if [ $SERVERID -eq 4 ]; then sleep 15 # This will force a CDE timeout fi @@ -48,7 +56,7 @@ sleep 5 # Give servers some time to boot for GWID in $(seq 5 -1 1) do IDX=$(($GWID - 1)) - GATEWAYCMD="../bin/gateway -v -i $IDX --disablePermissioning --noTLS --config gateway-$GWID.yaml" + GATEWAYCMD="../bin/gateway -v -i $IDX --disablePermissioning --config gateway-$GWID.yaml" $GATEWAYCMD > $GATEWAYLOGS/gateway-$GWID-console.txt 2>&1 & PIDVAL=$! echo "$GATEWAYCMD -- $PIDVAL" @@ -65,9 +73,9 @@ finish() { echo "KILLING $job" kill $job || true done - tail $SERVERLOGS/* - tail $CLIENTCLEAN/* - diff -ruN clients.goldoutput $CLIENTCLEAN + #tail $SERVERLOGS/* + #tail $CLIENTCLEAN/* + #diff -ruN clients.goldoutput $CLIENTCLEAN } trap finish EXIT @@ -110,31 +118,23 @@ runclients() { done } -# Start a user discovery bot server -UDBCMD="../bin/udb -v --config udb.yaml --noTLS" -$UDBCMD >> $UDBOUT 2>&1 & -PIDVAL=$! -echo $PIDVAL >> results/serverpids -echo "$UDBCMD -- $PIDVAL" - -echo "RUNNING CLIENTS..." +echo "RUNNING BASIC CLIENTS..." runclients -echo "RUNNING CLIENTS (2nd time)..." +echo "RUNNING BASIC CLIENTS (2nd time)..." runclients # Register two users and then do UDB search on each other +echo "REGISTERING AND SEARCHING WITH PRECANNED USERS..." CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob9 -E niamh@elixxir.io -i 9 -d 9 -m \"Hi\"" eval $CLIENTCMD >> $CLIENTOUT/client9.txt 2>&1 & PIDVAL=$! echo "$CLIENTCMD -- $PIDVAL" wait $PIDVAL - CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob18 -E bernardo@elixxir.io -i 18 -d 9 -s \"niamh@elixxir.io\" --keyParams 3,4,2,1.0,2" eval $CLIENTCMD >> $CLIENTOUT/client18.txt 2>&1 & PIDVAL=$! echo "$CLIENTCMD -- $PIDVAL" wait $PIDVAL - CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob9 -i 9 -d 18 -s \"bernardo@elixxir.io\" --keyParams 3,4,2,1.0,2" eval $CLIENTCMD >> $CLIENTOUT/client9.txt 2>&1 & PIDVAL=$! @@ -142,24 +142,64 @@ echo "$CLIENTCMD -- $PIDVAL" wait $PIDVAL # Send multiple E2E encrypted messages between users that discovered each other +echo "SENDING MESSAGES TO PRECANNED USERS AND FORCING A REKAY..." CLIENTCMD="timeout 180s ../bin/client $CLIENTOPTS -c 20 -w 20 -i 18 -d 9 -s \"niamh@elixxir.io\" -f blob18 -m \"Hello, 9, with E2E Encryption\" --end2end" eval $CLIENTCMD >> $CLIENTOUT/client18_rekey.txt 2>&1 || true & PIDVAL=$! echo "$CLIENTCMD -- $PIDVAL" - CLIENTCMD="timeout 180s ../bin/client $CLIENTOPTS -c 20 -w 20 -i 9 -d 18 -s \"bernardo@elixxir.io\" -f blob9 -m \"Hello, 18, with E2E Encryption\" --end2end" eval $CLIENTCMD >> $CLIENTOUT/client9_rekey.txt 2>&1 || true & PIDVAL=$! echo "$CLIENTCMD -- $PIDVAL" - set +e wait $PIDVAL || true -# CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob9 -E rick42@elixxir.io -i 9 -d 9 -m \"Hi\"" -# eval $CLIENTCMD >> $CLIENTOUT/client9.txt 2>&1 & -# PIDVAL=$! -# echo "$CLIENTCMD -- $PIDVAL" -# wait $PIDVAL + +# Register non-precanned users +echo "REGISTERING NEW USERS..." +CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob42 -E rick42@elixxir.io" +eval $CLIENTCMD >> $CLIENTOUT/client42.txt 2>&1 & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob43 -E ben43@elixxir.io" +eval $CLIENTCMD >> $CLIENTOUT/client43.txt 2>&1 & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 + +# Have each non-precanned user search for each other +echo "SEARCHING FOR NEW USERS..." +CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob42 -s \"ben43@elixxir.io\" --keyParams 3,4,2,1.0,2" +eval $CLIENTCMD >> $CLIENTOUT/client42.txt 2>&1 & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +CLIENTCMD="timeout 60s ../bin/client $CLIENTOPTS -f blob43 -s \"rick42@elixxir.io\" --keyParams 3,4,2,1.0,2" +eval $CLIENTCMD >> $CLIENTOUT/client43.txt 2>&1 & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 + +# Extract generated user name from logs +echo "EXTRACTING USER IDs FROM LOG FILES..." +TMPID=$(cat $CLIENTOUT/client42.txt | grep "Successfully registered user" | awk -F' ' '{print $8}') +RICKID=${TMPID%?} # remove ! from end +TMPID=$(cat $CLIENTOUT/client43.txt | grep "Successfully registered user" | awk -F' ' '{print $8}') +BENID=${TMPID%?} # remove ! from end + +# Non-precanned user messaging +echo "SENDING E2E MESSAGES TO NEW USERS..." +CLIENTCMD="timeout 180s ../bin/client $CLIENTOPTS -c 1 -w 1 --dest64 $BENID -s \"ben43@elixxir.io\" -f blob42 -m \"Hello from Rick42, with E2E Encryption\" --end2end" +eval $CLIENTCMD >> $CLIENTOUT/client42.txt 2>&1 || true & +PIDVAL=$! +echo "$CLIENTCMD -- $PIDVAL" +CLIENTCMD="timeout 180s ../bin/client $CLIENTOPTS -c 1 -w 1 --dest64 $RICKID -s \"rick42@elixxir.io\" -f blob43 -m \"Hello from Ben43, with E2E Encryption\" --end2end" +eval $CLIENTCMD >> $CLIENTOUT/client43.txt 2>&1 || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL" +wait $PIDVAL +wait $PIDVAL2 # FIXME: Go into client and clean up it's output so this is not necessary @@ -176,6 +216,12 @@ head -10 $CLIENTCLEAN/client9_rekey.txt | strings | grep -v "\.\.\." > $CLIENTCL head -10 $CLIENTCLEAN/client18_rekey.txt | strings | grep -v "\.\.\." > $CLIENTCLEAN/client18.txt || true rm $CLIENTCLEAN/client9_rekey.txt $CLIENTCLEAN/client18_rekey.txt || true + +strings $CLIENTCLEAN/client42.txt | grep -v "\.\.\." > $CLIENTCLEAN/client42-clean.txt || true +strings $CLIENTCLEAN/client43.txt | grep -v "\.\.\." > $CLIENTCLEAN/client43-clean.txt || true +mv $CLIENTCLEAN/client42-clean.txt $CLIENTCLEAN/client42.txt +mv $CLIENTCLEAN/client43-clean.txt $CLIENTCLEAN/client43.txt + for C in $(ls -1 $CLIENTCLEAN); do sort -o tmp $CLIENTCLEAN/$C || true uniq tmp $CLIENTCLEAN/$C || true @@ -183,6 +229,9 @@ done set -e + +echo "TESTS EXITED SUCCESSFULLY, CHECKING OUTPUT..." +set +x diff -ruN clients.goldoutput $CLIENTCLEAN cat $CLIENTOUT/* | strings | grep -e "ERROR" -e "FATAL" > results/client-errors || true @@ -198,4 +247,4 @@ cat $GATEWAYLOGS/*.log | grep "ERROR" | grep -v "context" | grep -v "certificate cat $GATEWAYLOGS/*.log | grep "FATAL" | grep -v "context" >> results/gateway-errors.txt || true diff -ruN results/gateway-errors.txt noerrors.txt -echo "SUCCESS!" +echo "NO OUTPUT ERRORS, SUCCESS!" diff --git a/basice2e/server-1.yaml b/basice2e/server-1.yaml index e9862cce0bdbd1cc9447dbe0b59b736d0e7471ef..653b133f567f0c600cc9fd150a4ece0cbed45390 100644 --- a/basice2e/server-1.yaml +++ b/basice2e/server-1.yaml @@ -6,6 +6,7 @@ ################################################################################ # batch size batch: 4 +skipReg: true # debug logging verbose: true node: diff --git a/basice2e/server-2.yaml b/basice2e/server-2.yaml index db14b13b89d89ea3a24aecbebd9b1c9371028a30..ab7f577100b864669d873e86e3ed080744f39574 100644 --- a/basice2e/server-2.yaml +++ b/basice2e/server-2.yaml @@ -6,6 +6,7 @@ ################################################################################ # batch size batch: 4 +skipReg: true # debug logging verbose: true node: diff --git a/basice2e/server-3.yaml b/basice2e/server-3.yaml index 4601b93f9203a9a8a450e1b1060465aa6ce5a580..a7de0eb74dcdbd5d87fc6ca752b0db3d527579e9 100644 --- a/basice2e/server-3.yaml +++ b/basice2e/server-3.yaml @@ -6,6 +6,7 @@ ################################################################################ # batch size batch: 4 +skipReg: true # debug logging verbose: true node: diff --git a/basice2e/server-4.yaml b/basice2e/server-4.yaml index b1283e4b0e6cb56d72d698df7a2c34479b5ceffd..8a54e9398e1aa3da852646585e1f41bb7f0aab2a 100644 --- a/basice2e/server-4.yaml +++ b/basice2e/server-4.yaml @@ -6,6 +6,7 @@ ################################################################################ # batch size batch: 4 +skipReg: true # debug logging verbose: true node: diff --git a/basice2e/server-5.yaml b/basice2e/server-5.yaml index 8d7a42f07fbfa686e64bc83edfb83c8088206a27..3b5671057126dcf462b9bd1a44806a93b580811d 100644 --- a/basice2e/server-5.yaml +++ b/basice2e/server-5.yaml @@ -6,6 +6,7 @@ ################################################################################ # batch size batch: 4 +skipReg: true # debug logging verbose: true node: