-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with SSL support in the official docker image #989
Labels
question
Usability question, not directly related to an error with the image
Comments
wglambert
added
the
question
Usability question, not directly related to an error with the image
label
Aug 22, 2022
Your $ cat docker-compose.yml
version: '3.5'
services:
postgresserver:
image: postgres:14.5
container_name: postgresserver
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: my_password
PGPORT: 5432
command: -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
volumes:
- ./server.crt:/var/lib/postgresql/server.crt
- ./server.key:/var/lib/postgresql/server.key $ ls -ln
total 12
-rw-r--r-- 1 1000 1000 444 Aug 22 16:57 docker-compose.yml
-rwxrwxrwx 1 0 1000 1939 Aug 22 16:01 server.crt
-rw------- 1 999 999 3272 Aug 22 16:00 server.key
$ docker-compose up -d
Creating network "postgres_default" with the default driver
Creating postgresserver ... done
$ docker-compose logs | tail -n 10
postgresserver | server stopped
postgresserver |
postgresserver | PostgreSQL init process complete; ready for start up.
postgresserver |
postgresserver | 2022-08-22 16:59:21.528 UTC [1] LOG: starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
postgresserver | 2022-08-22 16:59:21.529 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgresserver | 2022-08-22 16:59:21.529 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgresserver | 2022-08-22 16:59:21.531 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgresserver | 2022-08-22 16:59:21.535 UTC [59] LOG: database system was shut down at 2022-08-22 16:59:21 UTC
postgresserver | 2022-08-22 16:59:21.541 UTC [1] LOG: database system is ready to accept connections
$ docker run -it --network=host --rm postgres bash
root@demo:/# psql "sslmode=require host=localhost user=postgres password=my_password"
psql (14.5 (Debian 14.5-1.pgdg110+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=# |
Closing assuming this is resolved |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have an issue with enabling of SSL support on postgres docker image. The host is Window 10 machine. The following configuration is used in docker-compose.yml.
The files server.crt, server.key contain the server certificate and the private key signed by my own CA athorities whose certificate is in CA.pem
I have tried to connect using the pre-installed psql-client from Windows PowerShell on host as follows:
This call have produced the following output:
The call without "sslmode=require" switch works like a charm.
I have also tried to use openssl from openssl container as follows:
This call has produced the following output:
The text was updated successfully, but these errors were encountered: