Postgresql image configured for optimal security
395
This image pulls straight from the Official Postgres Docker image.
There is a 0-config.sh script that does the following:
Revokes CONNECT privileges on the template1 database from the PUBLIC role. All databases that are created are copied from the template1 database unless specified otherwise. By revoking connect privileges this ensures that nobody can mess around with the database from which all other databases are created
Revokes ALL (CREATE and USAGE) privileges on schema public from the PUBLIC role. Typically when a new schema is created, only the owner has privileges to that schema, however, by default every database has a public schema that grants ALL privileges to the PUBLIC role. This allows any user to create their own tables in the database. So by revoking these privileges, the public schema has the same privileges as a newly created schema.
Roles and Privileges
Creates Four roles:
The adminuser is granted ALL privileges to the public schema. So basically the adminuser is the only one that should be creating tables in the database. The cruduser role is granted SELECT, INSERT, UPDATE, and DELETE privileges to all future tables created by the adminuser in the public schema. The rwuser role is granted SELECT, INSERT, and UPDATE privileges to all future tables created by the adminuser in the public schema The readuser role is granted SELECT privileges to all future tables created by the adminuser in the public schema.
Encryption and Authentication
Environment Variables
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_DB
PG_ADMIN_USER
PG_ADMIN_PASSWORD
PG_CRUD_USER
PG_CRUD_PASSWORD
PG_RW_USER -PG_RW_PASSWORD
PG_READ_USER
PG_READ_PASSWORD
The default password for any account is always the same as the user name. It is highly recommended to create a password.
Content type
Image
Digest
Size
26.9 MB
Last updated
about 7 years ago
docker pull rykroon/postgres:11-alpine