Skip to content

Fix permissions for systemd-journal.plugin on offline installs#21953

Merged
stelfrag merged 6 commits intonetdata:masterfrom
ralphm:systemd-journal.plugin-permissions
Mar 17, 2026
Merged

Fix permissions for systemd-journal.plugin on offline installs#21953
stelfrag merged 6 commits intonetdata:masterfrom
ralphm:systemd-journal.plugin-permissions

Conversation

@ralphm
Copy link
Member

@ralphm ralphm commented Mar 16, 2026

Summary by cubic

Ensure systemd-journal.plugin gets correct ownership and permissions on offline installs. Tries setcap before SUID and skips changes when the plugin is absent to prevent journal read errors.

  • Bug Fixes
    • In packaging/makeself/install-or-update.sh, include systemd-journal.plugin in ownership/permission handling; try setcap cap_dac_read_search=eip with chmod 4750 fallback, all guarded by -f checks.

Written for commit 0b268bc. Summary will update on new commits.

@ralphm ralphm requested a review from a team as a code owner March 16, 2026 12:17
@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Mar 16, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 3/5

  • There is a concrete medium-risk issue in packaging/makeself/install-or-update.sh: systemd-journal.plugin is being forced to setuid-root (4750) even when setcap is available.
  • Because this affects privilege handling and is reported with high confidence, it raises regression/security risk enough to warrant a moderate merge-risk score.
  • This likely has a straightforward fix (move systemd-journal.plugin into the capability path), so risk should drop quickly once adjusted.
  • Pay close attention to packaging/makeself/install-or-update.sh - avoid unnecessary setuid-root fallback when capabilities can be used.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packaging/makeself/install-or-update.sh">

<violation number="1" location="packaging/makeself/install-or-update.sh:227">
P2: This makes `systemd-journal.plugin` setuid-root even when `setcap` is available; add it to the capability branch instead of the unconditional 4750 fallback.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packaging/makeself/install-or-update.sh">

<violation number="1" location="packaging/makeself/install-or-update.sh:217">
P2: Reset the plugin mode to `0750` before `setcap`; otherwise successful upgrades can leave `systemd-journal.plugin` setuid-root even when file capabilities are available.</violation>

<violation number="2" location="packaging/makeself/install-or-update.sh:217">
P1: Guard the new `systemd-journal.plugin` permission changes with `[ -f ]`; disabled makeself builds will otherwise fail the offline installer.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@stelfrag stelfrag requested a review from Copilot March 16, 2026 14:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fi
fi
if [ -f "usr/libexec/netdata/plugins.d/systemd-journal.plugin" ]; then
if ! run setcap "cap_dac_read_search=epi" "usr/libexec/netdata/plugins.d/systemd-journal.plugin"; then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eip is consistent with the packaged cap flags. Changed the order in the follow-up commit.

fi
if [ -f "usr/libexec/netdata/plugins.d/systemd-journal.plugin" ]; then
if ! run setcap "cap_dac_read_search=epi" "usr/libexec/netdata/plugins.d/systemd-journal.plugin"; then
run chmod 4750 "usr/libexec/netdata/plugins.d/systemd-journal.plugin"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. This is part of an install that overwrites the target files from the archive, therefor resetting any prior permissions.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

run chmod 4750 "usr/libexec/netdata/plugins.d/otel-signal-viewer-plugin"
fi
fi
if [ -f "usr/libexec/netdata/plugins.d/systemd-journal.plugin" ]; then
@ralphm
Copy link
Member Author

ralphm commented Mar 16, 2026

@stelfrag I can't seem to convince Copilot this last thing is needed without providing explicit instructions for this repo.

@stelfrag stelfrag merged commit aa77c3a into netdata:master Mar 17, 2026
192 of 193 checks passed
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Mar 17, 2026
…ta#21953)

* Fix permissions for systemd-journal.plugin on offline installs

* Try setcap before suid

* systemd-journal.plugin is optional

* systemd-journal.plugin is optional for the fallback, too

* Use customary order of cap flags

(cherry picked from commit aa77c3a)
@stelfrag stelfrag mentioned this pull request Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants