1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Introduce --with-ssl={openssl} as a configure option

This is a replacement for the existing --with-openssl, extending the
logic to make easier the addition of new SSL libraries.  The grammar is
chosen to be similar to --with-uuid, where multiple values can be
chosen, with "openssl" as the only supported value for now.

The original switch, --with-openssl, is kept for compatibility.

Author: Daniel Gustafsson, Michael Paquier
Reviewed-by: Jacob Champion
Discussion: https://postgr.es/m/FAB21FC8-0F62-434F-AA78-6BD9336D630A@yesql.se
This commit is contained in:
Michael Paquier
2021-02-01 19:19:44 +09:00
parent 7c5d57caed
commit fe61df7f82
22 changed files with 137 additions and 82 deletions

View File

@ -183,7 +183,7 @@ with_icu = @with_icu@
with_perl = @with_perl@
with_python = @with_python@
with_tcl = @with_tcl@
with_openssl = @with_openssl@
with_ssl = @with_ssl@
with_readline = @with_readline@
with_selinux = @with_selinux@
with_systemd = @with_systemd@

View File

@ -28,7 +28,7 @@ OBJS = \
pqmq.o \
pqsignal.o
ifeq ($(with_openssl),yes)
ifeq ($(with_ssl),openssl)
OBJS += be-secure-openssl.o
endif

View File

@ -1041,7 +1041,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel)
ereport(elevel,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("hostssl record cannot match because SSL is not supported by this build"),
errhint("Compile with --with-openssl to use SSL connections."),
errhint("Compile with --with-ssl=openssl to use SSL connections."),
errcontext("line %d of configuration file \"%s\"",
line_num, HbaFileName)));
*err_msg = "hostssl record cannot match because SSL is not supported by this build";

View File

@ -80,7 +80,7 @@ OBJS_COMMON = \
wait_error.o \
wchar.o
ifeq ($(with_openssl),yes)
ifeq ($(with_ssl),openssl)
OBJS_COMMON += \
protocol_openssl.o \
cryptohash_openssl.o

View File

@ -899,7 +899,7 @@
/* Define to select named POSIX semaphores. */
#undef USE_NAMED_POSIX_SEMAPHORES
/* Define to build with OpenSSL support. (--with-openssl) */
/* Define to build with OpenSSL support. (--with-ssl=openssl) */
#undef USE_OPENSSL
/* Define to 1 to build with PAM support. (--with-pam) */

View File

@ -45,9 +45,14 @@ OBJS = \
pqexpbuffer.o \
fe-auth.o
ifeq ($(with_openssl),yes)
# File shared across all SSL implementations supported.
ifneq ($(with_ssl),no)
OBJS += \
fe-secure-common.o
endif
ifeq ($(with_ssl),openssl)
OBJS += \
fe-secure-common.o \
fe-secure-openssl.o
endif

View File

@ -28,7 +28,7 @@ ifneq (,$(filter ldap,$(PG_TEST_EXTRA)))
SUBDIRS += ldap
endif
endif
ifeq ($(with_openssl),yes)
ifeq ($(with_ssl),openssl)
ifneq (,$(filter ssl,$(PG_TEST_EXTRA)))
SUBDIRS += ssl
endif

View File

@ -28,7 +28,7 @@ SUBDIRS = \
unsafe_tests \
worker_spi
ifeq ($(with_openssl),yes)
ifeq ($(with_ssl),openssl)
SUBDIRS += ssl_passphrase_callback
else
ALWAYS_SUBDIRS += ssl_passphrase_callback

View File

@ -1,6 +1,6 @@
# ssl_passphrase_callback Makefile
export with_openssl
export with_ssl
MODULE_big = ssl_passphrase_func
OBJS = ssl_passphrase_func.o $(WIN32RES)

View File

@ -7,9 +7,9 @@ use TestLib;
use Test::More;
use PostgresNode;
unless (($ENV{with_openssl} || 'no') eq 'yes')
unless ($ENV{with_ssl} eq 'openssl')
{
plan skip_all => 'SSL not supported by this build';
plan skip_all => 'OpenSSL not supported by this build';
}
my $clearpass = "FooBaR1";

View File

@ -13,7 +13,7 @@ subdir = src/test/ssl
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
export with_openssl
export with_ssl
CERTIFICATES := server_ca server-cn-and-alt-names \
server-cn-only server-single-alt-name server-multiple-alt-names \

View File

@ -11,13 +11,13 @@ use lib $FindBin::RealBin;
use SSLServer;
if ($ENV{with_openssl} eq 'yes')
if ($ENV{with_ssl} ne 'openssl')
{
plan tests => 93;
plan skip_all => 'OpenSSL not supported by this build';
}
else
{
plan skip_all => 'SSL not supported by this build';
plan tests => 93;
}
#### Some configuration

View File

@ -13,9 +13,9 @@ use lib $FindBin::RealBin;
use SSLServer;
if ($ENV{with_openssl} ne 'yes')
if ($ENV{with_ssl} ne 'openssl')
{
plan skip_all => 'SSL not supported by this build';
plan skip_all => 'OpenSSL not supported by this build';
}
# This is the hostname used to connect to the server.

View File

@ -1156,7 +1156,7 @@ sub GetFakeConfigure
$cfg .= ' --with-ldap' if ($self->{options}->{ldap});
$cfg .= ' --without-zlib' unless ($self->{options}->{zlib});
$cfg .= ' --with-extra-version' if ($self->{options}->{extraver});
$cfg .= ' --with-openssl' if ($self->{options}->{openssl});
$cfg .= ' --with-ssl=openssl' if ($self->{options}->{openssl});
$cfg .= ' --with-uuid' if ($self->{options}->{uuid});
$cfg .= ' --with-libxml' if ($self->{options}->{xml});
$cfg .= ' --with-libxslt' if ($self->{options}->{xslt});

View File

@ -16,7 +16,7 @@ our $config = {
tcl => undef, # --with-tcl=<path>
perl => undef, # --with-perl=<path>
python => undef, # --with-python=<path>
openssl => undef, # --with-openssl=<path>
openssl => undef, # --with-ssl=openssl with <path>
uuid => undef, # --with-uuid=<path>
xml => undef, # --with-libxml=<path>
xslt => undef, # --with-libxslt=<path>