Skip to content

Commit 98efa76

Browse files
committed
Add ssl_library preset parameter
This allows querying the SSL implementation used on the server side. It's analogous to using PQsslAttribute(conn, "library") in libpq. Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
1 parent ab87b8f commit 98efa76

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

doc/src/sgml/config.sgml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8401,6 +8401,22 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
84018401
</listitem>
84028402
</varlistentry>
84038403

8404+
<varlistentry id="guc-ssl-library" xreflabel="ssl_library">
8405+
<term><varname>ssl_library</varname> (<type>string</type>)
8406+
<indexterm>
8407+
<primary><varname>ssl_library</varname> configuration parameter</primary>
8408+
</indexterm>
8409+
</term>
8410+
<listitem>
8411+
<para>
8412+
Reports the name of the SSL library that this PostgreSQL server was
8413+
built with (even if SSL is not currently configured or in use on this
8414+
instance), for example <literal>OpenSSL</literal>, or an empty string
8415+
if none.
8416+
</para>
8417+
</listitem>
8418+
</varlistentry>
8419+
84048420
<varlistentry id="guc-wal-block-size" xreflabel="wal_block_size">
84058421
<term><varname>wal_block_size</varname> (<type>integer</type>)
84068422
<indexterm>

src/backend/libpq/be-secure.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "storage/proc.h"
3939

4040

41+
char *ssl_library;
4142
char *ssl_cert_file;
4243
char *ssl_key_file;
4344
char *ssl_ca_file;

src/backend/utils/misc/guc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,6 +3723,21 @@ static struct config_string ConfigureNamesString[] =
37233723
check_canonical_path, NULL, NULL
37243724
},
37253725

3726+
{
3727+
{"ssl_library", PGC_INTERNAL, PRESET_OPTIONS,
3728+
gettext_noop("Name of the SSL library."),
3729+
NULL,
3730+
GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
3731+
},
3732+
&ssl_library,
3733+
#ifdef USE_SSL
3734+
"OpenSSL",
3735+
#else
3736+
"",
3737+
#endif
3738+
NULL, NULL, NULL
3739+
},
3740+
37263741
{
37273742
{"ssl_cert_file", PGC_SIGHUP, CONN_AUTH_SSL,
37283743
gettext_noop("Location of the SSL server certificate file."),

src/include/libpq/libpq.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ extern int pq_putbytes(const char *s, size_t len);
7575
/*
7676
* prototypes for functions in be-secure.c
7777
*/
78+
extern char *ssl_library;
7879
extern char *ssl_cert_file;
7980
extern char *ssl_key_file;
8081
extern char *ssl_ca_file;

src/test/ssl/t/001_ssltests.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
if ($ENV{with_openssl} eq 'yes')
1010
{
11-
plan tests => 64;
11+
plan tests => 65;
1212
}
1313
else
1414
{
@@ -49,6 +49,11 @@
4949
$ENV{PGHOST} = $node->host;
5050
$ENV{PGPORT} = $node->port;
5151
$node->start;
52+
53+
# Run this before we lock down access below.
54+
my $result = $node->safe_psql('postgres', "SHOW ssl_library");
55+
is($result, 'OpenSSL', 'ssl_library parameter');
56+
5257
configure_test_server_for_ssl($node, $SERVERHOSTADDR, 'trust');
5358

5459
note "testing password-protected keys";

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