Giter Club home page Giter Club logo

Comments (8)

emaxx-google avatar emaxx-google commented on August 25, 2024

By the way, you may want to check this project which is basically a port of PC/SC+CCID onto Chrome OS, together with integration with the browser using the Chrome extensions API:
https://github.com/GoogleChromeLabs/chromeos_smart_card_connector
(Although, to be clear, that port isn't directly compiling the native code under Chrome OS, but it rather uses the Native Client technology for sandboxing; it's also possible that the implementation will migrate off the Native Client onto some other technology in the future.)
And if what you need is to implement the PC/SC client application on Chrome OS, then you can build you application as an extension that talks to the Smart Card Connector app that is distributed by Google.

from pcsc.

helge000 avatar helge000 commented on August 25, 2024

@emaxx-google - thanks for getting back to me! My original issue was just a bad lib search path. and of course I found this just after opening the issue ;)

I am using smart-card-connector already. While this works great for the stored ssh key, I have no idea how to get it working with GnuPG (mainly commit signing...). My goal is to create a chromebrew package.

However, running pcscd seems not that easy ... using libusb, the card gets detected but I cannot access it. Maybe you have an idea...

00000561 [133791105814784] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x1050, PID: 0x0116, path: /dev/bus/usb/001/023
00000046 [133791105814784] hotplug_libudev.c:440:HPAddDevice() Adding USB device: Yubico Yubikey NEO OTP+U2F+CCID
00000149 [133791105814784] readerfactory.c:1075:RFInitializeReader() Attempting startup of Yubico Yubikey NEO OTP+U2F+CCID 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000778 [133791105814784] readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000085 [133791105814784] ifdhandler.c:1961:init_driver() Driver version: 1.4.29
00002873 [133791105814784] ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000027 [133791105814784] ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00000599 [133791105814784] ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:1050/0116:libudev:1:/dev/bus/usb/001/023
00000033 [133791105814784] ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00001788 [133791105814784] ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau ([email protected])
00000021 [133791105814784] ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000013 [133791105814784] ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00002853 [133791105814784] ccid_usb.c:634:OpenUSBByName() Found interface 2 but expecting 1
00000030 [133791105814784] ccid_usb.c:636:OpenUSBByName() Wrong interface for USB device 1/23. Checking next one.
00000086 [133791105814784] ccid_usb.c:189:close_libusb_if_needed() libusb_exit
00000141 [133791105814784] ccid_usb.c:789:OpenUSBByName() Device not found?
00000016 [133791105814784] ifdhandler.c:150:CreateChannelByNameOrChannel() failed
00000013 [133791105814784] readerfactory.c:1106:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0116:libudev:1:/dev/bus/usb/001/023)
00000011 [133791105814784] readerfactory.c:376:RFAddReader() Yubico Yubikey NEO OTP+U2F+CCID init failed.

using libudev does not work (i expected that)

from pcsc.

emaxx-google avatar emaxx-google commented on August 25, 2024

I'm not sure I understand fully why the extension wouldn't work, but anyway...

If the Smart Card Connector app is running simultaneously within the browser, then it grabs the USB access to the device so that nothing else in the system can access it.

Otherwise, it may still be that the system prevents the unknown component from accessing the USB. I'm not an expert in this topic, but it may be the permission_broker daemon who's responsible for that - see https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/permission_broker (for example, the "OpenDevice" method).

from pcsc.

helge000 avatar helge000 commented on August 25, 2024

I would gladly use the Smart Card Connector, however I have no idea how to get it to work with gpg-agent... or git for that matter. For testing, I disabled the chrome extensions.

The CrOS Permission Broker makes total sense. But I could get my YubiKey working with Crouton, witch is basically a chroot. I will investigate some more....

from pcsc.

LudovicRousseau avatar LudovicRousseau commented on August 25, 2024

The "Yubico Yubikey NEO OTP+U2F+CCID" is a composite device. It has more than one interface (it is not just a CCID device).

In your logs you have:

00002853 [133791105814784] ccid_usb.c:634:OpenUSBByName() Found interface 2 but expecting 1
00000030 [133791105814784] ccid_usb.c:636:OpenUSBByName() Wrong interface for USB device 1/23. Checking next one.

This is code at https://github.com/LudovicRousseau/CCID/blob/master/src/ccid_usb.c#L631

I don't know why the next interface is not tried (and found).
Is the log complete?
Is the CCID interface present on your reader? See https://ccid.apdu.fr/#CCID_compliant

You can also have a look at "PC/SC sample in Smart Card Connector on Chromebook" https://ludovicrousseau.blogspot.com/2017/03/pcsc-sample-in-smart-card-connector-on.html but that will not help for using GPG on a Chromebook.

from pcsc.

helge000 avatar helge000 commented on August 25, 2024

Below the full debug log (pcscd -fd), from starting the daemon with the YubiKey inserted. The YubiKey is listed as supported and works well on all other devices.

In the end, I suspect LIBUSB_ERROR_ACCESS to be the clue? As @emaxx-google suggested, might be in CroOS security keeping me from accessing the reader (why a chroot can do so is beyond me, however).

I am using the following configure flags:

  • pcsc-lite: ./configure --disable-libudev --disable-libsystemd --enable-libusb --enable-ipcdir=/usr/local/var/run/pcscd --enable-confdir=/usr/local/etc/reader.conf.d --prefix=/usr/local
  • ccis: ./configure --enable-static=yes --prefix=/usr/local --enable-usbdropdir=/usr/local/lib/pcsc/drivers PCSC_CFLAGS=-I/usr/local/include/PCSC PCSC_LIBS="-L/usr/local/lib -lpcsclite" CFLAGS=-lpthread
