Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mandatory sslmode variable when loading a PostGIS Layer #58936

Open
cymed opened this issue Oct 1, 2024 · 12 comments
Open

Remove mandatory sslmode variable when loading a PostGIS Layer #58936

cymed opened this issue Oct 1, 2024 · 12 comments

Comments

@cymed
Copy link

cymed commented Oct 1, 2024

Feature description

Currently, when defining a Postgres connection in the data service config, one has to set an ssl mode (the Combobox does not allow NULL values). This can lead to problems when using multiple pg_service files on different user profiles with different ssl mode settings or when sharing projects across organisations. We should allow setting no sslmode.

Additional context

No response

@DelazJ
Copy link
Contributor

DelazJ commented Oct 1, 2024

Currently, when defining a Postgres connection in the data service config, one has to set an ssl mode (the Combobox does not allow NULL values).

@cymed what is the dialog you are referring to?

@cymed
Copy link
Author

cymed commented Oct 1, 2024

grafik

@DelazJ
Copy link
Contributor

DelazJ commented Oct 1, 2024

Isn't "disable" equivalent to not use the SSL mode?

@cymed
Copy link
Author

cymed commented Oct 1, 2024

no, it means to specifically not use SSL mode, overwriting i.e. a sslmode=verify-full on the pg service

@DelazJ
Copy link
Contributor

DelazJ commented Oct 2, 2024

And "prefer" neither works?
So the point would be to have this dialog not overwriting what is in the pg_service file, but the opposite: if an SSL mode is provided in pg_service then it takes precedence, and if not we use what is in the dialog. Not everyone uses a pg_service file, or change that parameter in it. Removing the option is propably not desirable for everyone.

@cymed
Copy link
Author

cymed commented Oct 2, 2024

And "prefer" neither works?

"prefer" allows not passing keys, which can be undesirable.

So the point would be to have this dialog not overwriting what is in the pg_service file, but the opposite: if an SSL mode is provided in pg_service then it takes precedence, and if not we use what is in the dialog. Not everyone uses a pg_service file, or change that parameter in it. Removing the option is propably not desirable for everyone.

We should allow to set or not set the sslmode.

@NyakudyaA
Copy link
Contributor

Screenshot 2024-10-02 at 10 34 20

On my side, if I define a service configuration, the SSL mode is not saved in the project file.

@cymed
Copy link
Author

cymed commented Oct 2, 2024

Screenshot 2024-10-02 at 10 34 20

On my side, if I define a service configuration, the SSL mode is not saved in the project file.

On which OS? I am running on Windows with 3.34.11

@NyakudyaA
Copy link
Contributor

MacOS Sequoia, QGIS 3.38.2

@ponceta
Copy link

ponceta commented Oct 24, 2024

This is the feedback I get here too :
teksi/wastewater#470 (comment)

When using a pg_service, connexion information should not be saved to the QGIS project (except service name of course). This should enable the user to define.

@cymed can you check that if you load a layer from a pg_service it works that way too?

@cymed
Copy link
Author

cymed commented Oct 24, 2024

@ponceta When loading a pg_service without defining sslmode in QGIS, it works just fine
However, people who don't use pg_service are glad about the option of defining the sslmode. I would like to be able to not define sslmode, as it overrides pg_service settings, but not make it mandatory.

@ponceta
Copy link

ponceta commented Oct 25, 2024

Actually you either have a project configured for pg_service use :

<layer-tree-layer 
checked="Qt::Checked" 
expanded="1"
id="accident_22adc163_cd99_4190_864f_df42ade4c75a" 
legend_exp="" 
legend_split_behavior="0" 
name="accident" 
patch_size="-1,-1" 
providerKey="postgres"
source="service='pg_qgep' -->PG SERVICE
key='obj_id' srid=21781 
type=Point 
checkPrimaryKeyUnicity='0' 
table=&quot;qgep_od&quot;.&quot;accident&quot; (situation_geometry)">

Or for a "direct connexion"

<layer-tree-layer 
checked="Qt::Checked"
expanded="1" 
id="accident_1bc2f213_9d43_45e7_9a73_95a75636cae9" 
legend_exp="" 
legend_split_behavior="0" 
name="accident" 
patch_size="-1,-1" 
providerKey="postgres"
source="dbname='qgep' --> direct connection
host=mysuperfunkyhost.qgis.ch --> direct connection
port=5432 --> direct connection
authcfg=mysuperconnectionname --> direct connection
key='obj_id' 
srid=21781 
type=Point 
checkPrimaryKeyUnicity='0' 
table=&quot;qgep_od&quot;.&quot;accident&quot; (situation_geometry)">

So including sslmode statement in pg_service configured project seems to be a non-sense.

But you can easily include it in your pg_configuration :

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants