RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2138102 - [RFE] Allow containers to write to "container_log_t" - for log processing apps
Summary: [RFE] Allow containers to write to "container_log_t" - for log processing apps
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: container-selinux
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jindrich Novy
QA Contact: Edward Shen
URL:
Whiteboard:
Depends On:
Blocks: 1782128 2093956
TreeView+ depends on / blocked
 
Reported: 2022-10-27 09:08 UTC by Kashyap Chamarthy
Modified: 2023-05-09 08:27 UTC (History)
6 users (show)

Fixed In Version: container-selinux-2.193.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:33:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-137714 0 None None None 2022-10-27 09:23:25 UTC
Red Hat Product Errata RHBA-2023:2206 0 None None None 2023-05-09 07:34:18 UTC

Description Kashyap Chamarthy 2022-10-27 09:08:41 UTC
[This is a bug based on a suggestion by Dan Walsh in an email thread. For detailed context, please see this bug: https://bugzilla.redhat.com/show_bug.cgi?id=2093956 — 'swtpm' binary is denied write/"append" permissions to log files under /var/log/swtpm/]

Description
-----------

In short, from an  RHEL-9 container, '/usr/bin/swtpm' is currently unable to write to log files under /var/log/swtpm/ directory.                                                                                                                                                                  

Currently files under /var/log/swtpm/ get the label 'container_ro_file_t' — i.e. they're unable to write.

Dan Walsh suggested an addition to allow containers to read/write to "container_log_t", and "define it as a log file, so that log processing apps can use it."

Comment 2 Daniel Walsh 2022-10-27 11:02:16 UTC
I think we should just leave content on the host labeled as a logfile, and not make it specific to a container.

matchpathcon  /var/log/swtpm/
/var/log/swtpm	system_u:object_r:var_log_t:s0

Then either disable the SELinux separation for the container with 
podman run --security-opt label=disable ...

Or if running in Kubernetes use
type: spc_t.

If we really need to confine this container, then I could add a new type container_logwriter_t and then we could run this container with that type.

We currently have container_logreader_t.  Container_logwriter_t would be allowed to write to any file under /var/log (Types with attribute logfile)

Comment 3 Bogdan Dobrelya 2022-10-28 12:55:58 UTC
> Then either disable the SELinux separation for the container with 
podman run --security-opt label=disable ...

Just to not that for Tripleo/OSP that would require containerized logrotate, libvirt and may be more containers to run with --security-opt label=disable.
I'm not sure if that'd be a nice move, so my vote goes for the 2nd option.

Comment 4 Daniel Walsh 2022-10-28 14:15:12 UTC
https://github.com/containers/container-selinux/releases/tag/v2.191.0 adds container_logwriter_t.

Comment 9 errata-xmlrpc 2023-05-09 07:33:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (container-selinux bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2206


Note You need to log in before you can comment on or make changes to this bug.