我用 Linux 原始机器测试了这个设置 - 一切都是一样的 - 只有第一跳可以使用来自原始机器的密钥。
我正在尝试设置多跳的 SSH 代理转发。我的本地机器是 Windows,有 putty 和 pageant,所有 Linux 机器都是 Debian 7。
问题是我的私钥源自 Windows,仅在第一跳有效。在任何第一台机器上添加的私钥在任何地方都可以使用。
第一跳机器被称为'vpn1',第二个是'www1'。“vpn1”已连接到 Internet 和 Intranet (10.1.0.1)。“www1”仅连接到内部网 (10.1.0.10)。“vpn1”使用“ssh-add”添加密钥(enbyted@vpn1.enbyted.org),该密钥显示在选美中。
我看到所有 3 个键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'
Run Code Online (Sandbox Code Playgroud)
当我尝试ssh -v -T git@github.com
从“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).
Run Code Online (Sandbox Code Playgroud)
当我尝试ssh -v -T git@github.com
从“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
Run Code Online (Sandbox Code Playgroud)
ssh 到仅接受“enbyted@home.robotronika.pl”密钥的主机也是如此。但是我可以通过 'enbyted@vpn1.enbyted.org' 使用任意数量的 SSH 进行 SSH。当然,git 命令也是如此。
我的~/.ssh/config
(在所有服务器上都一样):
Host 10.1.0.*
ForwardAgent yes
Host *
ForwardAgent no
Run Code Online (Sandbox Code Playgroud)
我的/etc/ssh/sshd_config
(没有评论,所有服务器都一样):
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
Run Code Online (Sandbox Code Playgroud)
此外,这真的很奇怪,“www1”上的 github 提供了两种身份验证方法 - 密码和公钥……我确定“www1”到 github.com 的 SSH 连接与“vpn1”连接到同一台服务器。
请注意,该图片来自文章,但几乎显示了我的设置。
因此,我的家用 PC 上有 2 个键,ruapehu (vpn1) 上有一个键。
当我从家用 PC 通过 SSH 连接到 ruapehu 时,我可以很好地使用所有三个密钥。但是当我从 ruapehu (vpn1) 到 aoraki (www1) 执行另一个 ssh 时,我只能使用来自 ruapehu 的密钥。
当我从 aoraki (www1) ssh 到下面的任何主机时,任何数量的跃点只有来自 ruapehu 的密钥才有效。
如果家用 PC 是带有 Putty + pageant 的 Windows 或带有 ssh-agent 的 Linux,则不会。
归档时间: |
|
查看次数: |
5567 次 |
最近记录: |