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
12 changed files with 883 additions and 3 deletions

View File

@@ -409,6 +409,51 @@ if test "$DANTED_ENABLED" = "no"; then
fi
AC_SUBST(DANTED)
dnl we would like a sshd as test server
dnl
SSHD_ENABLED="maybe"
AC_ARG_WITH(test-sshd, [AS_HELP_STRING([--with-test-sshd=PATH],
[where to find sshd for testing])],
[request_sshd=$withval], [request_sshd=check])
if test "x$request_sshd" = "xcheck" || test "x$request_sshd" = "xyes"; then
if test -x "/usr/sbin/sshd"; then
# common location on distros (debian/ubuntu)
SSHD="/usr/sbin/sshd"
else
AC_PATH_PROG([SSHD], [sshd])
if test -z "$SSHD"; then
AC_PATH_PROG([SSHD], [sshd])
fi
fi
elif test "x$request_sshd" != "xno"; then
SSHD="${request_sshd}"
if test ! -x "${SSHD}"; then
AC_MSG_NOTICE([sshd not found as ${SSHD}, sshd tests disabled])
SSHD_ENABLED="no"
else
AC_MSG_NOTICE([using SSHD=$SSHD for tests])
fi
fi
if test "$SSHD_ENABLED" = "no"; then
SSHD=""
SFTPD=""
else
if test -x "/usr/libexec/sftp-server"; then
# common location on macOS)
SFTPD="/usr/libexec/sftp-server"
elif test -x "/usr/lib/openssh/sftp-server"; then
# common location on debian
SFTPD="/usr/lib/openssh/sftp-server"
else
AC_PATH_PROG([SFTPD], [sftp-server])
if test -z "$SFTPD"; then
AC_PATH_PROG([SFTPD], [sftp-server])
fi
fi
fi
AC_SUBST(SSHD)
AC_SUBST(SFTPD)
dnl the nghttpx we might use in httpd testing
if test -n "$TEST_NGHTTPX" && test "x$TEST_NGHTTPX" != "xnghttpx"; then
HTTPD_NGHTTPX="$TEST_NGHTTPX"