1

I want to enable SSL for PostgreSQL DB.

I have generated certificates and Key also.

By trying multiple ways, I have enabled it on default port i.e 5432.

But I want to enable SSL on new port.

Please help me with exact working solution.

sujay777
  • 41
  • 5
  • did you try changing port number in `postgresql.conf`? – thirdeye Apr 28 '23 at 10:12
  • yes, but its not working. giving this error msg - An error occurred while establishing the connection: Long Message: Connection timed out: connect Details:    Type: org.netezza.error.NzSQLException    Error Code: 1114    SQL State: 08001 – sujay777 Apr 28 '23 at 12:06
  • consider sharing more research information and your work in a detailed manner – thirdeye Apr 28 '23 at 13:31

1 Answers1

0

The PostgreSQL protocol uses the same port for plain-text and SSL/TLS connections. (The upgrade is done on an existing connection using an SSLRequest message, part of PostgreSQL communication protocol. This is very similar to the use of STARTTLS in other protocols.)

As such, you can't really have one port listening to plain connections and another listening to SSL/TLS connections.

If you really want them on a different port, you could use a tool like pgBouncer in front of your PostgreSQL server and configure it to handle the SSL/TLS settings.

Bruno
  • 119,590
  • 31
  • 270
  • 376