selinux-policy: add confined CSI and log-reader support - #67
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure Linux selinux-policy SRPM to support confined AKS Backup and managed CSI sidecars when CRI SELinux confinement is enabled, primarily by extending container_t ↔ spc_t socket connectivity and adding narrowly-scoped read permissions for container_logreader_t.
Changes:
- Bump
selinux-policyspec release from 10 to 11 and add a corresponding changelog entry. - Add a policy rule allowing
container_ttoconnecttospc_tUnix stream sockets (for CSI sidecars → privileged driver). - Add targeted read-only sysctl/sysfs permissions for
container_logreader_t(Fluent Bit startup probes).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| acl/SPECS/selinux-policy/selinux-policy.spec | Bumps SRPM release to 11 and wires in the two new policy patches plus changelog. |
| acl/SPECS/selinux-policy/0062-container-Allow-default-containers-to-connect-to-SPC.patch | Grants container_t the connectto permission to spc_t Unix stream sockets to prevent CSI sidecar crash-loops under confinement. |
| acl/SPECS/selinux-policy/0063-container-Allow-log-reader-runtime-probes.patch | Grants container_logreader_t additional read-only access needed for Fluent Bit runtime probes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d4a64f3 to
6f75ec2
Compare
6f75ec2 to
23b1cff
Compare
23b1cff to
6953927
Compare
6953927 to
75f35a1
Compare
75f35a1 to
5272e2d
Compare
5272e2d to
cb966b3
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
SELinux policy changes (notably cross-domain socket connectto to spc_t) are security-sensitive and warrant final human review of the confinement boundary impact.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Add MCS-constrained domains for trusted CSI helpers and host-log collectors. Grant each only the validated access needed for its workflow. Signed-off-by: Sean Dougherty <sdougherty@microsoft.com>
cb966b3 to
8c4ac01
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
SELinux policy changes (notably cross-domain connectto into spc_t) are security-sensitive and should receive final human review despite no issues found in the diff.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7ebfef4
There was a problem hiding this comment.
🔵 Needs a closer look
SELinux policy changes (especially new domain creation and cross-domain connectto allowances) are security-sensitive and warrant final human review before approval.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
SELinux policy changes (new domain + privileged-domain connect rules) are security-sensitive and warrant final human review despite the changes appearing internally consistent.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Dismissing as feedback was incorporated
Summary
container_csi_sidecar_tdomain for trusted CSI helper containersconnecttorule plus the read-only sysfs/cgroup startup probes observed in live testingcontainer_logreader_tthe standard read-only sysctl/sysfs probes required by Fluent Bit startupselinux-policyto release 11No workload receives
spc_tcapabilities or unconfined attributes from this change.Why
With CRI SELinux confinement active, managed Azure Disk/File CSI drivers run in
spc_t, while registrar and liveness helpers need to call/csi/csi.sock. Adding a direct rule to allcontainer_tworkloads would weaken the boundary around every reachablespc_tstream server.container_csi_sidecar_tlimits the new source rule to explicitly selected, platform-managed CSI helpers. It remains MCS constrained and is neither privileged nor unconfined. Live testing found that the helper runtimes also read generic sysfs and cgroup files during startup, so the domain uses the standard read-only refpolicy interfaces for those probes.AKS Backup host-log collectors separately need
container_logreader_t. AVC-driven testing showed Fluent Bit performs additional read-only startup probes covered by standard refpolicy interfaces.Security boundary
spc_tis shared by privileged system containers, not only CSI drivers. MCS does not narrowcontainer_csi_sidecar_t -> spc_tbecausespc_tis not MCS constrained and normally runs ats0. Mount-namespace visibility, pathname permissions, and DAC still apply; use the type only for trusted platform CSI helpers with narrowly mounted socket directories.The log-reader domain intentionally does not receive
kubernetes_container_domain, whose policy includes management of runtime, log, and plugin files beyond a read-only collector requirement.Rollout dependency
Policy support must reach every applicable node before managed CSI manifests select
seLinuxOptions.type: container_csi_sidecar_t. Canary Disk/File registrar and liveness containers first. Do not bypass MCS with a static all-category level.Validation
git format-patch -U3; patches 1 through 63 replay with zero fuzz.eeaf3b79) plus ACL production hotfix/minimization; the result matched the node policy SHA-25698da0717...exactly.container_logreader_tandcontainer_csi_sidecar_t.container_csi_sidecar_twith runtime-assigned MCS categories; privileged drivers remainedspc_tcsi.sockinodes werecontainer_file_t:s0, so common container policy supplied directory search and socket-file write; no pathname-socket rule was neededsysfs_t:file readandcgroup_t:file read; Patch62 now usesdev_read_sysfs()andfs_read_cgroup_files()container_csi_sidecar_tAVCs and zero container restartscontainer_t -> spc_t:unix_stream_socket connecttoAVCs, registrar crash-loop, and loss of File CSINode registration; selecting the dedicated type restored itspc_tbecause this older image separately denies ordinarycontainer_twrites tocifs_t)