Ver Fonte

fix(install): preflight SSH check uses the --ssh-key identity (#1473)

The BatchMode preflight ignored $SSH_IDENT_ARGS, so a run with a valid
--ssh-key (the one the webui copies when the server has cfg.SSHKeyPath,
i.e. exactly the routers that only authorize the NetPulse key) died at
fatal 13 before any real step. Also make the error say that password
auth never works and how to authorize the public key.

Closes #1472
Nacho há 1 mês atrás
pai
commit
718777f7df
1 ficheiros alterados com 9 adições e 2 exclusões
  1. 9 2
      install-agent.sh

+ 9 - 2
install-agent.sh

@@ -160,8 +160,15 @@ case "$SERVER" in
         ;;
         ;;
 esac
 esac
 
 
-ssh -o ConnectTimeout=8 -o BatchMode=yes "$SSH" true \
-    || fatal 13 "no hay SSH a $SSH (¿dropbear + clave autorizada?)"
+# Preflight con la MISMA identidad que el resto del script: sin
+# $SSH_IDENT_ARGS el chequeo caía a ~/.ssh/id_* y fallaba aunque --ssh-key
+# fuera la válida (#1472). BatchMode=yes a propósito: el instalador es no
+# interactivo y la contraseña NUNCA basta; hay que autorizar la clave
+# pública en el router (dropbear: /etc/dropbear/authorized_keys).
+ssh $SSH_IDENT_ARGS -o ConnectTimeout=8 -o BatchMode=yes "$SSH" true || {
+    PUB="${SSH_KEY:-~/.ssh/id_ed25519.pub}"
+    fatal 13 "sin SSH por clave a $SSH (el instalador es no interactivo: la contraseña no vale). Autoriza la clave pública en el router y repite: ssh-copy-id -i $PUB $SSH"
+}
 
 
 # ----------------------------------------------------- netgrip handoff --
 # ----------------------------------------------------- netgrip handoff --
 # Si el router ya corre NetGrip, su agente EMBEBIDO cubre el sondeo: no se
 # Si el router ya corre NetGrip, su agente EMBEBIDO cubre el sondeo: no se