summaryrefslogtreecommitdiffstats
path: root/debian/tests/xinetd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-27 08:42:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-27 08:42:41 +0000
commit824f26a90b0875c5697e2adf05360c0193a7c88d (patch)
treecd6784bde264c1c08b1f84557ddeca819ae93a93 /debian/tests/xinetd
parentMerging upstream version 1:9.9p1. (diff)
downloadopenssh-824f26a90b0875c5697e2adf05360c0193a7c88d.tar.xz
openssh-824f26a90b0875c5697e2adf05360c0193a7c88d.zip
Merging debian version 1:9.9p1-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/xinetd52
1 files changed, 52 insertions, 0 deletions
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