mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Add connection parameters to control SSL protocol min/max in libpq
These two new parameters, named sslminprotocolversion and sslmaxprotocolversion, allow to respectively control the minimum and the maximum version of the SSL protocol used for the SSL connection attempt. The default setting is to allow any version for both the minimum and the maximum bounds, causing libpq to rely on the bounds set by the backend when negotiating the protocol to use for an SSL connection. The bounds are checked when the values are set at the earliest stage possible as this makes the checks independent of any SSL implementation. Author: Daniel Gustafsson Reviewed-by: Michael Paquier, Cary Huang Discussion: https://postgr.es/m/4F246AE3-A7AE-471E-BD3D-C799D3748E03@yesql.se
This commit is contained in:
@@ -13,7 +13,7 @@ use SSLServer;
|
||||
|
||||
if ($ENV{with_openssl} eq 'yes')
|
||||
{
|
||||
plan tests => 86;
|
||||
plan tests => 93;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -356,6 +356,27 @@ command_like(
|
||||
^\d+,t,TLSv[\d.]+,[\w-]+,\d+,f,_null_,_null_,_null_\r?$}mx,
|
||||
'pg_stat_ssl view without client certificate');
|
||||
|
||||
# Test min/max SSL protocol versions.
|
||||
test_connect_ok(
|
||||
$common_connstr,
|
||||
"sslrootcert=ssl/root+server_ca.crt sslmode=require sslminprotocolversion=TLSv1.2 sslmaxprotocolversion=TLSv1.2",
|
||||
"connection success with correct range of TLS protocol versions");
|
||||
test_connect_fails(
|
||||
$common_connstr,
|
||||
"sslrootcert=ssl/root+server_ca.crt sslmode=require sslminprotocolversion=TLSv1.2 sslmaxprotocolversion=TLSv1.1",
|
||||
qr/invalid SSL protocol version range/,
|
||||
"connection failure with incorrect range of TLS protocol versions");
|
||||
test_connect_fails(
|
||||
$common_connstr,
|
||||
"sslrootcert=ssl/root+server_ca.crt sslmode=require sslminprotocolversion=incorrect_tls",
|
||||
qr/invalid sslminprotocolversion value/,
|
||||
"connection failure with an incorrect SSL protocol minimum bound");
|
||||
test_connect_fails(
|
||||
$common_connstr,
|
||||
"sslrootcert=ssl/root+server_ca.crt sslmode=require sslmaxprotocolversion=incorrect_tls",
|
||||
qr/invalid sslmaxprotocolversion value/,
|
||||
"connection failure with an incorrect SSL protocol maximum bound");
|
||||
|
||||
### Server-side tests.
|
||||
###
|
||||
### Test certificate authorization.
|
||||
|
Reference in New Issue
Block a user