Improve SSH fingerprint display logic

- Compare fingerprints and show if they're the same
- Clear indication when keys are shared vs different
- Better user experience for host key verification

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Dominik Moritz Roth 2025-08-18 21:33:12 +02:00
parent 96ff742bd5
commit b49fcb3358

View File

@ -445,18 +445,28 @@ echo ""
# Display SSH host key fingerprints
echo "SSH Host Key Fingerprints:"
ed25519_fp=""
dropbear_fp=""
if [ -f "/etc/ssh/ssh_host_ed25519_key.pub" ] && command -v ssh-keygen >/dev/null 2>&1; then
ed25519_fp=$(ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub -E sha256 2>/dev/null | awk '{print $2}')
if [ -n "$ed25519_fp" ]; then
echo " Normal SSH (ED25519): $ed25519_fp"
fi
fi
if [ -f "/etc/dropbear/dropbear_ed25519_host_key" ] && command -v ssh-keygen >/dev/null 2>&1; then
dropbear_fp=$(dropbearkey -y -f /etc/dropbear/dropbear_ed25519_host_key 2>/dev/null | ssh-keygen -lf - -E sha256 2>/dev/null | awk '{print $2}')
if [ -n "$dropbear_fp" ]; then
echo " Rescue SSH (ED25519): $dropbear_fp"
fi
fi
if [ -n "$ed25519_fp" ] && [ -n "$dropbear_fp" ] && [ "$ed25519_fp" = "$dropbear_fp" ]; then
echo " SSH (ED25519): $ed25519_fp (same for both rescue and normal)"
elif [ -n "$ed25519_fp" ] && [ -n "$dropbear_fp" ]; then
echo " Normal SSH (ED25519): $ed25519_fp"
echo " Rescue SSH (ED25519): $dropbear_fp"
elif [ -n "$ed25519_fp" ]; then
echo " Normal SSH (ED25519): $ed25519_fp"
elif [ -n "$dropbear_fp" ]; then
echo " Rescue SSH (ED25519): $dropbear_fp"
else
echo " No ED25519 keys found"
fi
echo ""