diff --git a/tests/runtime-smoke/operating-systems/anolis/23.4/smoke.sh b/tests/runtime-smoke/operating-systems/anolis/23.4/smoke.sh index 8bea20a5..7b84ae0f 100644 --- a/tests/runtime-smoke/operating-systems/anolis/23.4/smoke.sh +++ b/tests/runtime-smoke/operating-systems/anolis/23.4/smoke.sh @@ -69,6 +69,13 @@ if [ ! -x /usr/sbin/sshd ]; then exit 1 fi +for nologin_file in /run/nologin /etc/nologin; do + if [ -e "$nologin_file" ]; then + echo "$nologin_file blocks non-root SSH logins" >&2 + exit 1 + fi +done + if ! /usr/sbin/sshd -T | grep -qx 'allowtcpforwarding yes'; then echo "sshd AllowTcpForwarding is not enabled" >&2 exit 1 diff --git a/tests/runtime-smoke/operating-systems/kylin/v10-sp3/smoke.sh b/tests/runtime-smoke/operating-systems/kylin/v10-sp3/smoke.sh index 3ba0dc1e..4c280db2 100644 --- a/tests/runtime-smoke/operating-systems/kylin/v10-sp3/smoke.sh +++ b/tests/runtime-smoke/operating-systems/kylin/v10-sp3/smoke.sh @@ -69,6 +69,13 @@ if [ ! -x /usr/sbin/sshd ]; then exit 1 fi +for nologin_file in /run/nologin /etc/nologin; do + if [ -e "$nologin_file" ]; then + echo "$nologin_file blocks non-root SSH logins" >&2 + exit 1 + fi +done + if ! /usr/sbin/sshd -T | grep -qx 'allowtcpforwarding yes'; then echo "sshd AllowTcpForwarding is not enabled" >&2 exit 1 diff --git a/tooling/scripts/svc/configure-sshd.sh b/tooling/scripts/svc/configure-sshd.sh index 1acbc546..c7fbb087 100644 --- a/tooling/scripts/svc/configure-sshd.sh +++ b/tooling/scripts/svc/configure-sshd.sh @@ -43,6 +43,7 @@ exec 2>&1 mkdir -p /run/sshd chmod 755 /run/sshd +rm -f /run/nologin /etc/nologin if ! ls /etc/ssh/ssh_host_*_key >/dev/null 2>&1; then if ! command -v ssh-keygen >/dev/null 2>&1; then