ssh erro com publickey para usuário normal

1

Eu sei que os problemas do ssh já foram discutidos aqui ainda antes de votar para baixo, por favor, leia. : -)

Eu tenho dois servidores virtualmente iguais recentemente instalados no CentOS 6. Eles são usados no ambiente DRBD / HA . Todas as configurações em ambos, AFAIK, são as mesmas. A maioria deles foi copiada com rsync .

Eu posso logar como root com a minha chave sendo aceita em ambos os servidores; no entanto, posso fazer o login como usuário normal somente em um deles ( master1 ).

Mais algumas informações.

Utilizador : As permissões nos usuários home-directory e em .ssh são 700. Os arquivos: authorized_keys, id_dsa, id_rsa são 600. Toda a estrutura de / HOME é exatamente o mesmo em ambas as máquinas (rsynced).

Configuração : GSSAPI, Kerberos e PAM estão desativados. Os arquivos sshd_config e ssh_config são exatamente iguais em ambas as máquinas (rsynced). O mesmo vale para / etc / hosts , / etc / passwd , / etc / group , / etc / shadow , configurações de rede (exceto IPs e MACs), executando serviços (exceto que estes iniciados com heartbeat não estão sendo executados em master2 ) ...

Uma tentativa de loggin como um usuário xxxx de master1 para master2 se parece com:

ssh -v master2
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to master2 [XXX.XXX.XX.2] port 22.
debug1: Connection established.
debug1: identity file /home/xxxx/.ssh/identity type -1
debug1: identity file /home/xxxx/.ssh/id_rsa type 1
debug1: identity file /home/xxxx/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'master2' is known and matches the RSA host key.
debug1: Found key in /home/xxxx/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/xxxx/.ssh/identity
debug1: Offering public key: /home/xxxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/xxxx/.ssh/id_dsa
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
xxxx@master2's password:

Agora vem a diversão:

Eu iniciei o sshd no modo de depuração / não-bifurcação (em temp_sshd alterei a porta para 12345):

cp /etc/ssh/sshd_config ~/temp_sshd_config
vi  ~/temp_sshd_config
/usr/sbin/sshd -f ~/temp_sshd_config -dd

Que loggin como usuário normal trabalha com chave pública:

ssh -v -p 12345 master2
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to master2 [XXX.XXX.XX.2] port 12345.
debug1: Connection established.
debug1: identity file /home/xxxx/.ssh/identity type -1
debug1: identity file /home/xxxx/.ssh/id_rsa type 1
debug1: identity file /home/xxxx/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: checking without port identifier
debug1: Host 'master2' is known and matches the RSA host key.
debug1: Found key in /home/xxxx/.ssh/known_hosts:2
debug1: found matching key w/out port
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/xxxx/.ssh/identity
debug1: Offering public key: /home/xxxx/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Wed Feb 29 15:06:25 2012 from master1

Como eu quero definir PasswordAuthentication NO em sshd , eu preciso ter o loggin de chave pública em execução.

Qualquer ajuda é muito bem-vinda.

    
por Kris_R 29.02.2012 / 16:36

1 resposta

1

Por favor, mostre / examine o log do servidor ssh ( /var/log/secure ) em master2 também. Como é o servidor que decide se aceita a chave pública, a resposta deve estar lá.

Pessoalmente, suspeito que tenha algo a ver com o contexto do SELinux (não copiado pelo rsync sem -X ).

    
por 01.03.2012 / 01:06

Tags