Use default certificate only if provided SNI isn't found #700
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Default or fallback certificate is defined in haproxy declaring it as the first certificate. It should be used in TLS handshakes when SNI is not provided or if the provided one does not have a match.
HAProxy Ingress uses
crt-list
to better implements Ingress spec: a valid certificate is not one that its CN or SAN has the provided SNI, but instead that one the user declares in the spec.tls hostname.There is however a scenario which trigger the wrong path: if the default certificate is valid for a provided SNI, haproxy will use it in the handshake instead of a declared certificate - this happens because the default certificate, being the first one, is validated first.
This commit adds a
!*
in the snifilter of the default certificate. This will instruct haproxy to not add any of its domains - CN and SAN - in the SNI, so it won't match any domain, except if a valid one cannot be found. This is exactly what a default certificate is all about.#687