Skip to content

Conversation

@haircommander
Copy link
Member

the intent of hostmount-anyuid is to allow a pod access to paths on the host. The problem is, hostPath volumes aren't selinux relabeled, and there are paths that the default selinux type container_t cannot access.

This breaks expectation, and makes pods that rely on hostmount-anyuid brittle to selinux changes on the host (see https://issues.redhat.com/browse/OCPBUGS-55013)

Instead of relaxing permissions of all paths on the host, or increasing the ability of container_t, we should trust pods that are granted access to this already powerful SCC to use its power fully.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 28, 2025
@openshift-ci-robot
Copy link

@haircommander: This pull request references Jira Issue OCPBUGS-55013, which is invalid:

  • expected the bug to target the "4.19.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

the intent of hostmount-anyuid is to allow a pod access to paths on the host. The problem is, hostPath volumes aren't selinux relabeled, and there are paths that the default selinux type container_t cannot access.

This breaks expectation, and makes pods that rely on hostmount-anyuid brittle to selinux changes on the host (see https://issues.redhat.com/browse/OCPBUGS-55013)

Instead of relaxing permissions of all paths on the host, or increasing the ability of container_t, we should trust pods that are granted access to this already powerful SCC to use its power fully.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from sanchezl and vrutkovs April 28, 2025 19:43
@haircommander
Copy link
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Apr 28, 2025
@openshift-ci-robot
Copy link

@haircommander: This pull request references Jira Issue OCPBUGS-55013, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.0) matches configured target version for branch (4.19.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sergiordlr

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Apr 28, 2025
@openshift-ci openshift-ci bot requested a review from sergiordlr April 28, 2025 19:43
restricted SCC but allows host mounts any UID, and any SELinux label by a pod. This is primarily
used by the persistent volume recycler. WARNING: this SCC allows host file
system access as any UID, including UID 0. Grant with caution.
name: hostmount-anyuid
Copy link
Member

Choose a reason for hiding this comment

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

Hey @haircommander , thanks for the quick follow up! Should this be

Suggested change
name: hostmount-anyuid
name: hostmount-anyuid-v2

?

cc @lwan-wanglin

Copy link
Member Author

Choose a reason for hiding this comment

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

absolutely good catch

@vrutkovs
Copy link
Contributor

/cc @ibihim

@openshift-ci openshift-ci bot requested a review from ibihim April 29, 2025 11:00
@haircommander
Copy link
Member Author

/retest

1 similar comment
@haircommander
Copy link
Member Author

/retest

hostmount-anyuid-v2 provides all the features of the
restricted SCC but allows host mounts any UID, and any SELinux label by a pod. This is primarily
used by the persistent volume recycler. WARNING: this SCC allows host file
system access as any UID, including UID 0. Grant with caution.
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, in good practice of the v2s, we should mention that we are by-passing SELinux context as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is captured with and any SELinux label by a pod

Comment on lines 37 to 38
users:
- system:serviceaccount:openshift-infra:pv-recycler-controller
Copy link
Contributor

@sjenning sjenning May 14, 2025

Choose a reason for hiding this comment

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

we are moving away from specifying subjects directly in the SCC and it seems that pv-recycler-controller works just fine with with old SCC, so let start out clean in v2.

supplementalGroups:
type: RunAsAny
users:
- system:serviceaccount:openshift-infra:pv-recycler-controller
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious if we can drop this.

the intent of hostmount-anyuid is to allow a pod access to paths on the host.
The problem is, hostPath volumes aren't selinux relabeled, and there
are paths that the default selinux type `container_t` cannot access.

This breaks expectation, and makes pods that rely on hostmount-anyuid brittle to
selinux changes on the host (see https://issues.redhat.com/browse/OCPBUGS-55013)

Instead of relaxing permissions of all paths on the host, or increasing the
ability of container_t, we should trust pods that are granted access to this already powerful
SCC to use its power fully.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
@haircommander haircommander force-pushed the hostmount-anyuid-v2 branch from e72e1d5 to 8ecdca3 Compare May 14, 2025 14:54
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 14, 2025

@haircommander: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-operator-single-node 8ecdca3 link false /test e2e-gcp-operator-single-node
ci/prow/e2e-aws-ovn-single-node 8ecdca3 link false /test e2e-aws-ovn-single-node
ci/prow/e2e-aws-operator-disruptive-single-node 8ecdca3 link false /test e2e-aws-operator-disruptive-single-node

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link

@ibihim-unsafe ibihim-unsafe left a comment

Choose a reason for hiding this comment

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

Looks good. Please create a PR for e2e tests as well.

Copy link
Contributor

@ibihim ibihim left a comment

Choose a reason for hiding this comment

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

Looks good. Please create a PR for e2e tests as well.

@Prashanth684
Copy link

thanks @ibihim . @vrutkovs could you approve please?

@vrutkovs
Copy link
Contributor

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 15, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 15, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, ibihim-unsafe, vrutkovs

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:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 438e1f6 into openshift:main May 15, 2025
14 of 17 checks passed
@openshift-ci-robot
Copy link

@haircommander: Jira Issue OCPBUGS-55013: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-55013 has been moved to the MODIFIED state.

In response to this:

the intent of hostmount-anyuid is to allow a pod access to paths on the host. The problem is, hostPath volumes aren't selinux relabeled, and there are paths that the default selinux type container_t cannot access.

This breaks expectation, and makes pods that rely on hostmount-anyuid brittle to selinux changes on the host (see https://issues.redhat.com/browse/OCPBUGS-55013)

Instead of relaxing permissions of all paths on the host, or increasing the ability of container_t, we should trust pods that are granted access to this already powerful SCC to use its power fully.

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 openshift-eng/jira-lifecycle-plugin repository.

@Prashanth684
Copy link

/cherry-pick release-4.19

@openshift-cherrypick-robot

@Prashanth684: new pull request created: #1844

In response to this:

/cherry-pick release-4.19

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.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-cluster-kube-apiserver-operator
This PR has been included in build ose-cluster-kube-apiserver-operator-container-v4.20.0-202505151814.p0.g438e1f6.assembly.stream.el9.
All builds following this will include this PR.

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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants