HAproxy REQ_SSL_SNI 및 SSL 종료

HAproxy REQ_SSL_SNI 및 SSL 종료

REQ_SSL_SNI 및 SSL 종료와 함께 작동하도록 haproxy를 얻으려고 합니다.

내가 따라온 가이드https://www.haproxy.com/blog/enhanced-ssl-load-balancing-with-server-name-indication-sni-tls-extension/ https://stuff-things.net/2016/11/30/haproxy-sni/

설정: HA-Proxy 버전 1.6.3 Ubuntu 16.04

로그는 다음을 생성합니다.

HTTP-in ~ http-in/NOSRV-1/-1/12 0 SC 0/0/0/0/0 0/0

frontend http-in
bind *:443 ssl crt /etc/haproxy/certs/
log global
reqadd X-Forwarded-Proto:\ https
mode tcp 
option tcplog
# wait up to 5 seconds from the time the tcp socket opens
# until the hello packet comes in (otherwise fallthru to the default)
tcp-request inspect-delay 5s
tcp-request content accept if { req.ssl_hello_type 1 }
acl is_site1 req_ssl_sni -i foo.foobar.com
acl is_site2 req_ssl_sni -i foobar.com
use_backend www-foo-foobar if is_site1
use_backend www-foobar if is_site2

backend www-foo-foobar
log global
mode tcp 
option tcplog
redirect scheme https if !{ ssl_fc }
server www-1 127.0.0.1:3030 check

backend www-foobar
log global
mode tcp 
option tcplog
redirect scheme https if !{ ssl_fc }
server www-1 127.0.0.1:5000 check

내가 무엇을 놓치고 있나요?

누군가 나에게 올바른 방향을 알려줄 수 있습니까?

답변1

다음을 사용해 보세요 ssl_fc_sni:

    acl is_site1 ssl_fc_sni foo.foobar.com
    acl is_site2 ssl_fc_sni foobar.com

ssl_fc_sni기본적으로 SSL을 종료/복호화할 때 (OpenSSL API에서 SNI 가져오기)를 사용해야 합니다 .

req_ssl_sniTCP 모드를 통해 전달할 때는 (TCP 패킷에서 SNI를 구문 분석)을 사용해야 합니다 .

문서에서:

ssl_fc_sni : 문자열

이는 SSL/TLS 전송 계층을 통해 이루어지고 haproxy에 의해 로컬로 해독되는 수신 연결에서 SNI(서버 이름 표시 TLS 확장) 필드를 추출합니다. 결과(있는 경우)는 일반적으로 HTTPS 호스트 이름(253자 이하)과 일치하는 문자열입니다. SSL 라이브러리는 TLS 확장 지원을 활성화하여 구축되어야 합니다(haproxy -vv 확인).

이 가져오기는 haproxy에 의해 해독되는 연결에 적용되고 맹목적으로 전달되는 SSL 콘텐츠에는 적용되지 않는다는 점에서 위의 "req_ssl_sni"와 다릅니다. 아래의 "ssl_fc_sni_end" 및 "ssl_fc_sni_reg"도 참조하세요. 이를 위해서는 TLS 확장 지원을 활성화하여 SSL 라이브러리를 구축해야 합니다(haproxy -vv 확인).

ACL 파생물:

  • ssl_fc_sni_end : 접미사 일치
  • ssl_fc_sni_reg : 정규식 일치

https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#7.3.4-ssl_fc_sni

관련 정보