无法让代理转发流浪汉工作

Chr*_*ock 5 ssh forwarding agent vagrant

尽管我尽了最大的努力,但我似乎无法在 Vagrant 上获得代理转发。我正在使用以下 vagrant/virtualbox 组合运行 OS X:

[chrisshorrock:~]$ vboxwebsrv --version
Oracle VM VirtualBox web service Version 4.2.18
(C) 2007-2013 Oracle Corporation
All rights reserved.
4.2.18r88780
[chrisshorrock:~]$ vagrant --version   
Vagrant 1.3.5
Run Code Online (Sandbox Code Playgroud)

首先 - 在我的流浪文件中,我有

config.ssh.forward_agent = true
Run Code Online (Sandbox Code Playgroud)

我已经确认我的密钥(在我的 os x 盒子上)添加到我的 ssh 代理中:

ssh-add -L
Run Code Online (Sandbox Code Playgroud)

我的 ~/.ssh/config 文件包含以下内容:

Host 127.0.0.1
  ForwardAgent yes
Run Code Online (Sandbox Code Playgroud)

我可以连接到外部服务器,并确认如下:

ssh -T git@github.com
Run Code Online (Sandbox Code Playgroud)

工作正常(本地和远程都表明 ssh 代理转发功能在 OS X 机器上似乎是正确的),但是,当我连接到我的 vagrant 实例时,我没有这样的运气:

[chrisshorrock:~]$ ssh -v vagrant@127.0.0.1 -p 2222
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/chrisshorrock/.ssh/config
debug1: /Users/chrisshorrock/.ssh/config line 35: Applying options for 127.0.0.1
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file /Users/chrisshorrock/.ssh/id_rsa type 1
debug1: identity file /Users/chrisshorrock/.ssh/id_rsa-cert type -1
debug1: identity file /Users/chrisshorrock/.ssh/id_dsa type -1
debug1: identity file /Users/chrisshorrock/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 50:db:75:ba:11:2f:43:c9:ab:14:40:6d:7f:a1:ee:e3
debug1: Host '[127.0.0.1]:2222' is known and matches the RSA host key.
debug1: Found key in /Users/chrisshorrock/.ssh/known_hosts:29
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/chrisshorrock/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
Authenticated to 127.0.0.1 ([127.0.0.1]:2222).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_CA.UTF-8
debug1: Sending env LC_CTYPE = en_CA.UTF-8
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-56-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Nov 22 09:58:24 2013 from 10.0.2.2
[vagrant:~]$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list     of     known hosts.
    Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)

我不知所措。

Chr*_*ock 0

问题解决了。该盒子使用 oh-my-zsh,其插件定义为:

plugins=(git cp command-not-found git-extras gnu-utils history pip python ruby screen ssh-agent svn)
Run Code Online (Sandbox Code Playgroud)

这里的罪魁祸首是 oh-my-zsh 的 ssh-agent 助手。