Skip to contentSkip to conversation

ssh-stress: Convert to new api

PATCH Superseded Joerg Vehlow 3 participants 9 messages Jun 16, 2021 – Jun 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

From: Joerg Vehlow <[email protected]>

Apart from pure conversion:
- Use "StrictModes no" in ssh config, to get rid of
access permission problems; All part of the path of the authorized_keys file must not be writeable by anyone but the owner. This allows writing the file to the default temp directory
- Moved all rhost scripts into ssh-stress.sh

Changes in v3:
- use pkill instead of ps | awk | xargs
- Changed test descriptions slightly
* include actual ip version
* dropped "for a long time", the tests do not run for a long time with the default config
- Use netstress -B and ssh -f for background processes This implies using pgrep to get the pids of these processes.

---
 .../network/stress/ssh/00_Descriptions.txt    |  11 -
 testcases/network/stress/ssh/Makefile         |  24 +-
 testcases/network/stress/ssh/ssh-stress.sh    | 259 ++++++++++++------
 .../network/stress/ssh/ssh-stress01-rmt.sh    |  65 -----
 .../network/stress/ssh/ssh-stress02-rmt.sh    |  76 -----
 .../network/stress/ssh/ssh-stress03-rmt.sh    |  77 ------
 6 files changed, 172 insertions(+), 340 deletions(-)
 delete mode 100644 testcases/network/stress/ssh/00_Descriptions.txt
 delete mode 100755 testcases/network/stress/ssh/ssh-stress01-rmt.sh
 delete mode 100755 testcases/network/stress/ssh/ssh-stress02-rmt.sh
 delete mode 100755 testcases/network/stress/ssh/ssh-stress03-rmt.sh
testcases/network/stress/ssh/00_Descriptions.txt deleted +0 -11
deleted file mode 100644
index 543e60d7d..000000000
@@ -1,11 +0,0 @@
-ssh-stress01
-	Verify the ssh connectivity over IPv4/IPv6 is not broken
-	after creating many ssh sessions
-
-ssh-stress02
-	Verify the ssh connectivity over IPv4/IPv6 is not broken
-	after logged in/out by many clients asynchronously for a long time
-
-ssh-stress03
-	Verify the ssh connectivity over IPv4/IPv6 is not broken
-	after forwarding TCP traffic for a long time
testcases/network/stress/ssh/Makefile +3 -21
index 1a6d052eb..7ebeec142 100644
@@ -1,24 +1,6 @@
-#
-#    testcases/network/stress/ssh Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, October 2009
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
 
 top_srcdir		?= ../../../..
 
testcases/network/stress/ssh/ssh-stress.sh +169 -90

316 lines not on this page · raw message

testcases/network/stress/ssh/ssh-stress01-rmt.sh deleted +0 -65

65 lines not on this page · raw message

testcases/network/stress/ssh/ssh-stress02-rmt.sh deleted +0 -76

76 lines not on this page · raw message

testcases/network/stress/ssh/ssh-stress03-rmt.sh deleted +0 -77

77 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Joerg, Alexey,

Quoted 7 lines

Apart from pure conversion:
- Use "StrictModes no" in ssh config, to get rid of
access permission problems; All part of the path of the authorized_keys file must not be writeable by anyone but the owner. This allows writing the file to the default temp directory
- Moved all rhost scripts into ssh-stress.sh

Quoted 8 lines

Changes in v3:
- use pkill instead of ps | awk | xargs
- Changed test descriptions slightly
* include actual ip version
* dropped "for a long time", the tests do not run for a long time with the default config
- Use netstress -B and ssh -f for background processes This implies using pgrep to get the pids of these processes.

LGTM.

Kind regards,
Petr

#2 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

In reply to Joerg Vehlow
Quoted 20 lines · Joerg Vehlow

From: Joerg Vehlow <[email protected]>

Apart from pure conversion:
- Use "StrictModes no" in ssh config, to get rid of
access permission problems; All part of the path of the authorized_keys file must not be writeable by anyone but the owner. This allows writing the file to the default temp directory
- Moved all rhost scripts into ssh-stress.sh

