# Haproxy w/ssl 'SSL handshake failure'

**URL:** <https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378>\
**Category:** Help!\
**Created:** [February 9, 2023, 2:24am UTC](https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378 "2023-02-09T02:24:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![strig](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@strig](https://discourse.haproxy.org/u/strig)\
**Post date:** [February 9, 2023, 2:24am UTC](https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378/1 "2023-02-09T02:24:05Z")

</div>

I’ve had haproxy working with a non-ssl/tls frontend for some time. Just recently I was tasked to have haproxy listen for https connections specifically. I’m troubled with the error `haproxy-ssl/1: SSL handshake failure` regardless of the changes I make to my configuration. I’m hoping someone here can help!

What I am trying to accomplish is:

`client -> haproxy (http/https) -> tinyproxy (http) -> internet`

* * *

```auto
haproxy -vv
HAProxy version 2.4.18-0ubuntu1.1 2023/01/19 - https://haproxy.org/
Running on: Linux 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64
...

```

```auto
global
	log /dev/log	local0
	log /dev/log	local1 notice
	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

	# Default SSL material locations
	ca-base /etc/ssl/certs
	crt-base /etc/ssl/private

	# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
    	ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    	ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
    	ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets

    	ssl-default-server-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    	ssl-default-server-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
    	ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets

    	# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
    	ssl-dh-param-file /etc/haproxy/dhparam

defaults
	log	global
	mode	http
	option	httplog
	option	dontlognull
        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 haproxy
    bind *:8008
    default_backend tinyproxy

#
# cat /etc/letsencrypt/live/sfre.io/fullchain.pem /etc/letsencrypt/live/sfre.io/privkey.pem /etc/haproxy/lets-encrypt-r3.pem > /etc/ssl/private/site.pem
#
frontend haproxy-ssl
    bind *:8181 ssl crt site.pem alpn h2,http/1.1
    http-request set-header X-Forwarded-For %[src]
    http-request add-header X-Forwarded-Proto https
    option http-server-close
    default_backend tinyproxy

backend tinyproxy
    mode http
    server haha90 192.168.1.90:8888 verify none

```

```auto
curl -vv --proxy haha90:8181 https://vox.com
* Trying 192.168.1.90:8181...
* Connected to haha90 (192.168.1.90) port 8181 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to vox.com:443
> CONNECT vox.com:443 HTTP/1.1
> Host: vox.com:443
> User-Agent: curl/7.77.0
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* CONNECT phase completed!
* Closing connection 0
curl: (56) Proxy CONNECT aborted
hello:/tmp>curl -vv --proxy haha90:8181 https://vox.com
* Trying 192.168.1.90:8181...
* Connected to haha90 (192.168.1.90) port 8181 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to vox.com:443
> CONNECT vox.com:443 HTTP/1.1
> Host: vox.com:443
> User-Agent: curl/7.77.0
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* CONNECT phase completed!
* Closing connection 0
curl: (56) Proxy CONNECT aborted

```

```auto
tail -f /var/log/haproxy.log:

Feb 8 18:23:02 haha90 haproxy[436294]: 192.168.1.15:54459 [08/Feb/2023:18:23:02.203] haproxy-ssl/1: SSL handshake failure

```

---

<div class="post-metadata">

**Author:** ![stormrover](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/stormrover/32/1847_2.png) [@stormrover](https://discourse.haproxy.org/u/stormrover)\
**Post date:** [February 9, 2023, 12:30pm UTC](https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378/2 "2023-02-09T12:30:57Z")

</div>

I’m not sure it’s possible to use HAProxy as a forward proxy. I see **[generate-certificates](http://docs.haproxy.org/2.6/configuration.html#5.1-generate-certificates)** in the configuration manual that might be useful in this case.

Edit: Not sure if you can use HAProxy _with SSL_ as a forward proxy.

---

<div class="post-metadata">

**Author:** ![strig](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@strig](https://discourse.haproxy.org/u/strig)\
**Post date:** [February 10, 2023, 5:19pm UTC](https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378/3 "2023-02-10T17:19:06Z")

</div>

While I’m not finding much about my issue with search, and the mentions of using haproxy this way are few, I continue to move ahead thinking this might be possible. If it isn’t I’d like to gain an understanding of why it isn’t.

I believe it’s possible because I can configure `mode http` with `bind ... crt` --and additionally there are many mentions of using haproxy w/tls in various configurations.

Not getting much help here and unsure why. Is there something additional I should be providing?

---

<div class="post-metadata">

**Author:** ![stormrover](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/stormrover/32/1847_2.png) [@stormrover](https://discourse.haproxy.org/u/stormrover)\
**Post date:** [February 10, 2023, 5:40pm UTC](https://discourse.haproxy.org/t/haproxy-w-ssl-ssl-handshake-failure/8378/4 "2023-02-10T17:40:44Z")

</div>

Looking at your workflow and your server line, looks like you intend to use SSL but didn’t explicitly say it, and I don’t think `verify none` assumes the `ssl` part. Try adding `ssl` to your backend.

```auto
backend tinyproxy
    mode http
    server haha90 192.168.1.90:8888 ssl verify none

```
