MySQL Mariadb: is it possible to have an alternative to pipe for authentication? #1033
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1033
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'd like to do and why
Even if the use of pipes for passing credentials is good practice, sometimes this is a disadvantage.
Reference:
def make_defaults_file_options(username=None, password=None, defaults_extra_filename=None):In a scenario with some containers (managed with
docker compose, but that's not important), I am backing up a postgresql db of an application, by using this configuration:This works and has several advantages:
I tried to do the same with mariadb but that's not working with a similar configuration:
This configuration is NOT working and borgmatic is exiting with this message:
This is not directly a borgmatic problem:
mariadb-dumpis complaining about not being able to load the defaults file: this happens because the pipe is created in borgmatic's container and this is not accessible by the target db container.docker image:
ghcr.io/borgmatic-collective/borgmatic:1.9.14Other notes / implementation ideas
I know this is an edge case, but it would be great to have a way for the
make_defaults_file_optionsto return an empty string, so that I can use something like:Or a flag to disable the pipe, and use something else (env vars, arguments, ...)
Thanks for bringing this to my attention! And yeah, I think the right solution here is probably a borgmatic configuration option that, when enabled, reverts to the old borgmatic behavior of sending passwords to MariaDB via environment variable and username via CLI flags. Then you would be able to do something like this:
Okay, this is implemented in main and will be part of the next release! The new database option is called
password_transportand is implemented for both MariaDB and MySQL database hooks. Example usage:Thanks again for suggesting this!
Released in borgmatic 2.0.5!
Documentation is here: https://torsion.org/borgmatic/docs/how-to/backup-your-databases/#database-client-in-a-running-container