PostgreSQL authentication method 10 not supported

38,697

Solution 1

You have to upgrade the PostgreSQL client software (in this case, the libpq used by the Rust driver) to a later version that supports the scram-sha-256 authentication method introduced in PostgreSQL v10.

Downgrading password_encryption in PostgreSQL to md5, changing all the passwords and using the md5 authentication method is a possible, but bad alternative. It is more effort, and you get worse security and old, buggy software.

Solution 2

This isn't a Rust-specific question; the issue applies to any application connecting to a Postgres DB that doesn't support the scram-sha-256 authentication method. In my case it was a problem with the Perl application connecting to Postgres.

These steps are based on a post.

You need to have installed the latest Postgres client. The client bin directory (SRC) is "C:\Program Files\PostgreSQL\13\bin" in this example. The target (TRG) directory is where my application binary is installed: "C:\Strawberry\c\bin". My application failed during an attempt to connect the Postgres DB with error "... authentication method 10 not supported ...".

set SRC=C:\Program Files\PostgreSQL\13\bin
set TRG=C:\Strawberry\c\bin

dir "%SRC%\libpq.dll"         # to see the source DLL
dir "%TRG%\libpq__.dll"       # to see the target DLL. Will be replaced from SRC

cp "%SRC%\libpq.dll" %TRG%\.

cd %TRG%
pexports libpq.dll > libpq.def 
dlltool --dllname libpq.dll --def libpq.def --output-lib ..\lib\libpq.a

move "%TRG%"\libpq__.dll "%TRG%"\libpq__.dll_BUP # rename ORIGINAL name to BUP
move "%TRG%"\libpq.dll "%TRG%"\libpq__.dll       # rename new DLL to ORIGINAL

At this point I was able successfully connect to Postgres from my Perl script.

The initial post shown above also suggested to copy other DLLs from source to the target:

libiconv-2.dll
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
libintl-8.dll

However, I was able to resolve my issue without copying these libraries.

Share:
38,697
chasahodge
Author by

chasahodge

Retired Programmer/Developer

Updated on December 20, 2021

Comments

  • chasahodge
    chasahodge over 2 years

    I'm trying to follow the diesel.rs tutorial using PostgreSQL. When I get to the Diesel setup step, I get an "authentication method 10 not supported" error. How do I resolve it?