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 1898694 - Add setgid capability into policy for tcsd
Summary: Add setgid capability into policy for tcsd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.4
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 8.4
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
: 1901984 (view as bug list)
Depends On:
Blocks: 1882414
TreeView+ depends on / blocked
 
Reported: 2020-11-17 20:43 UTC by Jerry Snitselaar
Modified: 2021-05-18 14:58 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 14:58:17 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jerry Snitselaar 2020-11-17 20:43:06 UTC
Description of problem: A fix for the tcsd daemon in the trousers package makes
use of setgid. While fixing a coverity scan complaint about checking the return value of setgid, I noticed that selinux didn't like tcsd trying to setgid.

Zdenek Pytela suggests that a setgid capability should be added after:

allow tcsd_t self:capability { dac_read_search dac_override setuid };

in contrib/tcsd.te

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Milos Malik 2020-11-20 16:13:02 UTC
Something is wrong on my RHEL-8.3 VM. The tcsd service won't start:

# ls -l /dev/tpm*
crw-rw----. 1 tss root  10,   224 Nov 20 17:07 /dev/tpm0
crw-rw----. 1 tss tss  253, 65536 Nov 20 17:07 /dev/tpmrm0
# ls -1Z /dev/tpm*
system_u:object_r:tpm_device_t:s0 /dev/tpm0
system_u:object_r:tpm_device_t:s0 /dev/tpmrm0
# service tcsd start
Redirecting to /bin/systemctl start tcsd.service
Job for tcsd.service failed because the control process exited with error code.
See "systemctl status tcsd.service" and "journalctl -xe" for details.
# service tcsd status
Redirecting to /bin/systemctl status tcsd.service
● tcsd.service - TCG Core Services Daemon
   Loaded: loaded (/usr/lib/systemd/system/tcsd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2020-11-20 17:09:39 CET; 2s ago
  Process: 3656 ExecStart=/sbin/tcsd (code=exited, status=30)

Nov 20 17:09:39 localhost.localdomain systemd[1]: Starting TCG Core Services Daemon...
Nov 20 17:09:39 localhost.localdomain tcsd[3656]: TCSD TDDL[3656]: TrouSerS ioctl: (25) Inappropriate ioctl for device
Nov 20 17:09:39 localhost.localdomain tcsd[3656]: TCSD TDDL[3656]: TrouSerS Falling back to Read/Write device support.
Nov 20 17:09:39 localhost.localdomain tcsd[3656]: TCSD TCS[3656]: TrouSerS ERROR: TCS GetCapability failed with result = 0x1e
Nov 20 17:09:39 localhost.localdomain systemd[1]: tcsd.service: Control process exited, code=exited status=30
Nov 20 17:09:39 localhost.localdomain systemd[1]: tcsd.service: Failed with result 'exit-code'.
Nov 20 17:09:39 localhost.localdomain systemd[1]: Failed to start TCG Core Services Daemon.
# 

No matter if SELinux is enforcing or permissive.

Comment 2 Jerry Snitselaar 2020-11-23 19:56:17 UTC
Hi Milos,

Can you verify that the VM has a TPM1.2 device and not a TPM2.0?

Comment 3 Jerry Snitselaar 2020-11-23 19:57:15 UTC
It should also be TIS and not CRB, which is only TPM2.0.

Comment 5 Zdenek Pytela 2020-11-30 20:14:03 UTC
*** Bug 1901984 has been marked as a duplicate of this bug. ***

Comment 9 Zdenek Pytela 2020-12-07 22:17:05 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/498

Comment 11 Zdenek Pytela 2020-12-09 23:37:03 UTC
This is the rawhide commit to backport:
commit 81c95e0d84bc442879302d905ac198f69732725a
Author: Zdenek Pytela <zpytela>
Date:   Mon Dec 7 23:15:06 2020 +0100

    Allow tcsd the setgid capability

    Resolves: rhbz#1898694

diff --git a/policy/modules/contrib/tcsd.te b/policy/modules/contrib/tcsd.te
index 285ef0874..d541406dc 100644
--- a/policy/modules/contrib/tcsd.te
+++ b/policy/modules/contrib/tcsd.te
@@ -20,7 +20,7 @@ files_type(tcsd_var_lib_t)
 # Local policy
 #

-allow tcsd_t self:capability { dac_read_search dac_override setuid };
+allow tcsd_t self:capability { dac_read_search dac_override setgid setuid };
 allow tcsd_t self:process { signal sigkill };
 allow tcsd_t self:tcp_socket { accept listen };

Comment 15 Zdenek Pytela 2021-01-07 07:38:30 UTC
The test fails as the service cannot start:

Jan  7 02:33:12 prereserve-1mt-rhel-8 systemd[1]: Starting TCG Core Services Daemon...
Jan  7 02:33:12 prereserve-1mt-rhel-8 journal[33623]: TCSD TDDL[33623]: TrouSerS ERROR: Could not find a device to open!
Jan  7 02:33:12 prereserve-1mt-rhel-8 systemd[1]: tcsd.service: Control process exited, code=exited status=137
Jan  7 02:33:12 prereserve-1mt-rhel-8 systemd[1]: tcsd.service: Failed with result 'exit-code'.
Jan  7 02:33:12 prereserve-1mt-rhel-8 systemd[1]: Failed to start TCG Core Services Daemon.

# rpm -q trousers selinux-policy
trousers-0.3.15-1.el8.x86_64
selinux-policy-3.14.3-59.el8.noarch

Comment 16 Milos Malik 2021-01-07 07:58:38 UTC
The tcsd service requires a special piece of HW, which was not available on the Beaker machines.

Comment 22 errata-xmlrpc 2021-05-18 14:58:17 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 (selinux-policy 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-2021:1639


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