首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在HAProxy上运行OPNsense的tcp模式有问题

在HAProxy上运行OPNsense的tcp模式有问题
EN

Server Fault用户
提问于 2020-08-13 07:49:59
回答 1查看 2.8K关注 0票数 0

我正在尝试设置HAProxy,以便基于SNI对不同后端进行简单的tcp传输。然而,如果我这样做的话,我对我的客户有严重的问题:

  • 火狐: PR_END_OF_FILE_ERROR
  • 勇敢/Chrome/Safari: ERR_CONNECTION_CLOSED (在几次重新加载后工作,但错误再次间歇显示)

如果我直接与后端联系,绕过HAProxy,我就没有这样的问题。因此,HAProxy中的某些内容配置不正确,但我看不出它是什么。

技术细节:

  • HA-代理版本2.0.14
  • 运行在OPNsense 20.1.x,20.7.x (FreeBSD 11.2,12.1)上
  • 在ESXi 6.7U3上的虚拟机中

我的配置如下所示:

代码语言:javascript
复制
global
    # NOTE: Could be a security issue, but required for some feature.
    uid                         80
    gid                         80
    chroot                      /var/haproxy
    daemon
    stats                       socket /var/run/haproxy.socket group proxy mode 775 level admin
    nbproc                      1
    nbthread                    1
    tune.ssl.default-dh-param   1024
    spread-checks               0
    tune.chksize                16384
    tune.bufsize                16384
    tune.lua.maxmem             0
    log /var/run/log local0 info

defaults
    log     global
    option redispatch -1
    timeout client 30s
    timeout connect 30s
    timeout server 30s
    retries 3

# Frontend: https_passthrough (https tcp mode main ip)
frontend https_passthrough
    bind x.x.x.x:443 name x.x.x.x:443
    mode tcp
    # tuning options
    timeout client 30s

    # logging options
    # ACL: service_sni
    acl acl_5f34555b7fae76.76760871 req.ssl_sni -i service.example.com

    # ACTION: service_https_passthrough
    use_backend service_https_passthrough if acl_5f34555b7fae76.76760871
    # WARNING: pass through options below this line
    tcp-request inspect-delay 10s

# Backend: service_https_passthrough ()
backend service_https_passthrough
    # health checking is DISABLED
    mode tcp
    balance source
    # stickiness
    stick-table type ip size 50k expire 30m
    stick on src
    # tuning options
    timeout connect 30s
    timeout server 30s
    server service_https_passthrough 10.0.1.105:443

如果连接失败,我会找到类似的条目

代码语言:javascript
复制
https_passthrough https_passthrough/<NOSRV> -1/-1/0 0 SC 1/1/0/0/0 0/0

在原木上。但是,正如我所说的,后端服务器每天24小时运行,在内部局域网(这里还涉及路由/防火墙/VLAN)上工作一整天都很好,所以我怀疑这是防火墙问题。

任何帮助都很感激。

EN

回答 1

Server Fault用户

发布于 2020-08-13 13:09:38

看起来,将这两行添加到前端配置为我解决了这个问题:

代码语言:javascript
复制
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }

是从HAProxy博客文章上提取的。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1029930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档