1 # $OpenBSD: reconfigure.sh,v 1.5 2015/03/03 22:35:19 markus Exp $ 2 # Placed in the Public Domain. 3 4 tid="simple connect after reconfigure" 5 6 # we need the full path to sshd for -HUP 7 if test "x$USE_VALGRIND" = "x" ; then 8 case $SSHD in 9 /*) 10 # full path is OK 11 ;; 12 *) 13 # otherwise make fully qualified 14 SSHD=$OBJ/$SSHD 15 esac 16 fi 17 18 start_sshd 19 20 trace "connect before restart" 21 for p in ${SSH_PROTOCOLS} ; do 22 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true 23 if [ $? -ne 0 ]; then 24 fail "ssh connect with protocol $p failed before reconfigure" 25 fi 26 done 27 28 PID=`$SUDO cat $PIDFILE` 29 rm -f $PIDFILE 30 $SUDO kill -HUP $PID 31 32 trace "wait for sshd to restart" 33 i=0; 34 while [ ! -f $PIDFILE -a $i -lt 10 ]; do 35 i=`expr $i + 1` 36 sleep $i 37 done 38 39 test -f $PIDFILE || fatal "sshd did not restart" 40 41 trace "connect after restart" 42 for p in ${SSH_PROTOCOLS} ; do 43 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true 44 if [ $? -ne 0 ]; then 45 fail "ssh connect with protocol $p failed after reconfigure" 46 fi 47 done 48