Não é possível efetuar login via SSH com a conta LDAP após a alteração da porta padrão

1

Altero a porta padrão do ssh na instalação do CentOS7. Mas não consigo me conectar ao servidor com uma conta ldap. Estou recebendo "conexão recusada e o seguinte erro:

Nov 16 16:43:52 server sshd[26297]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost
Nov 16 16:43:59 server sshd[26308]: Invalid user random2 from ::1
Nov 16 16:43:59 server sshd[26308]: input_userauth_request: invalid user random2 [preauth]
Nov 16 16:44:04 server sshd[26308]: pam_unix(sshd:auth): check pass; user unknown
Nov 16 16:44:04 server sshd[26308]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost
Nov 16 16:44:07 server sshd[26308]: Failed password for invalid user random2 from ::1 port 58711 ssh2

O firewall está desligado e eu já habilitei a porta não padrão.

Eu não sei o que esse "usuário inválido" significa, porque posso vê-lo claramente.

Espero que alguém tenha uma ideia.

Obrigado antecipadamente.

com mais sinceridade

Twinhand

Editar1: nsswitch.conf

passwd:     files sss ldap
shadow:     files sss ldap
group:      files sss ldap

/etc/openldap/ldap.conf

URI ldap://servername.example.com/
BASE dc=example,dc=com
TLS_REQCERT allow

Editar2

ssh -vv -p 2431 random2@localhost
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 2431.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
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_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: setup [email protected]
debug1: kex: server->client aes128-ctr [email protected] none
debug2: mac_setup: setup [email protected]
debug1: kex: client->server aes128-ctr [email protected] none
debug1: kex: [email protected] need=16 dh_need=16
debug1: kex: [email protected] need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
debug1: Host '[localhost]:2431' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /root/.ssh/id_rsa ((nil)),
debug2: key: /root/.ssh/id_dsa ((nil)),
debug2: key: /root/.ssh/id_ecdsa ((nil)),
debug2: key: /root/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
random2@localhost's password: 
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
random2@localhost's password: 

Editar 2:

Nov 18 17:30:01 peacock systemd: Created slice user-0.slice.
Nov 18 17:30:01 peacock systemd: Starting Session 329 of user root.
Nov 18 17:30:01 peacock systemd: Started Session 329 of user root.
Nov 18 17:30:01 peacock nslcd[2917]: [45d5c5] <passwd="root"> ldap_result() failed: No such object
Nov 18 17:30:01 peacock nslcd[2917]: [16f79a] <group/member="root"> ldap_result() failed: No such object
Nov 18 17:30:01 peacock nslcd[2917]: [16f79a] <group/member="root"> ldap_result() failed: No such object
Nov 18 17:30:01 peacock nslcd[2917]: [c8c7c2] <group/member="gdm"> ldap_result() failed: No such object
Nov 18 17:30:01 peacock nslcd[2917]: [c8c7c2] <group/member="gdm"> ldap_result() failed: No such object
Nov 18 17:30:01 peacock nslcd[2917]: [f31d87] <group/member="gdm"> ldap_result() failed: No such object

O que no mundo é isso? Minhas mensagens / var / log / completas estão cheias disso.

    
por Twinhand 16.11.2015 / 10:47

2 respostas

1

Parece que você está tentando autenticar usando o arquivo passwd local em vez do servidor LDAP.

Na verificação da máquina cliente:

  • /etc/ldap.conf e /etc/openldap/ldap.conf - > O servidor LDAP e a pesquisa básica devem ser definidos corretamente.
  • /etc/nsswitch.conf - > Pesquise as definições passwd, group e shadow . Eles devem incluir "ldap":
passwd:         ldap compat  
group:          ldap compat  
shadow:         ldap compat

Aumentar a verbosidade ajuda muito. Conecte-se usando os switches -v -vv -vvv e procure por informações de autenticação:

ssh -vv user@host
    
por 16.11.2015 / 13:36
0

Bem, isso não é realmente uma solução, mas funcionou de alguma forma. Como eu tentei coisas diferentes ontem para corrigir esse problema, eu acidentalmente deletei / etc com o meu servidor morto, no entanto, eu apenas reinstalei a partir do zero. E configuração slapd no mesmo modo exato com os arquivos The Same e o mesmo procedimento. E funcionou. Eu não sei qual foi o problema, mas obrigado por você ajudar de qualquer maneira.

    
por 20.11.2015 / 11:00

Tags