- publishing free software manuals
The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide
by The PostgreSQL Global Development Group
Paperback (6"x9"), 274 pages
ISBN 9781906966072
RRP £9.95 ($14.95)

Sales of this book support the PostgreSQL project! Get a printed copy>>>

3.6 Preventing Server Spoofing

While the server is running, it is not possible for a malicious user to take the place of the normal database server. However, when the server is down, it is possible for a local user to spoof the normal server by starting their own server. The spoof server could read passwords and queries sent by clients, but could not return any data because the PGDATA directory would still be secure because of directory permissions. Spoofing is possible because any user can start a database server; a client cannot identify an invalid server unless it is specially configured.

The simplest way to prevent spoofing for local connections is to use a Unix domain socket directory ( unix_socket_directory) that has write permission only for a trusted local user. This prevents a malicious user from creating their own socket file in that directory. If you are concerned that some applications might still reference ‘/tmp’ for the socket file and hence be vulnerable to spoofing, during operating system startup create a symbolic link ‘/tmp/.s.PGSQL.5432’ that points to the relocated socket file. You also might need to modify your ‘/tmp’ cleanup script to prevent removal of the symbolic link.

To prevent spoofing on TCP connections, the best solution is to use SSL certificates and make sure that clients check the server's certificate. To do that, the server must be configured to accept only hostssl connections (section 5.1 The pg_hba.conf file) and have SSL ‘server.key’ (key) and ‘server.crt’ (certificate) files (section 3.8 Secure TCP/IP Connections with SSL). The TCP client must connect using sslmode=verify-ca or verify-full and have the appropriate root certificate file installed ( Volume 2: Database Connection Control Functions).

ISBN 9781906966072The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration GuideSee the print edition