Add passcommand for database dumps #795
Loading…
x
Reference in New Issue
Block a user
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
A
passcommand
in addition topassword
for database dumps would be nice for those who cannot login without password nor like to have the password inconfig.yaml
.Other notes / implementation ideas
No response
Thanks for taking the time to file this! Maybe there could be a new option in each database configuration that allows the user to specify the passcommand for that database instead of a password. And if specified, borgmatic would call out to that command, consuming its stdout (stripped of newlines) to get the password to use.
In the meantime though, these docs may be helpful: https://torsion.org/borgmatic/docs/how-to/provide-your-passwords/
But borgmatic can already do that right? Afaik it should support reading things from the env so why add a feature to do that manually for one field? Is there any limitation to running your password script before calling borgmatic, saving the output in the env and calling borgmatic after that?
If there's one common theme in borgmatic feature requests, it's that users want to do more and more directly from the configuration file rather than having to rely on external shell scripting. Having said that, the work-around you describe is a totally viable option for certain users.
@Martin borgmatic is getting several new credential loading hooks in the next release. None of them directly solve this ask, but it would be pretty easy now to add a new credential hook that allows calling arbitrary commands from password fields within borgmatic's configuration file. Made-up example:
However, one question first so I can understand the use case: What command do you want to run to get your password? It might be useful to support running arbitrary commands, but it might also be neat to add a more targeted credential hook as well (or instead). For instance, I just added a credential hook that allows loading credentials from KeePassXC, a password manager. Example:
So where is your database password actually coming from?
In my case, it is probably sth. simple as
cat <filename>
, while the file contains only the password.I.e. special handling that might make sense.
Oh, good news then! This is already implemented in main and will be part of the next release! Example usage:
What that does is read the contents of the
/path/to/my/credential.txt
file and insert it into the password field.So I'll call this done for now even though it doesn't (yet) support running arbitrary commands. But that could potentially be added later on if there's a need.
Released in borgmatic 1.9.11!