ProxyCommand を使用する SSH は接続されません。

ProxyCommand を使用する SSH は接続されません。

SSH 接続しようとしています。ミートプロシー次の SSH 構成ファイルを使用します。

Host test
        HostName 10.0.0.246
        User testssh
        ProxyCommand socat - PROXY:10.0.0.211:%h:%p,proxyport=9090

これにより、次の詳細な出力が生成され、最後の行以降に接続が中断されます。

OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Executing proxy command: exec socat - PROXY:10.0.0.211:10.0.0.246:22,proxyport=9090
debug1: identity file /home/ubuntu/.ssh/id_rsa type 0
debug1: identity file /home/ubuntu/.ssh/id_rsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/ubuntu/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519 type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519_sk type -1
debug1: identity file /home/ubuntu/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_xmss type -1
debug1: identity file /home/ubuntu/.ssh/id_xmss-cert type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa type -1
debug1: identity file /home/ubuntu/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.1

コンソールに接続は表示されませんmitmproxy。ただし、実行するだけでsocat - PROXY:10.0.0.211:%h:%p,proxyport=9090接続が実際に確立され、エージェントコンソールでそれを表示できます。

$ socat - PROXY:10.0.0.211:10.0.0.246:22,proxyport=9090
SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.3

私も試してみましたが、corkscrewどちらncも同じ動作をしています。 SSH は中断されますが、コマンドを直接呼び出すと接続が確立されます。

SSHにログがなくなった場合、接続は永久に中断されるようです。追加のデバッグのために何を試すことができますか?

編集:設定を削除すると、コンピュータが問題なく直接接続できるようになりますProxyCommand

編集:以下に基づいていますman ssh_config

このディレクティブは、nc(1)および対応するプロキシサポートと共に役立ちます。たとえば、次のコマンドは192.0.2.0のHTTPプロキシを介して接続されます。

ProxyCommand /usr/bin/nc -X 接続 -x 192.0.2.0:8080 %h %p

前に述べたように、この方法とそれ以上を試しましたが、違いはありません。

Host test
        HostName 10.0.0.246
        User testssh
        #ProxyCommand corkscrew 10.0.0.211 9090 %h %p
        #ProxyCommand socat - PROXY:10.0.0.211:%h:%p,proxyport=9090
        ProxyCommand /usr/bin/nc -X connect -x 127.0.0.1:8080 %h %p

ベストアンサー1

これは、SSHトンネルの処理方法がわからないプロキシサーバー自体の場合のようです。ブローカーのログでエラーが発生し、接続のリモート部分がシャットダウンしましたが、クライアントは開いて静止したままであることを確認できました。これは、SSHの詳細が答えを提供しない理由を説明します。

おすすめ記事