From 5f3724dd7c6b8beb9be3030cb3262038755c88e4 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 15 Dec 2008 10:28:22 +0000 Subject: Support specifying filename for SSL certificate, key, root certificate store and certificate revokation list by using connection parameters or environment variables. Original patch by Mark Woodward, heavily reworked by Alvaro Herrera and Magnus Hagander. --- doc/src/sgml/libpq.sgml | 110 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 89 insertions(+), 21 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 327eee1c2c9..dc04b006294 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,4 +1,4 @@ - + <application>libpq</application> - C Library @@ -317,6 +317,50 @@ + + sslcert + + + This parameter specifies the file name of the client SSL + certificate. + + + + + + sslkey + + + This parameter specifies the location for the secret key + used for the client certificate. It can either specify a filename + that will be used instead of the default + ~/.postgresql/postgresql.key, or can specify an external + engine (engines are OpenSSL loadable modules). The + external engine specification should consist of a colon-separated + engine name and an engine-specific key identifier. + + + + + + sslrootcert + + + This parameter specifies the file name of the root SSL certificate. + + + + + + sslcrl + + + This parameter specifies the file name of the SSL certificate + revocation list (CRL). + + + + krbsrvname @@ -5761,17 +5805,48 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) + + + + PGSSLCERT + + PGSSLCERT specifies the location for the client + certificate to use if the server requests one. + + + PGSSLKEY - PGSSLKEY specifies the hardware token that stores the - secret key for the client certificate. The value of this variable - should consist of a colon-separated engine name (engines are - OpenSSL loadable modules) and an engine-specific key - identifier. If this is not set, the secret key must be kept in a - file. + PGSSLKEY specifies the location for the secret key + used for the client certificate. It can either specify a filename + that will be used instead of the default + ~/.postgresql/postgresql.key, or can specify an external + engine (engines are OpenSSL loadable modules). The + external engine specification should consist of a colon-separated + engine name and an engine-specific key identifier. + + + + + + + PGSSLROOTCERT + + PGSSLROOTCERT specifies the file name where the SSL + root certificate is stored. + + + + + + + PGSSLCRL + + PGSSLCRL specifies the file name where the SSL certificate + revocation list is stored. @@ -6096,6 +6171,9 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) if the file ~/.postgresql/root.crl exists (%APPDATA%\postgresql\root.crl on Microsoft Windows). + The location of the root certificate store and the CRL can be overridden + by the connection parameters sslrootcert and sslcrl + or the environment variables PGSSLROOTCERT and PGSSLCRL. @@ -6105,26 +6183,16 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) directory. The certificate must be signed by one of the certificate authorities (CA) trusted by the server. A matching private key file ~/.postgresql/postgresql.key must also - be present, unless the secret key for the certificate is stored in a - hardware token, as specified by PGSSLKEY. The private + be present. The private key file must not allow any access to world or group; achieve this by the command chmod 0600 ~/.postgresql/postgresql.key. On Microsoft Windows these files are named %APPDATA%\postgresql\postgresql.crt and %APPDATA%\postgresql\postgresql.key, and there is no special permissions check since the directory is presumed secure. - - - - If the environment variable PGSSLKEY is set, its value - should consist of a colon-separated engine name and key identifier. In - this case, libpq will load the specified - engine, i.e. the OpenSSL module which supports special - hardware, and reference the key with the specified identifier. - Identifiers are engine-specific. Typically, cryptography hardware tokens - do not reveal secret keys to the application. Instead, applications - delegate all cryptography operations which require the secret key to - the hardware token. + The location of the certificate and key files can be overridden by the + connection parameters sslcert and sslkey or the + environment variables PGSSLCERT and PGSSLKEY. -- cgit v1.2.3