selinux-policy: complete container log reader support - #59
Conversation
There was a problem hiding this comment.
Pull request overview
Narrows the SELinux container_logreader_t domain so it no longer has access to host audit logs, and adds documentation describing ACL’s container SELinux domain choices and safe configuration patterns.
Changes:
- Bumps
selinux-policyrelease to2.20250213-10and adds patch0061to removecontainer_logreader_taudit-log access. - Adds a new SELinux container-domain guide (
acl/docs/selinux.md) and links it from the docs index and architecture guide.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| acl/SPECS/selinux-policy/selinux-policy.spec | Bumps RPM release and wires in the new refpolicy patch removing audit-log read for container_logreader_t. |
| acl/SPECS/selinux-policy/0061-container-Drop-audit-log-access-from-log-reader.patch | Drops logging_read_audit_log(container_logreader_t) from the container module policy. |
| acl/docs/selinux.md | Adds guidance on SELinux container workload domains, log-reader boundaries, MCS isolation, and usage examples. |
| acl/docs/README.md | Adds the SELinux doc to the documentation index. |
| acl/docs/architecture.md | Links to the new SELinux container domains guide from the architecture doc. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
acl/docs/selinux.md:112
- In the validation snippet, the single quotes around the
--filepath prevent shell glob expansion (*), sojournalctlwill receive a literal*and the command will typically fail to open the journal file. Use an unquoted glob (or otherwise expand it) so the machine-id directory is matched.
journalctl --file='/host/var/log/journal/*/system.journal' -n 5
|
Opened stacked docs-only follow-up #60 with the comprehensive customer-facing SELinux container-domain reference. It inventories all five compiled workload domains, distinguishes internal engine/file types, compares privilege and MCS boundaries, and guides teams toward narrow domains instead of blanket |
CRI SELinux validationThe exact ACL gallery image used for validation (
The earlier focused test manually supplied an OCI label through The reviewer is also right that this is not a universal AKS default: generic AgentBaker containerd templates omit |
|
Could we add some basic validation into a smoke test or preferably a kola test? Fine for a follow up, but if not right away, please create a task to track. |
|
Tracking the requested automated smoke/Kola coverage in AB#23492. The unassigned Cyc5 task covers the real containerd CRI |
Remove access to auditd_log_t from container_logreader_t because audit logs contain host-wide security events outside the general log collector use case. Document specialized container domains, selection examples, MCS behavior, and audit-log exclusion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sean Dougherty <sdougherty@microsoft.com>
Document the actual watch and audit boundaries on ACL, replace validation commands with stock journald equivalents, and grant read-only mmap access required by journalctl for persistent systemd journals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sean Dougherty <sdougherty@microsoft.com>
Retain the audit-log read semantics established by container-selinux so compatible collectors do not need spc_t, collapse the package to one release bump, and make sensitive audit mounts explicit. Keep the read-only journal mmap addition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sean Dougherty <sdougherty@microsoft.com>
cb3ab17 to
0917cb1
Compare
State that ACL enables enforcing mode by default while allowing permissive troubleshooting, and direct operators to getenforce for the effective node state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sean Dougherty <sdougherty@microsoft.com>
51a7208
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
acl/docs/selinux.md:15
- Grammar: “an SELinux” is incorrect here because “SELinux” is typically pronounced with an initial consonant sound (“sell…”). Use “a SELinux”.
| `container_logreader_t` | Opt-in log collector | Read-only access to objects labeled with an SELinux log type |
Jiri Appl (jiria)
left a comment
There was a problem hiding this comment.
Reviewed the policy change against upstream SELinuxProject/refpolicy at tag RELEASE_2_20250213. The patch is correct, minimal, and does exactly what the commit message claims — approving.
Verification notes:
systemd_read_journal_files()callsmmap_read_files_pattern, andmmap_read_file_perms = { getattr open map read ioctl }, somapis genuinely granted. Read/list onsystemd_journal_twas already covered attribute-wide by0060'slogging_read_all_logs(systemd.tecallslogging_log_file(systemd_journal_t)), so this patch is strictly additive formap. No write, no watch, no over-grant.- The
optional_policy()wrapper and its placement match howcontainer.tealready wraps its other systemd interface calls. - Retaining
logging_read_audit_log()is not redundant, as the description says:auditd_log_tis declared withfiles_security_file()and carries nologfileattribute, sologging_read_all_logsdoesn't reach it. - Spec hygiene checks out: single
Releasebump, one changelog entry, weekdays correct, and%autosetup -p1means no%patch -P 61line is needed. - All four documented domains exist in refpolicy
container.te, including thespc_t"may be unconfined" caveat (unconfined_domain_noaudit(spc_t)). journalctl --file='...*/system.journal'— the quoting is correct,journalctlglob-expands--file=itself.
I've also retracted my earlier mls_systemhigh comment above; the doc's MCS section is right and I was wrong.
The four comments below are all documentation suggestions, none blocking. Three of them share a theme worth noting: there are several ways a collector can fail here with no AVC (dontaudit'd map on audit files, DAC on the journal), while the doc's troubleshooting step looks only for AVCs. Happy for those to be follow-ups.
Nice work — the policy delta is exactly as small as it should be.
Summary
Complete the confined
container_logreader_tsupport added in #56: retain the cross-distro audit-read semantics established bycontainers/container-selinux, add read-only mmap access required by systemd journal readers, and document safe mount and MCS behavior.Change Log
systemd_read_journal_files()access sojournalctl --filecan map persistent journals; no journal write or watch permission is added.logging_read_audit_log(container_logreader_t)to match Fedora/RHEL/OpenSUSEcontainer-selinuxbehavior and avoid pushing compatible collectors tospc_t.selinux-policyonce from2.20250213-9to2.20250213-10.Type of Change
Does this affect the image build?
Associated Issues
Test Methodology
selinux-policy-2.20250213-10.azl3.noarch.rpm.container_logreader_tremainsmcs_constrained_type.containers/container-selinux, which includeslogging_read_audit_log(container_logreader_t).Merge Checklist
Azure Boards: AB#23415
Automated validation follow-up: AB#23492