Skip to contentSkip to conversation

ssh-stress: Add hostkey generation

PATCH New Joerg Vehlow 2 participants 3 messages Jun 21, 2021 – Jun 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssh-stress: Add hostkey generation

From: Joerg Vehlow <[email protected]>

If not specified, default host keys (in /etc/ssh) are used. If the keys do not exist, the test will fail or sshd will try to create the keys in the default location.

---
 testcases/network/stress/ssh/ssh-stress.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
testcases/network/stress/ssh/ssh-stress.sh +8 -1
index 997ad21db..baf1a7896 100755
@@ -11,7 +11,7 @@ TST_TESTFUNC="test"
 TST_CNT=3
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="sshd ssh od pkill pgrep"
+TST_NEEDS_CMDS="sshd ssh ssh-keygen od pkill pgrep"
 
 . tst_net.sh
 
@@ -56,8 +56,15 @@ TCPKeepAlive yes
 UseDNS no
 StrictModes no
 PidFile $TST_TMPDIR/sshd.pid
+HostKey $TST_TMPDIR/ssh_host_rsa_key
+HostKey $TST_TMPDIR/ssh_host_ecdsa_key
+HostKey $TST_TMPDIR/ssh_host_ed25519_key
 EOF
 
+	ssh-keygen -q -N "" -t rsa -b 4096 -f $TST_TMPDIR/ssh_host_rsa_key
+	ssh-keygen -q -N "" -t ecdsa -f $TST_TMPDIR/ssh_host_ecdsa_key
+	ssh-keygen -q -N "" -t ed25519 -f $TST_TMPDIR/ssh_host_ed25519_key
+
 	tst_res TINFO "Generate configuration file and key at the remote host"
 	tst_rhost_run -s -c "ssh-keygen -t rsa -N \"\" -f $TST_TMPDIR/id_rsa \
 		>/dev/null"
Signature · 1 line
2.25.1