Bug 604086 - SELinux is preventing /usr/libexec/gdm-smartcard-worker "create" access on coolkeypk11sGeneric CCID Reader 00 00-42.
SELinux is preventing /usr/libexec/gdm-smartcard-worker "create" access ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pam_pkcs11 (Show other bugs)
6.0
i386 Linux
medium Severity medium
: rc
: ---
Assigned To: Bob Relyea
Radek Bíba
setroubleshoot_trace_hash:54cb172e50b...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-15 07:53 EDT by Radek Bíba
Modified: 2010-11-11 11:21 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-11-11 11:21:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Radek Bíba 2010-06-15 07:53:40 EDT
Summary:

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
report.

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 08:13:12 EDT
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
inclusion.
Comment 3 Daniel Walsh 2010-06-16 12:03:26 EDT
What directory is this trying to create the file in?

/var/cache/coolkey

Should be labeled auth_cache_t.

restorecon -R -v /var/cache

Does this fix the problem?
Comment 4 Radek Bíba 2010-06-17 11:07:09 EDT
# 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 09:43:16 EDT
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 10:00:47 EDT
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 10:38:00 EDT
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)
setfscreatecon(con);
}
mkdir /var/cache/coolkey
setfscreatecon(NULL);
Comment 8 Jack Magne 2010-07-12 12:27:50 EDT
It looks like the package coolkey is creating this directory.
Comment 9 RHEL Product and Program Management 2010-07-15 11:01:07 EDT
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 19:26:28 EDT
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
/usr/bin/pk11install
/usr/lib64/libckyapplet.so.1
/usr/lib64/libckyapplet.so.1.0.0
/usr/lib64/libcoolkeypk11.so
/usr/lib64/pkcs11/libcoolkeypk11.so
/usr/share/doc/coolkey-1.1.0
/usr/share/doc/coolkey-1.1.0/ChangeLog
/usr/share/doc/coolkey-1.1.0/LICENSE

I've added it to the package and now we have:/usr/bin/pk11install
/usr/lib64/libckyapplet.so.1
/usr/lib64/libckyapplet.so.1.0.0
/usr/lib64/libcoolkeypk11.so
/usr/lib64/pkcs11/libcoolkeypk11.so
/usr/share/doc/coolkey-1.1.0
/usr/share/doc/coolkey-1.1.0/ChangeLog
/usr/share/doc/coolkey-1.1.0/LICENSE
/var/cache/coolkey

My question is, is that sufficient?

bob
Comment 11 Daniel Walsh 2010-07-27 09:29:54 EDT
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 14:37:52 EDT
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 16:34:53 EDT
Great.
Comment 14 Bob Relyea 2010-07-28 13:46:00 EDT
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
Changelog:
* 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.

bob
Comment 16 Radek Bíba 2010-07-30 04:41:28 EDT
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 11:21:20 EST
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.

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