Skip to content

Commit f427e1d

Browse files
Vasileios Almpanispevik
authored andcommitted
ssh-stress: disable resource penalties
Our tests create a number of ssh sessions in the background which are immediately killed. Some of them haven't finished the authentication stage yet and they close the connection incurring penalties from the ssh daemon. debug1: srclimit_penalise: active penalty for ipv4 10.0.0.1/32 already exists, 16 seconds remaining Then when we try to reconnect to the daemon we are bounced because of the active penalty which leads to a failed test. ssh-stress 1 TINFO: Killing all ssh sessions kex_exchange_identification: read: Connection reset by peer Connection reset by fd00:1:1:1::2 port 58373 ssh-stress 1 TFAIL: SSH not reachable >From the sshd logs we can see debug1: srclimit_penalise: active penalty for ipv4 10.0.0.1/32 already exists, 16 seconds remaining This feature was added to OpenSSH 9.8 in the 2024 release in the 81c1099d2 commit. Lets disable penalties for the versions that support them. Link: https://lore.kernel.org/ltp/20251222141331.121827-1-vasileios.almpanis@virtuozzo.com/ Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com> [ pvorel: fix version check, simplify version evaluation ] Signed-off-by: Petr Vorel <pvorel@suse.cz>
1 parent 98d1af9 commit f427e1d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

testcases/network/stress/ssh/ssh-stress.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ cleanup()
3939

4040
setup()
4141
{
42-
local port rc
42+
local port rc version
43+
local major=0 minor=0
4344

45+
version=$(sshd -V 2>&1 | sed -nE 's/^.*OpenSSH_([0-9]+)\.([0-9]+).*$/\1 \2/p' | head -n1)
46+
set -- $version
47+
major=$1
48+
minor=$2
4449

4550
port=$(tst_rhost_run -c "tst_get_unused_port ipv${TST_IPVER} stream")
4651

@@ -60,6 +65,11 @@ HostKey $TST_TMPDIR/ssh_host_ecdsa_key
6065
HostKey $TST_TMPDIR/ssh_host_ed25519_key
6166
EOF
6267

68+
if [ "$major" -gt 9 ] || [ "$major" -eq 9 -a "$minor" -ge 8 ]; then
69+
cat << EOF >> sshd_config
70+
PerSourcePenalties no
71+
EOF
72+
fi
6373
ssh-keygen -q -N "" -t rsa -b 4096 -f $TST_TMPDIR/ssh_host_rsa_key
6474
ssh-keygen -q -N "" -t ecdsa -f $TST_TMPDIR/ssh_host_ecdsa_key
6575
ssh-keygen -q -N "" -t ed25519 -f $TST_TMPDIR/ssh_host_ed25519_key

0 commit comments

Comments
 (0)