Re: Internal key management system - Mailing list pgsql-hackers
From | Bruce Momjian |
---|---|
Subject | Re: Internal key management system |
Date | |
Msg-id | 20201028014314.GA16897@momjian.us Whole thread Raw |
In response to | Re: Internal key management system (Bruce Momjian <bruce@momjian.us>) |
Responses |
Re: Internal key management system
|
List | pgsql-hackers |
On Tue, Oct 27, 2020 at 10:20:35AM -0400, Bruce Momjian wrote: > I don't know much about how to hook into that stuff so if you have an > idea, I am all ears. I have used OpenSSL with Yubikey via pksc11. You > can see the use of it on slide 57 and following: > > https://momjian.us/main/writings/crypto_hw_config.pdf#page=57 > > Interestingly, that still needed the user to type in a key to unlock the > Yubikey, so we might need PKCS11 and a password for the same server > start. > > I would like to get this moving forward so I will work on the idea of > passing an open /dev/tty file descriptor from pg_ctl to the postmaster > on start. Here is an updated patch that uses an argument to pass an open /dev/tty file descriptor to the postmaster. It uses -R for initdb/pg_ctl, -R ### for postmaster/postgres, and %R for cluster_passphrase_command. Here is a sample session: --> $ initdb -R --cluster-passphrase-command '/tmp/pass_fd.sh "%p" %R' The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. Key management system is enabled. fixing permissions on existing directory /u/pgsql/data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... America/New_York creating configuration files ... ok running bootstrap script ... --> Enter database encryption pass phrase: B1D7B405EDCD97B7351DD3B7AE0637775FFBC6A2C2EEADAEC009A75A58A79F50 ok performing post-bootstrap initialization ... --> Enter database encryption pass phrase: B1D7B405EDCD97B7351DD3B7AE0637775FFBC6A2C2EEADAEC009A75A58A79F50 ok syncing data to disk ... ok initdb: warning: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: pg_ctl -D /u/pgsql/data -l logfile start $ pg_ctl stop pg_ctl: PID file "/u/pgsql/data/postmaster.pid" does not exist Is server running? --> $ pg_ctl -l /u/pg/server.log -R start waiting for server to start... --> Enter database encryption pass phrase: B1D7B405EDCD97B7351DD3B7AE0637775FFBC6A2C2EEADAEC009A75A58A79F50 done server started Attached is my updated patch, based on Masahiko Sawada's patch, and my pass_fd.sh script. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee
Attachment
pgsql-hackers by date: