Autoconfigurable 🐘 Postgres image
100K+
Image that configures Postgres before starting it.
To automate dealing with specific users accessing from specific networks to a postgres server.
It tries to configure as good as possible, differentiating between connections made from LAN (docker networks attached) and from WAN (all others). This is done at entrypoint time, because it's the only way to know dynamic IP ranges in attached networks.
Then it generates appropriate postgres.conf and pg_hba.conf files.
It doesn't validate your settings, so you should be aware of proper configuration:
cert auth method if client.ca.cert.pem is not supplied.server.cert.pem and server.key.pem are not supplied.Variables' defaults are all found in the Dockerfile.
The container is mainly configured via these environment variables:
CERTSJSON object with some or all of these keys:
client.ca.cert.pem: PEM contents for Postgres' ssl_ca_file parameter. Enables cert authentication in remote postgres clients. It's the most secure remote auth option. All clients must authenticate with a cert signed by this CA.server.cert.pem: PEM contents for Postgres' ssl_cert_file parameter. The Postgres server will identify himself and encrypt the connection with this certificate.server.key.pem: PEM contents for Postgres' ssl_key_file parameter. The Postgres server will identify himself and encrypt the connection with this private key.If you pass server.cert.pem, you should pass server.key.pem too, and viceversa, or TLS encryption will not be properly configured. You also need both of them if you use client.ca.cert.pem.
It is safer to mount files with secrets instead of passing a JSON string in an env variable. You can mount the equivalents:
/etc/postgres/client.ca.cert.pem/etc/postgres/server.cert.pem/etc/postgres/server.key.pemCONF_EXTRAString with contents appended to the generated postgres.conf file.
LAN_AUTH_METHODMethod required to authenticate clients that connect from LAN.
LAN_CONNECTIONConnection type allowed for LAN connections.
LAN_DATABASESJSON array with database names whose access is allowed from LAN.
LAN_HBA_TPLTemplate applied for each combination of LAN CIDR/USER/DATABASE in the pg_hba.conf file.
Some placeholders can be expanded. See the Dockerfile to know them.
LAN_TLSWether to enable or not TLS in LAN connections.
LAN_USERSUsers allowed to connect from LAN.
WAN_AUTH_METHODMethod required to authenticate clients that connect from WAN.
WAN_CONNECTIONConnection type allowed for WAN connections. If it is hostssl, it will only have effect when the required certs are received.
WAN_DATABASESJSON array with database names whose access is allowed from WAN.
WAN_HBA_TPLTemplate applied for each combination of USER/DATABASE in the pg_hba.conf file, for public connections.
Some placeholders can be expanded. See the Dockerfile to know them.
WAN_TLSWether to enable or not TLS in WAN connections.
WAN_USERSUsers allowed to connect from WAN.
Content type
Image
Digest
sha256:fd79514f8…
Size
128.4 MB
Last updated
about 1 month ago
docker pull tecnativa/postgres-autoconf:alpine