Haproxy 1.4连接到https后端服务器



我正试图使用端口443通过https连接到2个后端服务器,我想找到一种方法来发送密钥&将cert文件发送到后端的服务器。我的haproxy.cfg是:

global
    log 127.0.0.1   local0
    log 127.0.0.1   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    user haproxy
    group haproxy
    daemon
    #debug
    #quiet
defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 2000
    contimeout  5000
    clitimeout  50000
    srvtimeout  50000
listen stats :8000
    #mode http
    stats enable
    stats realm Haproxy Statistics
    stats uri /
    stats auth admin:password

listen  ssl-relay :80
    mode tcp
    balance roundrobin
    stick-table type ip size 200m expire 30m
    stick on src
    server  server01 www.example.com:443 check inter 2000 fall 3
    server  server02 www.example.com:443 check inter 2000 fall 3

我们如何使haproxy服务器和后端服务器之间的通信安全???

您的客户会使用https://myfakepage.com:80作为url?如果没有,那么你所做的基本上是毫无意义的。您正在处理与前端的未加密连接,然后再处理与后端的加密连接。问题是,当连接返回到客户端时,它将是未加密的,所以你不会给自己买任何东西。如果您的客户将使用https://pmyfakepage.com:80那么就没有什么可做的了,因为haproxy已经充当了https流量的传递。

你是否试图在负载均衡器上进行SSL终止,如果是,你是在向后进行

你的绑定secion看起来像

frontend ssl-site
bind *:443 ssl crt /path/to/bundle.pem  #you need to make sure the whole cert path is in one pem file
reqadd X-Forwarded-Proto: https
default_backend myServers
backend myServers
balance roundrobin
server server1 www.example.com:80
server server2 www2.example.com:80

但正如dtorgo所说,以这种方式进行ssl终止只适用于1.5及以上版本。另一个选择,如果你发现眩晕太慢是螺柱。

希望这能帮你解决问题。

haproxy 1.4不支持SSL。要么更新到1.5,要么考虑使用类似stunnel的东西。

我已经在一个非常大的企业实现中使用了这两种产品,而且这两个产品都运行良好。如果你想坚持使用haproxy 1.4,那么眩晕路线非常简单。只需在haproxy服务器上安装stunnel,监听本地端口,让haproxy连接到该本地端口,然后将stunnel配置为指向远程https端点。除了stunnel中的全局设置外,实际配置为3行

  1. 名称
  2. 本地主机上的侦听端口
  3. 目标主机和端口

最新更新