Test: add ssl_ecdh_curve test to 023.ssl_connection.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 27 Aug 2025 01:14:53 +0000 (10:14 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 27 Aug 2025 01:26:31 +0000 (10:26 +0900)
023.ssl_connection did not cover the test for ssl_ecdh_curve.  This
commit tests it using bad ssl_ecdh_curve parameter to see if connection
between frontend and pgpool fails.

Author: Tatsuo Ishii <ishii@postgresql.org>
Backpatch-through: v4.2

src/test/regression/tests/023.ssl_connection/test.sh

index 17e375339849c9d5b3515036c1ad2c11c5bf38bf..6b1dbb8af2260d3459e68838a3b3848099dc3cd4 100755 (executable)
@@ -99,4 +99,49 @@ fi
 echo "Checking SSL connection between Pgpool-II and backend was ok."
 
 ./shutdownall
+
+# Checking ssl_ecdh_curve. Set bad value to see if SSL connection fails.
+echo "ssl_ecdh_curve = 'badcurve'" >> etc/pgpool.conf
+
+./startall
+wait_for_pgpool_startup
+
+$PSQL -h localhost test <<EOF > result
+\conninfo
+\q
+EOF
+
+grep SSL result
+
+if [ $? = 0 ];then
+    echo "Checking SSL connection between frontend and Pgpool-II succeeded despite bad ssl_ecdh_curve."
+    ./shutdownall
+    exit 1
+fi
+
+echo "Checking SSL connection between frontend and Pgpool-II failed due to bad ssl_ecdh_curve as expected."
+./shutdownall
+
+# Make sure that SSL connection succeeds with good ssl_ecdh_curve
+echo "ssl_ecdh_curve = 'prime256v1'" >> etc/pgpool.conf
+
+./startall
+wait_for_pgpool_startup
+
+$PSQL -h localhost test <<EOF > result
+\conninfo
+\q
+EOF
+
+grep SSL result
+
+if [ $? = 0 ];then
+    echo "Checking SSL connection between frontend and Pgpool-II succeeded with good ssl_ecdh_curve."
+    ./shutdownall
+else
+    echo "Checking SSL connection between frontend and Pgpool-II failed with good ssl_ecdh_curve."
+    ./shutdownall
+    exit 1
+fi
+
 exit 0