5

I have a setup where I'm running Ubuntu 11.10 as a VirtualBox guest under a Windows 7 host, behind a restrictive corporate firewall. I have set up NAT from the host port 22 to Ubuntu's port 22; IT inform me that they have opened port 22 outbound for the host machine's IP address.

I have run ssh-keygen -t rsa, and am trying to test the setup by connecting to github and another known ssh server. In both cases the connect is refused with ssh_exchange_identification: Connection closed by remote host. Full -vvv log is below.

Is this possibly still due to the corporate firewall? If so, what else might I need to request from them? Any other ideas what might be wrong and how to fix it?

~$ ssh -Tvvv [email protected]
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/chris/.ssh/id_rsa" as a RSA1 public key
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/chris/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/chris/.ssh/id_rsa-cert type -1
debug1: identity file /home/chris/.ssh/id_dsa type -1
debug1: identity file /home/chris/.ssh/id_dsa-cert type -1
debug1: identity file /home/chris/.ssh/id_ecdsa type -1
debug1: identity file /home/chris/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host

Edit: Requested diagnostics:

~$ ls -la ~/.ssh
total 16
drwx------  2 chris chris 4096 2012-03-30 13:12 .
drwxr-xr-x 29 chris chris 4096 2012-03-30 13:25 ..
-rw-------  1 chris chris 1766 2012-03-30 13:12 id_rsa
-rw-r--r--  1 chris chris  409 2012-03-30 13:12 id_rsa.pub

2 Answers 2

1

The following line can be a very misleading message:

debug3: Could not load "/home/chris/.ssh/id_rsa" as a RSA1 public key
debug2: key_type_from_name: unknown key type '-----BEGIN'

It will send you on a wild goose chase. I say that given that you went through all the diagnostics and even regenerated the key and the problem persisted.

From experience, I can say that this problem can be caused by server configuration even though the messages make it look like it is strictly a client key problem.

To resolve this, check the server SSH config carefully. In this case, first make sure you have added the contents of id_rsa.pub to your Git account. Check any other permissions there.

When this happens on your own server check configuration carefully. For example, I found that if your user is not allowed by ssh config on the server, the ssh client gives this exact same (misleading) error message.

sudo nano /etc/sshd_config
AllowUsers yourname@*
2
  • Thanks for the advice. My best bet is still a firewall problem - I'm not 100% convinced IT have opened the firewall for reciprocal connections (so I think I'm talking to github, but it isn't allowed to talk back - certainly the public key has been added). Sadly, they're not being very responsive.
    – Chowlett
    May 5, 2012 at 13:33
  • Yes, it could be. In my experience, the messages starting with Could not load ... key and continuing with the "missing whitespace" make it sound like a client problem. But, as I pointed out, server configuration problems can cause this same sequence of messages. So it may be possible that firewall problems could do it too. There isn't really much ssh configuration a user can do on github, so that does point to the firewall as the most likely problem. I suggest you test your github account from outside the firewall to be 100% sure.
    – MountainX
    May 5, 2012 at 17:36
0

Try to delete your existing keys first..

rm ~/.ssh/id_*

And now try regenerate a key.

ssh-keygen -t rsa
6
  • I've already tried that; no change.
    – Chowlett
    Mar 30, 2012 at 15:03
  • What's the output of ls -la ~/.ssh?
    – SirCharlo
    Mar 30, 2012 at 15:14
  • Edited in to question.
    – Chowlett
    Mar 30, 2012 at 16:29
  • Ok... Have you added to contents of id_rsa.pub to your Git account? I got the same errors as you until I did so. Follow this guide, especially the section Set Up SSH Keys, step 4...
    – SirCharlo
    Mar 30, 2012 at 16:38
  • Yes, definitely. (Well, almost definitely. 99% definitely, but I can't now check the fingerprints until Monday)
    – Chowlett
    Mar 30, 2012 at 18:36

You must log in to answer this question.

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