Introducing SNI in TLS handshake for SSL connections

From: Florin Asavoaie <florin(dot)asavoaie(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Introducing SNI in TLS handshake for SSL connections
Date: 2017-04-25 02:26:25
Message-ID: CAPPwrB_tsOw8MtVaA_DFyOFRY2ohNdvMnLoA_JRr3yB67Rggmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Back in November 2013 someone suggested adding the SNI header in the TLS
handshake for connections initiated by libpq using OpenSQL. There was no
usecase at that point.

However, right now there is one:

I'd like to write a small "PostGreSQL router" that routes connections to a
specific cluster based on the requested SNI. Maybe it is even possible to
just integrate this as an option in HaProxy, didn't look how difficult it
would be to do it there.

The whole point is for using PostGreSQL inside containers and being able to
connect to it from anywhere. For example if you are using Docker, you could
expose the default PostGreSQL port on Dockers ingress routing mesh and let
it go to the router application. Then the router application will read the
SNI headers and forward the connection to the appropriate container via the
Docker Overlay network (and maybe optionally even do "ssl offload" at this
point since the Overlay network is already encrypted).

If there's nobody against this, I can try to do the patch myself, doesn't
look too difficult (I expect it to simply work by calling
SSL_set_tlsext_host_name(SSL_context, PQhost(conn))) somewhere in
initialize_SSL
in fe-secure-openssl.c.

Thanks,
Florin.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2017-04-25 02:40:23 Re: PG 10 release notes
Previous Message Bruce Momjian 2017-04-25 01:54:44 Re: PG 10 release notes