haproxy sni ssl_fc_has_sni 始终为 0
haproxy sni ssl_fc_has_sni always 0
我正在尝试在 HAProxy 中创建基于 SNI 的 frontend/backend 设置。似乎 ssl_fc_has_sni 在我的日志中总是评估为 0,我一直无法弄清楚为什么。
这是我一直在测试的配置的简化版本:
global
user haproxy
group haproxy
daemon
log /dev/log local0
defaults
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
log-format frontend:%f\ %b/%s\ client_ip:%Ci\ client_port:%Cp\ SSL_version:%sslv\ SSL_cypher:%sslc\ SNI:%[ssl_fc_has_sni]\ %ts
frontend public_ssl
bind :443
log global
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_sni if { ssl_fc_has_sni }
default_backend be_no_sni
backend be_sni
server fe_sni 127.0.0.1:10444 weight 1 send-proxy
frontend fe_sni
#terminate with a cert that matches the sni host
bind 127.0.0.1:10444 ssl crt /mycertdir/certs accept-proxy no-sslv3
default_backend be_default
frontend fe_no_sni
#terminate with a generic cert
bind 127.0.0.1:10443 ssl crt /myothercertdir/default_pub_keys.pem accept-proxy no-sslv3
default_backend be_default
# backend for when sni does not exist, or ssl term needs to happen on the edge
backend be_no_sni
server fe_no_sni 127.0.0.1:10443 weight 1 send-proxy
backend be_default
mode http
option forwardfor
option http-pretend-keepalive
server the_backend 127.0.0.1:8080
其他注意事项:
haproxy -vv
显示 OpenSSL 库支持 SNI:是
- 我通过 vagrant 在 fedora 20 上运行 haproxy 版本 1.5.9
- 日志总是显示SNI:0
haproxy[17807]: frontend:public_ssl be_no_sni/fe_no_sni client_ip:<ip> client_port:42285 SSL_version:- SSL_cypher:- SNI:0 --
- 我正在使用
openssl s_client -servername www.example.com -connect <ip>:443
进行测试。
我觉得我遗漏了一些明显的东西,因为没有 ssl 版本、密码或 sni。
看起来 ssl_fc_has_sni
是为了使用 post 终止。检查 SNI 主机是否存在可以通过以下方式完成:
frontend public_ssl
bind :443
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_sni if { req.ssl_sni -m found }
default_backend be_no_sni
我正在尝试在 HAProxy 中创建基于 SNI 的 frontend/backend 设置。似乎 ssl_fc_has_sni 在我的日志中总是评估为 0,我一直无法弄清楚为什么。
这是我一直在测试的配置的简化版本:
global
user haproxy
group haproxy
daemon
log /dev/log local0
defaults
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
log-format frontend:%f\ %b/%s\ client_ip:%Ci\ client_port:%Cp\ SSL_version:%sslv\ SSL_cypher:%sslc\ SNI:%[ssl_fc_has_sni]\ %ts
frontend public_ssl
bind :443
log global
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_sni if { ssl_fc_has_sni }
default_backend be_no_sni
backend be_sni
server fe_sni 127.0.0.1:10444 weight 1 send-proxy
frontend fe_sni
#terminate with a cert that matches the sni host
bind 127.0.0.1:10444 ssl crt /mycertdir/certs accept-proxy no-sslv3
default_backend be_default
frontend fe_no_sni
#terminate with a generic cert
bind 127.0.0.1:10443 ssl crt /myothercertdir/default_pub_keys.pem accept-proxy no-sslv3
default_backend be_default
# backend for when sni does not exist, or ssl term needs to happen on the edge
backend be_no_sni
server fe_no_sni 127.0.0.1:10443 weight 1 send-proxy
backend be_default
mode http
option forwardfor
option http-pretend-keepalive
server the_backend 127.0.0.1:8080
其他注意事项:
haproxy -vv
显示 OpenSSL 库支持 SNI:是- 我通过 vagrant 在 fedora 20 上运行 haproxy 版本 1.5.9
- 日志总是显示SNI:0
haproxy[17807]: frontend:public_ssl be_no_sni/fe_no_sni client_ip:<ip> client_port:42285 SSL_version:- SSL_cypher:- SNI:0 --
- 我正在使用
openssl s_client -servername www.example.com -connect <ip>:443
进行测试。
我觉得我遗漏了一些明显的东西,因为没有 ssl 版本、密码或 sni。
看起来 ssl_fc_has_sni
是为了使用 post 终止。检查 SNI 主机是否存在可以通过以下方式完成:
frontend public_ssl
bind :443
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_sni if { req.ssl_sni -m found }
default_backend be_no_sni