正在连接到节点jenkins(ssh错误:服务器拒绝了1个私有)

clj7thdc  于 2022-11-21  发布在  Jenkins
关注(0)|答案(1)|浏览(414)

已配置的节点:

Launch method: Launchagents via SSH
Host: host
Credentials: added a new one by specifying username and Private key
Host Key Verification Strategy: Not verifying (The error does not differ when choosing a different value)

当我尝试连接时,出现错误:

[08/24/22 14:39:14] [SSH] Opening SSH connection to host:22.
[08/24/22 14:39:14] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for cred_name (credentialId:cred_name/method:publickey)
ERROR: Failed to authenticate as cred_name with credential=cred_name
java.io.IOException: Publickey authentication failed.
    at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:349)
    at com.trilead.ssh2.Connection.authenticateWithPublicKey(Connection.java:472)
    at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.doAuthenticate(TrileadSSHPublicKeyAuthenticator.java:110)
    at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.authenticate(SSHAuthenticator.java:431)
    at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.authenticate(SSHAuthenticator.java:468)
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:881)
    at hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:434)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Could not generate signature
    at com.trilead.ssh2.signature.KeyAlgorithm.generateSignature(KeyAlgorithm.java:43)
    at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:316)
    ... 10 more
Caused by: java.security.SignatureException: Could not sign data
    at java.base/sun.security.rsa.RSASignature.engineSign(RSASignature.java:196)
    at java.base/java.security.Signature$Delegate.engineSign(Signature.java:1423)
    at java.base/java.security.Signature.sign(Signature.java:712)
    at com.trilead.ssh2.signature.KeyAlgorithm.generateSignature(KeyAlgorithm.java:41)
    ... 11 more
Caused by: javax.crypto.BadPaddingException: RSA private key operation failed
    at java.base/sun.security.rsa.RSACore.crtCrypt(RSACore.java:209)
    at java.base/sun.security.rsa.RSACore.rsa(RSACore.java:130)
    at java.base/sun.security.rsa.RSASignature.engineSign(RSASignature.java:193)
    ... 14 more
[08/24/22 14:39:14] [SSH] Authentication failed.

从安装了Jenkins的计算机上,我可以使用以下命令连接到远程计算机:

ssh name@host -p 22

我发现这个问题的所有解决方案都是通过用户Jenkins下的控制台解决的,但是如何使用Jenkins UI解决这个问题,因为到之前创建的节点的连接是活动的,问题只存在于此。可能他指出了一些错误
私钥是使用以下方法创建的:

ssh-keygen -t rsa

我从rsa_id获取密钥

7xllpg7q

7xllpg7q1#

我也遇到了同样的问题。我想是一个错误。
我将ssh-key的类型更改为ed 25519,它工作了。

ssh-keygen -t ed25519

相关问题