在 Bastion/Jump 主機上使用 bastion SSH 金鑰跳到目標主機

在 Bastion/Jump 主機上使用 bastion SSH 金鑰跳到目標主機

我正在研究一種分散 SSH 金鑰的方法。目標是為每個開發人員/管理員/系統管理員提供一個 SSH 金鑰。

此 SSH 金鑰將會新增至堡壘伺服器上的authorized_keys 檔案中。現在,我的下面的命令在作為終端命令運行時可以完美運行:

ssh -t [email protected] ssh -i /home/bastion/.ssh/id_rsa target.domain.tld

現在我正在嘗試將此命令轉換為一個~/.ssh/config條目。但經過多次嘗試,都沒有成功。

我嘗試過使用下面的區塊,但是目標伺服器正在使用管理員的 SSH 金鑰,這當然不會成功。

Host *.domain.tld !bastion.domain.tld
    ProxyJump [email protected]

我也嘗試過使用 nc,但這給了我相同的結果。

Host *.domain.tld !bastion.domain.tld
  IdentityFile /home/bastion/.ssh/id_rsa
  ProxyCommand ssh [email protected] nc %h %p

我在這裡做錯了什麼?

相關內容