Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, byavuz81(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0
Date: 2022-02-08 14:16:44
Message-ID: 9FC8618A-C651-4438-A6A3-7E6682944922@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 6 Feb 2022, at 01:53, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> ..we happily pass that bogus host name to SSL_set_tlsext_host_name.
> Apparently, openssl takes such a bogus setting in stride, but libressl
> not so much.

Looking at OpenSSL 1.1.1 (which is what LibreSSL claims API compatibility
with), the call ends up simply copying whatever came in without validation:

case SSL_CTRL_SET_TLSEXT_HOSTNAME:
/*
* TODO(OpenSSL1.2)
* This API is only used for a client to set what SNI it will request
* from the server, but we currently allow it to be used on servers
* as well, which is a programming error. Currently we just clear
* the field in SSL_do_handshake() for server SSLs, but when we can
* make ABI-breaking changes, we may want to make use of this API
* an error on server SSLs.
*/

In OpenSSL 3 they have removed the TODO marker, but still don't validate the
hostname, which explains why we don't see test errors here on the OpenSSL 3
animals (and likely wont going forward based on the comment).

In LibreSSL this is implemented with tlsext_sni_is_valid_hostname() which
checks for RFC 5890 compliance.

So, passing host='' seems the correct option. It would be nice to be able to
run testcases which knows if we use LibreSSL or OpenSSL to test situations like
this where they do differ.

> I'd recommend using host='' in the tests, as that more or less
> replicates what the test author probably expected to happen.

Agreed. Are you taking care of that or should I?

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2022-02-08 15:28:36 Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0
Previous Message Tom Lane 2022-02-08 12:28:09 Re: Build error in Solaris