diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-27 08:42:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-27 08:42:40 +0000 |
commit | 61ddb5002596ce4bfc6a400fd9952b514350c95a (patch) | |
tree | b3c2223bb28ef51f8c683867e440500ef781e20d /debian/tests/xinetd | |
parent | Merging upstream version 1:9.9p1. (diff) | |
download | openssh-61ddb5002596ce4bfc6a400fd9952b514350c95a.tar.xz openssh-61ddb5002596ce4bfc6a400fd9952b514350c95a.zip |
Adding debian version 1:9.9p1-1.debian/1%9.9p1-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/xinetd')
-rwxr-xr-x | debian/tests/xinetd | 52 |
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 |