Bug 1772445 - SELinux is preventing dogtag-ipa-rene from search access on the directory opencryptoki
Summary: SELinux is preventing dogtag-ipa-rene from search access on the directory ope...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: freeipa
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: IPA Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-14 11:31 UTC by Lukas Slebodnik
Modified: 2021-09-23 18:16 UTC (History)
14 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-05-25 15:10:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-6913 0 None None None 2021-09-23 18:16:30 UTC

Description Lukas Slebodnik 2019-11-14 11:31:00 UTC
SELinux is preventing dogtag-ipa-rene from search access on the directory opencryptoki.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that dogtag-ipa-rene should be allowed search access on the opencryptoki directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'dogtag-ipa-rene' --raw | audit2allow -M my-dogtagiparene
# semodule -X 300 -i my-dogtagiparene.pp


Additional Information:
Source Context                system_u:system_r:certmonger_t:s0
Target Context                system_u:object_r:pkcs_slotd_lock_t:s0
Target Objects                opencryptoki [ dir ]
Source                        dogtag-ipa-rene
Source Path                   dogtag-ipa-rene
Port                          <Unknown>
Host                          host.example.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.5-15.fc32.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     host.example.com
Platform                      Linux host.example.com
                              5.4.0-0.rc7.git1.1.fc32.x86_64 #1 SMP Wed Nov 13
                              14:45:32 UTC 2019 x86_64 x86_64
Alert Count                   62
First Seen                    2019-11-14 05:49:38 EST
Last Seen                     2019-11-14 05:52:41 EST
Local ID                      d649f36c-4389-4303-a3d5-4a7f206d3bd2

Raw Audit Messages
type=AVC msg=audit(1573728761.818:392): avc:  denied  { search } for  pid=27670 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=67054 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=0


Hash: dogtag-ipa-rene,certmonger_t,pkcs_slotd_lock_t,dir,search

Comment 1 Lukas Slebodnik 2019-11-14 11:32:25 UTC
SELinux is preventing pk12util from read access on the lnk_file log.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that pk12util should be allowed read access on the log lnk_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'pk12util' --raw | audit2allow -M my-pk12util
# semodule -X 300 -i my-pk12util.pp


Additional Information:
Source Context                system_u:system_r:ipa_custodia_t:s0
Target Context                system_u:object_r:devlog_t:s0
Target Objects                log [ lnk_file ]
Source                        pk12util
Source Path                   pk12util
Port                          <Unknown>
Host                          host.example.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.5-15.fc32.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     host.example.com
Platform                      Linux host.example.com
                              5.4.0-0.rc7.git1.1.fc32.x86_64 #1 SMP Wed Nov 13
                              14:45:32 UTC 2019 x86_64 x86_64
Alert Count                   4
First Seen                    2019-11-14 06:02:11 EST
Last Seen                     2019-11-14 06:02:23 EST
Local ID                      8a556046-8e1c-4e59-ad9e-bd9013ab7646

Raw Audit Messages
type=AVC msg=audit(1573729343.152:535): avc:  denied  { read } for  pid=29668 comm="pk12util" name="log" dev="devtmpfs" ino=12712 scontext=system_u:system_r:ipa_custodia_t:s0 tcontext=system_u:object_r:devlog_t:s0 tclass=lnk_file permissive=0


Hash: pk12util,ipa_custodia_t,devlog_t,lnk_file,read

Comment 2 Lukas Slebodnik 2019-11-14 11:33:24 UTC
Moving to freeIPA cause they are very likely introduced by freeipa-server-4.8.2-1.fc32.x86_64

Comment 3 Lukas Slebodnik 2019-11-14 11:35:05 UTC
AVCs in permissive mode

