Configure database to accept local connections only

I have 2 applications and a database. I just noticed PostgreSQL is listening to any address. How can I restrict it to accept only connections from localhost?

Hello @jordibuj,

This option is not directly available from Cleavr. However, you can SSH into the server and update the PostgreSQL configuration file:

/etc/postgresql/{{ version }}/main/postgresql.conf

Update the line listen_addresses to:

listen_addresses = 'localhost'

Once updated, restart the PostgreSQL service to apply the changes:

systemctl restart postgresql

Thanks @anish,
that was the first thing I tried but I didn’t have root access so I tried to find a way to do it from the dashboard.
I didn’t know I could create a user with root access, which I did, made the changes you suggested, and now the database is more secured!