mirror of
https://github.com/postgres/postgres.git
synced 2026-01-05 23:38:41 +03:00
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.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user