unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
@ 2018-05-01 22:29 Vagrant Cascadian
  2018-05-02  5:57 ` Nils Gillmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Vagrant Cascadian @ 2018-05-01 22:29 UTC (permalink / raw)
  To: 31337

[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]

I've been unable to use my gnuk usb smartcard token with gnupg on
GuixSD, and it appears this is because scdaemon is built without libusb
support:

      $ gpg --card-status
      gpg: selecting openpgp failed: No such device
      gpg: OpenPGP card not available: No such device

Attached is a patch that gets scdaemon working for me and a gnuk...

Unfortunately, enabling libusb causes one of the tets to hang
indefinitely:

      PASS: tests/openpgp/decrypt-session-key.scm
      Checking unwrapping the encryption.
          > encsig-2-keys-3 encsig-2-keys-4 <
      PASS: tests/openpgp/decrypt-unwrap-verify.scm
      Checking signing with the default hash algorithm
          >

So far, I've only been able to get it to work by disabling the
tests... so it's obviously not a good idea to enable without further
troubleshooting.

Another option might be to use pcsc-lite and ccid, but I had even less
luck getting that to work.


live well,
  vagrant


diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index f397482ab..0e9e72784 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -39,6 +39,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages emacs)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages openldap)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
@@ -232,6 +233,7 @@ compatible to GNU Pth.")
        ("libgcrypt" ,libgcrypt)
        ("libgpg-error" ,libgpg-error)
        ("libksba" ,libksba)
+       ("libusb" ,libusb)
        ("npth" ,npth)
        ("openldap" ,openldap)
        ("pcsc-lite" ,pcsc-lite)
@@ -246,12 +248,17 @@ compatible to GNU Pth.")
                           "--enable-all-tests")
       #:phases
       (modify-phases %standard-phases
+	;; (delete 'check)
         (add-before 'configure 'patch-paths
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "scd/scdaemon.c"
               (("\"(libpcsclite\\.so[^\"]*)\"" _ name)
                (string-append "\"" (assoc-ref inputs "pcsc-lite")
                               "/lib/" name "\"")))
+            (substitute* "configure"
+              (("/usr/include/libusb-1.0")
+               (string-append (assoc-ref inputs "libusb")
+                              "/include/libusb-1.0")))
             #t))
         (add-after 'build 'patch-scheme-tests
           (lambda _

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2018-05-01 22:29 bug#31337: Unable to use gnuk usb smartcard token on GuixSD Vagrant Cascadian
@ 2018-05-02  5:57 ` Nils Gillmann
  2018-05-07 10:04 ` Ludovic Courtès
  2018-05-08  5:53 ` Chris Marusich
  2 siblings, 0 replies; 7+ messages in thread
From: Nils Gillmann @ 2018-05-02  5:57 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 31337

Vagrant Cascadian transcribed 3.3K bytes:
> I've been unable to use my gnuk usb smartcard token with gnupg on
> GuixSD, and it appears this is because scdaemon is built without libusb
> support:
> 
>       $ gpg --card-status
>       gpg: selecting openpgp failed: No such device
>       gpg: OpenPGP card not available: No such device
> 
> Attached is a patch that gets scdaemon working for me and a gnuk...
> 
> Unfortunately, enabling libusb causes one of the tets to hang
> indefinitely:
> 
>       PASS: tests/openpgp/decrypt-session-key.scm
>       Checking unwrapping the encryption.
>           > encsig-2-keys-3 encsig-2-keys-4 <
>       PASS: tests/openpgp/decrypt-unwrap-verify.scm
>       Checking signing with the default hash algorithm
>           >

There should be a test-suite.log in some location in the build chroot,
have you checked that? You might need to build with -K.

