enso/test/Table_Tests/scripts/postgresssl/Dockerfile
James Dunkerley 7090e1fb91
Docker file for testing Postgres SSL and updated Postgres Spec (#3607)
Adds a Dockerfile and `CreatePostgresSSL.sh` script, which makes an Alpine based Postgres server with a self signed certificate. The script will drop the generated `rootCA.crt` into the `data/transient` folder.

This can then be included in the test by setting the environment variable `ENSO_DATABASE_TEST_CA_CERT_FILE`.

Test has been updated to check the various SSL connection modes.
2022-07-26 13:28:43 +00:00

20 lines
810 B
Docker

# syntax=docker/dockerfile:1
FROM postgres:14.4
ARG host_name
COPY ./*.conf /root/
RUN apt-get update && \
apt-get upgrade -y && \
mkdir openssl && cd openssl && \
openssl req -x509 -sha256 -days 356 -nodes -newkey rsa:2048 -subj "/CN=${host_name}/C=UK/L=London" -keyout rootCA.key -out rootCA.crt && \
openssl genrsa -out server.key 2048 && \
openssl req -new -key server.key -out server.csr -config /root/csr.conf && \
openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt -days 365 -sha256 -extfile /root/cert.conf && \
chmod 400 server.key && \
chmod 444 server.crt && \
chown postgres:postgres server.*
CMD ["postgres", "-c", "ssl=on", "-c", "ssl_cert_file=/openssl/server.crt", "-c", "ssl_key_file=/openssl/server.key"]