Problema com a conexão SSH: ssh_exchange_identification: Conexão fechada pelo host remoto

2

Estou tendo problemas para me conectar a desktop1 (veja a figura abaixo) em server (seta vermelha na figura) com ssh. Sempre diz:

ssh_exchange_identification: Connection closed by remote host

Eu não tenho problema para me conectar ao servidor a partir de desktop1 ou desktop2 , nem tenho nenhum problema de conexão com desktop2 de server ou de conexão de desktop1 a desktop2 e vice-versa versa.

Eu tentei solucionar o problema criando um servidor sshd temporário em desktop1 da seguinte maneira:

[desktop1]# $(which sshd) -Ddddp 4000

e para se conectar a ele de server :

[server]# ssh -v -p 4000 root@desktop1
OpenSSH_7.1p2, OpenSSL 1.0.2g-fips  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Executing proxy command: exec /usr/bin/sss_ssh_knownhostsproxy -p 4000 desktop1
debug1: permanently_set_uid: 0/0
debug1: permanently_drop_suid: 0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
ssh_exchange_identification: Connection closed by remote host
#

que não funciona.

Mas a partir de desktop2 , a conexão funciona bem:

[desktop2]# ssh -v -p 4000 root@desktop1
OpenSSH_7.1p2, OpenSSL 1.0.2g-fips  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Executing proxy command: exec /usr/bin/sss_ssh_knownhostsproxy -p 4000 desktop1
debug1: permanently_set_uid: 0/0
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: kex: [email protected] need=64 dh_need=64
debug1: kex: [email protected] need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
[...]
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Mon Mar  7 15:24:05 2016 from 10.0.21.200
Environment:
  LANG=en_US.UTF-8
  USER=root
  LOGNAME=root
  HOME=/root
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
  MAIL=/var/mail/root
  SHELL=/bin/bash
  SSH_CLIENT=10.0.21.200 39150 4000
  SSH_CONNECTION=10.0.21.200 39150 10.0.21.204 4000
  SSH_TTY=/dev/pts/1
  TERM=xterm-256color
  DISPLAY=localhost:11.0
Running /usr/bin/xauth remove unix:11.0
/usr/bin/xauth add unix:11.0 MIT-MAGIC-COOKIE-1 2843404fd74f1294efce8c6bb786fd75

O arquivo /etc/ssh/sshd_config é o mesmo em desktop1 e desktop2 .

As chaves públicas / privadas da raiz são as mesmas em server , desktop1 e desktop2 .

As permissões estão corretas nas 3 máquinas e são assim:

# ll .ssh/
total 24
-rw-------  1 root root 1883 Nov  6 09:33 authorized_keys
-rw-------. 1 root root  668 Jan 26  2015 id_dsa
-rw-r--r--. 1 root root  620 Jan 26  2015 id_dsa.pub
-rw-------. 1 root root  887 Jan 26  2015 id_rsa
-rw-r--r--. 1 root root  240 Jan 26  2015 id_rsa.pub
-rw-r--r--. 1 root root 1893 Nov  5 10:31 known_hosts

O traceroute encontra ambos os desktops a partir de server :

[server]# traceroute -T -p 22 desktop1
traceroute to desktop1 (10.0.21.204), 30 hops max, 60 byte packets
 1  gateway (10.0.21.30)  0.704 ms  0.874 ms  1.041 ms
 2  desktop1 (10.0.21.204)  0.325 ms  0.438 ms  0.407 m
[server]#
[server]# traceroute -T -p 22 desktop1
traceroute to desktop2 (10.0.21.200), 30 hops max, 60 byte packets
 1  gateway (10.0.21.30)  0.847 ms  0.985 ms  1.158 ms
 2  desktop2 (10.0.21.200)  0.286 ms  0.310 ms  0.314 ms

Então, qual pode ser a causa desse problema de troca de ID: ssh_exchange_identification: Connection closed by remote host ?

Obrigado pela sua ajuda.

Atenciosamente, Fuji.

    
por Fuji San 07.03.2016 / 16:04

2 respostas

2

Esse é um problema conhecido (provavelmente em kernel ), rastreado como rhbz # 1313979

A inicialização do kernel antigo (ex. kernel 4.3.5-300.fc23.x86_64 ) deve resolver o problema (como solução alternativa). Mais investigação é bem-vinda aqui ou no bugzilla.

    
por 07.03.2016 / 16:36
3

Seu problema pode ser causado por:

debug1: Executing proxy command: exec /usr/bin/sss_ssh_knownhostsproxy -p 4000 desktop1

Edite / etc / ssh / ssh_config e comente a linha ProxyCommand. Eu encontrei isso ao juntar clientes ao FreeIPA.

    
por 15.09.2016 / 09:05

Tags