1# $OpenBSD: reconfigure.sh,v 1.9 2021/06/10 09:46:28 dtucker Exp $ 2# Placed in the Public Domain. 3 4tid="simple connect after reconfigure" 5 6# we need the full path to sshd for -HUP 7start_sshd 8 9trace "connect before restart" 10${SSH} -F $OBJ/ssh_config somehost true 11if [ $? -ne 0 ]; then 12 fail "ssh connect with failed before reconfigure" 13fi 14 15PID=`$SUDO cat $PIDFILE` 16rm -f $PIDFILE 17$SUDO kill -HUP $PID 18 19trace "wait for sshd to restart" 20i=0; 21while [ ! -f $PIDFILE -a $i -lt 10 ]; do 22 i=`expr $i + 1` 23 sleep $i 24done 25 26test -f $PIDFILE || fatal "sshd did not restart" 27 28trace "connect after restart" 29${SSH} -F $OBJ/ssh_config somehost true 30if [ $? -ne 0 ]; then 31 fail "ssh connect with failed after reconfigure" 32fi 33 34trace "reconfigure with active clients" 35${SSH} -F $OBJ/ssh_config somehost sleep 10 # authenticated client 36${NC} -d 127.0.0.1 $PORT >/dev/null & # unauthenticated client 37PID=`$SUDO cat $PIDFILE` 38rm -f $PIDFILE 39$SUDO kill -HUP $PID 40 41trace "wait for sshd to restart" 42i=0; 43while [ ! -f $PIDFILE -a $i -lt 10 ]; do 44 i=`expr $i + 1` 45 sleep $i 46done 47 48test -f $PIDFILE || fatal "sshd did not restart" 49 50trace "connect after restart with active clients" 51${SSH} -F $OBJ/ssh_config somehost true 52if [ $? -ne 0 ]; then 53 fail "ssh connect with failed after reconfigure" 54fi 55