time->Thu Nov 14 05:47:15 2019
type=AVC msg=audit(1573728435.969:287): avc:  denied  { search } for  pid=25691 comm="dogtag-ipa-rene" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:47:54 2019
type=AVC msg=audit(1573728474.835:292): avc:  denied  { search } for  pid=26092 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:48:50 2019
type=AVC msg=audit(1573728530.447:299): avc:  denied  { search } for  pid=26537 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:49:20 2019
type=AVC msg=audit(1573728560.736:310): avc:  denied  { search } for  pid=27002 comm="dogtag-submit" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:49:26 2019
type=AVC msg=audit(1573728566.157:312): avc:  denied  { search } for  pid=27042 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:49:37 2019
type=AVC msg=audit(1573728577.545:324): avc:  denied  { search } for  pid=27358 comm="dogtag-submit" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:49:57 2019
type=AVC msg=audit(1573728597.275:334): avc:  denied  { search } for  pid=27488 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=67125 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1


----
time->Thu Nov 14 05:59:16 2019
type=AVC msg=audit(1573729156.041:475): avc:  denied  { read } for  pid=29481 comm="pk12util" name="log" dev="devtmpfs" ino=12712 scontext=system_u:system_r:ipa_custodia_t:s0 tcontext=system_u:object_r:devlog_t:s0 tclass=lnk_file permissive=1
----
time->Thu Nov 14 05:59:16 2019
type=AVC msg=audit(1573729156.042:476): avc:  denied  { write } for  pid=29481 comm="pk12util" name="dev-log" dev="tmpfs" ino=12710 scontext=system_u:system_r:ipa_custodia_t:s0 tcontext=system_u:object_r:devlog_t:s0 tclass=sock_file permissive=1
----
time->Thu Nov 14 05:59:21 2019
type=AVC msg=audit(1573729161.131:478): avc:  denied  { write } for  pid=29494 comm="pk12util" name="dev-log" dev="tmpfs" ino=12710 scontext=system_u:system_r:ipa_custodia_t:s0 tcontext=system_u:object_r:devlog_t:s0 tclass=sock_file permissive=1


time->Thu Nov 14 05:58:03 2019
type=AVC msg=audit(1573729083.797:327): avc:  denied  { search } for  pid=25618 comm="dogtag-ipa-rene" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:58:36 2019
type=AVC msg=audit(1573729116.633:341): avc:  denied  { search } for  pid=26140 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 05:58:54 2019
type=AVC msg=audit(1573729134.143:350): avc:  denied  { search } for  pid=26333 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 06:01:53 2019
type=AVC msg=audit(1573729313.753:370): avc:  denied  { search } for  pid=27873 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 06:01:55 2019
type=AVC msg=audit(1573729315.166:371): avc:  denied  { search } for  pid=27876 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 06:02:32 2019
type=AVC msg=audit(1573729352.281:377): avc:  denied  { search } for  pid=28248 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1
----
time->Thu Nov 14 06:03:19 2019
type=AVC msg=audit(1573729399.331:389): avc:  denied  { search } for  pid=28881 comm="certmonger" name="opencryptoki" dev="tmpfs" ino=69521 scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:pkcs_slotd_lock_t:s0 tclass=dir permissive=1

Comment 4 Lukas Slebodnik 2019-11-14 13:49:50 UTC
How to reproduce:
Install freeIPA master, replica and client

Actually it could be caused also by other changes
selinux-policy-3.14.5-12.fc32.noarch ->  selinux-policy-3.14.5-15.fc32.noarch
opencryptoki-3.11.1-1.fc32.x86_64 -> opencryptoki-3.12.0-1.fc32.x86_64

So feel free to move to different component.

Comment 5 Rob Crittenden 2019-11-14 14:22:08 UTC
Is pcscd running? Do you have a smartcard installed?

For the certmonger AVC I'm guessing it is trying to read the tokens off a card.

Seems like SELinux needs to add at least: 

allow certmonger_t pkcs_slotd_lock_t:dir search;

