-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Fedora and RHEL use etc_t and the convention is <type_name>_t #7891
Fedora and RHEL use etc_t and the convention is <type_name>_t #7891
Conversation
Hi @cristicalin. 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 Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
7a55b51
to
6a4ffd7
Compare
@@ -17,7 +17,7 @@ | |||
template: | |||
src: "kubelet.env.{{ kubeletConfig_api_version }}.j2" | |||
dest: "{{ kube_config_dir }}/kubelet.env" | |||
setype: "{{ (preinstall_selinux_state == 'enforcing') | ternary('t_etc', omit) }}" | |||
setype: "{{ (preinstall_selinux_state == 'enforcing') | ternary('etc_t', omit) }}" |
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.
You should also set the correct type in permissive mode
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 idea, I changed the condition to != 'disabled'
.
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.
This is now needed to fix current deployments, but I'm wondering why it was introduced in the first place
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.
https://bugzilla.redhat.com/show_bug.cgi?id=1957840 may shed some light.
systemd
runs as init_t
domain and it is not allowed to read kubernetes_files_t
which was recently introduced in Fedora 33/RHEL8.4. The fix was to allow init_t
access to kubernetes_files_t
but apparently the fix is still not working properly. Because of this we proactively change the context of /etc/kubernetes/kubelet.env
to etc_t
to allow systemd to read it and apply the environment to the kubelet service.
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.
/cc @spaced since you authored the initial change can you help with some extra context?
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.
yes, the != disabled
is much better.
and sorry, fucked up with etc_t
(our fork has the right value and i did no retest with upstream, shame on me)
I introduced the change because we use enforcing
forehand even kubespray does not really support it:
preinstall_selinux_state - Set selinux state, permitted values are permissive and disabled.
however we do not have any other issues except this.
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.
@spaced what OS are you using ? And what does your stack look like (containerd / calico / rook / ... ?)
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.
@champtar: fedora CoreOS, cri-o and calico
74a9f2a
to
be8626a
Compare
be8626a
to
3e85606
Compare
@cristicalin: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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/test-infra repository. |
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.
/ok-to-test
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cristicalin, floryut, spaced 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 |
…etes-sigs#7891) * Fedora and RHEL use etc_t and the convention is <type_name>_t * Docs: specify all values for preinstall_selinux_state * CI: Add Fedora 34 with SELinux in enforcing mode
…etes-sigs#7891) * Fedora and RHEL use etc_t and the convention is <type_name>_t * Docs: specify all values for preinstall_selinux_state * CI: Add Fedora 34 with SELinux in enforcing mode
What type of PR is this?
/kind bug
What this PR does / why we need it:
In #7791 the SELinux file context type for
/etc/kubernetes/kubelet.env
was incorrectly set tot_etc
. The convention and implementation of the type in Fedora, RHEL and derivatives isetc_t
. This PR sets the proper file type so that systemd can load the environment file.Which issue(s) this PR fixes:
Fixes #7790
Special notes for your reviewer:
This PR adds a CI job with
preinstall_selinux_state
set to enforcing on latest CentOS/Alma/Fedora to catch SELinux errors. Our default ispermissive
which is not something most people use in production.Does this PR introduce a user-facing change?: