Search code examples
postgresqliptables

iptables and PostgreSQL


Edit: Being wiser now, this question doesn't make much sense. Unfortunately, I'm unable to delete it.


Solution

  • This is apples-and-pears, to a large degree.

    iptables is used as a firewall to keep unwanted traffic out of the local network, pg_hba.conf determines not only who can connect to the database system on the server, but also what connections (users to databases) are allowed and how they are authenticated.

    In a typical setup, iptables would only filter on the internet connection, while pg_hba.conf applies to all traffic trying to connect to the database system, specifically also traffic on the internal network. So in practice, yes, you would combine them, but they are rally not something where you should weigh the benefits of one option to the other, they both serve their own purpose.