Comment 6 Lukas Slebodnik 2019-11-14 14:41:14 UTC
(In reply to Rob Crittenden from comment #5)
> Is pcscd running? Do you have a smartcard installed?
> 

No,

sh# systemctl status | grep [s]ervice
           │   └─user
             ├─rngd.service
             ├─systemd-udevd.service
             │ └─dirsrv
             ├─dbus-broker.service
             ├─oddjobd.service
             │ └─serial-getty
             ├─chronyd.service
             ├─named-pkcs11.service
             ├─ipa-custodia.service
             ├─auditd.service
             ├─certmonger.service
             │ └─pki-tomcatd
             ├─systemd-journald.service
             ├─sshd.service
             ├─NetworkManager.service
             ├─krb5kdc.service
             ├─gssproxy.service
             ├─rsyslog.service
             ├─abrtd.service
             ├─sssd.service
             ├─restraintd.service
             ├─httpd.service
             ├─kadmin.service
             │ └─getty
             ├─ipa-dnskeysyncd.service
             └─systemd-logind.service
sh# systemctl status pcscd

Unit pcscd.service could not be found.

> For the certmonger AVC I'm guessing it is trying to read the tokens off a
> card.
> 

FYI
sh# semanage fcontext -l | grep pkcs_slotd_lock_t
/var/lock/opencryptoki(/.*)?                       all files          system_u:object_r:pkcs_slotd_lock_t:s0


> Seems like SELinux needs to add at least: 
> 
> allow certmonger_t pkcs_slotd_lock_t:dir search;

The question is whether it is required or can be skipped with changing configuration for certmonger or somewhere else

Comment 7 Lukas Slebodnik 2019-11-14 14:51:06 UTC
(In reply to Lukas Slebodnik from comment #3)
> AVCs in permissive mode
> ----
> time->Thu Nov 14 05:59:16 2019
> type=AVC msg=audit(1573729156.041:475): avc:  denied  { read } for 
> pid=29481 comm="pk12util" name="log" dev="devtmpfs" ino=12712
> scontext=system_u:system_r:ipa_custodia_t:s0
> tcontext=system_u:object_r:devlog_t:s0 tclass=lnk_file permissive=1
> ----
> time->Thu Nov 14 05:59:16 2019
> type=AVC msg=audit(1573729156.042:476): avc:  denied  { write } for 
> pid=29481 comm="pk12util" name="dev-log" dev="tmpfs" ino=12710
> scontext=system_u:system_r:ipa_custodia_t:s0
> tcontext=system_u:object_r:devlog_t:s0 tclass=sock_file permissive=1
> ----
> time->Thu Nov 14 05:59:21 2019
> type=AVC msg=audit(1573729161.131:478): avc:  denied  { write } for 
> pid=29494 comm="pk12util" name="dev-log" dev="tmpfs" ino=12710
> scontext=system_u:system_r:ipa_custodia_t:s0
> tcontext=system_u:object_r:devlog_t:s0 tclass=sock_file permissive=1
> 

Lukas,
do you want to these AVCs to be part of different BZ?

Comment 8 Lukas Vrabec 2019-11-18 09:54:50 UTC
Lukas, 
Yes.

Comment 9 Lukas Slebodnik 2019-11-18 13:57:31 UTC
(In reply to Lukas Vrabec 🐦 from comment #8)
> Lukas, 
> Yes.

Actually, fixing issue with pkcs_slotd_lock_t solved also problem with ipa_custodia_t:s0 and devlog_t:s0.

Comment 10 Lukas Slebodnik 2019-11-27 11:29:42 UTC
(In reply to Rob Crittenden from comment #5)
> Is pcscd running? Do you have a smartcard installed?
> 
> For the certmonger AVC I'm guessing it is trying to read the tokens off a
> card.
> 
> Seems like SELinux needs to add at least: 
> 
> allow certmonger_t pkcs_slotd_lock_t:dir search;

Are you able to reproduce it yourself on rawhide?
Shall it be allowed? If yes, please move component back sot selinux-policy

Comment 11 Ben Cotton 2019-11-27 14:18:17 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 12 Ben Cotton 2019-11-27 15:16:25 UTC
This bug was accidentally closed due to a query error. Reopening.

Comment 13 Ben Cotton 2020-02-11 17:43:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 14 Fedora Program Management 2021-04-29 15:59:51 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 15 Ben Cotton 2021-05-25 15:10:48 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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