Bug 604086

Summary: SELinux is preventing /usr/libexec/gdm-smartcard-worker "create" access on coolkeypk11sGeneric CCID Reader 00 00-42.
Product: Red Hat Enterprise Linux 6 Reporter: Radek Bíba <rbiba>
Component: pam_pkcs11Assignee: Bob Relyea <rrelyea>
Status: CLOSED CURRENTRELEASE QA Contact: Radek Bíba <rbiba>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: dwalsh, jmagne, linkinpark_fan, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:54cb172e50b4ac97103cdcef28251e499056119a1f88f66a195f06b84042a3e7
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-11 16:21:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Radek Bíba 2010-06-15 11:53:40 UTC

SELinux is preventing /usr/libexec/gdm-smartcard-worker "create" access on
coolkeypk11sGeneric CCID Reader 00 00-42.

Detailed Description:

SELinux denied access requested by gdm-smartcard-w. It is not expected that this
access is required by gdm-smartcard-w and this access may signal an intrusion
attempt. It is also possible that the specific version or configuration of the
application is causing it to require additional access.

Allowing Access:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug

Additional Information:

Source Context                system_u:system_r:xdm_t:s0-s0:c0.c1023
Target Context                system_u:object_r:var_t:s0
Target Objects                coolkeypk11sGeneric CCID Reader 00 00-42 [ file ]
Source                        gdm-smartcard-w
Source Path                   /usr/libexec/gdm-smartcard-worker
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           gdm-plugin-smartcard-2.30.2-3.el6
Target RPM Packages           
Policy RPM                    selinux-policy-3.7.19-21.el6
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     (removed)
Platform                      Linux (removed) 2.6.32-33.el6.i686 #1
                              SMP Thu Jun 3 12:54:59 EDT 2010 i686 i686
Alert Count                   1
First Seen                    Tue 15 Jun 2010 01:20:08 PM CEST
Last Seen                     Tue 15 Jun 2010 01:20:08 PM CEST
Local ID                      5baffa1c-0d2a-42e4-81b2-3ae63b5f79e5
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1276600808.364:66): avc:  denied  { create } for  pid=3544 comm="gdm-smartcard-w" name=636F6F6C6B6579706B31317347656E657269632043434944205265616465722030302030302D3432 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_t:s0 tclass=file

node=(removed) type=SYSCALL msg=audit(1276600808.364:66): arch=40000003 syscall=5 success=no exit=-13 a0=9151100 a1=4c2 a2=180 a3=9150808 items=0 ppid=1 pid=3544 auid=4294967295 uid=42 gid=477 euid=42 suid=42 fsuid=42 egid=477 sgid=477 fsgid=477 tty=(none) ses=4294967295 comm="gdm-smartcard-w" exe="/usr/libexec/gdm-smartcard-worker" subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

Hash String generated from  catchall,gdm-smartcard-w,xdm_t,var_t,file,create
audit2allow suggests:

#============= xdm_t ==============
allow xdm_t var_t:file create;

Comment 2 RHEL Product and Program Management 2010-06-15 12:13:12 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for

Comment 3 Daniel Walsh 2010-06-16 16:03:26 UTC
What directory is this trying to create the file in?


Should be labeled auth_cache_t.

restorecon -R -v /var/cache

Does this fix the problem?

Comment 4 Radek Bíba 2010-06-17 15:07:09 UTC
# restorecon -R -v /var/cache/
restorecon reset /var/cache/coolkey context unconfined_u:object_r:var_t:s0->system_u:object_r:auth_cache_t:s0
restorecon reset /var/cache/coolkey/coolkeypk11sGeneric CCID Reader 00 00-0 context unconfined_u:object_r:var_t:s0->system_u:object_r:auth_cache_t:s0

That looks like a reasonable change. I'm not really sure what triggered the original SELinux denial, though. I was just playing with smartcard settings in authconfig, pklogin_finder and gdmflexiserver. However, when I delete /var/cache/coolkey and re-run pklogin_finder, it gets recreated with the wrong context, unconfined_u:object_r:var_t:s0. I'm not sure what's wrong.

Comment 5 Daniel Walsh 2010-06-18 13:43:16 UTC
Is pklogin_finder creating the directory?  If yes then it needs to set the label correct.  Is the directory part of the payload of an application

rpm -qf /var/cache/coolkey

Comment 6 Radek Bíba 2010-06-18 14:00:47 UTC
Yes, like I said, when I rm -rf /var/cache/coolkey and run pklogin_finder again, it's recreated.

Rpm says that it's not owned by any package.

Comment 7 Daniel Walsh 2010-06-18 14:38:00 UTC
This directory should be in the pam_pkcs11 package and the tool should create the directory with the correct context.  You can just run restorecon on it,  or from code do a

if selinux_enabled() {
matchpathcon(path, mode, &con)
mkdir /var/cache/coolkey

Comment 8 Jack Magne 2010-07-12 16:27:50 UTC
It looks like the package coolkey is creating this directory.

Comment 9 RHEL Product and Program Management 2010-07-15 15:01:07 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 10 Bob Relyea 2010-07-23 23:26:28 UTC
The directory is supposed to be part of the coolkey library. (pklogin_finder doesn't really create it, it just runs libcoolkeypk11 which does. It was created in the package, but it looks like it wasn't listed in list of files for the package:

rpm -q -l coolkey

I've added it to the package and now we have:/usr/bin/pk11install

My question is, is that sufficient?


Comment 11 Daniel Walsh 2010-07-27 13:29:54 UTC
Well maybe.  As long as the directory in /var/cache/coolkey does not get removed.

Bob does coolkey has a startup/service script?

Comment 12 Bob Relyea 2010-07-27 18:37:52 UTC
OK, for 6.0 I'm ok with requiring a restorecon if someone removes it. I'll add it to the coolkey package.

coolkey does not run as a service. It's a library.

Comment 13 Daniel Walsh 2010-07-27 20:34:53 UTC

Comment 14 Bob Relyea 2010-07-28 17:46:00 UTC
Package: coolkey-1.1.0-15.el6
Tag: RHEL-6-candidate
Status: complete
Built by: rrelyea
ID: 138485
Started: Tue, 27 Jul 2010 17:19:19 EDT
Finished: Tue, 27 Jul 2010 17:21:22 EDT
* Tue Jul 27 2010 Bob Relyea <rrelyea@redhat.com> - 1.1.0-15
- Own the coolkey cache directory.
- Bugzilla #604086

Marking Modified. Dan, if you need to check anything in on the profile side, go ahead and change this back to assigned.


Comment 16 Radek Bíba 2010-07-30 08:41:28 UTC
Thanks, the new package contains the cache directory, it gets created with the right context. The cache file in it has the right context too. I'm no longer getting the selinux denials using the steps that caused them in the past.

Comment 17 releng-rhel@redhat.com 2010-11-11 16:21:20 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.