chasahodge
chasahodge

Reputation: 443

PostgreSQL authentication method 10 not supported

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?

Upvotes: 23

Views: 128695

Answers (4)

Justin Edwards
Justin Edwards

Reputation: 171

Anyone using RDS can do the following to effect this change in an AWS environment in about 5 minutes. It does require downtime.

Steps:

  1. Create a parameter group and pick the family of your current PostgresQL db
  2. Edit the parameter group and search for "password"
  3. Ensure rds.accept_password_auth_method is md5, or md5+scram
  4. Change password_encryption to md5
  5. Modify the instance to belong to the new parameter group
  6. Reboot the instance manually
  7. Login and roll the passwords for any users using md5 alter user <name> password <password>
  8. Test your newly working login.
  9. Strongly consider upgrading whatever older tech is necessitating this change.

Upvotes: 0

Michal Varyš
Michal Varyš

Reputation: 142

Downgrading to PostgreSQL 12 helped

Upvotes: 0

VladZ
VladZ

Reputation: 61

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.

Upvotes: 6

Laurenz Albe
Laurenz Albe

Reputation: 246013

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.

Upvotes: 24

Related Questions