> So far, I've only been able to get it to work by disabling the
> tests... so it's obviously not a good idea to enable without further
> troubleshooting.
> 
> Another option might be to use pcsc-lite and ccid, but I had even less
> luck getting that to work.
> 
> 
> live well,
>   vagrant
> 
> 
> diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
> index f397482ab..0e9e72784 100644
> --- a/gnu/packages/gnupg.scm
> +++ b/gnu/packages/gnupg.scm
> @@ -39,6 +39,7 @@
>    #:use-module (gnu packages curl)
>    #:use-module (gnu packages crypto)
>    #:use-module (gnu packages emacs)
> +  #:use-module (gnu packages libusb)
>    #:use-module (gnu packages openldap)
>    #:use-module (gnu packages perl)
>    #:use-module (gnu packages perl-check)
> @@ -232,6 +233,7 @@ compatible to GNU Pth.")
>         ("libgcrypt" ,libgcrypt)
>         ("libgpg-error" ,libgpg-error)
>         ("libksba" ,libksba)
> +       ("libusb" ,libusb)
>         ("npth" ,npth)
>         ("openldap" ,openldap)
>         ("pcsc-lite" ,pcsc-lite)
> @@ -246,12 +248,17 @@ compatible to GNU Pth.")
>                            "--enable-all-tests")
>        #:phases
>        (modify-phases %standard-phases
> +	;; (delete 'check)
>          (add-before 'configure 'patch-paths
>            (lambda* (#:key inputs #:allow-other-keys)
>              (substitute* "scd/scdaemon.c"
>                (("\"(libpcsclite\\.so[^\"]*)\"" _ name)
>                 (string-append "\"" (assoc-ref inputs "pcsc-lite")
>                                "/lib/" name "\"")))
> +            (substitute* "configure"
> +              (("/usr/include/libusb-1.0")
> +               (string-append (assoc-ref inputs "libusb")
> +                              "/include/libusb-1.0")))
>              #t))
>          (add-after 'build 'patch-scheme-tests
>            (lambda _

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2018-05-01 22:29 bug#31337: Unable to use gnuk usb smartcard token on GuixSD Vagrant Cascadian
  2018-05-02  5:57 ` Nils Gillmann
@ 2018-05-07 10:04 ` Ludovic Courtès
  2018-05-08  5:53 ` Chris Marusich
  2 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2018-05-07 10:04 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 31337

Hi Vagrant,

Vagrant Cascadian <vagrant@debian.org> skribis:

> I've been unable to use my gnuk usb smartcard token with gnupg on
> GuixSD, and it appears this is because scdaemon is built without libusb
> support:
>
>       $ gpg --card-status
>       gpg: selecting openpgp failed: No such device
>       gpg: OpenPGP card not available: No such device
>
> Attached is a patch that gets scdaemon working for me and a gnuk...
>
> Unfortunately, enabling libusb causes one of the tets to hang
> indefinitely:
>
>       PASS: tests/openpgp/decrypt-session-key.scm
>       Checking unwrapping the encryption.
>           > encsig-2-keys-3 encsig-2-keys-4 <
>       PASS: tests/openpgp/decrypt-unwrap-verify.scm
>       Checking signing with the default hash algorithm
>           >
>
> So far, I've only been able to get it to work by disabling the
> tests... so it's obviously not a good idea to enable without further
> troubleshooting.

Did you try attaching strace or gdb to the faulty test to see what’s
going on?

It may be that this test depends on the availability of special hardware
or something like that, in which case we should arrange to skip just
this test.

Thanks for looking into it!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2018-05-01 22:29 bug#31337: Unable to use gnuk usb smartcard token on GuixSD Vagrant Cascadian
  2018-05-02  5:57 ` Nils Gillmann
  2018-05-07 10:04 ` Ludovic Courtès
@ 2018-05-08  5:53 ` Chris Marusich
  2018-06-02 21:33   ` Vagrant Cascadian
  2 siblings, 1 reply; 7+ messages in thread
From: Chris Marusich @ 2018-05-08  5:53 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 31337

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

Vagrant Cascadian <vagrant@debian.org> writes:

> Another option might be to use pcsc-lite and ccid, but I had even less
> luck getting that to work.

When you tried that, did you enable the USB drivers by creating a
symlink as described here?

https://lists.gnu.org/archive/html/guix-devel/2016-10/msg01433.html

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2018-05-08  5:53 ` Chris Marusich
@ 2018-06-02 21:33   ` Vagrant Cascadian
  2021-06-13  8:04     ` Brice Waegeneire
  0 siblings, 1 reply; 7+ messages in thread
From: Vagrant Cascadian @ 2018-06-02 21:33 UTC (permalink / raw)
  To: Chris Marusich; +Cc: 31337

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On 2018-05-07, Chris Marusich wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
>
>> Another option might be to use pcsc-lite and ccid, but I had even less
>> luck getting that to work.
>
> When you tried that, did you enable the USB drivers by creating a
> symlink as described here?
>
> https://lists.gnu.org/archive/html/guix-devel/2016-10/msg01433.html

With the symlink:

  lrwxrwxrwx 1 root root 41 Jun  2 06:31 /var/lib/pcsc/drivers -> /home/vagrant/.guix-profile/pcsc/drivers/

Then I tried to run:

  pcscd --debug --foreground
  00000000 pcscdaemon.c:347:main() pcscd set to foreground with debug send to stdout
  00000077 pcscdaemon.c:623:main() cannot create /var/run/pcscd: Permission denied

Running as root appears to have worked:

  sudo -E --debug --foreground pcscd

Then as a user, "gpg --card-status" works. Haven't tried any other
functionality yet, but that's a good start.


So this seems like a somewhat complicated workaround, and making a
proper pcscd service would reduce the complication significantly.  It
would obviously be slightly preferable to me for gnupg to support
smartcards out of the box. :)


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2018-06-02 21:33   ` Vagrant Cascadian
@ 2021-06-13  8:04     ` Brice Waegeneire
  2021-07-04 11:01       ` Brice Waegeneire
  0 siblings, 1 reply; 7+ messages in thread
From: Brice Waegeneire @ 2021-06-13  8:04 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 31337

Hello Vagrant,

Vagrant Cascadian <vagrant@debian.org> writes:

> So this seems like a somewhat complicated workaround, and making a
> proper pcscd service would reduce the complication significantly.  It
> would obviously be slightly preferable to me for gnupg to support
> smartcards out of the box. :)

There is a pcscd service in Guix now. Do you still have issue with using
smartcard in Guix or can we close this one?

Cheers,
- Brice




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#31337: Unable to use gnuk usb smartcard token on GuixSD
  2021-06-13  8:04     ` Brice Waegeneire
@ 2021-07-04 11:01       ` Brice Waegeneire
  0 siblings, 0 replies; 7+ messages in thread
From: Brice Waegeneire @ 2021-07-04 11:01 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 31337-close

Brice Waegeneire <brice@waegenei.re> writes:

Closing this issue since it's should be solved.  Feel free to reopen it
if it's not the case.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-04 11:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 22:29 bug#31337: Unable to use gnuk usb smartcard token on GuixSD Vagrant Cascadian
2018-05-02  5:57 ` Nils Gillmann
2018-05-07 10:04 ` Ludovic Courtès
2018-05-08  5:53 ` Chris Marusich
2018-06-02 21:33   ` Vagrant Cascadian
2021-06-13  8:04     ` Brice Waegeneire
2021-07-04 11:01       ` Brice Waegeneire

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).