使用haproxy 实现 http/ssh/mstsc复用

简介:

  网上较多HTTP/SSH复用,但实际环境中,使用HAPROXY做IIS负载均衡时,还需要使用80端口来使用远程桌面管理服务器。

近日通过Wireshark抓包,找到了TPKT的报头字段,终于成功实现RDP协议复用:

注:通常RDP使用TPKT作为其传输协议,TPKT运行在TCP之上。 当用于传输RDP时,使用的TCP端口是3389,而不是正常的TPKT端口102。

参考文献:

http://blog.csdn.net/kevin_bobolkevin/article/details/50790967

TPKT通讯说明

https://wenku.baidu.com/view/9f509844e2bd960591c67723.html


wKiom1laCESgVrh0AANwJnBcOd4329.png-wh_50


最终配置文件如下,供参考:

------------------------------------------------------


global

        daemon

        user haproxy

        group haproxy

        maxconn 49985

        log 127.0.0.1 local0

        log 127.0.0.1 local1 notice

       # tune.ssl.default-dh-param 2048


defaults

        mode tcp

        log global

        log 127.0.0.1 local0 err


        option tcplog

        option dontlog-normal


        timeout connect    10s

        timeout queue      30s

        timeout client     15m

        timeout client-fin 15m

        timeout server     15m

        timeout tunnel     12h


listen monitor 

        bind *:8888

#监听端口

        mode http

#http的7层模式

        log global

        log 127.0.0.1 local0 err


        maxconn 5


        option httplog


        stats enable

        stats uri /

        stats refresh 15s


        timeout connect    10s

        timeout queue      30s

        timeout client     30s

        timeout server     30s


listen http

        bind *:80

maxconn 800

    timeout client 1h

    tcp-request inspect-delay 2s

    acl is_http req.payload(0,3) -m bin 474554 504f53 505554 44454c

    acl is_ssh req.payload(0,3) -m bin 535348    

    acl is_rdp req.payload(0,3) -m bin 030000    

    tcp-request content accept if is_http

   # use_backend http if is_http

    use_backend ssh if is_ssh

    use_backend rdp if is_rdp

#监听端口

        option tcpka

        #是否允许客户端发送tcp keepalive 包,这个和http 的keepalive 没有关系

        #option redispatch  

        #是否允许失败后重新分配session  这个设置会存在返回的K/3CLOUD系统的session id变化导致闪退。可能的原因服务端有异常或者传输出现了异常

        option abortonclose

        #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接

        #tcp-request inspect-delay 30s


        hash-type consistent        

        balance roundrobin

        stick-table type ip size 10240k expire 24h

        stick on src

        server server01  192.168.90.121:80  weight 100  check agent-check agent-port 3333 minconn 0 maxconn 250 on-marked-down shutdown-sessions

        server server02  192.168.90.122:80  weight 100  check agent-check agent-port 3333 minconn 0 maxconn 250 on-marked-down shutdown-sessions


backend ssh

    mode tcp

    timeout server 1h

    server server-ssh 192.168.90.126:22


backend rdp

    mode tcp

    timeout server 1h

    server server-mstsc 192.168.90.121:3389



本文转自 sfih 51CTO博客,原文链接:http://blog.51cto.com/dayday/1944129

相关文章
|
9月前
|
网络协议 安全 网络安全
使用frp端口映射实现内网穿透(SSH、HTTP服务)
使用frp端口映射实现内网穿透(SSH、HTTP服务) 一、下载
|
10月前
|
存储 缓存 安全
linux中ssh免密登录及HTTP详解
linux中ssh免密登录及HTTP详解
106 0
linux中ssh免密登录及HTTP详解
|
域名解析 网络协议 应用服务中间件
快速搭建frp的ssh和http的内网穿透
快速搭建frp的ssh和http的内网穿透
快速搭建frp的ssh和http的内网穿透
|
存储 缓存 负载均衡
RH358优化Web服务器流量--使用HAProxy终止HTTPS流量和并进行负载均衡
RH358优化Web服务器流量--使用HAProxy终止HTTPS流量和并进行负载均衡
428 0
RH358优化Web服务器流量--使用HAProxy终止HTTPS流量和并进行负载均衡
|
Go
haproxy http实例配置
--------------------------------------------------------------------- Global settings code by www.
920 0
|
监控 负载均衡 测试技术
|
关系型数据库 MySQL 网络安全
|
1月前
|
安全 Linux Shell
Linux SSH(Secure Shell)服务
Linux SSH提供安全网络协议,使用公钥加密技术确保远程服务传输安全。OpenSSH是实现SSH服务的免费开源工具,允许用户加密连接远程登录Linux服务器执行任务。SSH比Telnet更安全,防止数据被截获。SSH还支持端口转发和隧道,广泛应用于系统管理和网络维护,是安全远程访问服务器的重要工具。
26 1