Stop using --password for sending database passwords to MongoDB #1013
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1013
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
Providing passwords to MongoDB via command-line (specifically
--password, which borgmatic uses today) is not great from a security perspective. That's because the full command-line shows up via tools likeps.So as part of this ticket, modify the borgmatic MongoDB hook to pass the configured password to the database client command via a more secure mechanism.
Other notes / implementation ideas
#1009 changed the MariaDB/MySQL hooks to use an anonymous pipe instead of an environment variable for transmitting the database password. A similar approach could work for MongoDB. It might go something like this:
--password. The idea is that MongoDB will then expect the password on stdin, which we can provide as follows.< /def/fd/[file descriptor number]shell redirection where[file descriptor number]is the file descriptor of an anonymous pipe created for this purpose.This approach works for dumping, but it doesn't work for restore because stdin is already used by the streaming extract process and therefore isn't available for sending the password to
mongorestore. Closing wontfix for now, but I'll reopen if anyone thinks of a better approach.Well, that didn't take long! The better approach is to use
--config /dev/fd/[file descriptor number], populating that anonymous pipe withpassword: thepassword.Implemented in main and will be part of the next release!
Released in borgmatic 1.9.13!