Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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(enbyted@vpn1.enbyted.org) using 'ssh-add', this key shows in pageant.

Debugging

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

ssh-rsa [pubkey-1] git@home.enbyted.org //This is github key originating from Windows
ssh-rsa [pubkey-2] enbyted@home.robotronika.pl //This is SSH key originating from Windows
ssh-rsa [pubkey-3] enbyted@vpn1.enbyted.org //This is SSH key originating from 'vpn1'

When I try to ssh -v -T git@github.com from 'vpn1'

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: git@home.enbyted.org
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).

When I try to ssh -v -T git@github.com from 'www1'

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: git@home.enbyted.org
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: enbyted@home.robotronika.pl
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: enbyted@vpn1.enbyted.org
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 'enbyted@home.robotronika.pl' key. But I can SSH with as many hops as I like with 'enbyted@vpn1.enbyted.org'. 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.

share|improve this question
    
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 Mar 22 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 Mar 22 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 Mar 22 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 Mar 22 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 Mar 22 at 18:50

1 Answer 1

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

                     ss of dialog

References

share|improve this answer
    
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 Mar 22 at 19:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.