3 votos

"Falló la verificación de la clave del host" a pesar de haber borrado known_hosts

Sé lo que significa este error, y normalmente elimino esa entrada del archivo known_hosts y sigo adelante (cuando sé por qué falla la verificación).

Esta vez seguí obteniendo el error después de eliminar la entrada específica para el host de known_hosts, así que eliminé todas las entradas y seguí obteniendo el error, luego eliminé todo el archivo known_hosts y seguí obteniendo el error?

Tengo este problema en todos los hosts.

Acabo de mover .ssh a .ssh-bak, he copiado mis claves en el nuevo directorio y todavía me da el error.

¿Cuál es la causa de esto?

$ ssh -vvv git@github.com
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "github.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: Connection established.
debug1: identity file /Users/herbert/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/herbert/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug2: fd 5 setting O_NONBLOCK
debug1: Authenticating to github.com:22 as 'git'
debug3: hostkeys_foreach: reading file "/Users/herbert/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: host key algorithms: ssh-dss,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc
debug2: MACs ctos: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: MACs stoc: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: compression ctos: none,zlib,zlib@openssh.com
debug2: compression stoc: none,zlib,zlib@openssh.com
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug3: hostkeys_foreach: reading file "/Users/herbert/.ssh/known_hosts"
debug3: hostkeys_foreach: reading file "/Users/herbert/.ssh/known_hosts"
Host key verification failed.

$ ssh -G github.com
user herbert
hostname github.com
port 22
addressfamily any
batchmode yes
canonicalizefallbacklocal yes
canonicalizehostname false
challengeresponseauthentication yes
checkhostip yes
compression no
controlmaster false
enablesshkeysign no
clearallforwardings no
exitonforwardfailure no
fingerprinthash SHA256
forwardagent no
forwardx11 no
forwardx11trusted no
gatewayports no
gssapiauthentication no
gssapidelegatecredentials no
hashknownhosts no
hostbasedauthentication no
identitiesonly no
kbdinteractiveauthentication yes
nohostauthenticationforlocalhost no
passwordauthentication yes
permitlocalcommand no
protocol 2
proxyusefdpass no
pubkeyauthentication yes
requesttty auto
rhostsrsaauthentication no
rsaauthentication yes
streamlocalbindunlink no
stricthostkeychecking ask
tcpkeepalive yes
tunnel false
useprivilegedport no
verifyhostkeydns false
visualhostkey no
updatehostkeys false
canonicalizemaxdots 1
compressionlevel 6
connectionattempts 1
forwardx11timeout 1200
numberofpasswordprompts 3
serveralivecountmax 3
serveraliveinterval 0
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
hostkeyalgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
hostbasedkeytypes ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
kexalgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
loglevel INFO
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
pubkeyacceptedkeytypes ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
xauthlocation xauth
identityfile ~/.ssh/id_rsa
identityfile ~/.ssh/id_dsa
identityfile ~/.ssh/id_ecdsa
identityfile ~/.ssh/id_ed25519
canonicaldomains
globalknownhostsfile /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2
userknownhostsfile ~/.ssh/known_hosts ~/.ssh/known_hosts2
sendenv LANG
sendenv LC_*
connecttimeout none
tunneldevice any:any
controlpersist no
escapechar ~
ipqos lowdelay throughput
rekeylimit 0 0
streamlocalbindmask 0177

Casi todo en dev tiene estos permisos:

0 crw-rw-rw- 1 root wheel 2, 0 22 Mar 10:07 tty 

¿Podrían estos 4 tener algo que ver?

0 crw--w---- 1 herbert tty 16, 0 12 Mar 12:55 ttys000 
0 crw--w---- 1 herbert tty 16, 1 22 Mar 15:12 ttys001 
0 crw--w---- 1 herbert tty 16, 2 22 Mar 15:14 ttys002 
0 crw--w---- 1 herbert tty 16, 3 22 Mar 17:44 ttys003 
0 crw--w---- 1 herbert tty 16, 4 22 Mar 17:44 ttys004

$ ls -lsa ~/.ssh
total 24 
0 drwx------ 5 herbert staff 170 22 Mar 15:39 . 
0 drwxr-xr-x+ 114 herbert staff 3876 22 Mar 15:29 .. 
8 -rw------- 1 herbert staff 1675 22 Mar 15:31 id_rsa 
8 -rw-r--r-- 1 herbert staff 414 22 Mar 15:31 id_rsa.pub 
8 -rw-r--r-- 1 herbert staff 848 22 Mar 16:42 known_hosts

0 votos

Publica el mensaje de error completo o el registro con ssh -vvv server .

0 votos

Añadida la salida

0 votos

Parece que en algún lugar está configurado que no debe pedir la verificación. ¿Cuál es la salida de ssh -G github.com ?

0voto

Jakuje Puntos 318

(desde el chat) Como solución, puedes descargar la clave pública desde github utilizando

ssh-keyscan github.com > ~/.ssh/known_hosts

Pero se me acabaron las ideas de cuál puede ser el problema subyacente ya que tanto la configuración como los registros de depuración me parecen buenos.

0 votos

Ya que está sucediendo para todos los anfitriones creo que tengo que llegar al fondo de la cuestión.

0voto

Nathan Puntos 93

¿Es posible esta respuesta ¿resuelve su problema? Reproducido aquí en aras de la exhaustividad:

Prueba con sudo chmod 666 /dev/tty para dar los permisos adecuados a /dev/tty - que pueden haber sido cambiados inadvertidamente. Si quieres de antemano puedes ls -la /dev/tty para comprobar los permisos actuales y ver si ya están rw-rw-rw .

0 votos

Casi todo en dev tiene estos permisos: 0 crw-rw-rw- 1 Root wheel 2, 0 22 Mar 10:07 tty ¿Podrían estos 4 tener algo que ver? 0 crw--w---- 1 herbert tty 16, 0 12 mar 12:55 ttys000 0 crw--w---- 1 herbert tty 16, 1 22 mar 15:12 ttys001 0 crw--w---- 1 herbert tty 16, 2 22 mar 15:14 ttys002 0 crw--w---- 1 herbert tty 16, 3 22 mar 17:44 ttys003 0 crw--w---- 1 herbert tty 16, 4 22 mar 17:44 ttys004

0 votos

Estos también fueron cambiados hace bastante tiempo

0 votos

Todo en ese directorio tiene una fecha modificada del 12 de marzo que fue hace diez días

0voto

Kyralessa Puntos 141

Como Sierra ha eliminado la reparación de permisos sólo pude probar la reparación de disco que, aunque tuvo éxito, no solucionó el problema. Aunque fue menos satisfactorio que encontrar la causa, reiniciar en modo de recuperación y reinstalar Sierra eliminó el problema.

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X