3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
260 stars 143 forks source link

[Bug]: Connection to postgres 13.3 fails, when pg uses scram-sha-256 authentication #2437

Open TotalNoobOnGIS opened 3 years ago

TotalNoobOnGIS commented 3 years ago

What is the bug?

kuva

After selecting postgis point layer for editing and pressing the "Add" button nothing halppens - connection/jelix error. layer coming from postgresql 13.3-2 and visible on the map as expected qgs-file contains pgsql credentials and layer test on qgis server passed

From the browser i can see that kuva

And lizmap error log says: 2021-08-19 07:28:27 127.0.0.1 error 2021-08-19 07:28:27 [402] virhe yhteyden my_server_ip_addr aikana D:\webserver\lizmap\prod\release_3_4_4\lib\jelix\plugins\db\pgsql\pgsql.dbconnection.php 166

Steps to reproduce the issue

launch lizmap project postgis layers can be seen on the map, selecting a feature the popup is displayed with correct attributes select edit tool select postgis layer to be edited press Add-button progress indicator displayed - not able to add point to postgis layer

Lizmap version

3.4.4

QGIS desktop version

3.20-1

QGIS server version

3.20-1

Operating system

Windows Server 2016

Browsers

Firefox

Browsers version

Firefox 90.2

Relevant log output

No response

TotalNoobOnGIS commented 3 years ago

Somehow this is related to postgresql version

Original problem is happening when layer is stored in postgresql 13.3 and edit is started

I did copy the same table(layer) to another machine where i have postgresql 10.3 running. And then added that layer to the original qgis project.

Result: layer on pg 13.3: Add operation fails like described above layer on pg 10.3: Add operation is working perfectly

below browser log after adding a feature to layer which is in pg10.3 kuva

TotalNoobOnGIS commented 3 years ago

Apparently default config of postgresql 13.3 expects client authentication to happen using scram-sha-256

As i'm not able to change lizmap/jelix to support scram-sha-256 i had to find a workaround

I had to revert postgresql authentication to md5

By using guidance from https://stackoverflow.com/questions/67265537/postgresql-downgrade-password-encryption-from-scram-to-md5

After the authentication method change i'm able to add/edit features to postgis as intended