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 1873211 - fsetid capability required by certmonger
Summary: fsetid capability required by certmonger
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: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
: 1909482 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-27 15:55 UTC by Kaleem
Modified: 2021-05-18 14:58 UTC (History)
7 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 Kaleem 2020-08-27 15:55:39 UTC
Description of problem:

This is a follow up bugzilla for a different avc seen in verification of bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1870596#c0 .
Scenario mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1870596#c0 works fine but following avc seen

[root@master ~]# ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today
----
type=PROCTITLE msg=audit(08/27/2020 04:19:36.297:4619) : proctitle=/usr/sbin/certmonger -S -p /var/run/certmonger.pid -n -d2 
type=PATH msg=audit(08/27/2020 04:19:36.297:4619) : item=0 name=(null) inode=17561161 dev=fc:03 mode=file,600 ouid=postfix ogid=postfix rdev=00:00 obj=system_u:object_r:cert_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=SYSCALL msg=audit(08/27/2020 04:19:36.297:4619) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x7f a1=0600 a2=0x5631d916db20 a3=0xd items=1 ppid=40956 pid=46309 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=certmonger exe=/usr/sbin/certmonger subj=system_u:system_r:certmonger_t:s0 key=(null) 
type=AVC msg=audit(08/27/2020 04:19:36.297:4619) : avc:  denied  { fsetid } for  pid=46309 comm=certmonger capability=fsetid  scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:certmonger_t:s0 tclass=capability permissive=1 
[root@master ~]#


Version-Release number of selected component (if applicable):
[root@master ~]# rpm -q selinux-policy
selinux-policy-3.14.3-53.el8.noarch
[root@master ~]# 

How reproducible:
Always

Steps to Reproduce:
1. Same as mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1870596#c0

Actual results:
AVC denial seen

Expected results:
No AVC denial is seen.

Comment 1 Zdenek Pytela 2020-08-27 16:06:15 UTC
Kaleem,

The path is not a part of the audit record; do you happen to know which file the fchmod syscall applies to?

The inode= part can be used together with dev= like

  # find /path -inum INUM

>> owner/group/permission all seems to ok for both cert/key files.
Is this statement valid when the test runs in SELinux enforcing mode?

