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

Add a flag in ApparmorProfile CRD to switch to switch the profile into complain mode #2598

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

ccojocar
Copy link
Contributor

@ccojocar ccojocar commented Dec 4, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a flag into ApparmorProfile CRD which allows to switch the profile mode from enfoce mode to complain mode.

It the current implementation the Profile Mode flag is not specified in the apparmor profile file, which
places the profile by default into enforce mode. In this mode if a profile action is not allowed in the rules,
it will automatically terminate the container execution with an error. This is the expected behavior when running
productively but sometimes during the development is useful to put the profile in complain mode. In this mode,
if the profile rules don't grant permissions to an action, that action will be allowed, but the violation will
be logged with a tag of ALLOWED unconfined.

Which issue(s) this PR fixes:

Fixes #2559

Does this PR have test?

Yes

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add the complainMode flag into the ApparmorProfile CRD which allows to switch the apparmor profile into complain mode.

cc @mhils

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. 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. labels Dec 4, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 4, 2024
@ccojocar ccojocar removed the request for review from Vincent056 December 4, 2024 12:18
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2024
@saschagrunert
Copy link
Member

@ccojocar you'd have to rebase to fix the macos CI.

This falg will place the apparmor profile into compalin mode, otherwise
it defaults to enforce mode.

In complain mode, if a given action is not allowed, it will be allowed,
but this violation will be logged with a tag of access being "ALLOWED
unconfined".

Change-Id: I597883a528edf60f05f1cb7914429b3c5b05b2cd
Signed-off-by: Cosmin Cojocar <[email protected]>
Change-Id: Id5272f5ba5b6858e3d620718964e4798f75bec6d
Signed-off-by: Cosmin Cojocar <[email protected]>
… the generate profile

Change-Id: If59b953c69e48e68b2bb56198567342ca9483170
Signed-off-by: Cosmin Cojocar <[email protected]>
Change-Id: I8a676faa5ccfbfe409905c5d10ade66a591e542d
Signed-off-by: Cosmin Cojocar <[email protected]>
Change-Id: Idd9ac0c6d409293f905df44df974646f0c48b3fb
Signed-off-by: Cosmin Cojocar <[email protected]>
Change-Id: I61832a638e8c17cc14175841c8e0d2e3e97bb2ab
Signed-off-by: Cosmin Cojocar <[email protected]>
@ccojocar ccojocar force-pushed the apparmor-profile-mode-complain branch from 9fe95df to 285f6e2 Compare December 4, 2024 12:35
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2024
Change-Id: I2c79838716ddac5a2a0a8f79902599ae590f55b3
Signed-off-by: Cosmin Cojocar <[email protected]>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ccojocar, 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 c20c5ea into main Dec 4, 2024
28 checks passed
@k8s-ci-robot k8s-ci-robot deleted the apparmor-profile-mode-complain branch December 4, 2024 13:35
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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Extend the AppArmor CRD with a profile flag which should allow to switch the profile mode
3 participants