我有一個標準設定:
客戶端 (Windows 2019) --> HTTP 代理程式 --> SSH 伺服器 (Ubuntu) --> 伺服器
我想將本地連接埠轉送到伺服器。
我能夠使用此設定從客戶端成功連接到伺服器。我沒有在通話中指定與代理商相關的任何內容
ssh -v -p 22 -N -C -L 50000:WinServer:8080 user@SSHServer
我認為這意味著 OpenSSH 實作正在從客戶端系統取得預設代理設定。我想明確指定代理,以便可以將我的解決方案與客戶端電腦設定隔離。
我嘗試了 ProxyCommand 選項,如下所示:
PS C:\scripts> ssh.exe -vvv -C -L 50000:WinServer:8080 -o ProxyCommand="ssh.exe -v -W %h:%p -p proxy-port proxy-host" user@SSHServer
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/Administrator/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug1: Executing proxy command: exec ssh.exe -v -W SSHServer:22 -p proxy-port proxy-host
debug3: spawning "C:\\Windows\\System32\\OpenSSH\\ssh.exe" -v -W SSHServer:22 -p proxy-port proxy-host
debug3: w32_getpeername ERROR: not sock :2
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_rsa error:2
debug1: Connecting to proxy-host [proxy-host] port proxy-port.
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_rsa.pub error:2
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_rsa type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_rsa-cert.pub error:2
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\Administrator/.ssh/id_rsa type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_dsa error:2
debug1: key_load_public: No such file or directory
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_dsa.pub error:2
debug1: identity file C:\\Users\\Administrator/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\Administrator/.ssh/id_dsa type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_dsa-cert error:2
debug1: key_load_public: No such file or directory
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_dsa-cert.pub error:2
debug1: identity file C:\\Users\\Administrator/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\Administrator/.ssh/id_ecdsa type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ecdsa error:2
debug1: key_load_public: No such file or directory
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ecdsa.pub error:2
debug1: identity file C:\\Users\\Administrator/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\Administrator/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ecdsa-cert error:2
debug1: key_load_public: No such file or directory
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ecdsa-cert.pub error:2
debug1: identity file C:\\Users\\Administrator/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\Administrator/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ed25519 error:2
debug1: key_load_public: No such file or directory
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ed25519.pub error:2
debug1: identity file C:\\Users\\Administrator/.ssh/id_xmss-cert type -1
debug1: key_load_public: No such file or directory
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: identity file C:\\Users\\Administrator/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ed25519-cert error:2
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_ed25519-cert.pub error:2
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_ed25519-cert type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_xmss error:2
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_xmss.pub error:2
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_xmss-cert error:2
debug3: Failed to open file:C:/Users/Administrator/.ssh/id_xmss-cert.pub error:2
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Administrator/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
ssh_exchange_identification: Connection closed by remote host
我的限制:
- 我無法更改代理上的任何內容。事實上,我的解決方案將部署在不同的客戶中,因此我不應該假設 HTTP 代理之外的任何內容。
- 我在客戶端上添加/更改軟體的能力有限。如果可能的話,我想使用預設的 Microsoft 功能。任何第三方軟體都需要經過資格認證,這很痛苦。
任何指導將不勝感激。
謝謝,