1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Mike Gerwitz <mtg@gnu.org>
5 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2018, 2019 Chris Marusich <cmmarusich@gmail.com>
10 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
11 ;;; Copyright © 2020 Raphaël Mélotte <raphael.melotte@mind.be>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages security-token)
29 #:use-module (gnu packages)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix gexp)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system glib-or-gtk)
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages curl)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages docbook)
43 #:use-module (gnu packages documentation)
44 #:use-module (gnu packages dns)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages graphviz)
47 #:use-module (gnu packages gnupg)
48 #:use-module (gnu packages gtk)
49 #:use-module (gnu packages libusb)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages man)
52 #:use-module (gnu packages networking)
53 #:use-module (gnu packages cyrus-sasl)
54 #:use-module (gnu packages popt)
55 #:use-module (gnu packages readline)
56 #:use-module (gnu packages tls)
57 #:use-module (gnu packages tex)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages python-crypto)
62 #:use-module (gnu packages python-xyz)
63 #:use-module (gnu packages swig)
64 #:use-module (gnu packages web)
65 #:use-module (gnu packages xml))
73 (uri (string-append "https://ccid.apdu.fr/files/ccid-"
77 "02mlbpnsvy6jgwpz0jk5lh27y3cn2bsyz9xini7898m9b5dn9xz6"))))
78 (build-system gnu-build-system)
80 `(#:configure-flags (list (string-append "--enable-usbdropdir=" %output
83 (modify-phases %standard-phases
84 (add-after 'unpack 'patch-Makefile
86 (substitute* "src/Makefile.in"
87 (("/bin/echo") (which "echo")))
91 ("pkg-config" ,pkg-config)))
94 ("pcsc-lite" ,pcsc-lite)))
95 (home-page "https://ccid.apdu.fr/")
96 (synopsis "PC/SC driver for USB smart card devices")
98 "This package provides a PC/SC IFD handler implementation for devices
99 compliant with the CCID and ICCD protocols. It supports a wide range of
100 readers and is needed to communicate with such devices through the
101 @command{pcscd} resource manager.")
102 (license license:lgpl2.1+)))
104 (define-public eid-mw
112 (url "https://github.com/Fedict/eid-mw")
113 (commit (string-append "v" version))))
114 (file-name (git-file-name name version))
116 (base32 "1hyxsbxjjn9hh5p7jlcfb5yplf3n8dg49dfgi8fjp95phis3gbd4"))))
117 (build-system glib-or-gtk-build-system)
119 `(("autoconf" ,autoconf)
120 ("autoconf-archive" ,autoconf-archive)
121 ("automake" ,automake)
122 ("gettext" ,gettext-minimal)
124 ("libassuan" ,libassuan)
125 ("pkg-config" ,pkg-config)
131 ("pcsc-lite" ,pcsc-lite)
133 ("libproxy" ,libproxy)
135 ("cyrus-sasl" ,cyrus-sasl)))
138 (list "--disable-static")
140 (modify-phases %standard-phases
143 ;; configure.ac relies on ‘git --describe’ to get the version.
144 ;; Patch it to just return the real version number directly.
145 (substitute* "scripts/build-aux/genver.sh"
146 (("/bin/sh") (which "sh"))
147 (("^(GITDESC=).*" _ match) (string-append match ,version "\n")))
148 (invoke "sh" "./bootstrap.sh")))
149 (add-after 'unpack 'make-reproducible
151 (substitute* "scripts/mac/create-vers.sh"
155 ;; Remove failing test that was removed upstream after version 5.0.8.
156 ;; See: https://github.com/Fedict/eid-mw/commit/3d1187b1b61118b9ae97607903d3d2fc0bad7518
157 (add-before 'check 'remove-failing-test
159 (substitute* "tests/unit/Makefile.am"
160 (("sign_state ordering cardcom_common")
161 "sign_state ordering #cardcom_common"))
164 (synopsis "Belgian eID Middleware")
165 (description "The Belgian eID Middleware is required to authenticate with
166 online services using the Belgian electronic identity card.")
167 (home-page "https://github.com/Fedict/eid-mw")
168 (license license:lgpl3)))
170 (define-public libyubikey
177 "https://developers.yubico.com/yubico-c/Releases/"
178 name "-" version ".tar.gz"))
181 "009l3k2zyn06dbrlja2d4p2vfnzjhlcqxi88v02mlrnb17mx1v84"))))
182 (build-system gnu-build-system)
183 (synopsis "Development kit for the YubiKey authentication device")
185 "This package contains a C library and command-line tools that make up
186 the low-level development kit for the Yubico YubiKey authentication device.")
187 (home-page "https://developers.yubico.com/yubico-c/")
188 (license license:bsd-2)))
190 (define-public softhsm
197 "https://dist.opendnssec.org/source/"
198 "softhsm-" version ".tar.gz"))
201 "1wkmyi6n3z2pak1cj5yk6v6bv9w0m24skycya48iikab0mrr8931"))))
202 (build-system gnu-build-system)
204 '(#:configure-flags '("--disable-gost"))) ; TODO Missing the OpenSSL
207 `(("openssl" ,openssl)))
209 `(("pkg-config" ,pkg-config)
210 ("cppunit" ,cppunit)))
211 (synopsis "Software implementation of a generic cryptographic device")
213 "SoftHSM 2 is a software implementation of a generic cryptographic device
214 with a PKCS #11 Cryptographic Token Interface.")
215 (home-page "https://www.opendnssec.org/softhsm/")
216 (license license:bsd-2)))
218 (define-public pcsc-lite
224 (uri (string-append "https://pcsclite.apdu.fr/files/"
225 "pcsc-lite-" version ".tar.bz2"))
228 "1y9f9zipnrmgiw0mxrvcgky8vfrcmg6zh40gbln5a93i2c1x8j01"))))
229 (build-system gnu-build-system)
231 `(#:configure-flags '("--enable-usbdropdir=/var/lib/pcsc/drivers"
232 "--disable-libsystemd")))
234 `(("perl" ,perl) ; for pod2man
235 ("pkg-config" ,pkg-config)))
237 `(("libudev" ,eudev)))
238 (home-page "https://pcsclite.apdu.fr/")
239 (synopsis "Middleware to access a smart card using PC/SC")
241 "pcsc-lite provides an interface to communicate with smartcards and
242 readers using the SCard API. pcsc-lite is used to connect to the PC/SC daemon
243 from a client application and provide access to the desired reader.")
244 (license (list license:bsd-3 ; pcsc-lite
245 license:isc ; src/strlcat.c src/strlcpy.c
246 license:gpl3+)))) ; src/spy/*
248 (define-public ykclient
255 "https://developers.yubico.com/yubico-c-client/Releases/"
256 name "-" version ".tar.gz"))
259 "05jhx9waj3pl120ddnwap1v3bjrnbfhvf3lxs2xmhpcmwzpwsqgl"))))
260 (build-system gnu-build-system)
262 ;; There's just one test, and it requires network access to access
263 ;; yubico.com, so skip it.
264 (arguments '(#:tests? #f))
266 (native-inputs `(("pkg-config" ,pkg-config)
267 ("help2man" ,help2man)))
268 (inputs `(("curl" ,curl)))
269 (synopsis "C library to validate one-time-password YubiKeys")
271 "YubiKey C Client Library (libykclient) is a C library used to validate a
272 one-time-password (OTP) YubiKey against Yubico’s servers. See the Yubico
273 website for more information about Yubico and the YubiKey.")
274 (home-page "https://developers.yubico.com/yubico-c-client/")
275 (license license:bsd-2)))
277 (define-public opensc
284 "https://github.com/OpenSC/OpenSC/releases/download/"
285 version "/opensc-" version ".tar.gz"))
288 "0pijycjwpll9zn83dazgsh8n9ywq0z1ragjsd1sqv3abrcfvpyrb"))))
289 (build-system gnu-build-system)
292 (modify-phases %standard-phases
293 ;; By setting an absolute path here, we arrange for OpenSC to
294 ;; successfully dlopen libpcsclite.so.1 by default. The user can
295 ;; still override this if they want to, by specifying a custom OpenSC
296 ;; configuration file at runtime.
297 (add-after 'unpack 'set-default-libpcsclite.so.1-path
298 (lambda* (#:key inputs #:allow-other-keys)
299 (let ((libpcsclite (string-append (assoc-ref inputs "pcsc-lite")
300 "/lib/libpcsclite.so.1")))
301 (substitute* "configure"
302 (("DEFAULT_PCSC_PROVIDER=\"libpcsclite\\.so\\.1\"")
304 "DEFAULT_PCSC_PROVIDER=\"" libpcsclite "\"")))
307 `(("readline" ,readline)
309 ("pcsc-lite" ,pcsc-lite)
312 `(("libxslt" ,libxslt)
313 ("docbook-xsl" ,docbook-xsl)
314 ("pkg-config" ,pkg-config)))
315 (home-page "https://github.com/OpenSC/OpenSC/wiki")
316 (synopsis "Tools and libraries related to smart cards")
318 "OpenSC is a set of software tools and libraries to work with smart
319 cards, with the focus on smart cards with cryptographic capabilities. OpenSC
320 facilitate the use of smart cards in security applications such as
321 authentication, encryption and digital signatures. OpenSC implements the PKCS
322 #15 standard and the PKCS #11 API.")
323 (license license:lgpl2.1+)))
325 (define-public yubico-piv-tool
327 (name "yubico-piv-tool")
332 "https://developers.yubico.com/yubico-piv-tool/Releases/"
333 name "-" version ".tar.gz"))
336 "10xgdc51xvszkxmsvqnbjs8ixxz7rfnfahh3wn8glllynmszbhwi"))))
337 (build-system gnu-build-system)
339 `(("gengetopt" ,gengetopt)
341 ("pcsc-lite" ,pcsc-lite)
342 ("openssl" ,openssl)))
344 `(("doxygen" ,doxygen)
345 ("graphviz" ,graphviz)
346 ("help2man" ,help2man)
348 ("texlive-bin" ,texlive-bin)
349 ("pkg-config" ,pkg-config)))
350 (home-page "https://developers.yubico.com/yubico-piv-tool/")
351 (synopsis "Interact with the PIV application on a YubiKey")
353 "The Yubico PIV tool is used for interacting with the Privilege and
354 Identification Card (PIV) application on a YubiKey. With it you may generate
355 keys on the device, import keys and certificates, create certificate requests,
356 and other operations. It includes a library and a command-line tool.")
357 ;; The file ykcs11/pkcs11.h also declares an additional, very short free
358 ;; license for that one file. Please see it for details. The vast
359 ;; majority of files are licensed under bsd-2.
360 (license license:bsd-2)))
362 (define-public yubikey-personalization
364 (name "yubikey-personalization")
369 "https://developers.yubico.com/" name
370 "/Releases/ykpers-" version ".tar.gz"))
373 "0jhvnavjrpwzmmjcw486df5s48j53njqgyz36yz3dskbaz3kwlfr"))))
374 (build-system gnu-build-system)
376 '(#:configure-flags (list (string-append "--with-udevrulesdir="
377 (assoc-ref %outputs "out")
378 "/lib/udev/rules.d"))))
380 `(("json-c" ,json-c-0.13)
382 ;; The library "libyubikey" is also known as "yubico-c".
383 ("libyubikey" ,libyubikey)))
385 `(("pkg-config" ,pkg-config)
387 (home-page "https://developers.yubico.com/yubikey-personalization/")
388 (synopsis "Library and tools to personalize YubiKeys")
390 "The YubiKey Personalization package contains a C library and command
391 line tools for personalizing YubiKeys. You can use these to set an AES key,
392 retrieve a YubiKey's serial number, and so forth.")
393 (license license:bsd-2)))
395 (define-public python-pyscard
397 (name "python-pyscard")
401 ;; The maintainer publishes releases on various sites, but
402 ;; SourceForge is apparently the only one with a signed release.
404 "mirror://sourceforge/pyscard/pyscard/pyscard%20"
405 version "/pyscard-" version ".tar.gz"))
408 "082cjkbxadaz2jb4rbhr0mkrirzlqyqhcf3r823qb0q1k50ybgg6"))))
409 (build-system python-build-system)
412 (modify-phases %standard-phases
413 ;; Tell pyscard where to find the PCSC include directory.
414 (add-after 'unpack 'patch-platform-include-dirs
415 (lambda* (#:key inputs #:allow-other-keys)
416 (let ((pcsc-include-dir (string-append
417 (assoc-ref inputs "pcsc-lite")
419 (substitute* "setup.py"
420 (("platform_include_dirs = \\[.*?\\]")
422 "platform_include_dirs = ['" pcsc-include-dir "']")))
424 ;; pyscard wants to dlopen libpcsclite, so tell it where it is.
425 (add-after 'unpack 'patch-dlopen
426 (lambda* (#:key inputs #:allow-other-keys)
427 (substitute* "smartcard/scard/winscarddll.c"
428 (("lib = \"libpcsclite\\.so\\.1\";")
431 (string-append (assoc-ref inputs "pcsc-lite")
432 "/lib/libpcsclite.so.1"))))
435 `(("pcsc-lite" ,pcsc-lite)))
438 (home-page "https://github.com/LudovicRousseau/pyscard")
439 (synopsis "Smart card library for Python")
441 "The pyscard smart card library is a framework for building smart card
442 aware applications in Python. The smart card module is built on top of the
443 PCSC API Python wrapper module.")
444 (license license:lgpl2.1+)))
446 (define-public python2-pyscard
447 (package-with-python2 python-pyscard))
449 (define-public libu2f-host
457 "https://developers.yubico.com"
458 "/libu2f-host/Releases/libu2f-host-" version ".tar.xz"))
461 "0vrivl1dwql6nfi48z6dy56fwy2z13d7abgahgrs2mcmqng7hra2"))))
462 (build-system gnu-build-system)
465 (list "--enable-gtk-doc"
466 (string-append "--with-udevrulesdir="
467 (assoc-ref %outputs "out")
468 "/lib/udev/rules.d"))
470 (modify-phases %standard-phases
471 (add-after 'unpack 'patch-docbook-xml
472 (lambda* (#:key inputs #:allow-other-keys)
473 ;; Avoid a network connection attempt during the build.
474 (substitute* "gtk-doc/u2f-host-docs.xml"
475 (("http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd")
476 (string-append (assoc-ref inputs "docbook-xml")
477 "/xml/dtd/docbook/docbookx.dtd")))
480 `(("json-c" ,json-c-0.13)
483 `(("help2man" ,help2man)
484 ("gengetopt" ,gengetopt)
485 ("pkg-config" ,pkg-config)
487 ("docbook-xml" ,docbook-xml-4.3)
489 (home-page "https://developers.yubico.com/libu2f-host/")
490 ;; TRANSLATORS: The U2F protocol has a "server side" and a "host side".
491 (synopsis "U2F host-side C library and tool")
493 "Libu2f-host provides a C library and command-line tool that implements
494 the host-side of the Universal 2nd Factor (U2F) protocol. There are APIs to
495 talk to a U2F device and perform the U2F Register and U2F Authenticate
497 ;; Most files are LGPLv2.1+, but some files are GPLv3+.
498 (license (list license:lgpl2.1+ license:gpl3+))))
500 (define-public libu2f-server
502 (name "libu2f-server")
508 (url "https://github.com/Yubico/libu2f-server")
509 (commit (string-append "libu2f-server-" version))))
510 (file-name (git-file-name name version))
513 "1nmsfq372zza5y6j13ydincjf324bwfcjg950vykh166xkp6wiic"))))
514 (build-system gnu-build-system)
517 (list "--enable-gtk-doc"
520 `(("json-c" ,json-c-0.13)
521 ("libressl" ,libressl)))
523 `(("autoconf" ,autoconf)
524 ("automake" ,automake)
527 ("gengetopt" ,gengetopt)
528 ("help2man" ,help2man)
529 ("pkg-config" ,pkg-config)
532 (home-page "https://developers.yubico.com/libu2f-server/")
533 ;; TRANSLATORS: The U2F protocol has a "server side" and a "host side".
534 (synopsis "U2F server-side C library")
536 "This is a C library that implements the server-side of the
537 @dfn{Universal 2nd Factor} (U2F) protocol. More precisely, it provides an API
538 for generating the JSON blobs required by U2F devices to perform the U2F
539 Registration and U2F Authentication operations, and functionality for
540 verifying the cryptographic operations.")
541 (license license:bsd-2)))
543 (define-public pam-u2f
551 (url "https://github.com/Yubico/pam-u2f")
552 (commit (string-append "pam_u2f-" version))))
553 (file-name (git-file-name name version))
556 "04d9davyi33gqbvga1rvh9fijp6f16mx2xmnn4n61rnhcn2jac98"))))
557 (build-system gnu-build-system)
560 (list (string-append "--with-pam-dir="
561 (assoc-ref %outputs "out") "/lib/security"))))
563 `(("libu2f-host" ,libu2f-host)
564 ("libu2f-server" ,libu2f-server)
565 ("linux-pam" ,linux-pam)))
567 `(("autoconf" ,autoconf)
568 ("automake" ,automake)
570 ("asciidoc" ,asciidoc)
571 ("pkg-config" ,pkg-config)))
572 (home-page "https://developers.yubico.com/pam-u2f/")
573 (synopsis "PAM module for U2F authentication")
575 "This package provides a module implementing PAM over U2F, providing an
576 easy way to integrate the YubiKey (or other U2F compliant authenticators) into
577 your existing infrastructure.")
578 (license license:bsd-2)))
580 (define-public python-fido2
582 (name "python-fido2")
588 "https://github.com/Yubico/python-fido2/releases/download/"
589 version "/fido2-" version ".tar.gz"))
592 "1pl8d2pr6jzqj4y9qiaddhjgnl92kikjxy0bgzm2jshkzzic8mp3"))
594 ;; Remove bundled dependency.
595 #~(delete-file "fido2/public_suffix_list.dat"))))
596 (build-system python-build-system)
599 (modify-phases %standard-phases
600 (add-after 'unpack 'install-public-suffix-list
601 (lambda* (#:key inputs #:allow-other-keys)
603 (string-append (assoc-ref inputs "public-suffix-list")
604 "/share/public-suffix-list-"
605 ,(package-version public-suffix-list)
606 "/public_suffix_list.dat")
607 "fido2/public_suffix_list.dat")
610 `(("python-cryptography" ,python-cryptography)
611 ("python-six" ,python-six)))
613 `(("python-mock" ,python-mock)
614 ("python-pyfakefs" ,python-pyfakefs)
615 ("public-suffix-list" ,public-suffix-list)))
616 (home-page "https://github.com/Yubico/python-fido2")
617 (synopsis "Python library for communicating with FIDO devices over USB")
619 "This Python library provides functionality for communicating with a Fast
620 IDentity Online (FIDO) device over Universal Serial Bus (USB) as well as
621 verifying attestation and assertion signatures. It aims to support the FIDO
622 Universal 2nd Factor (U2F) and FIDO 2.0 protocols for communicating with a USB
623 authenticator via the Client-to-Authenticator Protocol (CTAP 1 and 2). In
624 addition to this low-level device access, classes defined in the
625 @code{fido2.client} and @code{fido2.server} modules implement higher level
626 operations which are useful when interfacing with an Authenticator, or when
627 implementing a Relying Party.")
628 ;; python-fido2 contains some derivative files originally from pyu2f
629 ;; (https://github.com/google/pyu2f). These files are licensed under the
630 ;; Apache License, version 2.0. The maintainers have customized these
631 ;; files for internal use, so they are not really a bundled dependency.
632 (license (list license:bsd-2 license:asl2.0))))
634 (define-public python-yubikey-manager
636 (name "python-yubikey-manager")
641 "https://developers.yubico.com/yubikey-manager/Releases"
642 "/yubikey-manager-" version ".tar.gz"))
645 "11rsmcaj60k3y5m5gdhr2nbbz0w5dm3m04klyxz0fh5hnpcmr7fm"))))
646 (build-system python-build-system)
648 `(("python-six" ,python-six)
649 ("python-pyscard" ,python-pyscard)
650 ("python-pyusb" ,python-pyusb)
651 ("python-click" ,python-click)
652 ("python-cryptography" ,python-cryptography)
653 ("python-pyopenssl" ,python-pyopenssl)
654 ("python-fido2" ,python-fido2)))
656 `(("yubikey-personalization" ,yubikey-personalization)
657 ("pcsc-lite" ,pcsc-lite)
661 ("python-mock" ,python-mock)))
662 (home-page "https://developers.yubico.com/yubikey-manager/")
663 (synopsis "Command line tool and library for configuring a YubiKey")
665 "Python library and command line tool for configuring a YubiKey. Note
666 that after installing this package, you might still need to add appropriate
667 udev rules to your system configuration to be able to configure the YubiKey as
668 an unprivileged user.")
669 (license license:bsd-2)))