Managing pg_hba.conf

After configuring bind addresses, we can move on to the next level. The pg_hba.conf file will tell PostgreSQL how to authenticate people coming over the network. In general, pg_hba.conf file entries have the following layout:

# local DATABASE USER METHOD [OPTIONS] 
# host DATABASE USER ADDRESS METHOD [OPTIONS] 
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS] 
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] 

There are four types of rules that can be put into the pg_hba.conf file:

  • local: This can be used to configure local Unix socket connections.
  • host: This can be used for SSL and non-SSL connections.
  • hostssl: These are only valid for SSL connections. To make use of this option, SSL must be compiled into the server, ...

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.