Информация об изменениях

Сообщение SSH договорится о методе шифрования от 19.03.2025 19:03

Изменено 19.03.2025 19:40 TailWind

SSH договорится о методе шифрования
Читаю
https://datatracker.ietf.org/doc/html/rfc4253

Пишу клиент SSH

Пытаюсь договорится с сервером какие алгоритмы шифрования будем использовать

Подключился
Получил от сервера: SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.11
Отправил ему в ответ такую же строчку

Получил от сервера:
SSH_MSG_KEXINIT
packet_length  0x434
padding_length 0x5
cookie         a1b98423f8d41fe8dbea15fc080d9
kex_algorithms
  curve25519-sha256
  curve25519-sha256@libssh.org
  ecdh-sha2-nistp256
  ecdh-sha2-nistp384
  ecdh-sha2-nistp521
  diffie-hellman-group-exchange-sha256
  diffie-hellman-group16-sha512
  diffie-hellman-group18-sha512
  diffie-hellman-group14-sha256
  kex-strict-s-v00@openssh.com
server_host_key_algorithms
  rsa-sha2-512
  rsa-sha2-256
  ssh-rsa
  ecdsa-sha2-nistp256
  ssh-ed25519
encryption_algorithms_client_to_server
  chacha20-poly1305@openssh.com
  aes128-ctr
  aes192-ctr
  aes256-ctr
  aes128-gcm@openssh.com
  aes256-gcm@openssh.com
encryption_algorithms_server_to_client
  chacha20-poly1305@openssh.com
  aes128-ctr
  aes192-ctr
  aes256-ctr
  aes128-gcm@openssh.com
  aes256-gcm@openssh.com
mac_algorithms_client_to_server
  umac-64-etm@openssh.com
  umac-128-etm@openssh.com
  hmac-sha2-256-etm@openssh.com
  hmac-sha2-512-etm@openssh.com
  hmac-sha1-etm@openssh.com
  umac-64@openssh.com
  umac-128@openssh.com
  hmac-sha2-256
  hmac-sha2-512
  hmac-sha1
mac_algorithms_server_to_client
  umac-64-etm@openssh.com
  umac-128-etm@openssh.com
  hmac-sha2-256-etm@openssh.com
  hmac-sha2-512-etm@openssh.com
  hmac-sha1-etm@openssh.com
  umac-64@openssh.com
  umac-128@openssh.com
  hmac-sha2-256
  hmac-sha2-512
  hmac-sha1
compression_algorithms_client_to_server
  none
  zlib@openssh.com
compression_algorithms_server_to_client
  none
  zlib@openssh.com
languages_client_to_server
languages_server_to_client

first_kex_packet_follows 0x0
reserved  0x0


Отправил ему то же самое в ответ

А дальше что?
В доке не написано, что дальше делать
Как ему сказать какие алгоритмы я выбрал из его списка?
И почему он мне не отвечает какие ключи выбрал он из моего списка?
SSH договорится о методе шифрования
Читаю
https://datatracker.ietf.org/doc/html/rfc4253

Пишу клиент SSH

Пытаюсь договорится с сервером какие алгоритмы шифрования будем использовать

Подключился
Получил от сервера: SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.11
Отправил ему в ответ такую же строчку

Получил от сервера:
SSH_MSG_KEXINIT
packet_length  0x434
padding_length 0x5
cookie         a1b98423f8d41fe8dbea15fc080d9
kex_algorithms
  curve25519-sha256
  curve25519-sha256@libssh.org
  ecdh-sha2-nistp256
  ecdh-sha2-nistp384
  ecdh-sha2-nistp521
  diffie-hellman-group-exchange-sha256
  diffie-hellman-group16-sha512
  diffie-hellman-group18-sha512
  diffie-hellman-group14-sha256
  kex-strict-s-v00@openssh.com
server_host_key_algorithms
  rsa-sha2-512
  rsa-sha2-256
  ssh-rsa
  ecdsa-sha2-nistp256
  ssh-ed25519
encryption_algorithms_client_to_server
  chacha20-poly1305@openssh.com
  aes128-ctr
  aes192-ctr
  aes256-ctr
  aes128-gcm@openssh.com
  aes256-gcm@openssh.com
encryption_algorithms_server_to_client
  chacha20-poly1305@openssh.com
  aes128-ctr
  aes192-ctr
  aes256-ctr
  aes128-gcm@openssh.com
  aes256-gcm@openssh.com
mac_algorithms_client_to_server
  umac-64-etm@openssh.com
  umac-128-etm@openssh.com
  hmac-sha2-256-etm@openssh.com
  hmac-sha2-512-etm@openssh.com
  hmac-sha1-etm@openssh.com
  umac-64@openssh.com
  umac-128@openssh.com
  hmac-sha2-256
  hmac-sha2-512
  hmac-sha1
mac_algorithms_server_to_client
  umac-64-etm@openssh.com
  umac-128-etm@openssh.com
  hmac-sha2-256-etm@openssh.com
  hmac-sha2-512-etm@openssh.com
  hmac-sha1-etm@openssh.com
  umac-64@openssh.com
  umac-128@openssh.com
  hmac-sha2-256
  hmac-sha2-512
  hmac-sha1
compression_algorithms_client_to_server
  none
  zlib@openssh.com
compression_algorithms_server_to_client
  none
  zlib@openssh.com
languages_client_to_server
languages_server_to_client

first_kex_packet_follows 0x0
reserved  0x0


Отправил ему то же самое в ответ

А дальше что?
В доке не написано, что дальше делать
Как ему сказать какие алгоритмы я выбрал из его списка?
И почему он мне не отвечает какие ключи выбрал он из моего списка?

И еще я не понимаю зачем поле first_kex_packet_follows?