server: PostgreSQL 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, 64-bit client: psql (PostgreSQL) 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) (OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)) == A. ssl = on, pg_hba.conf has hostssl lines only disable | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", no encryption allow | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 prefer (libpq default) | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 require | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 verify-ca, no root cert | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: root certificate file "/tmp/pgssl.k6itXj/none.crt" does not exist Either provide the file, use the system's trusted roots with sslrootcert=system, or change sslmode to disable server certificate verification. verify-ca, right CA | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 verify-ca, wrong CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: SSL error: certificate verify failed verify-full, right CA, localhost | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 verify-full, right CA, 127.0.0.1 | psql: error: connection to server at "127.0.0.1", port 55432 failed: server certificate for "localhost" (and 2 other names) does not match host name "127.0.0.1" verify-full, tunnel style (hostaddr) | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 verify-full, sslrootcert=system | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: SSL error: certificate verify failed require + sslrootcert=right CA | TLS TLSv1.3 TLS_AES_256_GCM_SHA384 require + sslrootcert=wrong CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: SSL error: certificate verify failed require, a user no line matches | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "nobody", database "postgres", SSL encryption == A2. same server, node-postgres node v22.23.5, pg 8.23.1, pg-connection-string 2.14.1 no sslmode, no ssl option (pg default) | ERROR 28000: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", no encryption ?sslmode=disable | ERROR 28000: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", no encryption (node:2339) Warning: SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'. In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees. To prepare for this change: - If you want the current behavior, explicitly use 'sslmode=verify-full' - If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=prefer' See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions. (Use `node --trace-warnings ...` to show where the warning was created) ?sslmode=prefer | ERROR UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate [warning: SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliase...] ?sslmode=require | ERROR UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate ?sslmode=verify-ca (CA not given) | ERROR UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate ?sslmode=no-verify | TLS TLSv1.3 ?sslmode=require&uselibpqcompat=true | TLS TLSv1.3 ssl: { rejectUnauthorized: false } | TLS TLSv1.3 ?sslmode=require + ssl: { rejectUnauthorized: false } | ERROR UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate ssl: { ca } , host localhost | TLS TLSv1.3 ssl: { ca } , host 127.0.0.1 | ERROR ERR_TLS_CERT_ALTNAME_INVALID: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list: ?sslmode=verify-full&sslrootcert=ca.crt | TLS TLSv1.3 == B. ssl = off (server not configured for TLS), pg_hba.conf host lines disable | no TLS allow | no TLS prefer (libpq default) | no TLS require | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required verify-ca, no root cert | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required verify-ca, right CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required verify-ca, wrong CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required verify-full, right CA, localhost | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required verify-full, right CA, 127.0.0.1 | psql: error: connection to server at "127.0.0.1", port 55432 failed: server does not support SSL, but SSL was required verify-full, tunnel style (hostaddr) | psql: error: connection to server at "127.0.0.1", port 55432 failed: server does not support SSL, but SSL was required verify-full, sslrootcert=system | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required require + sslrootcert=right CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required require + sslrootcert=wrong CA | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required require, a user no line matches | psql: error: connection to server at "localhost" (127.0.0.1), port 55432 failed: server does not support SSL, but SSL was required