Credentials via systemd don't work #1271
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 project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
borgmatic-collective/borgmatic#1271
Loading…
Add table
Add a link
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'm trying to do and why
I have been trying to follow the documentation in setting up encrypted credentials via systemd.
Steps to reproduce
I used
systemd-ask-password -n | systemd-creds encrypt - /etc/credstore.encrypted/borgmatic.pwto first encrypt the secret, addedencryption_passphrase: "{credential systemd borgmatic.pw}"to my borgmatic config file, and debian setLoadCredentialEncrypted=borgmatic.pwin the borgmatic service file by default.Then, running
sudo borgmaticorsystemctl start borgmatic.serviceresults in the outputs below in Actual behavior.Actual behavior
Expected behavior
Borgmatic decrypts the credentials and uses them.
Other notes / implementation ideas
I have tried running
and it correctly shows the decrypted secret.
Also, replacing the
encryption_passphrasewith just the passphrase in plain text makes everything work.borgmatic version
1.9.14
borgmatic installation method
Debian package
Borg version
borg 1.4.0
Python version
Python 3.13.5
Database version (if applicable)
No response
Operating system and version
PRETTY_NAME="Debian GNU/Linux 13 (trixie)" NAME="Debian GNU/Linux" VERSION_ID="13" VERSION="13 (trixie)" VERSION_CODENAME=trixie DEBIAN_VERSION_FULL=13.3 ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
A few thoughts here:
Error getting local Borg version: This suggest that borgmatic could not find Borg. Isborg's parent directory in the systemPATH, both at the command-line and when running under systemd? If not, you can add it to thePATHor just set alocal_pathoption in borgmatic.Cannot load credential "borgmatic.pw" because the systemd CREDENTIALS_DIRECTORY environment variable is not set: Can I get a look at your borgmatic systemd service? Are you getting this error even when running borgmatic fromsystemd, or only when run manually from the command-line? If you want to run borgmatic manually from the command-line even when systemd credentials are configured, you'll need to upgrade to a newer version of borgmatic. (See the docs about this. You'll need 2.0.9+.)Thanks for your response!
encryption_passphrase, I am convinced, thatborgis in fact inPATH. In fact, I even get theError getting local Borg versionproblem, when thelocal_pathis specified to be/usr/bin/borg.borgmatic.service
Thanks for providing those details. It looks like the version of borgmatic included in Debian has a bug preventing use of credential names that contain the "." character (#1044). If you don't want to upgrade to get the fix, then you can rename the credential (e.g. to
borgmaticpw) in both the systemd service and borgmatic's configuration. Make sure to reload the service as well.Let me know how that works out for you!
Thank you a lot, this does indeed work!
Great, glad to hear it!