我正在设置一个新的 CentOS 9 Stream 容器作为 CI 系统的一部分。它需要建立 SSH 连接以使用密钥从旧版 Git 主机下载一些代码ssh-rsa
(这在该主机的网络上被认为是可接受的风险)。
我首先生成一个密钥。
ssh-keygen -t ssh-rsa -f test_rsa_key
Run Code Online (Sandbox Code Playgroud)
使用密钥运行时出现“无相互签名算法”错误。
ssh -v -i test_rsa_key user@server
Run Code Online (Sandbox Code Playgroud)
debug1: Next authentication method: publickey
debug1: Offering public key: test_rsa_key RSA SHA256:<snip> explicit
debug1: send_pubkey_test: no mutual signature algorithm
debug1: No more authentication methods to try.
user@server: Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
我可以显式启用ssh-rsa
with -oPubkeyAcceptedKeyTypes=+ssh-rsa
,但现在出现 libcrypto 错误。
ssh -oPubkeyAcceptedKeyTypes=+ssh-rsa -v -i test_rsa_key user@server
Run Code Online (Sandbox Code Playgroud)
debug1: Next authentication method: publickey
debug1: Offering public key: test_rsa_key RSA SHA256:<snip> explicit
debug1: Server accepts key: test_rsa_key RSA SHA256:<snip> explicit
debug1: identity_sign: sshkey_sign: error in libcrypto
sign_and_send_pubkey: signing failed for RSA "test_rsa_key": error in libcrypto
debug1: No more authentication methods to try.
user@server: Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
ssh-rsa
CentOS 9 Stream 中的 libcrypto 级别是否可能禁用对旧签名方法的支持?如何在最新的 CentOS 上与此密钥建立连接?
ddu*_*ney 10
找到了答案,得益于其他人在 Red Hat Bugzilla 上遇到的类似问题。
该问题是由 SHA1 弃用引起的。您可以按照此处的说明设置加密策略DEFAULT:SHA1
(仅重新启用 SHA-1)或LEGACY
(为了与更旧的东西兼容)来解决此问题。
命令是:
update-crypto-policies --set DEFAULT:SHA1
Run Code Online (Sandbox Code Playgroud)
或者
update-crypto-policies --set LEGACY
Run Code Online (Sandbox Code Playgroud)
在运行之前,请查看链接的页面,因为LEGACY
它确实启用了一些相当旧的加密设置,这对于您的用例来说可能太不安全。
小智 5
默认加密策略限制使用 SHA-1 进行签名。
尝试从 RHEL9(或变体)客户端通过 SSH 连接到 RHEL6(或变体)OpenSSH 服务器失败,并显示以下错误消息:
ssh_dispatch_run_fatal: Connection to 1.2.3.4 port 22: error in libcrypto
Run Code Online (Sandbox Code Playgroud)
有 2 个已知选项:
ssh_dispatch_run_fatal: Connection to 1.2.3.4 port 22: error in libcrypto
Run Code Online (Sandbox Code Playgroud)
在 RHEL6 上,使用 ECDSA 算法而不是 RSA 来创建主机密钥(首选)
我。生成 sshd ECDSA 主机密钥:
update-crypto-policies --set DEFAULT:SHA1
Run Code Online (Sandbox Code Playgroud)
二. 编辑/etc/ssh/sshd_config
并设置:
HostKey /etc/ssh/ssh_host_ecdsa_key
Run Code Online (Sandbox Code Playgroud)
三. 重新开始sshd
ssh-keygen -t ecdsa -b 384 -f /etc/ssh/ssh_host_ecdsa_key
semanage fcontext -a -f -- -t sshd_key_t /etc/ssh/ssh_host_ecdsa_key
semanage fcontext -a -f -- -t sshd_key_t /etc/ssh/ssh_host_ecdsa_key.pub
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16701 次 |
最近记录: |