The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

форумы  помощь  поиск  регистрация  майллист  вход/выход  слежка  RSS
"ssh аутентификация с помощью ключей"
Вариант для распечатки  
Пред. тема | След. тема 
Форумы OpenNET: Виртуальная конференция (Public)
Изначальное сообщение [ Отслеживать ]

"ssh аутентификация с помощью ключей"  +/
Сообщение от Cherepulya email(??) on 07-Фев-06, 15:20 
возникла необходимость (для скриптов) доступа по ссш к другому хосту без введения паролей. Была прочитана документация по ssh и на основе ее сделано следующее:

- На клиентской машине запущен ssh-keygen -t dsa
- Пассфраза оставлена пустой
- содержимое файлика id_dsa.pub добавлена в .ssh/authorised_keys в домашней папке на другой машине.

И дальше собственно процедура аутентификации по ключу не происходит.

ssh -2 -vvv -l cherep -i .ssh/id_dsa host

OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to host [x.y.z.v] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file .ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
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 .ssh/id_dsa type 2
debug3: Not a RSA1 key file /home/cherep/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
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
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/cherep/.ssh/id_rsa type 1
debug3: Not a RSA1 key file /home/cherep/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
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/cherep/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: 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,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,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-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,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,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_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: 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: 137/256
debug2: bits set: 495/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/cherep/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 4
debug3: check_host_in_hostfile: filename /home/cherep/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 4
debug1: Host 'host' is known and matches the RSA host key.
debug1: Found key in /home/cherep/.ssh/known_hosts:4
debug2: bits set: 520/1024
debug1: ssh_rsa_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: /home/cherep/.ssh/id_rsa (0x95474b8)
debug2: key: .ssh/id_dsa (0x9542d00)
debug2: key: /home/cherep/.ssh/id_dsa (0x9542d48)
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-with-mic,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup gssapi-with-mic
debug3: remaining preferred: publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug2: we sent a gssapi-with-mic packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug2: we sent a gssapi-with-mic packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug2: we did not send a packet, disable method
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/cherep/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Offering public key: .ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Offering public key: /home/cherep/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
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

Высказать мнение | Ответить | Правка | Cообщить модератору

Оглавление

Сообщения по теме [Сортировка по времени | RSS]


1. "ssh аутентификация с помощью ключей"  +/
Сообщение от edwin (ok) on 07-Фев-06, 15:55 
Потдерживает ли удаленный сервер авторизацию по ключам ?
А то ведь мало ли
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору

2. "ssh аутентификация с помощью ключей"  +/
Сообщение от Synopsis email(??) on 20-Янв-10, 15:37 
>[оверквотинг удален]
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>debug1: Offering public key: /home/cherep/.ssh/id_dsa
>debug3: send_pubkey_test
>debug2: we sent a publickey packet, wait for reply
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>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

Видно по логу, что устанавливается соединение по порту.
Включается авторизация и начинается самое главное
Сервер спрашивает ключ не DSA, а RCA1 (который предназначен для SSH1)
Считывает файл с ключом DSA, который вы ему подставляете, а он ожидает ключ RSA1.
Чото с конфигом у вас не то О_о

У меня веселей ситуация.
Поставил систему, запустил SSH2 с ключмо RSA 2048bit.
Но вот ошибся с размером корневого раздела. Снес систему.
Поставил заново, скопировал ключи и файлы конфигураций.
Так похоже даемон вообще не считывает конфигурационный файл и лупит значения по умолчанию.
Почему не по ключу авторизация а по keyboard-interactive  О_О
Сегодня запущу в режиме дебуг даемона. :)

Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору

3. "ssh аутентификация с помощью ключей"  +/
Сообщение от Synopsis email(??) on 20-Янв-10, 15:43 
>[оверквотинг удален]
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>debug1: Offering public key: /home/cherep/.ssh/id_dsa
>debug3: send_pubkey_test
>debug2: we sent a publickey packet, wait for reply
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>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

Вот нашел.
У вас включены все три вида авторизации, что явно странно.
Один способ авторизации - пароль (keyboard-interactive)
Другой способ авторизации - public keys (метод RSA, DSA)
И еще один GSSAPI, который почему то выбирается по-умолчанию.
Как раз авторизация пытается по GSSAPI пройти, который не настроен толком
Отключите везде GSSAPI!

Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору

4. "ssh аутентификация с помощью ключей"  +/
Сообщение от Synopsis email(??) on 20-Янв-10, 16:00 
>[оверквотинг удален]
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>debug1: Offering public key: /home/cherep/.ssh/id_dsa
>debug3: send_pubkey_test
>debug2: we sent a publickey packet, wait for reply
>debug1: Authentications that can continue: publickey,gssapi-with-mic,password
>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

Сорри что как то мысли в кучу. Сам вот разбираюсь.
Вот участок отвечающий за авторизацию по публичному ключу. (то что говорил про GSSAPI, был не прав).
В конфиге ssh_config надо проверить
А на другом компе(который как сервер принимает соединение), тоже DSA включен?

Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору

Архив | Удалить

Индекс форумов | Темы | Пред. тема | След. тема




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру