Ssh

使用反向隧道訪問提供 HTTPS 的防火牆式 Web 伺服器

  • March 30, 2014

我的網路上有一個僅通過 HTTPS 提供內容的設備(“A)”,因為它位於我的路由器/防火牆後面,所以無法訪問它。

我在網際網路上的其他地方有另一台機器(“B”)(假 IP 為 44.44.44.44)

我想從 B 訪問從 A 提供的內容。我已經在 B 上為 A 設置了接受密鑰。

我對 SSL/TLS 隧道有基本的了解,但我從未使用 HTTPS 將其複雜化。

所以我開始從 A -> B 創建一個反向隧道:

ssh -N -R 8888:localhost:443 john@44.44.44.44

那麼此時,在B上,我應該能夠訪問埠8888,就好像它是A上的443一樣?

當我嘗試在 B 上點擊 localhost:8888 時,我得到以下資訊(來自 link2s)

Bad request!

   Your browser (or proxy) sent a request that this server could not understand.

   If you think this is a server error, please contact the webmaster.

Error 400

    www.example.com
    Sat Mar 29 22:50:34 2014
    Apache/2.2.26 (Unix) PHP/5.5.8 mod_ssl/2.2.26 OpenSSL/1.0.1f DAV/2

當我在玩這個時,我碰巧在使用 Apache,我需要在其配置中啟用一個功能還是我需要做的其他事情?

當您要求瀏覽器連接到localhost:8888它時,它實際上會預設使用 using http://localhost:8888/,這在您的情況下不起作用,因為它是一個 SSL 埠。除了證書警告之外,使用 URLhttps://localhost:8888/應該可以工作。

引用自:https://serverfault.com/questions/585417