[MDEV-20665] Equivalent utilities Created: 2019-09-25  Updated: 2022-04-05  Resolved: 2019-09-25

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.3.16
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: sreekanthpm Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Centos 7



 Description   

Hello Team,

I have newly installed mariadb 10.3.16 community edition. I have schedule my backup job on daily basis, so I have given the password in my script file.
In MYSQL we have "mysql_config_editor" were we can save the password, is there any equivalent to this in Mariadb?.
Thanks in advance.



 Comments   
Comment by Sergei Golubchik [ 2019-09-25 ]

No, mysql_config_editor doesn't encrypt, but only obfuscates passwords, that might create a false sense of security.

But having the password in a script is not a good idea, it'll be visible to ps. Better to put your password in a separate file and specify it with --defaults-extra-file.

Comment by sreekanthpm [ 2019-09-30 ]

Even If we are specifying in a separate file it will be visible to every one right....
Here my concern is not to have the password visible to any user.. How can I achieve it??

Thanks in advance....

Comment by Sergei Golubchik [ 2019-10-06 ]

The file name, yes. But the file doesn't have to be world readable, you can make it readable only by that user who runs the backup job.

And that user will always be able to read the password, even if you use mysql_config_editor.

Comment by Marlin Forbes [ 2022-04-05 ]

All you had to do was continue supporting the tool, and also set the permissions correctly on `$HOME/.mylogin.cnf`. Simple.

Before: A working tool with obfuscated logins, in a file which can be locked down to a specific user.
After: Non-working tool, unobfuscated logins in plaintext files, in a file which can be locked down to a specific user.

How is this better?

BTW, the default permissions on the config file created by `mysql_config_editor` are user read-write only.

This is as secure as your suggested replacement. More so, since it's also obfuscated.

Furthermore, there's this from the documentation for the tool.

> The login path file must be readable and writable to the current user, and inaccessible to other users. Otherwise, mysql_config_editor ignores it, and client programs do not use it, either.

It cannot be used if it is insecurely stored.

Comment by Sergei Golubchik [ 2022-04-05 ]

the bug report and my old answer was for 10.3. Since 10.4 one should prefer

sudo -u mysql /path/to/script

it won't need any password at all, readable or unreadable.

Generated at Thu Feb 08 09:01:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.