Update scripts/harden-ssh.sh

This commit is contained in:
2026-06-12 18:16:27 +00:00
parent 991758de4b
commit 85eeb79971
+8
View File
@@ -69,6 +69,14 @@ die() { printf '\033[1;31m[x]\033[0m %s\n' "$*" >&2; exit 1; }
# ----------------------------------------------------------------------------
# 1. Pre-flight checks
# ----------------------------------------------------------------------------
# Ensure ssh client is installed before probing its version. On a fresh
# Alpine box there's no `ssh` binary at all, and the version-detect
# pipeline below would die silently under `set -euo pipefail`.
if ! command -v ssh >/dev/null 2>&1; then
log "ssh not found; installing openssh + openssh-server..."
apk add -q openssh openssh-server
fi
log "Checking OpenSSH version supports PQ KEX..."
SSH_VER=$(ssh -V 2>&1 | grep -oE 'OpenSSH_[0-9]+\.[0-9]+' | head -1 \
| sed 's/OpenSSH_//')