Match sshd -T keywords case-insensitively when verifying hardening

OpenSSH 10.x prints configuration keywords in CamelCase in its sshd -T
dump, where 9.x printed them lowercase. The case-sensitive grep in
omarchy-setup-security-sshd therefore never matched on OpenSSH 10.x, so
the hardening drop-in was always judged ineffective and removed, leaving
password authentication enabled.
This commit is contained in:
Ryan Hughes
2026-08-30 15:03:06 -04:00
parent 4271b880c3
commit 71d7ac81ae
2 changed files with 18 additions and 4 deletions
+4 -2
View File
@@ -172,9 +172,11 @@ CONF
# Syntax alone is insufficient because sshd uses the first value it reads for
# these settings. An earlier administrator rule could leave passwords enabled.
# Match keywords case-insensitively: OpenSSH 9.x dumps them lowercase, 10.x
# in CamelCase.
if ! effective_config=$(sudo sshd -T) ||
! grep -qxF "passwordauthentication no" <<<"$effective_config" ||
! grep -qxF "kbdinteractiveauthentication no" <<<"$effective_config"; then
! grep -qixF "passwordauthentication no" <<<"$effective_config" ||
! grep -qixF "kbdinteractiveauthentication no" <<<"$effective_config"; then
echo -e "\e[31msshd did not apply the password-authentication restrictions; removing the ineffective config.\e[0m" >&2
sudo rm -f "$config"
return 1