I was trying to setup postgres the other day and I came across an exception “Ident authentication failed for user postgres”. This led me to look into how postgres defines it’s configuration.
The pg_hba.conf is a configuration file that provides the first level of access to postgres, providing client authentication. This file provides a gateway by defining the ip addresses that connect to a database and the databases that are available. Postgres listens for connection using unix socket. A simple netstat | grep postgres reveals the socket.