ssl - Weird behavior/error trying to use HAProxy to forward requests to ELBs -
we have architecture have several apis on multiple hosts. each api sits behind aws elb. want put proxy in front route requests based on uri elb.
what have far works, 3 out of 10 requests result in following error (using curl, problem isn't curl):
curl: (35) unknown ssl protocol error in connection test-router.versal.com:-9847 i have feeling elb culprit. ssl terminated there.
here our haproxy config:
global log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 10240 user haproxy group haproxy daemon debug stats socket /var/run/haproxy.sock log-send-hostname test-router.domain.com description "haproxy on test-router.domain.com" defaults log global mode http option httplog option dontlognull retries 3 option redispatch option forwardfor option httpclose option dontlognull option tcpka maxconn 10240 timeout connect 10000ms timeout client 600000ms timeout server 600000ms frontend public bind *:80 bind *:443 acl elb0 path_beg /elb0 acl elb1 path_beg /elb1 use_backend elb0 if elb0 use_backend elb1 if elb1 bind 0.0.0.0:443 ssl crt /etc/ssl/cert.pem no-sslv3 ciphers aes128+eecdh:aes128+edh backend elb0 server server_vcat elb0.domain.com:443 ssl verify none backend elb1 server server_laapi elb1.domain.com:443 ssl verify none
the ssl curl not terminated @ elb. terminated @ haproxy, in configuration...
bind 0.0.0.0:443 ssl crt /etc/ssl/cert.pem no-sslv3 ciphers aes128+eecdh:aes128+edh ...and entirely different ssl session established haproxy on connection elb:
server ... ssl verify none an ssl problem elb not possibly propagated curl through haproxy in configuration.
the problem in haproxy configuration, here:
bind *:443 remove line. it's redundant (and incorrect).
you telling haproxy bind port 443 twice: once speaking ssl, , once not speaking ssl.
so, statistically, on approximately 50% of connection attempts, curl finds haproxy not speaking ssl on port 443 -- it's speaking http, , curl can't (and shouldn't) handle gracefully.
i believe (mis)configuration goes undetected haproxy, not because of actual bug, rather because of way things implemented in haproxy internals, related multi-process deployments , hot reloads, in case valid have haproxy bound same socket more once.
Comments
Post a Comment