Bug 1159385

Summary: GDM does not prompt for smartcard
Product: Red Hat Enterprise Linux 7 Reporter: adam winberg <adam.winberg>
Component: gnome-shellAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: adam.winberg, martinsson.patrik, mdomonko, vbenes
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gnome-shell-3.8.4-44.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1160739 (view as bug list) Environment:
Last Closed: 2015-03-05 13:22:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pam-files
none
gnome-settings-daemon --debug none

Description adam winberg 2014-10-31 18:21:42 UTC
Description of problem:
We have smartcard authentication enabled and password/fingerprint auth disabled. We use the pam_pkcs11 module with the card_only option enabled to tell applications to get username directly from card rather than ask for it. Even so the gdm login screen does not prompt for smartcard if it is not inserted. What we get is a username prompt, and if we click 'Next' the spinner goes round and round and it just hangs, without saying anything about needing the smartcard. Inserting the smartcard makes the pin prompt appear. 

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Configure smartcard auth, disable password/fingerprint auth. Configure pam_pkcs11 with card_only option enabled.
2. Boot computer to gdm login screen without smartcard inserted
3. 

Actual results:
GDM asks for username, click next and it hangs waiting for smartcard without message.

Expected results:
GDM should not ask for username. GDM should ask the user to insert the smartcard. 

Additional info:

Comment 2 Ray Strode [halfline] 2014-10-31 20:26:20 UTC
did you set up your smartcard configuration manually or by using the authentication settings panel (authconfig-gtk)?

what's the output of

# gsettings get org.gnome.login-screen enable-smartcard-authentication
# DCONF_PROFILE=gdm gsettings get org.gnome.login-screen enable-smartcard-authentication

can you attach /etc/pam.d/smartcard-auth /etc/pam.d/password-auth and /etc/pam.d/system-auth

?

Comment 3 adam winberg 2014-10-31 20:53:28 UTC
First setup was via authconfig-gtk but its been slightly modified and is now handled via puppet. 

both gsettings commands returns 'true'.

Comment 4 adam winberg 2014-10-31 20:54:39 UTC
Created attachment 952613 [details]
pam-files

attached smartcard-auth-ac, system-auth-ac and password-auth-ac

Comment 5 Ray Strode [halfline] 2014-11-05 12:44:56 UTC
from the log on the sister bug, (bug 1159056 attachment 952614 [details]) I see this:

Oct 31 21:57:07 c20550.ad.smhi.se gnome-session[989]: (gnome-settings-daemon:1041): smartcard-plugin-WARNING **: Got potentially spurious smartcard event error: ffffe098.
Oct 31 21:57:07 c20550.ad.smhi.se gnome-session[989]: (gnome-settings-daemon:1041): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

gnome-settings-daemon is what listens for smartcard insertion events. It seems like it may have gotten into a confused state following a driver error.

Can you log in, pull out the smartcard, and then run

/usr/libexec/gnome-settings-daemon --replace --debug >& gsd.out

at terminal, insert the smartcard, and then attach gsd.out to this report?

Comment 6 adam winberg 2014-11-05 13:03:39 UTC
We lock the screen on smartcard removal, and it does not seem to be possible to run gnome-settings-daemon from console. I changed the order in your instruction a little, hope its ok:
- logged in
- started gnome-settings-daemon in debug mode
- removed smartcard
- insert smartcard. 

See attached file for details

Comment 7 adam winberg 2014-11-05 13:04:16 UTC
Created attachment 954024 [details]
gnome-settings-daemon --debug

Comment 8 Ray Strode [halfline] 2014-11-05 14:25:22 UTC
Thanks for the logs.

So the g_object_unref is actually unrelated to smartcards:

(gnome-settings-daemon:4688): color-plugin-DEBUG: failed to enumerate directory /home/a001329/.color/icc: No such file or directory

(gnome-settings-daemon:4688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

It's a bug in the color management plugin. I'll clone that as a separate report.

The spurious events are probably harmless too, since you only get 1 or 2, and we retry 10 times.

Actually, looking in the code this looks like a logic error in /usr/share/gnome-shell/js/gdm/util.js:

    _updateDefaultService: function() {
        if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
            this._defaultService = PASSWORD_SERVICE_NAME;
        else if (this.smartcardDetected)
            this._defaultService = SMARTCARD_SERVICE_NAME;
        else if (this._haveFingerprintReader)
            this._defaultService = FINGERPRINT_SERVICE_NAME;
    },

We only use the smartcard service if a smartcard is detected, but that's not correct.  We should use the smartcard service if password-authentication is disabled.

So really instead it should be: 

    _updateDefaultService: function() {
        if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
            this._defaultService = PASSWORD_SERVICE_NAME;
        else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
            this._defaultService = SMARTCARD_SERVICE_NAME;
        else if (this._haveFingerprintReader)
            this._defaultService = FINGERPRINT_SERVICE_NAME;
    },

Comment 9 adam winberg 2014-11-05 15:05:01 UTC
Awesome, I changed the line in /usr/share/gnome-shell/js/gdm/util.js and it does indeed work as expected after this. I did however stumble upon another bug, but I filed this separate in #1160764

Comment 13 errata-xmlrpc 2015-03-05 13:22:09 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, 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://rhn.redhat.com/errata/RHSA-2015-0535.html