-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CORE-11535: Fix svlogd rotated log files permissions #10590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
CORE-11535: Fix svlogd rotated log files permissions #10590
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the node/Dockerfile.amd64
build step to patch svlogd.c
so that rotated log files use 0644
permissions instead of 0744
, removing the execute bit from log files.
- Added inline
sed
commands to replace0744
with0644
at three locations insrc/svlogd.c
. - Ensures rotated logs are readable but not executable.
Comments suppressed due to low confidence (1)
node/Dockerfile.amd64:79
- Consider adding a CI step or unit/integration test that verifies the file mode of rotated logs is
0644
, so future changes can't inadvertently revert this permission fix.
sed -i '208s/0744/0644/' src/svlogd.c && sed -i '285s/0744/0644/' src/svlogd.c && sed -i '375s/0744/0644/' src/svlogd.c && \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have a single comment about thinking ahead to a scenario where we want to update the version of runit that we use.
In that situation, how will applying direct patch for svlogd
affect the update?
# Copy the patch that adjusts svlogd log file permissions from 0744 to 0644. | ||
# This file is used in the next step to apply the patch during the build process. | ||
COPY patches/svlogd_use_0644_permission_instead_of_0744.patch /svlogd_use_0644_permission_instead_of_0744.patch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any concerns around us applying this patch directly ourselves, in case in the future we update the version of runit that we download and use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
If svlogd.c changes in a newer runit version, the patch might fail to apply — but that will be immediately caught during the build, since the patch step will fail right after we bump the version.
In that case, we’ll just need to update the patch. The change is minimal (just replacing 0744 with 0644), so adjusting it should be quick and straightforward.
Description
📝 Summary
This PR addresses an issue where
svlogd
creates rotated log files with0744
permissions, making them executable. Executable permissions on log files are unnecessary and potentially insecure. This fix modifiessvlogd.c
to use0644
instead, ensuring log files are readable but not executable.🐞 Initial Problem
In the
calico/node
container, rotated log files under/var/log/calico/***
were being created with permissions-rwxr--r-- (0744)
. These permissions are overly permissive for logs, which should not be executable.🔗 Jira
https://tigera.atlassian.net/browse/CI-1790
🛠️ Fix Details
This PR applies a patch (
svlogd_use_0644_permission_instead_of_0744.patch
) tosvlogd.c
during the Docker image build process. This change ensures more secure file permissions for rotated log files.The patch has been integrated for only two out of four platforms:
Here is ticket to track missing fix for
ppc64le
ands390x
platforms: https://tigera.atlassian.net/browse/CORE-11592🧪 Testing
amd64
andarm64
platforms.📦 Components Affected
calico/node
Docker image build processReminder for the reviewer
Make sure that this PR has the correct labels and milestone set.
Every PR needs one
docs-*
label.docs-pr-required
: This change requires a change to the documentation that has not been completed yet.docs-completed
: This change has all necessary documentation completed.docs-not-required
: This change has no user-facing impact and requires no docs.Every PR needs one
release-note-*
label.release-note-required
: This PR has user-facing changes. Most PRs should have this label.release-note-not-required
: This PR has no user-facing changes.Other optional labels:
cherry-pick-candidate
: This PR should be cherry-picked to an earlier release. For bug fixes only.needs-operator-pr
: This PR is related to install and requires a corresponding change to the operator.