<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

    Using HAProxy to make SSH and SSL available on the same port

    Certain places firewall TCP ports other than the most common ports. There are many techniques for bypassing such restrictions. One simple approach is to run a SSH daemon on port 443, however a downside of this is you need to dedicate an IP address to this SSH service.

    There is quite a neat technique for making SSH and SSL share a port; in the SSL protocol clients should write first, whereas in SSH the server should write first; therefore by waiting to see if the client writes data it is possible to make a guess as to if the client is an SSL client or a SSH client.

    I'm not the first person to think this up, Net::Proxy has a script called sslh and confusingly there is also a C implementation also called sslh.

    I recently switched my web server to use HAProxy to allow me some more flexiblity in how I configure things (especially now the development version has keepalive support). While reading the (incredibly detailed) documentation I noticed it should be able to do the sslh technique.

    Doing this needs the (currently) in development HAProxy 1.4 (support was added for content switching TCP as well as HTTP in this commit -- thanks to Cyril Bonté on the mailing list for confirming that).

    The configuration looks something like the following (global section omitted, you'll want to run it as a user other than root and chroot it if you actually use this).

    defaults

      timeout connect 5s

      timeout client 50s

      timeout server 20s


    listen ssl :443

      tcp-request inspect-delay 2s

      acl is_ssl req_ssl_ver 2:3.1

      tcp-request content accept if is_ssl

      use_backend ssh if !is_ssl

      server www-ssl :444

      timeout client 2h


    backend ssh

      mode tcp

      server ssh :22

      timeout server 2h



    This listens on port 443, forwards it to port 444 (where the actual SSL web server is listening) unless it is not SSLv2, SSLv3 or TLSv1 traffic, in which case it forwards it to the ssh backend listening on port 22.

    Obviously as I said earlier this is only a guess that is subject to network conditions such as packet loss. I'm not recommending you use this technique on a production site, but for a low traffic machine where you want to run both protocols it is very useful. (By increasing the timeout for SSH you increase the chances of a correct result, but also add a potentially annoying delay).

    Sometimes layer 7 filtering techniques are in use and just listening on port 443 is not enough. In this case you can use SSH inside SSL.

    posted on 2014-03-19 01:53 ivaneeo 閱讀(1298) 評論(0)  編輯  收藏 所屬分類: GNU牛力
    主站蜘蛛池模板: 国产亚洲美日韩AV中文字幕无码成人| 最近的中文字幕大全免费版| 国产国产人免费人成免费视频 | 国产成人在线免费观看| 亚洲人片在线观看天堂无码| 19禁啪啪无遮挡免费网站| 久久亚洲国产精品成人AV秋霞| 最近最好最新2019中文字幕免费| 亚洲自偷精品视频自拍| 免费福利在线播放| 亚洲av永久无码一区二区三区 | 无码成A毛片免费| 亚洲av无码国产综合专区| 91在线视频免费91| 四虎国产精品成人免费久久| 久久精品国产亚洲Aⅴ蜜臀色欲| 久久WWW免费人成—看片| 亚洲αv久久久噜噜噜噜噜| 在线观看免费高清视频| 亚洲日韩一区精品射精| 久久久久亚洲av毛片大| 一级做a爰全过程免费视频| 精品亚洲成在人线AV无码| 亚洲国产精品成人网址天堂| 国产羞羞的视频在线观看免费| 亚洲国产夜色在线观看| 久久久久亚洲?V成人无码| 国产免费AV片在线观看| 亚洲精品无码专区在线播放| 中文字幕亚洲综合久久菠萝蜜 | 日韩精品视频免费在线观看| 中文字幕av无码不卡免费| 国产色在线|亚洲| 久久久亚洲欧洲日产国码二区| 四虎永久在线精品免费影视| 在线观看www日本免费网站| ssswww日本免费网站片| 亚洲人成色777777老人头| 久久久久久亚洲精品| 免费在线黄色网址| 四虎免费永久在线播放|