2021-06-10 11:46:28 +02:00
|
|
|
# $OpenBSD: reconfigure.sh,v 1.9 2021/06/10 09:46:28 dtucker Exp $
|
2003-06-18 14:18:57 +02:00
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
tid="simple connect after reconfigure"
|
|
|
|
|
|
|
|
# we need the full path to sshd for -HUP
|
2015-02-26 01:58:22 +01:00
|
|
|
if test "x$USE_VALGRIND" = "x" ; then
|
|
|
|
case $SSHD in
|
|
|
|
/*)
|
|
|
|
# full path is OK
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# otherwise make fully qualified
|
|
|
|
SSHD=$OBJ/$SSHD
|
|
|
|
esac
|
|
|
|
fi
|
2003-06-18 14:18:57 +02:00
|
|
|
|
|
|
|
start_sshd
|
|
|
|
|
2015-01-14 10:54:38 +01:00
|
|
|
trace "connect before restart"
|
2017-05-01 01:34:55 +02:00
|
|
|
${SSH} -F $OBJ/ssh_config somehost true
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh connect with failed before reconfigure"
|
|
|
|
fi
|
2015-01-14 10:54:38 +01:00
|
|
|
|
2010-08-12 18:43:13 +02:00
|
|
|
PID=`$SUDO cat $PIDFILE`
|
2005-11-12 11:30:07 +01:00
|
|
|
rm -f $PIDFILE
|
|
|
|
$SUDO kill -HUP $PID
|
2003-06-18 14:18:57 +02:00
|
|
|
|
|
|
|
trace "wait for sshd to restart"
|
|
|
|
i=0;
|
|
|
|
while [ ! -f $PIDFILE -a $i -lt 10 ]; do
|
|
|
|
i=`expr $i + 1`
|
|
|
|
sleep $i
|
|
|
|
done
|
|
|
|
|
|
|
|
test -f $PIDFILE || fatal "sshd did not restart"
|
|
|
|
|
2015-01-14 10:54:38 +01:00
|
|
|
trace "connect after restart"
|
2017-05-01 01:34:55 +02:00
|
|
|
${SSH} -F $OBJ/ssh_config somehost true
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh connect with failed after reconfigure"
|
|
|
|
fi
|
2021-06-10 05:45:31 +02:00
|
|
|
|
|
|
|
trace "reconfigure with active clients"
|
|
|
|
${SSH} -F $OBJ/ssh_config somehost sleep 10 # authenticated client
|
|
|
|
${NC} -d 127.0.0.1 $PORT >/dev/null & # unauthenticated client
|
2021-06-10 11:46:28 +02:00
|
|
|
PID=`$SUDO cat $PIDFILE`
|
2021-06-10 05:45:31 +02:00
|
|
|
rm -f $PIDFILE
|
|
|
|
$SUDO kill -HUP $PID
|
|
|
|
|
|
|
|
trace "wait for sshd to restart"
|
|
|
|
i=0;
|
|
|
|
while [ ! -f $PIDFILE -a $i -lt 10 ]; do
|
|
|
|
i=`expr $i + 1`
|
|
|
|
sleep $i
|
|
|
|
done
|
|
|
|
|
|
|
|
test -f $PIDFILE || fatal "sshd did not restart"
|
|
|
|
|
|
|
|
trace "connect after restart with active clients"
|
|
|
|
${SSH} -F $OBJ/ssh_config somehost true
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh connect with failed after reconfigure"
|
|
|
|
fi
|