[BSD] ssh auth gondok [RESOLVED]

Laszlo Nagy gandalf at shopzeus.com
2009. Okt. 12., H, 09:30:57 CEST


István írta:
> ssh -vvvvvvvvvvvvvv
Ma reggelre megváltozott a hibaüzenet, de most sem kevésbé rejtélyes. 
Ilyet csinál:

gandalf at laci:~$ ssh -l someuser neptunus
Received disconnect from 192.168.1.106: 2: Too many authentication 
failures for someuser
gandalf at laci:~$ ssh -l nonexistent_user neptunus
Received disconnect from 192.168.1.106: 2: Too many authentication 
failures for nonexistent_user
gandalf at laci:~$

Tökmindegy milyen user-t írok be. Ha konkrétan megadom a keyfile-t akkor 
jó. Az alábbi pl. működik:

gandalf at laci:~$ ssh -l gandalf -i 
/home/gandalf/.ssh/id_neptunus_gandalf_dsa neptunus


A log szerint azt csinálja, hogy az összes lehetséges elérhető public 
key-t megpróbálja felhasználni a bejelentkezéshez, a távoli host meg egy 
idő után megelégeli...

Íme:

gandalf at laci:~$ ssh -vvvvvv -l someuser neptunus
OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /home/gandalf/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to neptunus [192.168.1.106] port 22.
debug1: Connection established.
debug1: identity file /home/gandalf/.ssh/identity type -1
debug1: identity file /home/gandalf/.ssh/id_rsa type -1
debug1: identity file /home/gandalf/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version 
OpenSSH_4.5p1 FreeBSD-20061110
debug1: match: OpenSSH_4.5p1 FreeBSD-20061110 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1
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,ssh-dss
debug2: kex_parse_kexinit: 
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc at lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: 
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc at lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: 
hmac-md5,hmac-sha1,umac-64 at openssh.com,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: 
hmac-md5,hmac-sha1,umac-64 at openssh.com,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib at openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib at 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-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc at lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: 
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc at lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: 
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: 
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib at openssh.com
debug2: kex_parse_kexinit: none,zlib at openssh.com
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-cbc hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-cbc 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: 120/256
debug2: bits set: 535/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/gandalf/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 20
debug3: check_host_in_hostfile: filename /home/gandalf/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 19
debug1: Host 'neptunus' is known and matches the DSA host key.
debug1: Found key in /home/gandalf/.ssh/known_hosts:20
debug2: bits set: 499/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: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: gandalf at shopzeus.com (0xb8939a08)
debug2: key: gandalf at saturnus (0xb8939ea8)
debug2: key: gandalf at sorb.dyndns.org (0xb893b640)
debug2: key: gandalf at saturnus (0xb893b8f8)
debug2: key: gandalf at saturnus (0xb893bbb8)
debug2: key: shopzeus at neptunus.msnet (0xb893be80)
debug2: key: fileshare at designaproduct.biz (0xb893c160)
debug2: key: gandalf at saturnus (0xb893c428)
debug2: key: /home/gandalf/.ssh/identity ((nil))
debug2: key: /home/gandalf/.ssh/id_rsa ((nil))
debug2: key: /home/gandalf/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over, passed a different list publickey,keyboard-interactive
debug3: preferred 
gssapi-keyex,gssapi-with-mic,gssapi,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: gandalf at shopzeus.com
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: gandalf at saturnus
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: gandalf at sorb.dyndns.org
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: gandalf at saturnus
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: gandalf at saturnus
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: shopzeus at neptunus.msnet
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: fileshare at designaproduct.biz
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
Received disconnect from 192.168.1.106: 2: Too many authentication 
failures for someuser
gandalf at laci:~$

Újrageneráltam egy kulcsot, megint átmásolgattam és most jó lett. 
Viszont valamit még mindig nem értek. A .ssh/config állományban ez van 
benne:

host neptunus_gandalf
hostname neptunus.sznet
identityfile /home/gandalf/.ssh/id_neptunus_gandalf_dsa
compression yes
cipher aes256-cbc
protocol 2

Ha nem sikerült neki authentikálni a megadott identity file-val, akkor 
utána miért próbálja végig az összes lehetséges key-t ? Miért nem vált 
át keyboard-interactive -ra? Mert így az van hogy egyből rosszra gondol 
az ember. Én konkrétan arra, hogy valaki olyan sokszor próbált meg 
betörni az én user-emmel ssh-n keresztül, hogy az sshd letiltotta - bár 
nyilván RTFM és kiderül hogy nincs ilyen. :-)

Mindenesetre a probléma megoldva! :-)

Köszönöm,

Laci




További információk a(z) BSD levelezőlistáról