00000000 debuglog.c:299:DebugLogSetLevel() debug level=debug
00000539 configfile.l:361:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d
00000047 pcscdaemon.c:662:main() pcsc-lite 1.8.24 daemon ready.
00008118 hotplug_libusb.c:538:HPAddHotPluggable() Adding USB device: 1:42:0
00000110 readerfactory.c:1075:RFInitializeReader() Attempting startup of Yubico Yubikey NEO OTP+U2F+CCID 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000498 readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000096 ifdhandler.c:1961:init_driver() Driver version: 1.4.29
00001858 ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000021 ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00000479 ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if0
00000024 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00001313 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau ([email protected])
00000011 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000006 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00001946 ccid_usb.c:560:OpenUSBByName() Can't libusb_open(1/42): LIBUSB_ERROR_ACCESS
00000027 ccid_usb.c:189:close_libusb_if_needed() libusb_exit
00000038 ccid_usb.c:789:OpenUSBByName() Device not found?
00000005 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
00000009 readerfactory.c:1106:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if0)
00000005 readerfactory.c:376:RFAddReader() Yubico Yubikey NEO OTP+U2F+CCID init failed.
00000006 readerfactory.c:610:RFRemoveReader() UnrefReader() count was: 1
00000005 readerfactory.c:1126:RFUnInitializeReader() Attempting shutdown of Yubico Yubikey NEO OTP+U2F+CCID 00 00.
00000004 readerfactory.c:987:RFUnloadReader() Unloading reader driver.
00000088 hotplug_libusb.c:538:HPAddHotPluggable() Adding USB device: 1:42:1
00000013 readerfactory.c:1075:RFInitializeReader() Attempting startup of Yubico Yubikey NEO OTP+U2F+CCID 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000243 readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000030 ifdhandler.c:1961:init_driver() Driver version: 1.4.29
00001188 ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000009 ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00000358 ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if1
00000013 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00001050 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau ([email protected])
00000008 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000005 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00001410 ccid_usb.c:560:OpenUSBByName() Can't libusb_open(1/42): LIBUSB_ERROR_ACCESS
00000018 ccid_usb.c:189:close_libusb_if_needed() libusb_exit
00000021 ccid_usb.c:789:OpenUSBByName() Device not found?
00000005 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
00000005 readerfactory.c:1106:RFInitializeReader() Open Port 0x200001 Failed (usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if1)
00000004 readerfactory.c:376:RFAddReader() Yubico Yubikey NEO OTP+U2F+CCID init failed.
00000004 readerfactory.c:610:RFRemoveReader() UnrefReader() count was: 1
00000004 readerfactory.c:1126:RFUnInitializeReader() Attempting shutdown of Yubico Yubikey NEO OTP+U2F+CCID 00 00.
00000003 readerfactory.c:987:RFUnloadReader() Unloading reader driver.
00000059 hotplug_libusb.c:538:HPAddHotPluggable() Adding USB device: 1:42:2
00000011 readerfactory.c:1075:RFInitializeReader() Attempting startup of Yubico Yubikey NEO OTP+U2F+CCID 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000152 readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000023 ifdhandler.c:1961:init_driver() Driver version: 1.4.29
00001091 ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000009 ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00000402 ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if2
00000014 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00001050 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau ([email protected])
00000007 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000005 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00001377 ccid_usb.c:560:OpenUSBByName() Can't libusb_open(1/42): LIBUSB_ERROR_ACCESS
00000019 ccid_usb.c:189:close_libusb_if_needed() libusb_exit
00000034 ccid_usb.c:789:OpenUSBByName() Device not found?
00000004 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
00000005 readerfactory.c:1106:RFInitializeReader() Open Port 0x200002 Failed (usb:1050/0116:libhal:/org/freedesktop/Hal/devices/usb_device_1050_0116_serialnotneeded_if2)
00000004 readerfactory.c:376:RFAddReader() Yubico Yubikey NEO OTP+U2F+CCID init failed.
00000004 readerfactory.c:610:RFRemoveReader() UnrefReader() count was: 1
00000004 readerfactory.c:1126:RFUnInitializeReader() Attempting shutdown of Yubico Yubikey NEO OTP+U2F+CCID 00 00.
00000003 readerfactory.c:987:RFUnloadReader() Unloading reader driver.
00000087 hotplug_libusb.c:442:HPEstablishUSBNotifications() Driver ifd-ccid.bundle does not support IFD_GENERATE_HOTPLUG. Using active polling instead.
00000007 hotplug_libusb.c:451:HPEstablishUSBNotifications() Polling forced every 1 second(s)
10041435 pcscdaemon.c:193:signal_thread() Received signal: 2
00000059 pcscdaemon.c:226:signal_thread() Preparing for suicide
00967008 hotplug_libusb.c:405:HPRescanUsbBus() Hotplug stopped
00034339 readerfactory.c:1353:RFCleanupReaders() entering cleaning function
00000071 winscard_svc.c:155:ContextsDeinitialize() remaining threads: 0
00000012 pcscdaemon.c:786:at_exit() cleaning /usr/local/var/run/pcscd

from pcsc.

LudovicRousseau avatar LudovicRousseau commented on August 25, 2024

It looks like an access permission denied:

00001410 ccid_usb.c:560:OpenUSBByName() Can't libusb_open(1/42): LIBUSB_ERROR_ACCESS

The problem is not with pcsc-lite itself. You can close the issue.

from pcsc.

KireinaHoro avatar KireinaHoro commented on August 25, 2024

For reference, you can try bind-mounting an alternative group file to /etc/group and add chronos to group usb to work around the permission issue.

from pcsc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.