Powerbrokerがあり、ホストに直接アクセスできないRHEL6環境では、ジャンプボックス/ゲートウェイを介してそのホストに移動できます。
この明示的なコマンドは構成なしで動作しますが、冗長です。
dk@local $ ssh -t dk@gateway 'pbrun -u sysuser -h remote bash'
dk@gateway's password:
sysuser@remote's password:
sysuser@remote $
上記のコマンドをssh remote
。 Powerbroker(pbrunコマンド)による認証に注意してください。
簡単に言えば、これを達成することは可能ですか ~/.ssh/config
?それでは、私が試したコマンド/設定で明確な修正を見つけましたか?
限定:
セキュリティポリシーでは禁止されているため、公開鍵認証(PKA)を使用してサーバー間の信頼を確立することはできません。すべての認証はPowerbrokerを介して行う必要があります(上記のpbrunコマンドを参照)。
ゲートウェイからリモートへの認証はPowerbrokerを介して行われます(
pbrun
コマンドを参照)。
私が試したこと:
dk@local $ cat .ssh/config
Host behindProxy
HostName remote
ProxyCommand ssh -t dk@gateway 'pbrun -u sysuser -h %h bash'
dk@local $ ssh behindProxy
Pseudo-terminal will not be allocated because stdin is not a terminal.
dk@gateway's password:
pbrun8.5.1-01[4377]: 3346: TTY is no longer available
ssh_exchange_identification: Connection closed by remote host
dk@local $
dk@local $ cat ~/.ssh/config
Host behindProxy
HostName remote
ProxyCommand ssh -W %h:%p dk@gateway 'pbrun -u sysuser -h %h bash'
dk@local $ ssh behindProxy
dk@gateway's password:
dk@remote's password:
dk@remote $ # undesired, as the goal is to end up logged in as sysuser (see the pbrun command)
dk@local $ cat ~/.ssh/config
Host behindProxy
ProxyJump gateway
ProxyCommand pbrun -u sysuser -h remote bash
dk@local $ ssh behindProxy
dk@gateway's password:
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
kex_exchange_identification: Connection closed by remote host
ベストアンサー1
私が見つけた2つの構成は次のとおりです。
dk@local $ cat ~/.ssh/config
Host behindProxy
HostName gateway
LocalCommand pbrun -u sysuser -h remote bash
PermitLocalCommand yes
dk@local $ ssh behindProxy
dk@gateway's password:
sysuser@remote's password:
sysuser@remote $
ただし、接続は実際にゲートウェイで発生しません。
sysuser@remote $ last -1 -w
dk pts/18 local.domain.com Sun Nov 8 22:03 still logged in
または:
dk@local $ cat ~/.ssh/config
Host behindProxy2
HostName gateway
RemoteCommand pbrun -u sysuser -h remote bash
dk@local $ ssh -t behindProxy2
dk@gateway's password:
sysuser@remote's password:
sysuser@remote $
接続が実際にゲートウェイを通過していることを証明します。
sysuser@remote $ last -1 -w
dk pts/18 gateway.domain.com Sun Nov 8 22:06 still logged in
このオプションは-t
必須です。それ以外の場合はエラーが発生します。
dk@local $ ssh behindProxy2
dk@gateway's password:
sysuser@remote's password: pbrun8.5.1-01[20295]: 3346: TTY is no longer available
-t
以下を指定すると、これを提供する必要はありませんRequestTTY force
。
dk@local $ cat ~/.ssh/config
Host behindProxy2
HostName gateway
RequestTTY force
RemoteCommand pbrun -u sysuser -h remote bash
dk@local $ ssh behindProxy2
dk@gateway's password:
sysuser@remote's password:
sysuser@remote $