Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make libpcsc-lite also work on fedora #22

Open
Sorunome opened this issue Feb 11, 2023 · 3 comments
Open

Make libpcsc-lite also work on fedora #22

Sorunome opened this issue Feb 11, 2023 · 3 comments

Comments

@Sorunome
Copy link

pcsc works by a server-client architecture, where they communicate with each other. Inside the flatpak is only the client, thus "pcsc-lite". Now, the internal protocol for the communication is rather rigid. Most distros just compile pcsc with the default options for possible amount of smartcards, fedora, however, does not. That leads to the normally compiled pcsc-lite in this flatpak being incompatible on fedora hosts. This is a known issue, with no clear/easy fix on the horizon. Soru played around with pcsc for some other flat-packing and came up with a solution to still work on more hosts: Compiling both versions of pcsc-lite and determining in the runtime which one to load. Sadly sorus bash knowledge is not too good so she could only think of how to test for host system name, and not actual features.

Anyhow, the solution to compile both in is here:

  - name: pcsc-lite
    sources:
      - type: archive
        url: https://pcsclite.apdu.fr/files/pcsc-lite-1.9.9.tar.bz2
        sha256: cbcc3b34c61f53291cecc0d831423c94d437b188eb2b97b7febc08de1c914e8a
    config-opts:
      - --disable-libudev
      - --disable-libsystemd
      - --without-systemdsystemunitdir
      - --disable-serial
      - --disable-usb
      - --disable-documentation
      - --libdir=/app/lib/pcsc-lite
    cleanup:
      - /include
      - /bin/pcsc-spy
      - /lib/pcsc-lite/libpcscspy*
      - /lib/pcsc-lite/pkgconfig
      - /share/doc
      - /share/man
    post-install:
      - rm /app/sbin/pcscd
      - rmdir /app/sbin || true
  - name: pcsc-lite-fedora
    sources:
      - type: archive
        url: https://pcsclite.apdu.fr/files/pcsc-lite-1.9.9.tar.bz2
        sha256: cbcc3b34c61f53291cecc0d831423c94d437b188eb2b97b7febc08de1c914e8a
      - type: patch
        path: pcsc-lite-1.9.1-maxreaders.patch
    config-opts:
      - --disable-libudev
      - --disable-libsystemd
      - --without-systemdsystemunitdir
      - --disable-serial
      - --disable-usb
      - --disable-documentation
      - --libdir=/app/lib/pcsc-lite-fedora
    cleanup:
      - /include
      - /bin/pcsc-spy
      - /lib/pcsc-lite-fedora/libpcscspy*
      - /lib/pcsc-lite-fedora/pkgconfig
      - /share/doc
      - /share/man
    post-install:
      - rm /app/sbin/pcscd
      - rmdir /app/sbin || true

And then, to determine what to load, a script to source pre-execution something as following:

#!/bin/sh
if [[ $(cat /proc/version) =~ "fedora" || $(cat /proc/version) =~ "Red Hat" ]]; then
  echo "fedora"
  LD_LIBRARY_PATH=/app/lib/pcsc-lite-fedora:$LD_LIBRARY_PATH
else
  echo "normal"
  LD_LIBRARY_PATH=/app/lib/pcsc-lite:$LD_LIBRARY_PATH
fi

echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH
@misery
Copy link
Collaborator

misery commented Mar 9, 2023

@outergod Could you look into it? :-)

@outergod
Copy link
Collaborator

I don't have a working ID card, anymore. Tried different readers, nothing. Not sure how I can test any of this, anymore, until I get a new one - eventually.

@doczkal
Copy link

doczkal commented Jun 25, 2023

I think this is related to the libpcsc
I have two smart card reader attached to my laptop. One is for GPG Cards without the nPA functionality and the other one is the REINER SCT komfort.

