- Notifications
You must be signed in to change notification settings - Fork28
Commitd9bba27
committed
Fix SCRAM authentication via SSL when mixing versions of OpenSSL
When using a libpq client linked with OpenSSL 1.0.1 or older to connectto a backend linked with OpenSSL 1.0.2 or newer, the server would sendSCRAM-SHA-256-PLUS and SCRAM-SHA-256 as valid mechanisms for the SASLexchange, and the client would choose SCRAM-SHA-256-PLUS even if it doesnot support channel binding, leading to a confusing error. In thiscase, what the client ought to do is switch to SCRAM-SHA-256 so as theauthentication can move on and succeed.So for a SCRAM authentication over SSL, here are all the cases presentand how we deal with them using libpq:1) Server supports channel binding, it sends SCRAM-SHA-256-PLUS andSCRAM-SHA-256 as allowed mechanisms.1-1) Client supports channel binding, chooses SCRAM-SHA-256-PLUS.1-2) Client does not support channel binding, chooses SCRAM-SHA-256.2) Server does not support channel binding, sends SCRAM-SHA-256 asallowed mechanism.2-1) Client supports channel binding, still it has no choice but tochoose SCRAM-SHA-256.2-2) Client does not support channel binding, it chooses SCRAM-SHA-256.In all these scenarios the connection should succeed, and the one whichwas handled incorrectly prior this commit is 1-2), causing theconnection attempt to fail because client chose SCRAM-SHA-256-PLUS overSCRAM-SHA-256.Reported-by: Hugh RanalliDiagnosed-by: Peter EisentrautAuthor: Michael PaquierReviewed-by: Peter EisentrautDiscussion:https://postgr.es/m/CAAhbUMO89SqUk-5mMY+OapgWf-twF2NA5sCucbHEzMfGbvcepA@mail.gmail.comBackpatch-through: 111 parent50ae619 commitd9bba27
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
530 | | - | |
531 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
532 | 533 | | |
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
536 | 544 | | |
| 545 | + | |
| 546 | + | |
537 | 547 | | |
538 | 548 | | |
539 | 549 | | |
| |||
0 commit comments
Comments
(0)