Handling SSL

PostgreSQL allows you to encrypt the transfer between the server and the client. Encryption is highly beneficial, especially if you are communicating over long distances. SSL offers a simple and secure way to ensure that nobody is able to listen to your communication.

In this section, you will learn to set up SSL.

The first thing to do is to set the ssl parameter to on in the postgresql.conf file on server start. In the next step, you can put SSL certificates into the $PGDATA directory. If you don't want the certificates to be in some other directory, change the following parameters:

#ssl_cert_file = 'server.crt'    # (change requires restart) #ssl_key_file = 'server.key'     # (change requires restart) #ssl_ca_file = '' # (change requires ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.