将Mac Hudson从属连接到Linux主服务器时,SSH密钥身份验证失败

时间:2011-01-17 16:25:43

标签: macos ssh hudson master slave

好的,所以我让Hudson(v1.393)在Ubuntu VM中运行,一切正常。 但是我正在尝试将一个Mac奴隶添加到Ubuntu主服务器中,我遇到了一些问题。

我已经设置了SSH密钥,因此从命令行,Ubuntu VM可以使用密钥ssh到Mac上名为hudson的用户。

在Hudson slave配置中,我选择了“通过SSH在Unix机器上启动从属代理”并输入了主机IP,从属用户的用户名以及我的私钥文件在主服务器上的位置(具有已添加到从站上的授权密钥文件中。

但是,主站无法连接到从站。 查看日志(下面),它正在尝试使用密码进行身份验证。

这是否是基于密钥的SSH尝试失败的后退? Hudson是否只尝试使用密码进行身份验证,我需要更改其他内容以使其使用配置中定义的密钥文件?
是不是可以通过mac上的ssh启动slave代理? (我知道这种类型的奴隶启动方法明确表示Unix的名称,但我正在考虑(阅读:希望)它也适用于OS X)

记录

[01/14/11 10:38:07] [SSH] Opening SSH connection to 10.0.1.188:22.
[01/14/11 10:38:07] [SSH] Authenticating as hudson/******.
java.io.IOException: Password authentication failed.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:319)
at com.trilead.ssh2.Connection.authenticateWithPassword(Connection.java:314)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:565)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:179)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:184)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:289)
... 9 more
[01/14/11 10:38:07] [SSH] Connection closed.

如果有人设法征服此类设置,或者有任何提示或想法,我将非常感激! 感谢

3 个答案:

答案 0 :(得分:16)

我最近遇到了同样的问题,尝试使用SSH在Mac OS X 10.6计算机上启动代理。

要使密码身份验证正常工作,您需要在客户端节点上编辑/ etc / sshd_config,设置PasswordAuthentication yes

在Hudson仪表板中,使节点脱机,确保配置具有有效的用户名和密码,然后启动代理。还要确保 Remote FS root 目录归您正在连接的构建用户所有。

对于无密码的ssh身份验证,首先要检查Hudson主服务器正在运行的用户。让我们假设这是 tomcat55 。生成公钥/私钥SSH密钥对(使用空密码),然后验证Hudson用户是否可以连接。

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tomcat55/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/tomcat55/.ssh/id_rsa.
Your public key has been saved in /home/tomcat55/.ssh/id_rsa.pub.

$ # authorize the hudson master on the hudson node
$ scp /home/tomcat55/.ssh/id_rsa.pub hudson@macnode:~/.ssh/authorized_keys
$ # test the connection
$ ssh -i /home/tomcat55/.ssh/id_rsa hudson@macnode

在Hudson mac节点上,/ etc / sshd_config需要允许无密码访问。

Protocol 2
PubkeyAuthentication yes

在节点配置中清除密码字段,并设置私钥字段(在本例中为/home/tomcat55/.ssh/id_rsa)。您现在应该能够启动代理:

[01/19/11 22:38:44] [SSH] Opening SSH connection to macnode:22.
[01/19/11 22:38:44] [SSH] Authenticating as hudson with /home/tomcat55/.ssh/id_rsa.
[01/19/11 22:38:45] [SSH] Authentication successful.

答案 1 :(得分:2)

检查Ubuntu机器上的/var/log/auth.log文件。我打赌你需要chmod 700哈德森用户的.ssh目录。

答案 2 :(得分:1)

我认为第一个答案(选定的答案)是一个很棒的答案,但我确实找到了一个不是唯一解决方案的案例。

在我的情况下,我有一个正在运行的Mac OS奴隶,然后我把那台Mac拿下来并提出了一个新的。我想我可以调整现有节点配置的设置,将其指向新的Mac。它不起作用,我在此消息线程中描述了所有相同的错误和问题。

然后我进入并删除了节点并使用完全相同的设置重新创建它并且它工作正常。我怀疑 SSH密钥指纹已更改,通过删除节点并重新创建它,我能够使其正常工作。无论是什么,导致它失败的关键组件都不是配置选项。