Uploaded image for project: 'Percona Monitoring and Management'
  1. Percona Monitoring and Management
  2. PMM-10231

Credential Source Ignoring Username value provided in the source file mysql

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • 2.29.0
    • None
    • PMM Admin
    • Yes
    • Yes
    • 1
    • Yes
    • No
    • [obsolete] Implex

    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:

       {  
             "host": string,  
             "port": int, 
             "username": string,
             "password": string,
             "agentpassword": string
        }
      

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

      [client]
      host=127.0.0.1
      port=3306
      user=root
      password=root-password
      

      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.:

      [client] 
      host=127.0.0.1 
      port=12345 
      user=root123 
      password=root-password123  

      or

        { "username": "root123", "password": "root-password123" }
      

      Please remember to pass proper credentials for the database.
      4. Use pmm-admin with --service-params-source parameter and path to file 

      pmm-admin add mysql --service-params-source=~/.my.cnf 

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

      pmm-admin add mysql --service-params-source=~/.my.cnf --username=bad 
      pmm-admin add mysql --service-params-source=~/.my.cnf --password=wrong

      It should throws credentials error during connection test

      Attachments

        Issue Links

          Activity

            People

              przemyslaw.kadej Przemyslaw Kadej (Inactive)
              puneet.kala Puneet Kala
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Smart Checklist