一个伪linux粉丝的blog

  1. 首页
  2. unix/linux
  3. 正文

OpenSSH 8.8 ssh-rsa

2月 11, 2022 365点热度 0人点赞 0条评论

起因

话说部门最近搭了一个jump-server,有同事说他无法登录,报错 如下,看起来是rsa冲突:

Unable to negotiate with 192.168.41.11 port 32222: no matching host key type found. Their offer: ssh-rsa

然后他强调他电脑上装了linux,这个公钥匙用github是正常的,没多想,先排除法,找个虚拟机生成了一个新的key,后台绑定后发现可以登录,翻翻互联网吧,找到一个帖子,连接时要增加2行配置。

解决

https://stackoverflow.com/questions/69875520/unable-to-negotiate-with-40-74-28-9-port-22-no-matching-host-key-type-found-th

修改 ~/.ssh/config 配置,增加类似配置。

Host ssh.dev.azure.com
HostName ssh.dev.azure.com
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa

试了一下,果然可以登录了。

来龙去脉

得搞清原因呀,继续翻,找到官网 8.8的介绍,原来OpenSSH 8.8/8.8p1 (2021-09-26) 发布时修改了默认sha-rsa支持,所以,如果客户端升级了,服务还没支持,那就先改客户端兼容一下。

介绍文档 https://www.openssh.com/releasenotes.html


Potentially-incompatible changes
================================
This release disables RSA signatures using the SHA-1 hash algorithm
by default. This change has been made as the SHA-1 hash algorithm is
cryptographically broken, and it is possible to create chosen-prefix
hash collisions for <USD$50K [1]

For most users, this change should be invisible and there is
no need to replace ssh-rsa keys. OpenSSH has supported RFC8332
RSA/SHA-256/512 signatures since release 7.2 and existing ssh-rsa keys
will automatically use the stronger algorithm where possible.

Incompatibility is more likely when connecting to older SSH
implementations that have not been upgraded or have not closely tracked
improvements in the SSH protocol. For these cases, it may be necessary
to selectively re-enable RSA/SHA1 to allow connection and/or user
authentication via the HostkeyAlgorithms and PubkeyAcceptedAlgorithms
options. For example, the following stanza in ~/.ssh/config will enable
RSA/SHA1 for host and user authentication for a single destination host:

Host old-host
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

We recommend enabling RSA/SHA1 only as a stopgap measure until legacy
implementations can be upgraded or reconfigured with another key type
(such as ECDSA or Ed25519).

[1] "SHA-1 is a Shambles: First Chosen-Prefix Collision on SHA-1 and
Application to the PGP Web of Trust" Leurent, G and Peyrin, T
(2020) https://eprint.iacr.org/2020/014.pdf

再回头看一下同事的 ssh版本

ssh -V 看一下输出, OpenSSH_8.8p1, OpenSSL 1.1.1m 14 Dec 2021 ,正好时升级后的新版,报错的原因找到了,问题解决。

相关文章:

  1. Mtr(My traceroute) 使用简介
  2. crontab log error
  3. SSHTunnel Provides a Secure Internet Connection for Your Android
  4. debian-lighttpd-install
标签: OpenSSH
最后更新:2月 16, 2022

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据。

归档
分类
  • network / 324篇
  • Uncategorized / 116篇
  • unix/linux / 114篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 20篇
  • 英语学习 / 3篇
标签聚合
Opera Mini d90 虚拟主机 刷机 Nginx 泰国 Google Voice docker gitlab 网站运营 中国电信 k8s Linux jira Google Adwords kernel brew Google ldap dreamhost空间 nexus Android iMac debian 网通 wget dreamhost 邮件归档 VPS Ubuntu

COPYRIGHT © 2008-2022 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang