Details
-
New Feature
-
Status: Done
-
Medium
-
Resolution: Duplicate
-
2.0.0
-
None
-
3
-
Yes
-
Yes
-
Yes
-
No
-
[obsolete] Implex
Description
The following have not been implemented:
- --defaults-file
The absence of the ability to use a Mysql Config (my.cnf) file for connection config is bad for automation:
- it forces a password to be set in the command line
- it leads to the possibility that the password appears in logs and is shipped off somewhere
- it removes the ability to check if a password should change by detecting a change in the cnf file
Use case:
As PMM user I need to be able to specify --defaults-file flag as a path to .cnf file so that I can skip passing --user-name and --password options while adding DB and they will be extracted from config file
Acceptance criteria:
- User able to specify a path to defaults file
- If username and password is passed along with defaults path, the flags have highest priority and values (username and password) from file are ignored
- Parsing defaults file should be done by pmm-agent****
UI:
pmm-admin add mysql --defaults-file=~/my.sandbox.cnf MyDB 127.0.0.1
Also, Feature should be available by API (for future UI improvements) and follow common logic - implement logic in pmm-agent, not pmm-admin
Note:
- this is username and password related. We are not adding support of other fields from config file
- If password changed - user need to re-add Service to the system, as it goes with usual --password/–username flags
Out of scope:
- Handling encrypted credentials.
Suggested solution:
- Add --defaults-file flag to pmm-admin add mysql command
- Add new field `defaults_file` to management API for MySQL
- Add new action to extract credentials from defaults file
- Extract username and password on pmm-agent side
- Use ini parser for it.
- Return Username and password from the action
- Save returned username and password to agent model
- Check connection
How to test:
1. Run PMM server.
2. Run MySQL.
3. Run PMM agent and prepare defaults file. e.g.:
[client] host=127.0.0.1 port=12345 user=root123 password=root-password123
Please remember to change credentials for proper one for MySQL database.
4. Use pmm-admin with --defaults-file parameter and path to file
pmm-admin add mysql --defaults-file=~/.my.cnf
5. You can replace username/password just to check if have highest priority:
pmm-admin add mysql --defaults-file=~/.my.cnf --username=bad pmm-admin add mysql --defaults-file=~/.my.cnf --password=wrong
6. It should throws credentials error during connection test
Attachments
Issue Links
- blocks
-
PMM-6107 Restore options from pmm1: --defaults-file with encrypted credentials
-
- Done
-
- clones
-
PMM-4846 Restore options that have been removed for pmm-admin (host, port) + new one (name)
-
- Done
-
- has to be done before
-
PMM-6107 Restore options from pmm1: --defaults-file with encrypted credentials
-
- Done
-
- relates to
-
PMM-10231 Credential Source Ignoring Username value provided in the source file mysql
-
- Done
-
-
PMM-5011 Add support for reading ~/.my.cnf
-
- Done
-
-
PMM-10213 It's not possible to add MySQL with defaults-file option
-
- Done
-
-
PMM-10130 Create test checking adding MySQL with specified defaults-file
-
- Open
-