Comment 2 Kaleem 2020-09-03 12:22:53 UTC
(In reply to Zdenek Pytela from comment #1)
> Kaleem,
> 
> The path is not a part of the audit record; do you happen to know which file
> the fchmod syscall applies to?
I think it applies to /etc/pki/tls/private/postfix.key
> 
> The inode= part can be used together with dev= like
> 
>   # find /path -inum INUM
> 
> >> owner/group/permission all seems to ok for both cert/key files.
> Is this statement valid when the test runs in SELinux enforcing mode?

yes its valid in enforcing mode but type=PATH is part of enforcing mode logs, it is seen in permissive mode only.

[root@master ~]# ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today
----
type=PROCTITLE msg=audit(09/03/2020 08:10:08.510:4606) : proctitle=/usr/sbin/certmonger -S -p /var/run/certmonger.pid -n -d2 
type=SYSCALL msg=audit(09/03/2020 08:10:08.510:4606) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x7f a1=0600 a2=0x557358322fe0 a3=0xf0000000 items=0 ppid=41035 pid=46264 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=certmonger exe=/usr/sbin/certmonger subj=system_u:system_r:certmonger_t:s0 key=(null) 
type=AVC msg=audit(09/03/2020 08:10:08.510:4606) : avc:  denied  { fsetid } for  pid=46264 comm=certmonger capability=fsetid  scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:certmonger_t:s0 tclass=capability permissive=0 
----
type=PROCTITLE msg=audit(09/03/2020 08:10:08.516:4607) : proctitle=/usr/sbin/certmonger -S -p /var/run/certmonger.pid -n -d2 
type=SYSCALL msg=audit(09/03/2020 08:10:08.516:4607) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x7f a1=0600 a2=0x0 a3=0xf0000000 items=0 ppid=41035 pid=46266 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=certmonger exe=/usr/sbin/certmonger subj=system_u:system_r:certmonger_t:s0 key=(null) 
type=AVC msg=audit(09/03/2020 08:10:08.516:4607) : avc:  denied  { fsetid } for  pid=46266 comm=certmonger capability=fsetid  scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:certmonger_t:s0 tclass=capability permissive=0 
----
type=PROCTITLE msg=audit(09/03/2020 08:10:09.888:4608) : proctitle=/usr/sbin/certmonger -S -p /var/run/certmonger.pid -n -d2 
type=SYSCALL msg=audit(09/03/2020 08:10:09.888:4608) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x87 a1=0600 a2=0x557358325fb0 a3=0xf0000000 items=0 ppid=41035 pid=46287 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=certmonger exe=/usr/sbin/certmonger subj=system_u:system_r:certmonger_t:s0 key=(null) 
type=AVC msg=audit(09/03/2020 08:10:09.888:4608) : avc:  denied  { fsetid } for  pid=46287 comm=certmonger capability=fsetid  scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:certmonger_t:s0 tclass=capability permissive=0 
----
type=PROCTITLE msg=audit(09/03/2020 08:10:09.888:4609) : proctitle=/usr/sbin/certmonger -S -p /var/run/certmonger.pid -n -d2 
type=SYSCALL msg=audit(09/03/2020 08:10:09.888:4609) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x7f a1=0640 a2=0x557358325fb0 a3=0xf0000000 items=0 ppid=41035 pid=46287 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=certmonger exe=/usr/sbin/certmonger subj=system_u:system_r:certmonger_t:s0 key=(null) 
type=AVC msg=audit(09/03/2020 08:10:09.888:4609) : avc:  denied  { fsetid } for  pid=46287 comm=certmonger capability=fsetid  scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:system_r:certmonger_t:s0 tclass=capability permissive=0 
[root@master ~]# ls -la /etc/pki/tls/certs/postfix.pem
-rw-r-----. 1 postfix postfix 1879 Sep  3 08:10 /etc/pki/tls/certs/postfix.pem
[root@master ~]# ls -la /etc/pki/tls/private/postfix.key
-rw-------. 1 postfix postfix 1708 Sep  3 08:10 /etc/pki/tls/private/postfix.key
[root@master ~]# getenforce 
Enforcing
[root@master ~]#

Comment 3 Zdenek Pytela 2020-09-03 14:26:47 UTC
Kaleem,

The success=yes for syscall and denied fsetid avc with permissive=0 for the same audit event confuses me. Are there easy reproducing steps, or a test avilable to confirm and check some additional information?

Comment 4 Rob Crittenden 2020-09-09 20:27:18 UTC
The way I produced it the first time was by installing an IPA server on a VM with 2GB+ of RAM:

In RHEL 8:

# dnf -y module enable idm:DL1
# dnf -y install ipa-server-dns postfix

Once that's done:

# ipa-server-install -a password -p password -r EXAMPLE.TEST -U --setup-dns --allow-zone-overlap --no-forwarders -N --auto-reverse --hostname ipa.example.test

Once the installation is finished (~10 min):

# kinit admin
(the password is password)
# ipa service-add smtp/`hostname`
# ipa-getcert request -f /etc/pki/tls/certs/postfix.pem \
-k /etc/pki/tls/private/postfix.key \
-K smtp/`hostname` \
-D `hostname` \
-O postfix \
-o postfix \
-M 0640 \
-m 0600 \
-w

This will cause certmonger to request a certificate from IPA and store the result in /etc/pki/tls/certs/postfix.pem and /etc/pki/tls/private/postfix.key and set the owner/group to postfix:postfix and the modes accordingly.

Comment 6 Zdenek Pytela 2021-01-08 08:59:14 UTC
*** Bug 1909482 has been marked as a duplicate of this bug. ***

Comment 7 Zdenek Pytela 2021-01-08 13:55:45 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/534

Comment 8 Zdenek Pytela 2021-01-11 09:31:31 UTC
Merged in rawhide:
commit 2573f4190dee921aeb32f982830ab3841fba518c (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Fri Jan 8 14:52:06 2021 +0100

    Allow certmonger fsetid capability

    Along with fowner, fsetid capability is required during ipa server
    installation process when certificates for postfix are created and
    ownership+permissions are adjusted.

    Resolves: rhbz#1873211

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.