Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions auth_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
#
# This is a set of commands to run and verify they work before doing a new release.
# Eventually they should also use the -J flag to generate JSON output, and a program should
# be written to check the output.
# Be sure to test both client and server on Linux, BSD, and OSX
#

#
set -x

binary=./src/iperf3
output=/tmp/iperf3_auth_tmp.txt

# Generate keys and authorized user file

#sudo apt-get install libssl-dev
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem

#user,sha256(pwd)
S_USER=mario S_PASSWD=luigi
echo $U_USER
SHA=$(echo -n "{$S_USER}$S_PASSWD" | sha256sum | awk '{ print $1 }')
echo ${S_USER},${SHA} > authorized-user.txt
cat authorized-user.txt

# Run Server

${binary} -s --rsa-private-key-path=./private.pem --authorized-user=./authorized-user.txt &> ${output} &

# Run Client

IPERF3_PASSWORD=${S_PASSWD} ${binary} -c localhost --rsa-public-key-path=./public.pem --username=${S_USER}
IPERF3_PASSWORD="very incorrect" ${binary} -c localhost --rsa-public-key-path=./public.pem --username=${S_USER}
IPERF3_PASSWORD="very,very,very, incorrect, and really, really, really, really, really long. Just to check." ${binary} -c localhost --rsa-public-key-path=./public.pem --username=${S_USER}
IPERF3_PASSWORD=${S_PASSWD} ${binary} -c localhost --rsa-public-key-path=./public.pem --username=${S_USER}

pkill ${binary}

cat ${output}
rm ${output}