e2e test will not loop infinitely
This commit is contained in:
parent
96ddac09ba
commit
fc9cd704db
2 changed files with 10 additions and 9 deletions
|
|
@ -3,8 +3,6 @@ LABEL maintainer="Boshi Lian<farmer1992@gmail.com>"
|
|||
|
||||
RUN apt-get update && apt-get install -y libpam0g-dev libpam-google-authenticator
|
||||
|
||||
RUN ln -sf /usr/include/security/_pam_types.h /usr/include/security/pam_types.h
|
||||
|
||||
ADD . /go/src/github.com/tg123/sshpiper/
|
||||
RUN go install -ldflags "$(/go/src/github.com/tg123/sshpiper/sshpiperd/ldflags.sh)" -tags pam github.com/tg123/sshpiper/sshpiperd
|
||||
|
||||
|
|
@ -13,4 +11,4 @@ EXPOSE 2222
|
|||
ADD entrypoint.sh /
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["/go/bin/sshpiperd"]
|
||||
CMD ["/go/bin/sshpiperd", "daemon"]
|
||||
|
|
|
|||
|
|
@ -9,15 +9,19 @@ ssh-keygen -N '' -f /workingdir/host1/id_rsa
|
|||
/bin/cp /local/id_rsa.pub /workingdir/host1/authorized_keys
|
||||
/bin/cp /workingdir/host1/id_rsa.pub /host1/authorized_keys
|
||||
|
||||
chmod 600 /workingdir/host1/authorized_keys
|
||||
chmod 600 /host1/authorized_keys
|
||||
|
||||
echo "root@host1" > /workingdir/host1/sshpiper_upstream
|
||||
chmod 600 /workingdir/host1/sshpiper_upstream
|
||||
|
||||
echo "root@host2" > /workingdir/host2/sshpiper_upstream
|
||||
chmod 600 /workingdir/host2/sshpiper_upstream
|
||||
|
||||
|
||||
fail="\033[0;31mFAIL\033[0m"
|
||||
succ="\033[0;32mSUCC\033[0m"
|
||||
|
||||
|
||||
runtest(){
|
||||
casename=$1
|
||||
host=$2
|
||||
|
|
@ -43,13 +47,12 @@ runtest(){
|
|||
|
||||
if [ $? -ne 0 ];then
|
||||
echo -e "welcome text" $fail
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
|
||||
runtest "host1 with public key:" "host1" "ssh host1@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /local/id_rsa cat /names/host1"
|
||||
runtest "host2 with password:" "host2" "sshpass -p root ssh host2@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host2"
|
||||
|
||||
sleep 2
|
||||
done
|
||||
runtest "host1 with public key:" "host1" "ssh host1@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /local/id_rsa cat /names/host1"
|
||||
runtest "host2 with password:" "host2" "sshpass -p root ssh host2@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host2"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue