Credential Source Ignoring Username value provided in the source file mysql

Description

With --credential-source option implemented, we are still ignoring username field present in this json file, mysql connection assumes it to be from root user.

 

STR:

1) Prepare credential source file with username present and non root user

2) Try adding mysql service using --credential-srouce parameter

3) mysql connection ignores username provided.

 

Ticket update:

  • service-params-source pmm-admin’s parameter will send all information to pmm-managed which requests pmm-agent to read the file and return credentials

  • pmm-agent reads the file and based on content figures out if it is a credentials source or defaults file (in case of MySQL only)

  • pmm-admin parameters –username/–password should have the highest priority even if credentials are specified in credentials-source file

  • defaults-file is supported only for MySQL instances

The JSON service-params-source format is as follows:

The defaults-file (ini) MySQL format is as follows:

Tests:

Adding new MySQL:

Check adding MySQL with parameters specified in the service params file (JSON file)
Check adding MySQL with parameters specified without credentials file (JSON file)
Check adding MySQL with credentials file (JSON file) and specified parameters

Check adding MySQL with parameters specified in the service params file (defaults file file)
Check adding MySQL with parameters specified without credentials file (defaults file file)
Check adding MySQL with the service params file (defaults file file) and specified parameters

Adding new ProxySQL/postgreSQL/mongo/haproxy/external:

Check adding instance with parameters specified in the service params file (JSON file)
Check adding instance with parameters specified without credentials file (JSON file)
Check adding instance with credentials file (JSON file) and specified parameters

How to test:

1. Run PMM server.
2. Run MySQL/tested database
3. Run PMM agent and prepare credentials file. e.g.:

or

Please remember to pass proper credentials for the database.

4. Use pmm-admin with --service-params-source parameter and path to file 

5. You can replace username/password just to check if have highest priority:

It should throws credentials error during connection test

How to test

None

How to document

None

Attachments

6

Smart Checklist

Activity

Show:

Michal December 5, 2022 at 10:33 AM

, as discussed, we shall drop support for the credentials file and similar in favor of passing flags directly.

Supported by , this shall provide the solution as expected with less complexity.

Przemyslaw Kadej November 27, 2022 at 7:27 PM

Hello,

I think we cannot use '@' parameter from because parsing logic is implemented in pmm-admin component.  In case of 'service-params-service' (as this ticket define) parsing should be done by pmm-agent.

Please let me know what you think about it .

CC . 

Michal October 27, 2022 at 12:50 PM

As discussed with and , we will solve this by addressing .

This ticket would provide a subset of functionality from the and therefore it makes more sense to address this in .

The code related to parsing MySQL defaults file can be reused with .

Nurlan Moldomurov October 5, 2022 at 11:52 AM

--username/–password should have higher priority over --service-params-source

Nurlan Moldomurov October 5, 2022 at 11:01 AM

I have updated the description, so let's start working on it

Done

Details

Assignee

Reporter

Priority

Components

Labels

Needs QA

Yes

Needs Doc

No

Story Points

Regression Issue

Yes

Found by Automation

Yes

Affects versions

Smart Checklist

Created June 27, 2022 at 5:45 AM
Updated March 6, 2024 at 1:03 AM
Resolved December 6, 2022 at 1:27 PM