[LUG.ro] Problema con autenticación por claves en OpenSSH
Juan Manuel Oppedisano
jmo707 en gmail.com
Dom Oct 24 19:34:02 ART 2010
Recurro a ustedes porque esto me tiene totalmente intrigado. No veo que es
lo que me estoy pasando por alto.
La cosa es así:
- Tengo un servidor FreeNAS en casa conectado a través de un router a la
red, con una IP reservada que tiene salida a la nube por un puerto X abierto
y funciona con un cliente de DynDNS.
- Quiero conectarme a través de SSH al servidor utilizando archivos de
llave, y no una contraseña.
En mi PC de uso habitual, en la misma red, creo una clave con el comando
*ssh-keygen -t dsa*
Dejo la ruta como está y le asigno un passphrase.
Copio, mediante scp o como sea, la llave pública al servidor cambiándo el
nombre como corresponde
*scp ~/.ssh/id_dsa.pub usuario en servidor.dyndns.org:.ssh/authorized_keys*
Luego me logueo, me aseguro de que los permisos estén en 700 para la carpeta
.ssh y 600 para el archivo authorized_keys, y salgo.
A continuación intento ingresar al servidor desde la consola de comando
*ssh usuario en servidor.dyndns.org*
Y me pide la contraseña del usuario, no la passphrase del archivo. Probe
también con llaves RSA, y miré los archivos de configuración de SSH en ambas
máquinas. No sé que puede ser.
Si sirve, les dejo un debug de la conexión
*debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to servidor.dyndns.org [190.193.47.101] port X.
debug1: Connection established.
debug1: identity file /home/dantedario/.ssh/id_rsa type -1
debug1: identity file /home/dantedario/.ssh/id_rsa-cert type -1
debug3: Not a RSA1 key file /home/dantedario/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/dantedario/.ssh/id_dsa type 2
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: identity file /home/dantedario/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version
OpenSSH_5.2p1-hpn13v6 FreeBSD-openssh-portable-overwrite-base-5.2.p1_2,1
debug1: match: OpenSSH_5.2p1-hpn13v6
FreeBSD-openssh-portable-overwrite-base-5.2.p1_2,1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu4
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit:
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v00 en openssh.com,
ssh-dss-cert-v00 en openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,
rijndael-cbc en lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,
rijndael-cbc en lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64 en openssh.com
,hmac-ripemd160,hmac-ripemd160 en openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64 en openssh.com
,hmac-ripemd160,hmac-ripemd160 en openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib en openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib en openssh.com,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:
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,
rijndael-cbc en lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,
rijndael-cbc en lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64 en openssh.com
,hmac-ripemd160,hmac-ripemd160 en openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64 en openssh.com
,hmac-ripemd160,hmac-ripemd160 en openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib en openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib en openssh.com,zlib
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: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
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
debug2: dh_gen_key: priv key bits set: 129/256
debug2: bits set: 517/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: put_host_port: [190.193.47.101]:X
debug3: put_host_port: [servidor.dyndns.org]:X
debug3: check_host_in_hostfile: host [servidor.dyndns.org]:X filename
/home/dantedario/.ssh/known_hosts
debug3: check_host_in_hostfile: host [servidor.dyndns.org]:X filename
/home/dantedario/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: host [190.193.47.101]:X filename
/home/dantedario/.ssh/known_hosts
debug3: check_host_in_hostfile: host [190.193.47.101]:X filename
/home/dantedario/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug1: Host '[servidor.dyndns.org]:X' is known and matches the DSA host
key.
debug1: Found key in /home/dantedario/.ssh/known_hosts:1
debug2: bits set: 498/1024
debug1: ssh_dss_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: /home/dantedario/.ssh/id_dsa (0x7fc21a042200)
debug2: key: /home/dantedario/.ssh/id_rsa (0x7fc21a0476a0)
debug2: key: /home/dantedario/.ssh/id_dsa (0x7fc21a047820)
debug2: key: /home/dantedario/.ssh/id_rsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred
gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/dantedario/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/dantedario/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/dantedario/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/dantedario/.ssh/id_rsa
debug3: no such identity: /home/dantedario/.ssh/id_rsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
*
Más información sobre la lista de distribución Lugro