Changes in v3:
- use pkill instead of ps | awk | xargs
- Changed test descriptions slightly
* include actual ip version
* dropped "for a long time", the tests do not run for a long time with the default config
- Use netstress -B and ssh -f for background processes This implies using pgrep to get the pids of these processes.

---

...

Quoted 33 lines
testcases/network/stress/ssh/ssh-stress.sh +16 -8
-TCID=ssh-stress
-TST_TOTAL=3
 TST_CLEANUP="cleanup"
+TST_SETUP="setup"
+TST_TESTFUNC="test"
+TST_CNT=3
+TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="sshd ssh od pkill pgrep"
 
-TST_USE_LEGACY_API=1
 . tst_net.sh
 
-# Temporary directory to store sshd setting or ssh key
-# Note: ssh doesn't work when those directory is under /tmp.
-TMPDIR="/root"
+# SSH config file on the remote host
+RHOST_SSH_CONF=
+# SSH command to connect from the remote host to the test host
+RHOST_SSH=
+# Processes started on the remote host, killed at cleanup
+RHOST_PIDS=
+# Netstress process started on the test host, killed at cleanup
+NETSTRESS_PID=
 
 cleanup()
 {
+	local pids
+
 	# Stop the ssh daemon
-	test -s sshd.pid && kill $(cat sshd.pid)
-	pkill 'netstress$'

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

Quoted 10 lines
testcases/network/stress/ssh/ssh-stress.sh +7 -3
-	tst_rmdir
-	[ "$rtmpdir" ] && tst_rhost_run -c "rm -rf $rtmpdir"
-	TMPDIR=
+	[ -s sshd.pid ] && kill $(cat sshd.pid)
+	[ -n "$NETSTRESS_PID" ] && kill -2 $NETSTRESS_PID >/dev/null 2>&1
+
+	tst_rhost_run -c "kill $RHOST_PIDS"  >/dev/null 2>&1
+
+	# Kill all remaining ssh processes
+	tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Perhaps we should check that $RHOST_SSH_CONF is set before running pkill.

For the rest:

#3 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Joerg, Alexey,

...

Quoted 6 lines
Quoted 6 lines

cleanup()
{

testcases/network/stress/ssh/ssh-stress.sh +2 -1
+	local pids
+
 	# Stop the ssh daemon
-	test -s sshd.pid && kill $(cat sshd.pid)
Quoted 8 lines

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

Quoted 8 lines
testcases/network/stress/ssh/ssh-stress.sh +4 -4
-	pkill 'netstress$'
-	tst_rmdir
-	[ "$rtmpdir" ] && tst_rhost_run -c "rm -rf $rtmpdir"
-	TMPDIR=
+	[ -s sshd.pid ] && kill $(cat sshd.pid)
+	[ -n "$NETSTRESS_PID" ] && kill -2 $NETSTRESS_PID >/dev/null 2>&1
+
+	tst_rhost_run -c "kill $RHOST_PIDS"  >/dev/null 2>&1

And check also $RHOST_PIDS, right?
[ -n "$RHOST_PIDS" ] && tst_rhost_run -c "kill $RHOST_PIDS" >/dev/null 2>&1

Quoted 6 lines

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

Quoted 3 lines
testcases/network/stress/ssh/ssh-stress.sh +3 -0
+
+	# Kill all remaining ssh processes
+	tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Perhaps we should check that $RHOST_SSH_CONF is set before running pkill.

[ -n "$RHOST_SSH_CONF" ] && tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

No need to repost, I'll fix it before merge.

Quoted 2 lines

For the rest:

Thanks!

Kind regards,
Petr

#4 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Petr,

Quoted 19 lines · Petr Vorel

Hi Joerg, Alexey,

...

Quoted 6 lines
Quoted 6 lines
  cleanup()
  {
testcases/network/stress/ssh/ssh-stress.sh +2 -1
+	local pids
+
  	# Stop the ssh daemon
-	test -s sshd.pid && kill $(cat sshd.pid)
Quoted 8 lines

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

Quoted 8 lines
testcases/network/stress/ssh/ssh-stress.sh +4 -4
-	pkill 'netstress$'
-	tst_rmdir
-	[ "$rtmpdir" ] && tst_rhost_run -c "rm -rf $rtmpdir"
-	TMPDIR=
+	[ -s sshd.pid ] && kill $(cat sshd.pid)
+	[ -n "$NETSTRESS_PID" ] && kill -2 $NETSTRESS_PID >/dev/null 2>&1
+
+	tst_rhost_run -c "kill $RHOST_PIDS"  >/dev/null 2>&1

And check also $RHOST_PIDS, right?
[ -n "$RHOST_PIDS" ] && tst_rhost_run -c "kill $RHOST_PIDS" >/dev/null 2>&1

Right... But actually doesn't matter. Just "kill" does nothing"

Quoted 7 lines
Quoted 6 lines

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

Quoted 4 lines
testcases/network/stress/ssh/ssh-stress.sh +3 -0
+
+	# Kill all remaining ssh processes
+	tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Perhaps we should check that $RHOST_SSH_CONF is set before running pkill.

[ -n "$RHOST_SSH_CONF" ] && tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Yes, this should be done...

Quoted 2 lines

No need to repost, I'll fix it before merge.

Thanks

J?rg

#5 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Joerg,

Quoted 22 lines

Hi Petr,

Quoted 19 lines · Petr Vorel

Hi Joerg, Alexey,

...

Quoted 6 lines
Quoted 6 lines
  cleanup()
  {
testcases/network/stress/ssh/ssh-stress.sh +2 -1
+	local pids
+
  	# Stop the ssh daemon
-	test -s sshd.pid && kill $(cat sshd.pid)
Quoted 8 lines

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

Quoted 8 lines
testcases/network/stress/ssh/ssh-stress.sh +4 -4
-	pkill 'netstress$'
-	tst_rmdir
-	[ "$rtmpdir" ] && tst_rhost_run -c "rm -rf $rtmpdir"
-	TMPDIR=
+	[ -s sshd.pid ] && kill $(cat sshd.pid)
+	[ -n "$NETSTRESS_PID" ] && kill -2 $NETSTRESS_PID >/dev/null 2>&1
+
+	tst_rhost_run -c "kill $RHOST_PIDS"  >/dev/null 2>&1

And check also $RHOST_PIDS, right?
[ -n "$RHOST_PIDS" ] && tst_rhost_run -c "kill $RHOST_PIDS" >/dev/null 2>&1

Quoted 1 line

Right... But actually doesn't matter. Just "kill" does nothing"

Sure, but just to sync it with previous kill of $NETSTRESS_PID (both have stderr redirected, thus it shouldn't be necessary, but does not harm).

Kind regards,
Petr

Quoted 12 lines
Quoted 6 lines
Quoted 5 lines

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

Quoted 3 lines
testcases/network/stress/ssh/ssh-stress.sh +3 -0
+
+	# Kill all remaining ssh processes
+	tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Perhaps we should check that $RHOST_SSH_CONF is set before running pkill.

[ -n "$RHOST_SSH_CONF" ] && tst_rhost_run -c "pkill -f '^ssh $RHOST_SSH_CONF'"

Yes, this should be done...

Quoted 1 line

No need to repost, I'll fix it before merge.

Thanks

J?rg

#7 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Petr,

Quoted 3 lines · Petr Vorel

Hi Joerg, Alexey,

merged! Thanks both for your time.

thanks, but you should have removed my "changes in v3" from the commit message :)
Was I supposed to place stuff like that somewhere else in the mail, to prevent it from being merged?

J?rg

#8 lore raw

PATCH v3 1/1 ssh-stress: Convert to new api

Hi Joerg,

Quoted 8 lines

Hi Petr,

Quoted 3 lines · Petr Vorel

Hi Joerg, Alexey,

merged! Thanks both for your time.

thanks, but you should have removed my "changes in v3" from the commit message :)

Oh yes, although I usually check commit message, I haven't noticed.

Quoted 2 lines

Was I supposed to place stuff like that somewhere else in the mail, to prevent it from being merged?

Anything after first '---' in git format-patch output won't be included in commit message imported by git am. example: [1]

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/