我正在设置一个新的 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> …
Run Code Online (Sandbox Code Playgroud)