Re: psql v16.3 successfully connects via TLSv1.3 proxy, but psql v16.4 says "tlsv1 alert no application protocol"

From: Markus KARG <markus(at)headcrashing(dot)eu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: psql v16.3 successfully connects via TLSv1.3 proxy, but psql v16.4 says "tlsv1 alert no application protocol"
Date: 2024-12-25 22:47:15
Message-ID: 5fc24305-136e-4a6e-993e-b10dc2300403@headcrashing.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Markus KARG<markus(at)headcrashing(dot)eu> writes:
>> Following this theory, sslnegotiation=postgres used with psql v17.x
>> should solve the problem, as it falls back to the same mechanism
>> supported in v16.3, correct?
> No, sorry, it looks like we insert the ALPN extension into the SSL
> request packet regardless of that. Maybe there should have been
> a way to suppress that, but v17 libpq doesn't provide one.

Thank you, Tom, you saved my day! I have explicitly added the name
`postgresql` to the ALPN configuration on Traefik, and immediately psql
v16.4+ (including psql v17) worked like a charm!

As a reference for others, in `traefik-dynamic.yaml` add the follwing to
make it work (as long as you patch the `default` TLS options, take care
to keep all those protocols contained; alternative path a per-router tls
config instead to ONLY have postgresql in that list):

    ## Dynamic configuration
    tls:
      options:
        default:
          alpnProtocols:
            - acme-tls/1
            - http/1.1
            - h2
            - postgresql

>> Regarding your question: I have tried "sslnegotiation=postgres" and
>> "ssqlnegotiation=direct" with the original official PostgreSQL Docker
>> Container found on Docker Hub.
> Let's clarify something here: there is nothing "official" about either
> that docker container or anything else you might find on DockerHub.
> The Postgres community does not produce any such packaging. You'd
> have to discussion the inclusion of v17 libpq with whoever did build
> that container. I know that Debian thinks it's a good idea to use
> latest libpq with older servers, and this builder might be following
> their lead. (The timing would be about right, since v17.0 came out
> about the same time as 16.4.) This example does show that there
> are pitfalls in that policy.

Thanks a lot for this really essential information! In fact, the authors
of that official docker image (they really call it that way) call
themselves "The PostgreSQL Docker Community". This is totally
misleading, as one understands that to be "The Docker Community withing
the PostgreSQL Community", which it (apparently) is not. Instead, it
seems that it actually is "The PostgreSQL Community at Docker, Inc.",
people totally unrelated to the "real" PostgreSQL Community!

Thanks a lot, Tom, for your kind help. You provided the best Christmas
present this year! :-)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message yrshen 2024-12-26 09:47:55 Re: Re: Re: BUG #18750: Inappropriate update when it is blocked in RC
Previous Message Tom Lane 2024-12-25 19:37:00 Re: psql v16.3 successfully connects via TLSv1.3 proxy, but psql v16.4 says "tlsv1 alert no application protocol"