pytest: add tests using sshd

With either /usr/sbin/sshd found or configured via --with-test-sshd=path
add tests for SCP down- and uploads, insecure, with known hosts or not,
with authorized user key or unauthorized one.

Working now with libssh and libssh2, using a hashed known_hosts file.

Closes #19934
This commit is contained in:
Stefan Eissing 2025-12-11 16:02:41 +01:00 committed by Daniel Stenberg
parent 407d2f3d57
commit eb39fee40b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 883 additions and 3 deletions

View file

@ -34,7 +34,7 @@ from testenv.env import EnvConfig
sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from testenv import Env, Nghttpx, Httpd, NghttpxQuic, NghttpxFwd
from testenv import Env, Nghttpx, Httpd, NghttpxQuic, NghttpxFwd, Sshd
log = logging.getLogger(__name__)
@ -134,6 +134,17 @@ def nghttpx_fwd(env, httpd) -> Generator[Union[Nghttpx,bool], None, None]:
yield False
@pytest.fixture(scope='session')
def sshd(env: Env) -> Generator[Union[Sshd,bool], None, None]:
if env.has_sshd():
sshd = Sshd(env=env)
assert sshd.initial_start(), f'{sshd.dump_log()}'
yield sshd
sshd.stop()
else:
yield False
@pytest.fixture(scope='session')
def configures_httpd(env, httpd) -> Generator[bool, None, None]:
# include this fixture as test parameter if the test configures httpd itself