Haproxy "send-proxy" 未知协议 -- 说的不是 SSL 到 HTTPS 端口?
Haproxy "send-proxy" unknown protocol -- speaking not SSL to HTTPS port?
10.22.12.54 haproxy IP 地址
10.22.12.55 Apache 网络 IP 地址
fqdn hasan.example.com 已在 10.22.12.54
中解决
在我的 haproxy 配置中
global
log /dev/log local0
log /dev/log local1 notice
maxconn 100000
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd
listeners
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
defaults
log global
mode tcp
maxconn 1000000
option httplog
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend Front-"443"
bind *:443
mode tcp
use_backend hasan
backend hasan
mode tcp
option ssl-hello-chk
server hasan 10.22.12.55:443 send-proxy-v2
APACHE 网络配置
<VirtualHost *:443>
ServerName hasan.example.com:443
DocumentRoot /var/www/html/
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel debug
SSLProxyEngine on
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/httpd/conf.d/ssl/cert.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/key.pem
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/ssl_access_hasan_log" combined
ErrorLog "logs/ssl_errors_hasan.log
</VirtualHost>
远程 IP 模块配置
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.22.12.54
注:
我的证书 CN 在 apache ServerName 指令中相同
我的证书和私钥位于
haproxy: /etc/ssl/certs/ 和 /etc/ssl/private/
apache 网站: /etc/httpd/conf.d/ssl
我观察到的apache Log
[8 月 15 日星期四 11:36:23.368657 2019] [ssl:info] [pid 4058] SSL 库错误:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown 协议——不是 SSL 到 HTTPS 端口!?
[8 月 15 日星期四 11:36:23.368660 2019] [ssl:info] [pid 4058] [客户端 10.22.12.54:41800] AH01998:与子 2 的连接关闭并异常关闭(服务器 hasan.example.com:443)
[8 月 15 日星期四 11:36:24.704663 2019] [ssl:info] [pid 4056] [客户端 10.22.12.54:41804] AH01964:已建立与子 0 的连接(服务器 hasan.example.com:443)
[8 月 15 日星期四 11:36:24.704820 2019] [ssl:info] [pid 4056] [客户端 10.22.12.54:41804] AH02008:握手中的 SSL 库错误 1(服务器 hasan.example.com:443)
[8 月 15 日星期四 11:36:24.704840 2019] [ssl:info] [pid 4056] SSL 库错误:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown 协议——不是 SSL 到 HTTPS 端口!?
注意:
没有发送代理一切正常。
但我需要使用
1) 在HAPROXY中使用TCP模式
2) HAPROXY 后端中的发送代理
3) Apache Web端RemoteIP模块
来自 Base CentOS 7 repo 的最新版本(当我使用 yum install httpd 时)
不能理解
"RemoteIPProxyProtocol On"
最新的 apt 存储库中的情况相同。
我在**从源代码**编译 apache httpd 时解决了这个问题。
10.22.12.54 haproxy IP 地址
10.22.12.55 Apache 网络 IP 地址
fqdn hasan.example.com 已在 10.22.12.54
中解决在我的 haproxy 配置中
global
log /dev/log local0
log /dev/log local1 notice
maxconn 100000
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd
listeners
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
defaults
log global
mode tcp
maxconn 1000000
option httplog
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend Front-"443"
bind *:443
mode tcp
use_backend hasan
backend hasan
mode tcp
option ssl-hello-chk
server hasan 10.22.12.55:443 send-proxy-v2
APACHE 网络配置
<VirtualHost *:443>
ServerName hasan.example.com:443
DocumentRoot /var/www/html/
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel debug
SSLProxyEngine on
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/httpd/conf.d/ssl/cert.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/key.pem
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/ssl_access_hasan_log" combined
ErrorLog "logs/ssl_errors_hasan.log
</VirtualHost>
远程 IP 模块配置
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.22.12.54
注:
我的证书 CN 在 apache ServerName 指令中相同
我的证书和私钥位于
haproxy: /etc/ssl/certs/ 和 /etc/ssl/private/
apache 网站: /etc/httpd/conf.d/ssl
我观察到的apache Log
[8 月 15 日星期四 11:36:23.368657 2019] [ssl:info] [pid 4058] SSL 库错误:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown 协议——不是 SSL 到 HTTPS 端口!? [8 月 15 日星期四 11:36:23.368660 2019] [ssl:info] [pid 4058] [客户端 10.22.12.54:41800] AH01998:与子 2 的连接关闭并异常关闭(服务器 hasan.example.com:443) [8 月 15 日星期四 11:36:24.704663 2019] [ssl:info] [pid 4056] [客户端 10.22.12.54:41804] AH01964:已建立与子 0 的连接(服务器 hasan.example.com:443) [8 月 15 日星期四 11:36:24.704820 2019] [ssl:info] [pid 4056] [客户端 10.22.12.54:41804] AH02008:握手中的 SSL 库错误 1(服务器 hasan.example.com:443) [8 月 15 日星期四 11:36:24.704840 2019] [ssl:info] [pid 4056] SSL 库错误:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown 协议——不是 SSL 到 HTTPS 端口!?
注意:
没有发送代理一切正常。
但我需要使用
1) 在HAPROXY中使用TCP模式
2) HAPROXY 后端中的发送代理
3) Apache Web端RemoteIP模块
来自 Base CentOS 7 repo 的最新版本(当我使用 yum install httpd 时) 不能理解 "RemoteIPProxyProtocol On"
最新的 apt 存储库中的情况相同。
我在**从源代码**编译 apache httpd 时解决了这个问题。