Repository navigation
feat(roles/mariadb_server): store the dump login as a systemd credential - #522
Merged
Merged
Conversation
NavidSassan
force-pushed
the
feat/mariadb-dump-credential
branch
from
October 28, 2026 10:40
94b45cd to
7c6da16
Compare
NavidSassan
force-pushed
the
feat/mariadb-dump-credential
branch
from
October 28, 2026 11:01
3f1019d to
1cd7991
Compare
/usr/local/bin/mariadb-dump shadowed MariaDB's own mariadb-dump client in PATH. The script only works when started by mariadb-dump.service anyway.
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #521 (
systemd_credentialmodule); until that is merged, this PR also shows its commit.First consumer of
linuxfabrik.lfops.systemd_credential: the login of the dump user moves from/etc/mariadb-dump-login.cnf(plain text, since #505) to the systemd credentialmariadb-dump-login.cnf./etc/credstore.encrypted/;mariadb-dump.servicegetsLoadCredentialEncrypted=mariadb-dump-login.cnfand reads$CREDENTIALS_DIRECTORY/mariadb-dump-login.cnf. The host key/var/lib/systemd/credential.secretis not in the duplicity default sources, so a backup of/etcno longer contains the password./etc/credstore/(root, 0600); the script falls back to it via${CREDENTIALS_DIRECTORY:-/etc/credstore}./etc/mariadb-dump-login.cnfand the copiesbackup: trueleft next to it (/etc/mariadb-dump-login.cnf.<pid>.<date>~, each with the plain password) are removed./usr/local/bin/mariadb-dumpstarted directly aborts with a hint to usesystemctl start mariadb-dump.service.Verified with Molecule
mariadb_serveron Rocky 8, Rocky 9, Debian 13 and Ubuntu 22.04: converge, verify, idempotence, verify. The scenario's dump password carries a marker, andverify.ymlgreps all of/etcfor it: no match on systemd >= 251, only/etc/credstore/mariadb-dump-login.cnfbelow. Upgrade path: with the old plain login file and abackup: truecopy planted on all four VMs, the next converge removed both, and the dump and the/etccheck passed. On the VMs: Rocky 8 has/etc/credstore/mariadb-dump-login.cnf(0600 root), Rocky 9 the ciphertext in/etc/credstore.encrypted/andLoadCredentialEncrypted=on the unit.The first idempotence run failed once on Rocky 9 in
repo_mydumper(copy /tmp/ansible.mydumper.asc: the key fetched from keyserver.ubuntu.com differed between runs); unrelated, the rerun was green.