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?
-
1Hi chasahodge! It may be helpful if you update your question with the full error message and detailed explanation when the error appears.MaxV– MaxV2020-10-22 03:11:33 +00:00Commented Oct 22, 2020 at 3:11
-
You are using scram authentication on the server and an outdated client library that doesn't support ituser330315– user3303152020-10-22 05:22:03 +00:00Commented 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.chasahodge– chasahodge2020-10-22 15:35:03 +00:00Commented Oct 22, 2020 at 15:35
5 Answers
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.
13 Comments
libpq.so (or - worse - statically linked). That's the component you need to upgrade.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
Anyone using RDS can do the following to effect this change in an AWS environment in about 5 minutes. It does require downtime.
Steps:
- Create a parameter group and pick the family of your current PostgresQL db
- Edit the parameter group and search for "password"
- Ensure rds.accept_password_auth_method is md5, or md5+scram
- Change password_encryption to md5
- Modify the instance to belong to the new parameter group
- Reboot the instance manually
- Login and roll the passwords for any users using md5
alter user <name> password <password> - Test your newly working login.
- Strongly consider upgrading whatever older tech is necessitating this change.
Comments
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.