PostgreSQL SSL root.crt not loading

Solution 1:

Permissions are OK. I have working:

-rw-r--r--  1 postgres postgres  615 2011-04-25 16:23 root.crt
-rw-------  1 postgres postgres  692 2011-04-25 17:20 server.crt
-rw-------  1 postgres postgres  887 2011-04-25 17:17 server.key

Try to put this files in data directory (/var/lib/postgresql/9.0/{clustername}), not config directory (/etc/postgresql/9.0/{clustername}).

When cluster is created there are automatically provided snakeoil server.key and server.crt in data directory, but there is no root.crt. Probably you put your certs in config directory.

To start in SSL mode, the files server.crt and 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 server will prompt for the passphrase and will not start until it has been entered.

To require the client to supply a trusted certificate, place certificates of the certificate authorities (CA) you trust in the file root.crt in the data directory.

In Ubuntu:

cat /etc/postgresql/9.0/main/postgresql.conf | grep data_dir
data_directory = '/var/lib/postgresql/9.0/main' # use data in another directory