Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7729113

Browse files
committed
Remove support for tls-unique channel binding.
There are some problems with the tls-unique channel binding type. It's notsupported by all SSL libraries, and strictly speaking it's not defined forTLS 1.3 at all, even though at least in OpenSSL, the functions used for itstill seem to work with TLS 1.3 connections. And since we had nomechanism to negotiate what channel binding type to use, there would beawkward interoperability issues if a server only supported some channelbinding types. tls-server-end-point seems feasible to support with any SSLlibrary, so let's just stick to that.This removes the scram_channel_binding libpq option altogether, since thereis now only one supported channel binding type.This also removes all the channel binding tests from the SSL test suite.They were really just testing the scram_channel_binding option, whichis now gone. Channel binding is used if both client and server support it,so it is used in the existing tests. It would be good to have some testsspecifically for channel binding, to make sure it really is used, and thedifferent combinations of a client and a server that support or doesn'tsupport it. The current set of settings we have make it hard to write suchtests, but I did test those things manually, by disablingHAVE_BE_TLS_GET_CERTIFICATE_HASH and/orHAVE_PGTLS_GET_PEER_CERTIFICATE_HASH.I also removed the SCRAM_CHANNEL_BINDING_TLS_END_POINT constant. This is amatter of taste, but IMO it's more readable to just use the"tls-server-end-point" string.Refactor the checks on whether the SSL library supports the functionsneeded for tls-server-end-point channel binding. Now the server won'tadvertise, and the client won't choose, the SCRAM-SHA-256-PLUS variant, ifcompiled with an OpenSSL version too old to support it.In the passing, add some sanity checks to check that the chosen SASLmechanism, SCRAM-SHA-256 or SCRAM-SHA-256-PLUS, matches whether the SCRAMexchange used channel binding or not. For example, if the client selectsthe non-channel-binding variant SCRAM-SHA-256, but in the SCRAM messageuses channel binding anyway. It's harmless from a security point of view,I believe, and I'm not sure if there are some other conditions that wouldcause the connection to fail, but it seems better to be strict about thesethings and check explicitly.Discussion:https://www.postgresql.org/message-id/ec787074-2305-c6f4-86aa-6902f98485a4%40iki.fi
1 parent7a46068 commit7729113

File tree

15 files changed

+246
-336
lines changed

15 files changed

+246
-336
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,34 +1245,6 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
12451245
</listitem>
12461246
</varlistentry>
12471247

1248-
<varlistentry id="libpq-scram-channel-binding" xreflabel="scram_channel_binding">
1249-
<term><literal>scram_channel_binding</literal></term>
1250-
<listitem>
1251-
<para>
1252-
Specifies the channel binding type to use with SCRAM
1253-
authentication. While <acronym>SCRAM</acronym> alone prevents
1254-
the replay of transmitted hashed passwords, channel binding also
1255-
prevents man-in-the-middle attacks.
1256-
</para>
1257-
1258-
<para>
1259-
The list of channel binding types supported by the server are
1260-
listed in <xref linkend="sasl-authentication"/>. An empty value
1261-
specifies that the client will not use channel binding. If this
1262-
parameter is not specified, <literal>tls-unique</literal> is used,
1263-
if supported by both server and client.
1264-
Channel binding is only supported on SSL connections. If the
1265-
connection is not using SSL, then this setting is ignored.
1266-
</para>
1267-
1268-
<para>
1269-
This parameter is mainly intended for protocol testing. In normal
1270-
use, there should not be a need to choose a channel binding type other
1271-
than the default one.
1272-
</para>
1273-
</listitem>
1274-
</varlistentry>
1275-
12761248
<varlistentry id="libpq-connect-replication" xreflabel="replication">
12771249
<term><literal>replication</literal></term>
12781250
<listitem>

‎doc/src/sgml/protocol.sgml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,12 +1576,8 @@ the password is in.
15761576
<para>
15771577
<firstterm>Channel binding</firstterm> is supported in PostgreSQL builds with
15781578
SSL support. The SASL mechanism name for SCRAM with channel binding is
1579-
<literal>SCRAM-SHA-256-PLUS</literal>. Two channel binding types are
1580-
supported: <literal>tls-unique</literal> and
1581-
<literal>tls-server-end-point</literal>, both defined in RFC 5929. Clients
1582-
should use <literal>tls-unique</literal> if they can support it.
1583-
<literal>tls-server-end-point</literal> is intended for third-party clients
1584-
that cannot support <literal>tls-unique</literal> for some reason.
1579+
<literal>SCRAM-SHA-256-PLUS</literal>. The channel binding type used by
1580+
PostgreSQL is <literal>tls-server-end-point</literal>.
15851581
</para>
15861582

15871583
<para>
@@ -1596,19 +1592,11 @@ that cannot support <literal>tls-unique</literal> for some reason.
15961592

15971593
<para>
15981594
<acronym>SCRAM</acronym> with channel binding prevents such
1599-
man-in-the-middle attacks by mixing a value into the transmitted
1600-
password hash that cannot be retransmitted by a fake server.
1601-
In <acronym>SCRAM</acronym> with <literal>tls-unique</literal>
1602-
channel binding, the shared secret negotiated during the SSL session
1603-
is mixed into the user-supplied password hash. The shared secret
1604-
is partly chosen by the server, but not directly transmitted, making
1605-
it impossible for a fake server to create an SSL connection with the
1606-
client that has the same shared secret it has with the real server.
1607-
<acronym>SCRAM</acronym> with <literal>tls-server-end-point</literal>
1608-
mixes a hash of the server's certificate into the user-supplied password
1609-
hash. While a fake server can retransmit the real server's certificate,
1610-
it doesn't have access to the private key matching that certificate, and
1611-
therefore cannot prove it is the owner, causing SSL connection failure.
1595+
man-in-the-middle attacks by mixing the signature of the server's
1596+
certificate into the transmitted password hash. While a fake server can
1597+
retransmit the real server's certificate, it doesn't have access to the
1598+
private key matching that certificate, and therefore cannot prove it is
1599+
the owner, causing SSL connection failure.
16121600
</para>
16131601

16141602
<procedure>

‎doc/src/sgml/release-11.sgml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,10 +2693,7 @@ same commits as above
26932693
the feature currently does not prevent man-in-the-middle
26942694
attacks when using libpq and interfaces built using it. It is
26952695
expected that future versions of libpq and interfaces not built
2696-
using libpq, e.g. JDBC, will allow this capability. The libpq
2697-
options to control the optional channel binding type are <link
2698-
linkend="libpq-scram-channel-binding"><option>scram_channel_binding=tls-unique</option></link>
2699-
and <option>scram_channel_binding=tls-server-end-point</option>.
2696+
using libpq, e.g. JDBC, will allow this capability.
27002697
</para>
27012698
</listitem>
27022699

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp