10

I tested this setup with Linux origin machine - everything is the same - only the first hop can use keys from origin machine.

Initial problem

I'm trying to set up SSH agent forwarding with multiple hops. My local machine is Windows, with putty and pageant, all Linux machines are Debian 7.

The problem is that my private keys, originating from windows, work only on the first hop. Private key added on any the first machine works everywhere.

First hop machine is called 'vpn1', second 'www1'. 'vpn1' is connected to internet and to intranet(10.1.0.1). 'www1' is connected only to intranet(10.1.0.10). 'vpn1' adds key([email protected]) using 'ssh-add', this key shows in pageant.

Debugging

I see all 3 keys in ssh-add -L:

ssh-rsa [pubkey-1] [email protected] //This is github key originating from Windows
ssh-rsa [pubkey-2] [email protected] //This is SSH key originating from Windows
ssh-rsa [pubkey-3] [email protected] //This is SSH key originating from 'vpn1'

When I try to ssh -v -T [email protected] from 'vpn1'

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: [email protected]
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).

When I try to ssh -v -T [email protected] from 'www1'

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: [email protected]
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: [email protected]
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: [email protected]
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /home/enbyted/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/enbyted/.ssh/id_dsa
debug1: Trying private key: /home/enbyted/.ssh/id_ecdsa
debug1: Next authentication method: password

The same goes with ssh to hosts that accept only '[email protected]' key. But I can SSH with as many hops as I like with '[email protected]'. Of course, the same goes for git commands.

Configurations

My ~/.ssh/config (same on all servers):

Host 10.1.0.*
    ForwardAgent yes

Host *
    ForwardAgent no

My /etc/ssh/sshd_config (without comments, same on all servers):

Port <custom-port>
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 768
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes

Questions

  • So, why is that?
  • What am I doing wrong?

Also it's really strange, that on 'www1' github offers two auth methods - password and publickey ... I'm sure that 'www1' SSHing to github.com is connecting to the same server as 'vpn1'.

Update #1: network setup on image

Please note, that image is from article, but pretty much shows my setup.

           Network setup image

So, I have 2 keys on my home PC, and one key on ruapehu (vpn1).

When I SSH to ruapehu from the home PC I can use all three keys just fine. But when I do another ssh from ruapehu (vpn1) to aoraki (www1) I can use only the key from ruapehu.

And when I ssh from aoraki (www1) to any hosts below with any amount of hops only key from ruapehu works.

It doesn't if home PC is Windows with Putty + pageant or Linux with ssh-agent.

16
  • May be try to narrow it down by eliminating windows as first hop if possible. Use Linux for each hop to see if it works as expected.
    – Ketan
    Commented Mar 22, 2014 at 18:18
  • @Ketan Everything works on the first hop(and local machine). On the second hop though I can't use keys originating from local machine(Windows).
    – Enbyted
    Commented Mar 22, 2014 at 18:45
  • @slm I didn't say that in OP. vpn1 and www1 are in 10.1.0.0/24 class. But I tried it and it didn't help.
    – Enbyted
    Commented Mar 22, 2014 at 18:46
  • @Enbyted Is it possible that Windows machine is not doing the ssh handshake properly? One way to test that would be to use Linux as first machine.
    – Ketan
    Commented Mar 22, 2014 at 18:48
  • @Ketan it is technically possible, I use Putty and Pageant. Key added by 'vpn1' is visible in pageant. I don't have linux machine handy at the moment, but I'll test it ASAP.
    – Enbyted
    Commented Mar 22, 2014 at 18:50

1 Answer 1

1

I think your issue lies with the configuration of PuTTY. This forwards setting needs to be checked like so:

                     ss of dialog

References

3
  • Thanks for reply, but I have it already checked. As I told in OP - I can use Windows private keys on first hop, but not on second, third, ...
    – Enbyted
    Commented Mar 22, 2014 at 19:46
  • Really old but you need to load your keys. You can use Pageant for this. Commented Dec 1, 2020 at 8:05
  • Really late reply, but I do use pageant (or ssh-agent on linux). All the keys are available on the first hop, just not any further.
    – Enbyted
    Commented May 14, 2021 at 12:10

You must log in to answer this question.

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