summaryrefslogtreecommitdiffstats
path: root/debian/tests/socket-activation
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/socket-activation27
1 files changed, 27 insertions, 0 deletions
diff --git a/debian/tests/socket-activation b/debian/tests/socket-activation
new file mode 100755
index 0000000..20a0d0b
--- /dev/null
+++ b/debian/tests/socket-activation
@@ -0,0 +1,27 @@
+#! /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
+
+systemctl disable --now ssh.service
+systemctl enable --now ssh.socket
+sudo -u "$testuser" \
+ ssh -oStrictHostKeyChecking=accept-new "$testuser@localhost" date