大网数据广告活动
服务器运维问答

HAProxy, PROXY Protocol, and SSL extras

· 52CE 我爱测

I'm trying to set up HAProxy to pass on SSL information with PROXY protocol. So far I've been unsuccessful. My test config: global chroot /tmp/haproxy-chroot log stderr format raw local0 debug defaults mode tcp frontend testpp bi…

问题原文

原帖链接 · marcantonio · CC BY-SA 4.0

I'm trying to set up HAProxy to pass on SSL information with PROXY protocol. So far I've been unsuccessful. My test config:

global
        chroot /tmp/haproxy-chroot
        log stderr format raw local0 debug

defaults
        mode tcp

frontend testpp
         bind *:5000
         mode tcp
         option tcplog
         option logasap
         log global
         timeout client 1s #15s
         default_backend nginx

backend nginx
        mode tcp
        log global
        timeout server 1s #20s
        timeout connect 1s #10s
        server nginx1 localhost:443 send-proxy-v2-ssl

However, when I run tcpdump, I don't see the extra data:

        0x0000:  4500 029e 0918 4000 4006 3140 7f00 0001  E.....@.@.1@....
        0x0010:  7f00 0001 c55c 05a3 905c 04de 5983 fd53  .....\...\..Y..S
        0x0020:  8018 0156 0093 0000 0101 080a 96ee 0dcb  ...V............
        0x0030:  96ee 0dcb 0d0a 0d0a 000d 0a51 5549 540a  ...........QUIT.
        0x0040:  2111 0014 47a2 f3d2 0a01 015c d6b2 1388  !...G......\....
        0x0050:  2000 0500 0000 0000 1603 0102 4101 0002  ............A...
                                      ^-------------------TLS starts here

If I run with with just send-proxy-v2 (no -ssl) I see the exact same thing.

Am I missing something about how this should work?

已采纳解答

原帖链接 · Ginnungagap · CC BY-SA 4.0

From your configuration, HAProxy doesn't handle the SSL part of the connection so it cannot provide SSL information in the PROXY protocol header.

Add a crt <cert> directive to your frontend bind and you should see the SSL information in the PROXY protocol header.

If you think about it, it's rather normal since if HAProxy was to provide you with that information despite not handling the SSL termination, it couldn't appropriately request client certificates, offer cipher suites or any other options that are negotiated during the handshake.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。