mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Add key management system
This adds a key management system that stores (currently) two data encryption keys of length 128, 192, or 256 bits. The data keys are AES256 encrypted using a key encryption key, and validated via GCM cipher mode. A command to obtain the key encryption key must be specified at initdb time, and will be run at every database server start. New parameters allow a file descriptor open to the terminal to be passed. pg_upgrade support has also been added. Discussion: https://postgr.es/m/CA+fd4k7q5o6Nc_AaX6BcYM9yqTbC6_pnH-6nSD=54Zp6NBQTCQ@mail.gmail.com Discussion: https://postgr.es/m/20201202213814.GG20285@momjian.us Author: Masahiko Sawada, me, Stephen Frost
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
#include "common/file_perm.h"
|
||||
#include "common/ip.h"
|
||||
#include "common/string.h"
|
||||
#include "crypto/kmgr.h"
|
||||
#include "lib/ilist.h"
|
||||
#include "libpq/auth.h"
|
||||
#include "libpq/libpq.h"
|
||||
@@ -231,6 +232,7 @@ static int SendStop = false;
|
||||
|
||||
/* still more option variables */
|
||||
bool EnableSSL = false;
|
||||
int terminal_fd = -1;
|
||||
|
||||
int PreAuthDelay = 0;
|
||||
int AuthenticationTimeout = 60;
|
||||
@@ -687,7 +689,7 @@ PostmasterMain(int argc, char *argv[])
|
||||
* tcop/postgres.c (the option sets should not conflict) and with the
|
||||
* common help() function in main/main.c.
|
||||
*/
|
||||
while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:W:-:")) != -1)
|
||||
while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:R:S:sTt:W:-:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@@ -778,6 +780,10 @@ PostmasterMain(int argc, char *argv[])
|
||||
/* only used by single-user backend */
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
terminal_fd = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
SetConfigOption("work_mem", optarg, PGC_POSTMASTER, PGC_S_ARGV);
|
||||
break;
|
||||
@@ -1326,6 +1332,11 @@ PostmasterMain(int argc, char *argv[])
|
||||
*/
|
||||
RemovePgTempFiles();
|
||||
|
||||
InitializeKmgr();
|
||||
|
||||
if (terminal_fd != -1)
|
||||
close(terminal_fd);
|
||||
|
||||
/*
|
||||
* Initialize stats collection subsystem (this does NOT start the
|
||||
* collector process!)
|
||||
|
||||
Reference in New Issue
Block a user