A very popular standalone NoSQL database solution came under criticism about their security posture this week. It’s not the kind of publicity a database company – or any company for that matter – relishes. Although the vulnerability seems to have been less a problem with the core database than with insecure default settings, it’s worth remembering that, no matter what database you use, properly securing the database is an essential configuration step.
So, it seemed like a good time to write up a few tips on how to properly secure your PostgreSQL deployment.
Tip No. 1: Don’t be dumb! Unless you have a very good reason for doing otherwise, put your Postgres database – and any other network-facing services you run – behind your corporate firewall. Even the best-written software will occasionally have security vulnerabilities that can be exploited merely by connecting to the port it runs on. So public-facing network services should be limited to those which absolutely must allow access from the public Internet. Normally, the database is not one of those.
Tip No. 2: Use the listen_addresses setting to prevent connections from networks that don’t require database access. Depending on your installation method, the default value of listen_addresses may be ‘localhost’, in which case the operating system will reject connection attempts from other servers before they reach PostgreSQL. If you’re using another setting but don’t actually need access (more…)Tweet