Repository navigation
fix(actions): backup_reload refused units added with systemctl link - #154
Merged
Merged
Conversation
`systemctl link /opt/app/app.service` leaves a symlink in /etc/systemd/system, and systemd reports that symlink as FragmentPath (checked on Rocky 10, systemd 257). The backup opens every file with O_NOFOLLOW, so the action failed before the reload on every linked unit. Resolve the fragment and drop-in paths systemd reports before copying. Policy `paths` keep the no-symlink rule, and the final open still uses O_NOFOLLOW, so a service that owns the target's directory can't swap the file for a link. Signed-off-by: James Conway <148910373+jamesconwaydev@users.noreply.github.com>
Signed-off-by: James Conway <148910373+jamesconwaydev@users.noreply.github.com>
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.
A unit added with
systemctl link /opt/app/app.servicegets a symlink in/etc/systemd/system, and systemd reports that symlink asFragmentPath. I checked on the Rocky 10 test host:Since #144 the backup opens every file with
O_NOFOLLOW, sobackup_reloadfailed before the reload on every linked unit.This resolves the fragment and drop-in paths systemd reports, and only those. Policy
pathsstill refuse a symlink, and the final open still usesO_NOFOLLOW. Restore treats the resolved file like any file outside/etc/systemd/system: skipped if unchanged, and a refusal naming it if it changed.The new test fails on
mainand passes here. CHANGELOG anddocs/actions-and-safety.mdupdated.