]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: ssl: Fix update of default certificate
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 17 Mar 2021 13:56:54 +0000 (14:56 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 26 Mar 2021 12:06:29 +0000 (13:06 +0100)
commit8218aed90e862ed01c2a8bb9bf81e6d1a90f14db
tree1df6f8eb3893f36fe8c5151e66c4c57c19d0d660
parent62592ad967d6d24be2aabb664a5e1d594ab35415
BUG/MINOR: ssl: Fix update of default certificate

The default SSL_CTX used by a specific frontend is the one of the first
ckch instance created for this frontend. If this instance has SNIs, then
the SSL context is linked to the instance through the list of SNIs
contained in it. If the instance does not have any SNIs though, then the
SSL_CTX is only referenced by the bind_conf structure and the instance
itself has no link to it.
When trying to update a certificate used by the default instance through
a cli command, a new version of the default instance was rebuilt but the
default SSL context referenced in the bind_conf structure would not be
changed, resulting in a buggy behavior in which depending on the SNI
used by the client, he could either use the new version of the updated
certificate or the original one.

This patch adds a reference to the default SSL context in the default
ckch instances so that it can be hot swapped during a certificate
update.

This should fix GitHub issue #1143.

It can be backported as far as 2.2.
include/haproxy/ssl_ckch-t.h
reg-tests/ssl/set_default_cert.crt-list [new file with mode: 0644]
reg-tests/ssl/set_default_cert.pem [new file with mode: 0644]
reg-tests/ssl/set_ssl_cert.vtc
src/ssl_sock.c