1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
5 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
7 ;;; Copyright © 2015, 2016, 2017, 2018 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017, 2018 Nils Gillmann <ng0@n0.is>
10 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
11 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
13 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
14 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
15 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages tls)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix utils)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system perl)
39 #:use-module (guix build-system python)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system haskell)
42 #:use-module (guix build-system trivial)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages bash)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages curl)
48 #:use-module (gnu packages dns)
49 #:use-module (gnu packages gawk)
50 #:use-module (gnu packages guile)
51 #:use-module (gnu packages haskell)
52 #:use-module (gnu packages haskell-check)
53 #:use-module (gnu packages haskell-crypto)
54 #:use-module (gnu packages libbsd)
55 #:use-module (gnu packages libffi)
56 #:use-module (gnu packages libidn)
57 #:use-module (gnu packages linux)
58 #:use-module (gnu packages ncurses)
59 #:use-module (gnu packages nettle)
60 #:use-module (gnu packages perl)
61 #:use-module (gnu packages pkg-config)
62 #:use-module (gnu packages python)
63 #:use-module (gnu packages python-crypto)
64 #:use-module (gnu packages python-web)
65 #:use-module (gnu packages python-xyz)
66 #:use-module (gnu packages texinfo)
67 #:use-module (gnu packages time)
68 #:use-module (gnu packages base)
69 #:use-module (srfi srfi-1))
71 (define-public libtasn1
78 (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
82 "1jlc1iahj8k3haz28j55nzg7sgni5h41vqy461i1bpbx6668wlky"))))
83 (build-system gnu-build-system)
85 `(#:configure-flags '("--disable-static")))
86 (native-inputs `(("perl" ,perl)))
87 (home-page "https://www.gnu.org/software/libtasn1/")
88 (synopsis "ASN.1 library")
90 "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
91 for transmitting machine-neutral encodings of data objects in computer
92 networking, allowing for formal validation of data according to some
94 (license license:lgpl2.0+)))
102 (uri (string-append "https://lionet.info/soft/asn1c-"
106 "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0"))))
107 (build-system gnu-build-system)
110 (home-page "https://lionet.info/asn1c")
111 (synopsis "ASN.1 to C compiler")
112 (description "The ASN.1 to C compiler takes ASN.1 module
113 files and generates C++ compatible C source code. That code can be
114 used to serialize the native C structures into compact and unambiguous
115 BER/XER/PER-based data files, and deserialize the files back.
117 Various ASN.1 based formats are widely used in the industry, such as to encode
118 the X.509 certificates employed in the HTTPS handshake, to exchange control
119 data between mobile phones and cellular networks, to car-to-car communication
120 in intelligent transportation networks.")
121 (license license:bsd-2)))
123 (define-public p11-kit
130 (uri (string-append "https://github.com/p11-glue/p11-kit/releases/"
131 "download/" version "/p11-kit-" version ".tar.gz"))
132 (patches (search-patches "p11-kit-jks-timestamps.patch"))
135 "166pwj00cffv4qq4dvx0k53zka0b0r1fa0whc49007vsqyh3khgp"))))
136 (build-system gnu-build-system)
138 `(("pkg-config" ,pkg-config)))
141 ("libtasn1" ,libtasn1)))
143 `(#:configure-flags '("--without-trust-paths")
144 #:phases (modify-phases %standard-phases
145 (add-before 'check 'prepare-tests
147 ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
148 ;; and looks for .cache and other directories (only).
149 ;; For simplicity just drop it since it is irrelevant
150 ;; in the build container.
151 (substitute* "Makefile"
152 (("test-runtime\\$\\(EXEEXT\\)") ""))
154 (home-page "https://p11-glue.freedesktop.org/p11-kit.html")
155 (synopsis "PKCS#11 library")
157 "p11-kit provides a way to load and enumerate PKCS#11 modules. It
158 provides a standard configuration setup for installing PKCS#11 modules
159 in such a way that they are discoverable. It also solves problems with
160 coordinating the use of PKCS#11 by different components or libraries
161 living in the same process.")
162 (license license:bsd-3)))
164 (define-public gnutls
171 ;; Note: Releases are no longer on ftp.gnu.org since the
172 ;; schism (after version 3.1.5).
173 (string-append "mirror://gnupg/gnutls/v"
174 (version-major+minor version)
175 "/gnutls-" version ".tar.xz"))
177 (search-patches "gnutls-skip-trust-store-test.patch"
178 "gnutls-skip-pkgconfig-test.patch"))
181 "0d02x28fwkkx7xzn7807nww6idchizzq3plx8sfcyiw7wzclh8mf"))))
182 (build-system gnu-build-system)
184 `(; Ensure we don't keep a reference to this buggy software.
185 #:disallowed-references (,net-tools)
188 ;; GnuTLS doesn't consult any environment variables to specify
189 ;; the location of the system-wide trust store. Instead it has a
190 ;; configure-time option. Unless specified, its configure script
191 ;; attempts to auto-detect the location by looking for common
192 ;; places in the file system, none of which are present in our
193 ;; chroot build environment. If not found, then no default trust
194 ;; store is used, so each program has to provide its own
195 ;; fallback, and users have to configure each program
196 ;; independently. This seems suboptimal.
197 "--with-default-trust-store-dir=/etc/ssl/certs"
199 ;; FIXME: Temporarily disable p11-kit support since it is not
200 ;; working on mips64el.
203 #:phases (modify-phases %standard-phases
206 (lambda* (#:key outputs #:allow-other-keys)
207 ;; Copy the 4.1 MiB of section 3 man pages to "doc".
208 (let* ((out (assoc-ref outputs "out"))
209 (doc (assoc-ref outputs "doc"))
210 (mandir (string-append doc "/share/man/man3"))
211 (oldman (string-append out "/share/man/man3")))
213 (copy-recursively oldman mandir)
214 (delete-file-recursively oldman)
216 (outputs '("out" ;4.4 MiB
218 "doc")) ;4.1 MiB of man pages
220 `(("net-tools" ,net-tools)
221 ("pkg-config" ,pkg-config)
224 `(("guile" ,guile-2.2)))
226 ;; These are all in the 'Requires.private' field of gnutls.pc.
227 `(("libtasn1" ,libtasn1)
231 (home-page "https://www.gnu.org/software/gnutls/")
232 (synopsis "Transport layer security library")
234 "GnuTLS is a secure communications library implementing the SSL, TLS
235 and DTLS protocols. It is provided in the form of a C library to support the
236 protocols, as well as to parse and write X.5009, PKCS 12, OpenPGP and other
237 required structures.")
238 (license license:lgpl2.1+)
239 (properties '((ftp-server . "ftp.gnutls.org")
240 (ftp-directory . "/gcrypt/gnutls")))))
242 (define-public gnutls/guile-2.2
243 (deprecated-package "guile2.2-gnutls" gnutls))
245 (define-public gnutls/guile-2.0
246 ;; GnuTLS for Guile 2.0.
249 (name "guile2.0-gnutls")
250 (inputs `(("guile" ,guile-2.0)
251 ,@(alist-delete "guile" (package-inputs gnutls))))))
253 (define-public gnutls/dane
254 ;; GnuTLS with build libgnutls-dane, implementing DNS-based
255 ;; Authentication of Named Entities. This is required for GNS functionality
256 ;; by GNUnet and gnURL. This is done in an extra package definition
257 ;; to have the choice between GnuTLS with Dane and without Dane.
261 (inputs `(("unbound" ,unbound)
262 ,@(package-inputs gnutls)))))
264 (define-public openssl
270 (uri (list (string-append "https://www.openssl.org/source/openssl-"
272 (string-append "ftp://ftp.openssl.org/source/"
273 name "-" version ".tar.gz")
274 (string-append "ftp://ftp.openssl.org/source/old/"
275 (string-trim-right version char-set:letter)
276 "/" name "-" version ".tar.gz")))
279 "003xh9f898i56344vpvpxxxzmikivxig4xwlm7vbi7m8n43qxaah"))
280 (patches (search-patches "openssl-runpath.patch"
281 "openssl-c-rehash-in.patch"))))
282 (build-system gnu-build-system)
284 "doc" ;1.5MiB of man3 pages
285 "static")) ;6MiB of .a files
286 (native-inputs `(("perl" ,perl)))
288 `(#:disallowed-references (,perl)
293 ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
294 ;; so we explicitly disallow it here.
295 #:disallowed-references ,(list (canonical-package perl))
297 (modify-phases %standard-phases
299 'configure 'patch-Makefile.org
300 (lambda* (#:key outputs #:allow-other-keys)
301 ;; The default MANDIR is some unusual place. Fix that.
302 (let ((out (assoc-ref outputs "out")))
303 (patch-makefile-SHELL "Makefile.org")
304 (substitute* "Makefile.org"
305 (("^MANDIR[[:blank:]]*=.*$")
306 (string-append "MANDIR = " out "/share/man\n")))
310 (lambda* (#:key outputs #:allow-other-keys)
311 (let ((out (assoc-ref outputs "out")))
313 "shared" ;build shared libraries
316 ;; The default for this catch-all directory is
317 ;; PREFIX/ssl. Change that to something more
319 (string-append "--openssldir=" out
320 "/share/openssl-" ,version)
322 (string-append "--prefix=" out)))))
324 'install 'make-libraries-writable
325 (lambda* (#:key outputs #:allow-other-keys)
326 ;; Make libraries writable so that 'strip' does its job.
327 (let ((out (assoc-ref outputs "out")))
328 (for-each (lambda (file)
330 (find-files (string-append out "/lib")
333 (add-after 'install 'move-static-libraries
334 (lambda* (#:key outputs #:allow-other-keys)
335 ;; Move static libraries to the "static" output.
336 (let* ((out (assoc-ref outputs "out"))
337 (lib (string-append out "/lib"))
338 (static (assoc-ref outputs "static"))
339 (slib (string-append static "/lib")))
340 (for-each (lambda (file)
341 (install-file file slib)
343 (find-files lib "\\.a$"))
345 (add-after 'install 'move-man3-pages
346 (lambda* (#:key outputs #:allow-other-keys)
347 ;; Move section 3 man pages to "doc".
348 (let* ((out (assoc-ref outputs "out"))
349 (man3 (string-append out "/share/man/man3"))
350 (doc (assoc-ref outputs "doc"))
351 (target (string-append doc "/share/man/man3")))
353 (for-each (lambda (file)
355 (string-append target "/"
358 (delete-file-recursively man3)
361 'patch-source-shebangs 'patch-tests
362 (lambda* (#:key inputs native-inputs #:allow-other-keys)
363 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
364 (substitute* (find-files "test" ".*")
366 (string-append bash "/bin/sh"))
371 'install 'remove-miscellany
372 (lambda* (#:key outputs #:allow-other-keys)
373 ;; The 'misc' directory contains random undocumented shell and Perl
374 ;; scripts. Remove them to avoid retaining a reference on Perl.
375 (let ((out (assoc-ref outputs "out")))
376 (delete-file-recursively (string-append out "/share/openssl-"
380 (list (search-path-specification
381 (variable "SSL_CERT_DIR")
382 (separator #f) ;single entry
383 (files '("etc/ssl/certs")))
384 (search-path-specification
385 (variable "SSL_CERT_FILE")
387 (separator #f) ;single entry
388 (files '("etc/ssl/certs/ca-certificates.crt")))))
389 (synopsis "SSL/TLS implementation")
391 "OpenSSL is an implementation of SSL/TLS.")
392 (license license:openssl)
393 (home-page "https://www.openssl.org/")))
395 (define-public openssl-next
402 (uri (list (string-append "https://www.openssl.org/source/openssl-"
404 (string-append "ftp://ftp.openssl.org/source/"
405 name "-" version ".tar.gz")
406 (string-append "ftp://ftp.openssl.org/source/old/"
407 (string-trim-right version char-set:letter)
408 "/" name "-" version ".tar.gz")))
409 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
412 "0hcz7znzznbibpy3iyyhvlqrq44y88plxwdj32wjzgbwic7i687w"))))
414 "doc" ; 6.8 MiB of man3 pages and full HTML documentation
415 "static")) ; 6.4 MiB of .a files
417 (substitute-keyword-arguments (package-arguments openssl)
419 `(modify-phases ,phases
420 (delete 'patch-tests) ; These two phases are not needed by
421 (delete 'patch-Makefile.org) ; OpenSSL 1.1.
423 ;; Override configure phase since -rpath is now a configure option.
425 (lambda* (#:key outputs #:allow-other-keys)
426 (let* ((out (assoc-ref outputs "out"))
427 (lib (string-append out "/lib")))
428 ;; It's not a shebang so patch-source-shebangs misses it.
429 (substitute* "config"
431 (string-append (assoc-ref %build-inputs "coreutils")
434 "shared" ;build shared libraries
437 ;; The default for this catch-all directory is
438 ;; PREFIX/ssl. Change that to something more
440 (string-append "--openssldir=" out
441 "/share/openssl-" ,version)
443 (string-append "--prefix=" out)
444 (string-append "-Wl,-rpath," lib)
446 ;; XXX FIXME: Work around a code generation bug in GCC
447 ;; 4.9.3 on ARM when compiled with -mfpu=neon. See:
448 ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66917>
449 ,@(if (and (not (%current-target-system))
450 (string-prefix? "armhf" (%current-system)))
454 (delete 'move-man3-pages)
455 (add-after 'install 'move-extra-documentation
456 (lambda* (#:key outputs #:allow-other-keys)
457 ;; Move man3 pages and full HTML documentation to "doc".
458 (let* ((out (assoc-ref outputs "out"))
459 (man3 (string-append out "/share/man/man3"))
460 (html (string-append out "/share/doc/openssl"))
461 (doc (assoc-ref outputs "doc"))
462 (man-target (string-append doc "/share/man/man3"))
463 (html-target (string-append doc "/share/doc/openssl")))
464 (copy-recursively man3 man-target)
465 (delete-file-recursively man3)
466 (copy-recursively html html-target)
467 (delete-file-recursively html)
469 ;; XXX: Duplicate this phase to make sure 'version' evaluates
470 ;; in the current scope and not the inherited one.
471 (replace 'remove-miscellany
472 (lambda* (#:key outputs #:allow-other-keys)
473 ;; The 'misc' directory contains random undocumented shell and Perl
474 ;; scripts. Remove them to avoid retaining a reference on Perl.
475 (let ((out (assoc-ref outputs "out")))
476 (delete-file-recursively (string-append out "/share/openssl-"
480 (define-public libressl
486 (uri (string-append "mirror://openbsd/LibreSSL/"
487 name "-" version ".tar.gz"))
490 "19kxa5i97q7p6rrps9qm0nd8zqhdjvzx02j72400c73cl2nryfhy"))))
491 (build-system gnu-build-system)
493 ;; Do as if 'getentropy' was missing since older Linux kernels lack it
494 ;; and libc would return ENOSYS, which is not properly handled.
495 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
496 '(#:configure-flags '("ac_cv_func_getentropy=no"
497 ;; Provide a TLS-enabled netcat.
500 ;; FIXME: These two variables must designate a single file or directory
501 ;; and are not actually "search paths." In practice it works OK in
502 ;; user profiles because there's always just one item that matches the
504 (list (search-path-specification
505 (variable "SSL_CERT_DIR")
506 (files '("etc/ssl/certs")))
507 (search-path-specification
508 (variable "SSL_CERT_FILE")
509 (files '("etc/ssl/certs/ca-certificates.crt")))))
510 (home-page "https://www.libressl.org/")
511 (synopsis "SSL/TLS implementation")
512 (description "LibreSSL is a version of the TLS/crypto stack, forked from
513 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
514 and applying best practice development processes. This package also includes a
515 netcat implementation that supports TLS.")
516 ;; Files taken from OpenSSL keep their license, others are under various
517 ;; non-copyleft licenses.
518 (license (list license:openssl
519 (license:non-copyleft
521 "See COPYING in the distribution.")))))
523 (define-public python-acme
526 ;; Remember to update the hash of certbot when updating python-acme.
530 (uri (pypi-uri "acme" version))
533 "1wmqxrl4w9w79jd16bmxp8g3xbrx3az4137zbip8x44zrrzmnni9"))))
534 (build-system python-build-system)
537 (modify-phases %standard-phases
538 (add-after 'build 'build-documentation
540 (invoke "make" "-C" "docs" "man" "info")))
541 (add-after 'install 'install-documentation
542 (lambda* (#:key outputs #:allow-other-keys)
543 (let* ((out (assoc-ref outputs "out"))
544 (man (string-append out "/share/man/man1"))
545 (info (string-append out "/info")))
546 (install-file "docs/_build/texinfo/acme-python.info" info)
547 (install-file "docs/_build/man/acme-python.1" man)
549 ;; TODO: Add optional inputs for testing.
551 `(("python-mock" ,python-mock)
552 ("python-pytest" ,python-pytest)
554 ("python-sphinx" ,python-sphinx)
555 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
556 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
557 ("texinfo" ,texinfo)))
559 `(("python-josepy" ,python-josepy)
560 ("python-six" ,python-six)
561 ("python-requests" ,python-requests)
562 ("python-requests-toolbelt" ,python-requests-toolbelt)
563 ("python-pytz" ,python-pytz)
564 ("python-pyrfc3339" ,python-pyrfc3339)
565 ("python-pyasn1" ,python-pyasn1)
566 ("python-cryptography" ,python-cryptography)
567 ("python-pyopenssl" ,python-pyopenssl)))
568 (home-page "https://github.com/certbot/certbot")
569 (synopsis "ACME protocol implementation in Python")
570 (description "ACME protocol implementation in Python")
571 (license license:asl2.0)))
573 (define-public certbot
576 ;; Certbot and python-acme are developed in the same repository, and their
577 ;; versions should remain synchronized.
578 (version (package-version python-acme))
581 (uri (pypi-uri name version))
584 "0vkpqwps1c8ja140kiiz2cws9hqjrbkx58wbji3qxv9cap5qfi2k"))))
585 (build-system python-build-system)
587 `(,@(substitute-keyword-arguments (package-arguments python-acme)
589 `(modify-phases ,phases
590 (replace 'install-documentation
591 (lambda* (#:key outputs #:allow-other-keys)
592 (let* ((out (assoc-ref outputs "out"))
593 (man1 (string-append out "/share/man/man1"))
594 (man7 (string-append out "/share/man/man7"))
595 (info (string-append out "/info")))
596 (install-file "docs/_build/texinfo/Certbot.info" info)
597 (install-file "docs/_build/man/certbot.1" man1)
598 (install-file "docs/_build/man/certbot.7" man7)
600 ;; TODO: Add optional inputs for testing.
602 `(("python-nose" ,python-nose)
603 ("python-mock" ,python-mock)
605 ("python-sphinx" ,python-sphinx)
606 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
607 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
608 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
609 ("texinfo" ,texinfo)))
611 `(("python-acme" ,python-acme)
612 ("python-zope-interface" ,python-zope-interface)
613 ("python-pyrfc3339" ,python-pyrfc3339)
614 ("python-pyopenssl" ,python-pyopenssl)
615 ("python-configobj" ,python-configobj)
616 ("python-configargparse" ,python-configargparse)
617 ("python-zope-component" ,python-zope-component)
618 ("python-parsedatetime" ,python-parsedatetime)
619 ("python-six" ,python-six)
620 ("python-psutil" ,python-psutil)
621 ("python-requests" ,python-requests)
622 ("python-pytz" ,python-pytz)))
623 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
624 (description "Certbot automatically receives and installs X.509 certificates
625 to enable Transport Layer Security (TLS) on servers. It interoperates with the
626 Let’s Encrypt certificate authority (CA), which issues browser-trusted
627 certificates for free.")
628 (home-page "https://certbot.eff.org/")
629 (license license:asl2.0)))
631 (define-public letsencrypt
632 (package (inherit certbot)
634 (properties `((superseded . ,certbot)))))
636 (define-public perl-net-ssleay
638 (name "perl-net-ssleay")
642 (uri (string-append "mirror://cpan/authors/id/M/MI/MIKEM/"
643 "Net-SSLeay-" version ".tar.gz"))
646 "1j5h4ycm8538397l204d2d5fkm9595aj174pj7bkpbhwzfwqi0cx"))))
647 (build-system perl-build-system)
648 (inputs `(("openssl" ,openssl)))
651 (modify-phases %standard-phases
653 'configure 'set-ssl-prefix
654 (lambda* (#:key inputs #:allow-other-keys)
655 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
657 (synopsis "Perl extension for using OpenSSL")
659 "This module offers some high level convenience functions for accessing
660 web pages on SSL servers (for symmetry, the same API is offered for accessing
661 http servers, too), an sslcat() function for writing your own clients, and
662 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
663 servers or clients for more complicated applications.")
664 (license license:perl-license)
665 (home-page "https://metacpan.org/release/Net-SSLeay")))
667 (define-public perl-crypt-openssl-rsa
669 (name "perl-crypt-openssl-rsa")
675 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
680 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
681 (build-system perl-build-system)
683 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
685 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
686 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
687 ("openssl" ,openssl)))
688 (arguments perl-crypt-arguments)
690 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
692 "RSA encoding and decoding, using the openSSL libraries")
693 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
694 OpenSSL libraries).")
695 (license license:perl-license)))
697 (define perl-crypt-arguments
698 `(#:phases (modify-phases %standard-phases
699 (add-before 'configure 'patch-Makefile.PL
700 (lambda* (#:key inputs #:allow-other-keys)
701 (substitute* "Makefile.PL"
702 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
703 (assoc-ref inputs "openssl")
704 "/lib -lcrypto'],")))
707 (define-public perl-crypt-openssl-bignum
709 (name "perl-crypt-openssl-bignum")
715 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
720 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
721 (build-system perl-build-system)
722 (inputs `(("openssl" ,openssl)))
723 (arguments perl-crypt-arguments)
725 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
727 "OpenSSL's multiprecision integer arithmetic in Perl")
728 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
729 arithmetic in Perl.")
730 ;; At your option either gpl1+ or the Artistic License
731 (license license:perl-license)))
733 (define-public perl-crypt-openssl-guess
735 (name "perl-crypt-openssl-guess")
741 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
745 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
746 (build-system perl-build-system)
747 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
748 (synopsis "Guess the OpenSSL include path")
750 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
751 correct OpenSSL include path. It is intended for use in your
752 @file{Makefile.PL}.")
753 (license license:perl-license)))
755 (define-public perl-crypt-openssl-random
757 (name "perl-crypt-openssl-random")
763 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
768 "0vmvrb3shrzjzri3qn524dzdasbq8zhhbpc1vmq8sx68n4jhizb0"))))
769 (build-system perl-build-system)
771 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
773 `(("openssl" ,openssl)))
774 (arguments perl-crypt-arguments)
776 "https://metacpan.org/release/Crypt-OpenSSL-Random")
778 "OpenSSL/LibreSSL pseudo-random number generator access")
779 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
781 (license license:perl-license)))
783 (define-public acme-client
789 (uri (string-append "https://kristaps.bsd.lv/" name "/"
790 "snapshots/" name "-portable-"
794 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
795 (build-system gnu-build-system)
797 '(#:tests? #f ; no test suite
800 (string-append "PREFIX=" (assoc-ref %outputs "out")))
802 (modify-phases %standard-phases
803 (add-after 'unpack 'patch-paths
804 (lambda* (#:key inputs #:allow-other-keys)
805 (let ((pem (string-append (assoc-ref inputs "libressl")
806 "/etc/ssl/cert.pem")))
807 (substitute* "http.c"
808 (("/etc/ssl/cert.pem") pem))
810 (delete 'configure)))) ; no './configure' script
812 `(("pkg-config" ,pkg-config)))
815 ("libressl" ,libressl)))
816 (synopsis "Let's Encrypt client by the OpenBSD project")
817 (description "acme-client is a Let's Encrypt client implemented in C. It
818 uses a modular design, and attempts to secure itself by dropping privileges and
819 operating in a chroot where possible. acme-client is developed on OpenBSD and
820 then ported to the GNU / Linux environment.")
821 (home-page "https://kristaps.bsd.lv/acme-client/")
822 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
823 ;; and 'jsmn.c' are distributed under the Expat license.
824 (license (list license:isc license:expat))))
826 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
827 ;; variant exists in addition to the "-apache" one.
828 (define-public mbedtls-apache
830 (name "mbedtls-apache")
835 ;; XXX: The download links on the website are script redirection links
836 ;; which effectively lead to the format listed in the uri here.
837 (uri (string-append "https://tls.mbed.org/download/mbedtls-"
838 version "-apache.tgz"))
841 "1qlscr0m97favkqmrlj90rlgw40h8lcypxz0snvr1iwkj1pbbnp3"))))
842 (build-system cmake-build-system)
845 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON")))
849 (synopsis "Small TLS library")
851 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
852 for developers to include cryptographic and SSL/TLS capabilities in their
853 (embedded) products, facilitating this functionality with a minimal
855 (home-page "https://tls.mbed.org")
856 (license license:asl2.0)))
858 ;; The Hiawatha Web server requires some specific features to be enabled.
859 (define-public mbedtls-for-hiawatha
862 (inherit mbedtls-apache)
864 (substitute-keyword-arguments
866 (modify-phases %standard-phases
867 (add-after 'configure 'configure-extra-features
869 (for-each (lambda (feature)
870 (invoke "scripts/config.pl" "set" feature))
871 (list "MBEDTLS_THREADING_C"
872 "MBEDTLS_THREADING_PTHREAD"))
874 ,@(package-arguments mbedtls-apache)))))))
876 (define-public ghc-tls
882 (uri (string-append "https://hackage.haskell.org/package/"
883 "tls/tls-" version ".tar.gz"))
886 "1y083724mym28n6xfaz7pcc7zqxdhjpaxpbvzxfbs25qq2px3smv"))))
887 (build-system haskell-build-system)
889 `(("ghc-cereal" ,ghc-cereal)
890 ("ghc-data-default-class" ,ghc-data-default-class)
891 ("ghc-memory" ,ghc-memory)
892 ("ghc-cryptonite" ,ghc-cryptonite)
893 ("ghc-asn1-types" ,ghc-asn1-types)
894 ("ghc-asn1-encoding" ,ghc-asn1-encoding)
895 ("ghc-x509" ,ghc-x509)
896 ("ghc-x509-store" ,ghc-x509-store)
897 ("ghc-x509-validation" ,ghc-x509-validation)
898 ("ghc-async" ,ghc-async)
899 ("ghc-network" ,ghc-network)
900 ("ghc-hourglass" ,ghc-hourglass)))
902 `(("ghc-tasty" ,ghc-tasty)
903 ("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)
904 ("ghc-quickcheck" ,ghc-quickcheck)))
905 (home-page "https://github.com/vincenthz/hs-tls")
907 "TLS/SSL protocol native implementation (Server and Client)")
909 "Native Haskell TLS and SSL protocol implementation for server and client.
910 This provides a high-level implementation of a sensitive security protocol,
911 eliminating a common set of security issues through the use of the advanced
912 type system, high level constructions and common Haskell features. Currently
913 implement the SSL3.0, TLS1.0, TLS1.1 and TLS1.2 protocol, and support RSA and
914 Ephemeral (Elliptic curve and regular) Diffie Hellman key exchanges, and many
916 (license license:bsd-3)))
918 (define-public dehydrated
923 (method url-fetch/tarbomb)
925 "https://github.com/lukas2511/dehydrated/archive/v"
929 "03p80yj6bnzjc6dkp5hb9wpplmlrla8n5src71cnzw4rj53q8cqn"))
930 (file-name (string-append name "-" version ".tar.gz"))))
931 (build-system trivial-build-system)
933 `(#:modules ((guix build utils))
936 (use-modules (guix build utils))
937 (let* ((source (assoc-ref %build-inputs "source"))
938 (out (assoc-ref %outputs "out"))
939 (bin (string-append out "/bin"))
940 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
942 (with-directory-excursion bin
944 (in-vicinity source (string-append "/dehydrated-" ,version
946 (in-vicinity bin "dehydrated"))
947 (patch-shebang "dehydrated" (list bash))
949 ;; Do not try to write in the store.
950 (substitute* "dehydrated"
951 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
954 (wrap-program "dehydrated"
957 (string-append dir "/bin"))
959 (assoc-ref %build-inputs input))
970 ("coreutils" ,coreutils)
972 ("diffutils" ,diffutils)
977 (home-page "https://dehydrated.io/")
978 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
979 (description "Dehydrated is a client for signing certificates with an
980 ACME-server (currently only provided by Let's Encrypt) implemented as a
981 relatively simple Bash script.")
982 (license license:expat)))