diff --git a/post-install.sh b/post-install.sh index 77116aa..9c7b1cc 100755 --- a/post-install.sh +++ b/post-install.sh @@ -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 ""