Skip to content
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

fix apparmor profile for spod #2696

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

mhils
Copy link
Contributor

@mhils mhils commented Jan 24, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR fixes the apparmor profile for the bpf recorder itself so that recording works again after #2646. The template injection hack is not meant to be a permanent solution, but a temporary stopgap to make things work without reverts.

Most of the missing permissions were found looking at journalctl, but for / AppArmor did not emit any DENIED messages despite actually denying permissions. This is a bit worrying in general, but what to do.

Which issue(s) this PR fixes:

None

Does this PR have test?

N/A

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Jan 24, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 24, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @mhils. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.91%. Comparing base (11d77f4) to head (7099590).
Report is 667 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2696      +/-   ##
==========================================
- Coverage   45.50%   40.91%   -4.59%     
==========================================
  Files          79      109      +30     
  Lines        7782    18724   +10942     
==========================================
+ Hits         3541     7661    +4120     
- Misses       4099    10546    +6447     
- Partials      142      517     +375     

@saschagrunert
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 27, 2025
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 27, 2025
@ccojocar
Copy link
Contributor

The ptrace stuff is requried in addition to #2691. Did we find out what introduced the ptrace thingy? I think was not required before.

@ccojocar
Copy link
Contributor

@mhils this one needs a rebase.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 27, 2025
the template injection hack is not meant to be a permanent solution, but a temporary stopgap to make things work without reverts
@mhils mhils force-pushed the spo-apparmorprofile branch from a274eca to 7099590 Compare January 27, 2025 10:38
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 27, 2025
@mhils
Copy link
Contributor Author

mhils commented Jan 27, 2025

Did we find out what introduced the ptrace thingy? I think was not required before.

Based on https://gitlab.com/apparmor/apparmor/-/wikis/TechnicalDoc_Proc_and_ptrace#list-of-proc-files-that-may-cause-ptrace-trace-requests, AppArmor wants ptrace permissions if /proc/<pid>/ns/ is read. So the ptrace permission is not only about a ptrace() syscall, but also for certain file access.

/proc/1/ns is read by go-apparmor here: https://github.com/pjbgf/go-apparmor/blob/1375e5e7aa892edd0ad2a1cebef2297ac2e3872d/pkg/hostop/mount_linux.go#L86. So my explanation for why this did not show up before is that the previous cluster where we recorded the profile did not have apparmor recording enabled.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 27, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ccojocar, mhils, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [ccojocar,saschagrunert]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 82e1587 into kubernetes-sigs:main Jan 27, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants