0

VirtualBox seems to break my SSH ProxyCommand... here are the details:

I want to open an SSH connection from my laptop to desktop over an SSH (reverse) tunnel. I want to do that in one step using ProxyCommand (and netcat). It works when run from the installed OS on my laptop. It fails when run from a VirtualBox guest on my laptop.

My normal setup is that Kubuntu 12.04 is running in VirtualBox on the desktop and Kubuntu 12.04 is installed directly on my laptop. This works fine.

However, if I try to do the exact same thing with a Kubuntu 12.04 VirtualBox instance on my laptop, it fails as I will detail below.

Here's what my SSH tunnel looks like:

laptop--->nat--->middleman<--nat<--desktop

The desktop & laptop run Kubuntu 12.04 regardless of whether I'm using VirtualBox; and the middleman is Ubuntu 8.04.

I'll describe my SSH tunnel in more detail. Regarding this leg:

middleman<--nat<--desktop

...here is how it is established:

autossh -M 5234 -N -f -R 1234:localhost:22 [email protected]

That part is automatic and trouble-free.

From the laptop:

laptop--->nat--->middleman

I can connect to middleman and then from the middleman to the desktop in two steps under all conditions:

me@laptop:~$ ssh -i ~/.ssh/id_rsa admin@middleman  
    admin@middleman:~$ ssh -i ~/.ssh/id_rsa localhost -p 1234

To do this in one step I use netcat ("nc") on middleman and I edit my SSH config file on laptop to use ProxyCommand and nc:

me@laptop:~/.ssh$ nano config

The contents are:

Host family_desktops
  ProxyCommand ssh middleman_fqdn nc localhost %p
  User admin
  PasswordAuthentication no
  IdentityFile ~/.ssh/my_id_rsa

Where middleman_fqdn is like "middleman.com"

Then I just connect to "desktop" in one step:

me@laptop:~$ ssh family_desktops -p 1234

Here's the problem. This works when run directly from my laptop (where Kubuntu 12.04 is installed). But when I run it from VirtualBox instance of Kubuntu 12.04 (guest) on my laptop, it does not work. SSH asks for the password for middleman. There is no password set up, so I cannot connect.

The strange thing is that running the two separate commands allows me to connect to my desktop and it doesn't ask for a password. The ssh -vvv option shows no errors and nothing helpful.

I have been troubleshooting all day and I cannot find any difference in settings between the VirtualBox instance and the host OS on my laptop. I use the exact same id_rsa keys (public & private), the same user, and auth.log on the middleman server indicates it sees the same IP address in both cases.

So why would running VirtualBox on my laptop make this SSH tunnel stop working (at least working in one step)?

1
  • You don't need netcat if you use a recent version of OpenSSH. You can replace nc localhost %p with -W localhost:%p.
    – Marco
    Jul 27, 2013 at 2:57

1 Answer 1

1

It appears that this was my problem:

Bug #201786 “ssh Agent admitted failure to sign using the key on...” : Bugs : “gnome-keyring” package : Ubuntu https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/201786

To resolve my problem all I did was run ssh-add on the VirtualBox instance running on my laptop:

ssh-add ~/.ssh/my_other_key

which is the solution mentioned in this comment:
https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/201786/comments/58

I do not understand why the problems shows up only when running VirtualBox, but since some feel it is related to endian-ness, maybe that explains it in a very nebulous way. Anyway, that's resolved it for me.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .