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 1874527 - /var/tmp/krb5_0.rcache2 is created with a wrong selinux context when krb5-API is used
Summary: /var/tmp/krb5_0.rcache2 is created with a wrong selinux context when krb5-API...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.3
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 8.4
Assignee: Patrik Koncity
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-01 14:40 UTC by Filip Dvorak
Modified: 2021-05-18 14:58 UTC (History)
6 users (show)

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


Attachments (Terms of Use)

Description Filip Dvorak 2020-09-01 14:40:15 UTC
Description of problem:
The script (rctest [1]) in the TCMS test [2] uses krb5-API (krb5_mk_req_extended) to create several authentication requests (AS_REQ and TGS_REQ messages) and then to check if the replay cache has been created. The problem is that the replay cache /var/tmp/krb5_0.rcache2 has a wrong security context.
 
[1]http://pkgs.devel.redhat.com/cgit/tests/krb5/tree/Regression/regression-test-suite/testcases/bz714188-host_0-wrong-selinux-context.sh
[2]http://pkgs.devel.redhat.com/cgit/tests/krb5/tree/Regression/regression-test-suite

Version-Release number of selected component (if applicable):
RHEL 8.3
krb5-1.18.2-5.el8
selinux-policy-3.14.3-53.el8

How reproducible:
always

Steps to Reproduce:
1.Configure krb5 with some user and service principal
$krb5conf="/etc/krb5.conf"
$krb5REALM="TEST.REDHAT.COM"
$krb5kdcconf="/var/kerberos/krb5kdc/kdc.conf"

sed -i "s/\[libdefaults\]/[libdefaults]\n default_realm = $krb5REALM/" $krb5conf
sed -i "s/\[realms\]/[realms]\n $krb5REALM = {\n  kdc = $hostname \n  admin_server = $hostname\n }/" $krb5conf
sed -i "s/\[domain_realm\]/[domain_realm]\n .$(hostname -d) = $krb5REALM\n $(hostname -d) = $krb5REALM/" $krb5conf
sed -i 's/EXAMPLE.COM/$krb5REALM/' $krb5kdcconf
sed -i 's/*\/admin@EXAMPLE\.COM/krb5user@$krb5REALM/' /var/kerberos/krb5kdc/kadm5.acl

kdb5_util create -s -P $Passwd
systemctl start kadmin krb5kdc
kadmin.local -q "addprinc -pw Passwd krb5user
kadmin.local -q "addprinc -randkey host/$(hostname)"
kadmin.local -q "ktadd host/$(hostname)"

2. compile script [1]
   gcc -o rctest rctest.c `krb5-config --cflags --libs`

3. 
kinit krb5user
./rctest host/$(hostname)@$krb5REALM

Actual results:
# ll -Z  /var/tmp/krb5_0.rcache2 
-rw-------. 1 root root unconfined_u:object_r:user_tmp_t:s0 16368 Sep  1 10:12 /var/tmp/krb5_0.rcache2

Expected results:
ll -Z  /var/tmp/krb5_0.rcache2 
-rw-------. 1 root root unconfined_u:object_r:krb5_host_rcache_t:s0 16368 Sep  1 10:12 /var/tmp/krb5_0.rcache2

Comment 1 Zdenek Pytela 2020-09-01 15:22:36 UTC
Filipe,

Could you please attach avc.log?

Comment 3 Zdenek Pytela 2020-09-03 10:56:23 UTC
Filipe,

I haven't managed to find any AVCs in the logs, neither I succeeded with the reproducer steps.

I'd like to get some additional information:
- who is the user running the step 3 commands:
  $ id
- what is the context of the executable:
  $ ls -lZ rctest
- if the test is close to some real scenario or what are the conditions to trigger this issue.

Comment 7 Patrik Koncity 2021-02-05 08:14:28 UTC
PR: https://github.com/fedora-selinux/selinux-policy/pull/562

Comment 19 errata-xmlrpc 2021-05-18 14:57:54 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.