Commit 621c2aa8 authored by Niels Möller's avatar Niels Möller
Browse files

Some cleanups

Rev: src/testsuite/rapid7-lshd-test:1.2
parent 8aac25ef
#! /bin/sh
: ${LSHD:=lshd}
werror () {
echo 1>&2 "$1"
}
die () {
werror "$1"
exit 1
}
if [ -s hostkey ] ; then : ; else
echo 1>&2 Generating key
werror "Generating key"
lsh-keygen -a rsa -l 1000 | lsh-writekey -o hostkey
fi
LSH_YARROW_SEED_FILE=yarrow-seed-file
if [ -s "$LSH_YARROW_SEED_FILE" ] ; then : ; else
echo 1>&2 Generating seed
werror "Generating seed"
lsh-make-seed -o "$LSH_YARROW_SEED_FILE" --sloppy
fi
export LSH_YARROW_SEED_FILE
if lshd -h hostkey --interface=127.0.0.1 -p 5555 --pid-file=lshd-pid \
--daemon --no-syslog ; then : ; else
echo 1>&2 Starting lshd failed
exit 1
fi
werror "Testing $LSHD"
"$LSHD" -h hostkey --interface=127.0.0.1 -p 5555 --pid-file=lshd-pid \
--daemon --no-syslog \
|| die "Starting lshd failed"
sleep 2
trap "kill -HUP `cat lshd-pid`" 0
for f in rapid7-ssh-pdu/*.pdu ; do
echo 1>&2 "Testing $f"
tcpconnect 127.0.0.1 5555 < "$f" > /dev/null
if kill -0 `cat lshd-pid` ; then : ; else
echo 1>&2 "Server died"
exit 1
fi
werror "Testing $f"
tcpconnect 127.0.0.1 5555 < "$f" > /dev/null \
|| die "Connect failed"
kill -0 `cat lshd-pid` || die "Server died"
done
echo 1>&2 Done
kill -HUP "`cat lshd-pid`"
werror "Test done"
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment