diff options
Diffstat (limited to 'debian/tests')
-rw-r--r-- | debian/tests/control | 13 | ||||
-rwxr-xr-x | debian/tests/xinetd | 52 |
2 files changed, 64 insertions, 1 deletions
diff --git a/debian/tests/control b/debian/tests/control index 0f5a493..a09633a 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -24,7 +24,7 @@ Restrictions: Depends: krb5-admin-server, krb5-kdc, - openssh-server, + openssh-server-gssapi, Tests: socket-activation, @@ -35,3 +35,14 @@ Restrictions: Depends: openssh-server, sudo, + +Tests: + xinetd, +Restrictions: + allow-stderr, + isolation-container, + needs-root, +Depends: + openssh-server, + sudo, + xinetd, diff --git a/debian/tests/xinetd b/debian/tests/xinetd new file mode 100755 index 0000000..b63fbd7 --- /dev/null +++ b/debian/tests/xinetd @@ -0,0 +1,52 @@ +#! /bin/sh +set -e + +testuser="testuser$$" +adduser --quiet --disabled-password --gecos "" "$testuser" +sudo -u "$testuser" mkdir -m700 "/home/$testuser/.ssh" +sudo -u "$testuser" \ + ssh-keygen -t ed25519 -N '' -f "/home/$testuser/.ssh/id_ed25519" +sudo -u "$testuser" \ + cp "/home/$testuser/.ssh/id_ed25519.pub" \ + "/home/$testuser/.ssh/authorized_keys" + +cleanup () { + if [ $? -ne 0 ]; then + echo "## Something failed" + echo + echo "## ssh server log" + journalctl -b -u ssh.service --lines 100 + fi +} + +trap cleanup EXIT + +cat >/etc/xinetd.d/sshd <<EOF +service ssh +{ + id = sshd + disable = no + type = UNLISTED + port = 22 + socket_type = stream + wait = no + user = root + server = /usr/sbin/sshd + server_args = -i -4 + log_on_success += DURATION USERID + log_on_failure += USERID + nice = 10 +} +EOF + +mkdir -p /etc/systemd/system/xinetd.service.d +cat >/etc/systemd/system/xinetd.service.d/sshd.conf <<EOF +[Service] +RuntimeDirectory=sshd +EOF + +systemctl daemon-reload +systemctl disable --now ssh.service +systemctl reload xinetd.service +sudo -u "$testuser" \ + ssh -oStrictHostKeyChecking=accept-new "$testuser@localhost" date |