24

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?

3
  • 1
    Hi chasahodge! It may be helpful if you update your question with the full error message and detailed explanation when the error appears. Commented Oct 22, 2020 at 3:11
  • You are using scram authentication on the server and an outdated client library that doesn't support it Commented Oct 22, 2020 at 5:22
  • @a_horse_with_no_name (love the name; one of the first songs I learned on the guitar): That is the whole Error Message.. Thanks for your help. Commented Oct 22, 2020 at 15:35

5 Answers 5

26

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.

Sign up to request clarification or add additional context in comments.

13 Comments

I’m using PostgreSQL 13. I changed the pg_hba.conf file setting the Authentication Method to trust and then the password_encryption to md5 in the postgresql.conf file. Both files reside in the /share/postgresql folder. Haven’t changed the password since I edited those files so I’ll try that now and see what happens
Don't. Upgrade the client software.
@chasahodge Have you managed to resolve this issue?
Same issue here, upgrading solved the problem for me, thanks.
@Paroo That Go driver is in turn linked with an old version of libpq.so (or - worse - statically linked). That's the component you need to upgrade.
|
7

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.

1 Comment

Other alternatives is just to update file libpq.dll into the newest one thats support SCRAM-256. You could find related specific library in wiki.postgresql.org/wiki/List_of_drivers#Drivers. In my-case i'm update the libpq.dll from exefiles.com/en/dll/libpq-dll
1

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.

Comments

0

Downgrading to PostgreSQL 12 helped

Comments

0

I got the following error in Nifi (Basically a Spring Boot Java application underneath):

Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.)

Caused by: org.postgresql.util.PSQLException: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.

Upgrading the PostgreSQL JDBC driver used (in the workflow) to connect to my PostgreSQL database resolves the error.

Since this isn't specifically for Rust, updating the PostgreSQL JDBC driver is applicable for different types of projects.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.