diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-31 02:43:14 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-31 02:43:14 +0000 |
commit | 3405f2b92532cb9559aed1316b3df2262aaadaef (patch) | |
tree | 7bc8067b5b80cef7ef751871efc07eef34ce91d2 /doc/src | |
parent | c5f11f9d19964b8dc568bc4b9bfff7d31ee26db0 (diff) |
Use error message wordings for permissions checks on .pgpass and SSL private
key files that are similar to the one for the postmaster's data directory
permissions check. (I chose to standardize on that one since it's the most
heavily used and presumably best-wordsmithed by now.) Also eliminate explicit
tests on file ownership in these places, since the ensuing read attempt must
fail anyway if it's wrong, and there seems no value in issuing the same error
message for distinct problems. (But I left in the explicit ownership test in
postmaster.c, since it had its own error message anyway.) Also be more
specific in the documentation's descriptions of these checks. Per a gripe
from Kevin Hunter.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/libpq.sgml | 12 | ||||
-rw-r--r-- | doc/src/sgml/runtime.sgml | 15 |
2 files changed, 19 insertions, 8 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 9e63c916418..2f1a248ca76 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.256 2008/03/06 15:37:56 momjian Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.257 2008/03/31 02:43:14 tgl Exp $ --> <chapter id="libpq"> <title><application>libpq</application> - C Library</title> @@ -5223,11 +5223,13 @@ defaultNoticeProcessor(void *arg, const char *message) authorities (<acronym>CA</acronym>) trusted by the server. A matching private key file <filename>~/.postgresql/postgresql.key</> must also be present, unless the secret key for the certificate is stored in a - hardware token, as specified by <envar>PGSSLKEY</envar>. (On Microsoft - Windows these files are named + hardware token, as specified by <envar>PGSSLKEY</envar>. The private + key file must not allow any access to world or group; achieve this by the + command <command>chmod 0600 ~/.postgresql/postgresql.key</command>. + On Microsoft Windows these files are named <filename>%APPDATA%\postgresql\postgresql.crt</filename> and - <filename>%APPDATA%\postgresql\postgresql.key</filename>.) The private - key file must not be world-readable. + <filename>%APPDATA%\postgresql\postgresql.key</filename>, and there + is no special permissions check since the directory is presumed secure. </para> <para> diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 7d89be32fb1..1c799d8965b 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.410 2008/03/21 14:23:37 momjian Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.411 2008/03/31 02:43:14 tgl Exp $ --> <chapter Id="runtime"> <title>Operating System Environment</title> @@ -1632,7 +1632,11 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput To start in <acronym>SSL</> mode, the files <filename>server.crt</> and <filename>server.key</> must exist in the server's data directory. These files should contain the server certificate and private key, - respectively. If the private key is protected with a passphrase, the + respectively. + On Unix systems, the permissions on <filename>server.key</filename> must + disallow any access to world or group; achieve this by the command + <command>chmod 0600 server.key</command>. + If the private key is protected with a passphrase, the server will prompt for the passphrase and will not start until it has been entered. </para> @@ -1731,10 +1735,15 @@ rm privkey.pem Enter the old passphrase to unlock the existing key. Now do: <programlisting> openssl req -x509 -in server.req -text -key server.key -out server.crt -chmod og-rwx server.key </programlisting> to turn the certificate into a self-signed certificate and to copy the key and certificate to where the server will look for them. + Finally do +<programlisting> +chmod og-rwx server.key +</programlisting> + because the server will reject the file if its permissions are more + liberal than this. For more details on how to create your server private key and certificate, refer to the <productname>OpenSSL</> documentation. </para> |