Phing 在服务器 A 上运行,使用此 SSH 任务连接到服务器 B:
它连接到服务器 B ok,但是尝试连接到服务器 C 的 hg pull 吐回 remote: Permission denied (public key).
但是,从 A 手动 SSH 连接到服务器 B 并执行 hg pull 工作正常,这表明代理转发正在工作,因为我没有在 B 上运行任何代理,仅在 A 上运行.
有什么方法可以让我看到 B 确实在使用哪个公钥来尝试调试它?
解决方案Phing 的任务使用的 PHP SSH2 似乎不支持代理转发.
用一个简单的 exec 任务替换 任务,即,
<exec command="ssh xxxxxx@B 'cd ./public_html/staging; hg pull'"/>
成功了.
Phing running on Server A, with this SSH task to connect to server B:
<ssh username="xxxxxx" host="B" pubkeyfile="/home/xxxx/.ssh/id_rsa.pub" privkeyfile="/home/xxxx/.ssh/id_rsa.pem" command="cd ./public_html/staging; hg pull />It connects to server B ok, but the hg pull which tries to connect to server C spits back remote: Permission denied (public key).
However manually SSH'ing into server B from A and doing an hg pull works fine, suggesting Agent Forwarding is working as I'm not running any agent on B, only on A.
Is there a way I can see which public key is indeed being used by B to try to debug this?
解决方案It seems like agent forwarding is not supported by PHP's SSH2 which Phing's task uses.
Replacing the <ssh> task with a simple exec task, i.e.,
<exec command="ssh xxxxxx@B 'cd ./public_html/staging; hg pull'"/>
did the trick.
更多推荐
Phing SSH 代理转发
发布评论