Bug 2097048 - Screen does not lock when smartcard reader is removed with smartcard inserted
Summary: Screen does not lock when smartcard reader is removed with smartcard inserted
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: opensc
Version: 8.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: 8.9
Assignee: Jakub Jelen
QA Contact: Marek Havrila
Mirek Jahoda
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-14 19:21 UTC by Andrew Mike
Modified: 2023-08-02 12:32 UTC (History)
13 users (show)

Fixed In Version: opensc-0.20.0-5.el8
Doc Type: Known Issue
Doc Text:
.The automatic screen lock does not work when a smart-card reader is removed The `opensc` packages incorrectly handle removing USB smart-card readers. Consequently, the system remains unlocked even when the GNOME Display Manager (GDM) is configured to lock the screen when a smart card is removed. Furthermore, after you reconnect the USB reader, the screen also does not lock after removing the smart card. To work around this problem, perform one of the following actions: * Always remove only a smart card, not a smart-card reader. * When using hardware tokens that integrate a reader and a card in one package, upgrade to RHEL 9.
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CRYPTO-9631 0 None None None 2023-02-28 14:07:24 UTC
Red Hat Issue Tracker RHELPLAN-125284 0 None None None 2022-06-14 19:57:25 UTC

Description Andrew Mike 2022-06-14 19:21:18 UTC
Description of problem: When a USB smartcard reader is removed from a system when a smartcard is inserted, the screen does not lock.

Version-Release number of selected component (if applicable):
gdm-40.0-23.el8.x86_64

How reproducible: 100%

Steps to Reproduce:
1. Configure authselect with options "--with smartcard --with-mkhomedir - with-smartcard-lock-on-removal".
2. Enroll a user with a smartcard and log them in to GNOME.
3. Remove the smartcard reader with the user's smartcard inside it.

Actual results: Screen fails to lock.

Expected results: Screen doesn't lock.

Additional info:
- This was observed on a customer system using an SCR3310 USB smartcard reader, but is consistent across all USB smartcard readers.

Comment 4 Steve Ross 2023-02-22 23:19:12 UTC
We see this issue too.  Any suggestions for a work-around would be appreciated. -- Steve Ross

Comment 7 Jakub Jelen 2023-02-28 12:25:46 UTC
Moving to OpenSC, as this is most likely an issue on our side.

Marek checked the RHEL9 OpenSC works as expected (will check if the card works again after the reader removal again). For now, we do not have a workaround (except for the update to RHEL9), but we will consider if we will be able to backport the changes to RHEL8 or do the rebase to newer version.

Comment 8 Steve Ross 2023-02-28 16:20:45 UTC
Jakub Jelen wrote:
> Moving to OpenSC, as this is most likely an issue on our side.

I have reproduced this issue on both a RHEL8.6 EUS machine, which uses OpenSC, and another platform (based on RHEL8.6) which uses a different PKCS #11 module.  So, I question whether this is an issue with OpenSC or with, for example, (just speculating) "gsd-smartcard".

In the next couple of days, I can plan to try the other module on the stock RHEL8.6 machine.

-- Steve Ross

Comment 9 Jakub Jelen 2023-03-01 15:52:20 UTC
Marek mentioned in the private comment that this works with RHEL9, which has newer OpenSC and I vaguely remember fixing some related bugs in the OpenSC upstream. Another data-point to verify would be trying the new OpenSC 0.23.0 (for example from the below copr) on RHEL8.6 if it will work or not:

https://copr.fedorainfracloud.org/coprs/jjelen/opensc-latest/

If you could test it on stock RHEL 8.6 machine with the new OpenSC, it would be very appreciated.

Comment 10 Steve Ross 2023-03-03 22:59:28 UTC
I wrote:
> In the next couple of days, I can plan to try the other module on the stock RHEL8.6 machine.

I did try the other PKCS #11 module on the stock RHEL8 EUS machine.  Like the stock "opensc-0.20.0-4.el8" package, the other module (correctly) locks the screen when I remove the smart card (used for authentication) from the reader, and (incorrectly) leaves the screen unlocked when I unplugged the reader+card together.  So, this would lead me to believe that the issue is outside of the PKCS #11 module.

Jakub wrote:
> Marek mentioned in the private comment that this works with RHEL9, which has newer OpenSC
> and I vaguely remember fixing some related bugs in the OpenSC upstream. 
> Another data-point to verify would be trying the new OpenSC 0.23.0 
> (for example from the below copr) on RHEL8.6 if it will work or not:
>
> https://copr.fedorainfracloud.org/coprs/jjelen/opensc-latest/
>
> If you could test it on stock RHEL 8.6 machine with the new OpenSC, it would be very appreciated.

I installed "opensc-0.23.0-2.el8" from your site on the RHEL 8.6 machine.  It (correctly) locks the screen when I remove the smart card, and (correctly!!) locks the screen when I unplugged the reader+card combination.  I did *not* expect correct operation for reader+card; that points to some issue with both older the module(s).

Comment 11 Jakub Jelen 2023-03-06 07:02:24 UTC
Thank you for double-checking!

Comment 12 Steve Ross 2023-03-06 17:34:37 UTC
Jakub wrote:
> Thank you for double-checking!
You are welcome.

And earlier wrote:
> I vaguely remember fixing some related bugs in the OpenSC upstream.
This is a low-priority request (so feel free to ignore it), but I am curious about which bugs these are.  My searching skills for issues/Pull Requests on GitHub in OpenSC/OpenSC were not sufficient for me to find them.

Comment 13 Jakub Jelen 2023-03-07 10:16:32 UTC
There was a lot of changes regarding the token/card/reader removal and reinsertion over the last couple of years. I thought it was something I was fixing, but it looks like the first merge request for this particular issue was this one (but it looks like it should already have been in 0.20.0 which is in RHEL8):

https://github.com/OpenSC/OpenSC/pull/1615

There were many changes how the pcscd events are handled since then:

https://github.com/OpenSC/OpenSC/pull/1970
https://github.com/OpenSC/OpenSC/pull/1923
https://github.com/OpenSC/OpenSC/pull/2051
https://github.com/OpenSC/OpenSC/pull/2077
https://github.com/OpenSC/OpenSC/pull/2418
https://github.com/OpenSC/OpenSC/pull/2600

I might have missed some though.

Comment 14 Steve Ross 2023-03-07 14:37:42 UTC
Jakub wrote:
> There was a lot of changes regarding the token/card/reader removal and reinsertion over the last couple of years.
Thank you for the list!


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