summaryrefslogtreecommitdiff
path: root/src/test/ssl/t/002_scram.pl
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-01-06 20:56:32 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-01-06 20:56:32 -0500
commit2bd0735b954b14dcfab85d57fc4a0c7f9826fbb1 (patch)
tree5e246b3eb67d1c3dc52240542e30fd1ecd4560bc /src/test/ssl/t/002_scram.pl
parente369f3708636c66718796fc8269d253432410392 (diff)
Clean up management of IP addresses in our SSL tests.
Instead of hard-wiring the netmask as /32, allow it to be specified where we specify the server address. This will ease changing the test to use IPv6, when/if somebody wants to do that. Also remove the hard-wired pg_hba.conf entries for IPv6 (::1/128). These have never had any usefulness, because the client side of the tests has always explicitly connected to $SERVERHOSTADDR which has always been set to IPv4 (127.0.0.1). All they accomplish is to break the test on non-IPv6-supporting hosts, and besides that they violate the express intent of the code to minimize the server's range of allowed connections. This could be back-patched, perhaps, but for now I don't see a need to. Discussion: https://postgr.es/m/1899.1578356089@sss.pgh.pa.us
Diffstat (limited to 'src/test/ssl/t/002_scram.pl')
-rw-r--r--src/test/ssl/t/002_scram.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index c08aa19aee5..a6642f88592 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -20,6 +20,8 @@ if ($ENV{with_openssl} ne 'yes')
# This is the hostname used to connect to the server.
my $SERVERHOSTADDR = '127.0.0.1';
+# This is the pattern to use in pg_hba.conf to match incoming connections.
+my $SERVERHOSTCIDR = '127.0.0.1/32';
# Determine whether build supports tls-server-end-point.
my $supports_tls_server_end_point =
@@ -43,8 +45,8 @@ $ENV{PGPORT} = $node->port;
$node->start;
# Configure server for SSL connections, with password handling.
-configure_test_server_for_ssl($node, $SERVERHOSTADDR, "scram-sha-256",
- "pass", "scram-sha-256");
+configure_test_server_for_ssl($node, $SERVERHOSTADDR, $SERVERHOSTCIDR,
+ "scram-sha-256", "pass", "scram-sha-256");
switch_server_cert($node, 'server-cn-only');
$ENV{PGPASSWORD} = "pass";
$common_connstr =