mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Allow specifying CRL directory
Add another method to specify CRLs, hashed directory method, for both server and client side. This offers a means for server or libpq to load only CRLs that are required to verify a certificate. The CRL directory is specifed by separate GUC variables or connection options ssl_crl_dir and sslcrldir, alongside the existing ssl_crl_file and sslcrl, so both methods can be used at the same time. Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/20200731.173911.904649928639357911.horikyota.ntt@gmail.com
This commit is contained in:
@ -150,6 +150,8 @@ sub configure_test_server_for_ssl
|
||||
copy_files("ssl/root+client_ca.crt", $pgdata);
|
||||
copy_files("ssl/root_ca.crt", $pgdata);
|
||||
copy_files("ssl/root+client.crl", $pgdata);
|
||||
mkdir("$pgdata/root+client-crldir");
|
||||
copy_files("ssl/root+client-crldir/*", "$pgdata/root+client-crldir/");
|
||||
|
||||
# Stop and restart server to load new listen_addresses.
|
||||
$node->restart;
|
||||
@ -167,14 +169,24 @@ sub switch_server_cert
|
||||
my $node = $_[0];
|
||||
my $certfile = $_[1];
|
||||
my $cafile = $_[2] || "root+client_ca";
|
||||
my $crlfile = "root+client.crl";
|
||||
my $crldir;
|
||||
my $pgdata = $node->data_dir;
|
||||
|
||||
# defaults to use crl file
|
||||
if (defined $_[3] || defined $_[4])
|
||||
{
|
||||
$crlfile = $_[3];
|
||||
$crldir = $_[4];
|
||||
}
|
||||
|
||||
open my $sslconf, '>', "$pgdata/sslconfig.conf";
|
||||
print $sslconf "ssl=on\n";
|
||||
print $sslconf "ssl_ca_file='$cafile.crt'\n";
|
||||
print $sslconf "ssl_cert_file='$certfile.crt'\n";
|
||||
print $sslconf "ssl_key_file='$certfile.key'\n";
|
||||
print $sslconf "ssl_crl_file='root+client.crl'\n";
|
||||
print $sslconf "ssl_crl_file='$crlfile'\n" if defined $crlfile;
|
||||
print $sslconf "ssl_crl_dir='$crldir'\n" if defined $crldir;
|
||||
close $sslconf;
|
||||
|
||||
$node->restart;
|
||||
|
Reference in New Issue
Block a user