I see the following logs
qml 2023.06.25 12:32:31.561 2 ReaderScanEnabler::enableScan(ui/qml/ReaderScanEnabler.cpp:49) : Stopping scan on REMOTE_IFD
card 2023.06.25 12:32:31.562 7 ReaderManagerWorker::callOnPlugIn(card/base/ReaderManagerWorker.cpp:131) : Stop scan on plugin: governikus::RemoteIfdReaderManagerPlugIn
qml 2023.06.25 12:32:31.563 2 ReaderScanEnabler::enableScan(ui/qml/ReaderScanEnabler.cpp:40) : Starting scan on PCSC
card 2023.06.25 12:32:31.563 7 ReaderManagerWorker::callOnPlugIn(card/base/ReaderManagerWorker.cpp:131) : Start scan on plugin: governikus::PcscReaderManagerPlugIn
network 2023.06.25 12:32:31.564 2 ...mHandlerImpl::~DatagramHandlerImpl(network/DatagramHandlerImpl.cpp:104) : Shutdown socket
card 2023.06.25 12:32:31.565 2 ReaderManager::doUpdatePluginCache(card/base/ReaderManager.cpp:286) : Update cache entry: REMOTE_IFD
card_pcsc 2023.06.25 12:32:31.582 7 ...eaderManagerPlugIn::startScan(card/pcsc/PcscReaderManagerPlugIn.cpp:55) : SCardEstablishContext: "Scard_S_Success"
card 2023.06.25 12:32:31.585 2 ReaderManager::doUpdatePluginCache(card/base/ReaderManager.cpp:286) : Update cache entry: PCSC
card_pcsc 2023.06.25 12:32:32.057 7 PcscReaderFeature::PcscReaderFeature(card/pcsc/PcscReaderFeature.cpp:22) : features: null
card_pcsc 2023.06.25 12:32:32.057 7 PcscReader::PcscReader(card/pcsc/PcscReader.cpp:25) : "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:32.072 7 PcscReader::init(card/pcsc/PcscReader.cpp:42) : SCardEstablishContext: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.072 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:286) : "SCardConnect(5064106a, Alcor Micro AU9540 00 00, 3, 1, 0, 0)"
card_pcsc 2023.06.25 12:32:32.089 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:288) : SCardConnect for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.089 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:316) : SCardControl for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.090 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:323) : FEATURES: "120442330012"
card_pcsc 2023.06.25 12:32:32.090 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:325) : FEATURES: QList(TLV_PROPERTIES)
card_pcsc 2023.06.25 12:32:32.090 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:296) : SCardDisconnect for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.090 7 PcscReader::updateCard(card/pcsc/PcscReader.cpp:190) : old state: "(0) UNAWARE" | new state: "(18) CHANGED EMPTY"
card_pcsc 2023.06.25 12:32:32.090 7 ...derManagerPlugIn::addReaders(card/pcsc/PcscReaderManagerPlugIn.cpp:170) : fireReaderAdded: "Alcor Micro AU9540 00 00" ( 1 reader in total )
card_pcsc 2023.06.25 12:32:32.090 7 PcscReaderFeature::PcscReaderFeature(card/pcsc/PcscReaderFeature.cpp:22) : features: null
card_pcsc 2023.06.25 12:32:32.090 7 PcscReader::PcscReader(card/pcsc/PcscReader.cpp:25) : "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card 2023.06.25 12:32:32.090 2 ReaderManager::doUpdateCacheEntry(card/base/ReaderManager.cpp:268) : Update cache entry: "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:32.120 7 PcscReader::init(card/pcsc/PcscReader.cpp:42) : SCardEstablishContext: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.120 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:286) : "SCardConnect(3b243a57, REINER SCT cyberJack RFID komfort (6479140943) 00 00, 3, 1, 0, 0)"
card_pcsc 2023.06.25 12:32:32.147 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:288) : SCardConnect for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.147 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:316) : SCardControl for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.147 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:323) : FEATURES: "060442000db2070442000db3080442000db4090442000db5200442000dcc"
card_pcsc 2023.06.25 12:32:32.147 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:325) : FEATURES: QList(VERIFY_PIN_DIRECT, MODIFY_PIN_DIRECT, MCT_READERDIRECT, MCT_UNIVERSAL, EXECUTE_PACE)
card_pcsc 2023.06.25 12:32:32.147 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:296) : SCardDisconnect for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.148 7 PcscReader::updateCard(card/pcsc/PcscReader.cpp:190) : old state: "(0) UNAWARE" | new state: "(917522) CHANGED EMPTY"
card_pcsc 2023.06.25 12:32:32.148 7 ...derManagerPlugIn::addReaders(card/pcsc/PcscReaderManagerPlugIn.cpp:170) : fireReaderAdded: "REINER SCT cyberJack RFID komfort (6479140943) 00 00" ( 2 reader in total )
card 2023.06.25 12:32:32.182 2 ReaderManager::doUpdateCacheEntry(card/base/ReaderManager.cpp:268) : Update cache entry: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:66) : "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:70) : SCardCancel: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:71) : SCardReleaseContext: "Scard_S_Success"
card 2023.06.25 12:32:32.532 7 ReaderManagerWorker::onReaderRemoved(card/base/ReaderManagerWorker.cpp:59) : fireReaderRemoved: "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:66) : "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:70) : SCardCancel: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:32.532 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:71) : SCardReleaseContext: "Scard_S_Success"
card 2023.06.25 12:32:32.532 7 ReaderManagerWorker::onReaderRemoved(card/base/ReaderManagerWorker.cpp:59) : fireReaderRemoved: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card 2023.06.25 12:32:32.532 2 ReaderManager::doRemoveCacheEntry(card/base/ReaderManager.cpp:277) : Remove cache entry: "Alcor Micro AU9540 00 00"
card 2023.06.25 12:32:32.607 2 ReaderManager::doRemoveCacheEntry(card/base/ReaderManager.cpp:277) : Remove cache entry: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card_pcsc 2023.06.25 12:32:33.482 7 PcscReaderFeature::PcscReaderFeature(card/pcsc/PcscReaderFeature.cpp:22) : features: null
card_pcsc 2023.06.25 12:32:33.482 7 PcscReader::PcscReader(card/pcsc/PcscReader.cpp:25) : "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:33.498 7 PcscReader::init(card/pcsc/PcscReader.cpp:42) : SCardEstablishContext: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.498 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:286) : "SCardConnect(79a1163b, Alcor Micro AU9540 00 00, 3, 1, 0, 0)"
card_pcsc 2023.06.25 12:32:33.513 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:288) : SCardConnect for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.514 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:316) : SCardControl for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.514 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:323) : FEATURES: "120442330012"
card_pcsc 2023.06.25 12:32:33.514 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:325) : FEATURES: QList(TLV_PROPERTIES)
card_pcsc 2023.06.25 12:32:33.514 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:296) : SCardDisconnect for "Alcor Micro AU9540 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.514 7 PcscReader::updateCard(card/pcsc/PcscReader.cpp:190) : old state: "(0) UNAWARE" | new state: "(18) CHANGED EMPTY"
card_pcsc 2023.06.25 12:32:33.514 7 ...derManagerPlugIn::addReaders(card/pcsc/PcscReaderManagerPlugIn.cpp:170) : fireReaderAdded: "Alcor Micro AU9540 00 00" ( 1 reader in total )
card_pcsc 2023.06.25 12:32:33.515 7 PcscReaderFeature::PcscReaderFeature(card/pcsc/PcscReaderFeature.cpp:22) : features: null
card_pcsc 2023.06.25 12:32:33.515 7 PcscReader::PcscReader(card/pcsc/PcscReader.cpp:25) : "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card 2023.06.25 12:32:33.515 2 ReaderManager::doUpdateCacheEntry(card/base/ReaderManager.cpp:268) : Update cache entry: "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:33.557 7 PcscReader::init(card/pcsc/PcscReader.cpp:42) : SCardEstablishContext: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.557 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:286) : "SCardConnect(6217face, REINER SCT cyberJack RFID komfort (6479140943) 00 00, 3, 1, 0, 0)"
card_pcsc 2023.06.25 12:32:33.589 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:288) : SCardConnect for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.590 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:316) : SCardControl for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.590 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:323) : FEATURES: "060442000db2070442000db3080442000db4090442000db5200442000dcc"
card_pcsc 2023.06.25 12:32:33.590 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:325) : FEATURES: QList(VERIFY_PIN_DIRECT, MODIFY_PIN_DIRECT, MCT_READERDIRECT, MCT_UNIVERSAL, EXECUTE_PACE)
card_pcsc 2023.06.25 12:32:33.590 7 PcscReader::readReaderFeatures(card/pcsc/PcscReader.cpp:296) : SCardDisconnect for "REINER SCT cyberJack RFID komfort (6479140943) 00 00" : "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.590 7 PcscReader::updateCard(card/pcsc/PcscReader.cpp:190) : old state: "(0) UNAWARE" | new state: "(917522) CHANGED EMPTY"
card_pcsc 2023.06.25 12:32:33.590 7 ...derManagerPlugIn::addReaders(card/pcsc/PcscReaderManagerPlugIn.cpp:170) : fireReaderAdded: "REINER SCT cyberJack RFID komfort (6479140943) 00 00" ( 2 reader in total )
card 2023.06.25 12:32:33.605 2 ReaderManager::doUpdateCacheEntry(card/base/ReaderManager.cpp:268) : Update cache entry: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
qml 2023.06.25 12:32:33.904 2 ReaderScanEnabler::enableScan(ui/qml/ReaderScanEnabler.cpp:49) : Stopping scan on PCSC
card 2023.06.25 12:32:33.904 7 ReaderManagerWorker::callOnPlugIn(card/base/ReaderManagerWorker.cpp:131) : Stop scan on plugin: governikus::PcscReaderManagerPlugIn
card_pcsc 2023.06.25 12:32:33.904 7 ...ReaderManagerPlugIn::stopScan(card/pcsc/PcscReaderManagerPlugIn.cpp:74) : SCardReleaseContext: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.904 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:66) : "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:33.904 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:70) : SCardCancel: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.904 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:71) : SCardReleaseContext: "Scard_S_Success"
card 2023.06.25 12:32:33.904 7 ReaderManagerWorker::onReaderRemoved(card/base/ReaderManagerWorker.cpp:59) : fireReaderRemoved: "Alcor Micro AU9540 00 00"
card_pcsc 2023.06.25 12:32:33.904 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:66) : "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card_pcsc 2023.06.25 12:32:33.904 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:70) : SCardCancel: "Scard_S_Success"
card_pcsc 2023.06.25 12:32:33.905 7 PcscReader::~PcscReader(card/pcsc/PcscReader.cpp:71) : SCardReleaseContext: "Scard_S_Success"
card 2023.06.25 12:32:33.905 7 ReaderManagerWorker::onReaderRemoved(card/base/ReaderManagerWorker.cpp:59) : fireReaderRemoved: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card 2023.06.25 12:32:33.905 2 ReaderManager::doRemoveCacheEntry(card/base/ReaderManager.cpp:277) : Remove cache entry: "Alcor Micro AU9540 00 00"
card 2023.06.25 12:32:33.979 2 ReaderManager::doRemoveCacheEntry(card/base/ReaderManager.cpp:277) : Remove cache entry: "REINER SCT cyberJack RFID komfort (6479140943) 00 00"
card 2023.06.25 12:32:33.988 2 ReaderManager::doUpdatePluginCache(card/base/ReaderManager.cpp:286) : Update cache entry: PCSC

Which results in the follwing images flapping (rough estimation: every second)
USB-card-reader-not-detected
USB-card-reader-detected

I have compiled version 1.26.4 community edition from upstream and dection of the REINER SCT cyberJack RFID komfort works fine. I could authenticate with the nPA and see my personal data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants