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

Rework pg_service.conf handling to support SSL keys authentication #5855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nirvn
Copy link
Member

@nirvn nirvn commented Dec 1, 2024

This PR reworks the way we handle the presence of a pg_service.conf in the QField data directory (i.e. on Android /Android/data/ch.opengis.qfield/files/QField) to allow for immediate and future improvements.

The big change: instead of having postgres consume that service configuration file (most often drag and dropped via USB cable), QField will copy its content into a new pg_service.conf file living within the QField app's writable system directory. By doing this, we unlock the ability by QField to modify that pg_service.conf file at will (think QFieldCloud-provided services being written into that file when successfully logging into QFC).

Back to the present, the new handling is meant to unlock support for SSL keys authentication through the following logic:

  • when a pg_service.conf file is detected, QField will scan for three keys: sslrootcert, sslcert, and sslkey;
  • for each key, QField will capture the value and look for its associated file using the value as a relative file path to pg_services.conf;
  • when a file is found, QField will copy the file into the above-mentioned app's writable system directory and will tweak its access permission to satisfy postgres / openssl;
  • QField will then modify the pg_services.conf content for the services to point to the newly copied files.

This method allows us to support SSL authentication on Android in a way that allows for the users to share the same pg_services.conf content across desktop and Android.

@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Dec 1, 2024

…e.conf in the app system directory, support SSL keys authentication
@nirvn nirvn force-pushed the postgis_ssl_keys_handling branch from e49b226 to 213468b Compare December 2, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants