Skip to content

Commit bdd6e9b

Browse files
committed
Make SSL tests more robust
Someone running these test could have key or certificate files in their ~/.postgresql/, which would interfere with the tests. The way to override that is to specify sslcert=invalid and/or sslrootcert=invalid if no actual certificate is used for a particular test. Document that and fix up one test that had a risk of failing in these circumstances. Discussion: https://www.postgresql.org/message-id/flat/398754d8-6bb5-c5cf-e7b8-22e5f0983caf@2ndquadrant.com/
1 parent 9745b52 commit bdd6e9b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/test/ssl/ServerSetup.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
# The server is configured to only accept connections from localhost. If you
1515
# want to run the client from another host, you'll have to configure that
1616
# manually.
17+
#
18+
# Note: Someone running these test could have key or certificate files
19+
# in their ~/.postgresql/, which would interfere with the tests. The
20+
# way to override that is to specify sslcert=invalid and/or
21+
# sslrootcert=invalid if no actual certificate is used for a
22+
# particular test. libpq will ignore specifications that name
23+
# nonexisting files. (sslkey and sslcrl do not need to specified
24+
# explicitly because an invalid sslcert or sslrootcert, respectively,
25+
# causes those to be ignored.)
26+
1727
package ServerSetup;
1828

1929
use strict;

src/test/ssl/t/002_scram.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
switch_server_cert($node, 'server-cn-only');
4040
$ENV{PGPASSWORD} = "pass";
4141
$common_connstr =
42-
"user=ssltestuser dbname=trustdb sslmode=require hostaddr=$SERVERHOSTADDR";
42+
"user=ssltestuser dbname=trustdb sslmode=require sslcert=invalid sslrootcert=invalid hostaddr=$SERVERHOSTADDR";
4343

4444
# Default settings
4545
test_connect_ok($common_connstr, '',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy