fix: tests: 900-strict-checking.sh: more resilient version of the change_host_keys step

multifixes
Stéphane Lesimple 2 days ago committed by Stéphane Lesimple
parent fcba07b130
commit 58f42bbb29

@ -23,10 +23,12 @@ testsuite_strict_checking()
contain "Permanently added"
# change the remote hostkeys, and get the proper sshd PID so that we can force it to reload
success change_host_keys $r0 "\"find /etc/ssh/ -type f -name 'ssh_host_*key*' -print -delete; ssh-keygen -A; ps faxu; printf %s SSHD_PIDS=; ps ax -o pid,args | grep -E '^ *[0-9]+ +(sshd: .+listener|/usr/sbin/sshd)' | awk '{print \\\$1}' | tr '\\\n' ' '\""
success change_host_keys $r0 "\"find /etc/ssh/ -type f -name 'ssh_host_*key*' -print -delete; ssh-keygen -A; ps faxu; printf %s SSHD_PIDS=; ps ax -o pid,args | grep -E '^ *[0-9]+ +(sshd: .+listener|/usr/sbin/sshd)' | awk '{print \\\$1}' | tr '\\\n' ' '; echo\""
contain 'generating new host keys'
contain REGEX 'SSHD_PIDS=[0-9]'
local sshd_pids
sshd_pids=$(get_stdout | grep SSHD_PIDS= | cut -d= -f2-)
sshd_pids=$(get_stdout | grep -Eo 'SSHD_PIDS=[0-9 ]+' | cut -d= -f2)
infomsg "detected sshd PIDs are: $sshd_pids"
success reload_target_sshd $r0 "\"kill -HUP $sshd_pids\""

Loading…
Cancel
Save