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, 2019 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, 2019 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"))
176 (patches (search-patches "gnutls-skip-trust-store-test.patch"))
179 "0ddvg97dyrh8dkffv1mdc0knxx5my3qdbzv97s4a6jggmk9wwgh7"))
180 (modules '((guix build utils)))
183 ;; XXX: The generated configure script in GnuTLS 3.6.5
184 ;; apparently does not know about Guile 2.2.
185 (substitute* "configure"
186 (("guile_versions_to_search=\"2\\.0 1\\.8\"")
187 "guile_versions_to_search=\"2.2 2.0 1.8\""))
189 (build-system gnu-build-system)
191 `(; Ensure we don't keep a reference to this buggy software.
192 #:disallowed-references (,net-tools)
195 ;; GnuTLS doesn't consult any environment variables to specify
196 ;; the location of the system-wide trust store. Instead it has a
197 ;; configure-time option. Unless specified, its configure script
198 ;; attempts to auto-detect the location by looking for common
199 ;; places in the file system, none of which are present in our
200 ;; chroot build environment. If not found, then no default trust
201 ;; store is used, so each program has to provide its own
202 ;; fallback, and users have to configure each program
203 ;; independently. This seems suboptimal.
204 "--with-default-trust-store-dir=/etc/ssl/certs"
206 ;; FIXME: Temporarily disable p11-kit support since it is not
207 ;; working on mips64el.
210 #:phases (modify-phases %standard-phases
213 (lambda* (#:key outputs #:allow-other-keys)
214 ;; Copy the 4.1 MiB of section 3 man pages to "doc".
215 (let* ((out (assoc-ref outputs "out"))
216 (doc (assoc-ref outputs "doc"))
217 (mandir (string-append doc "/share/man/man3"))
218 (oldman (string-append out "/share/man/man3")))
220 (copy-recursively oldman mandir)
221 (delete-file-recursively oldman)
223 (outputs '("out" ;4.4 MiB
225 "doc")) ;4.1 MiB of man pages
227 `(("net-tools" ,net-tools)
228 ("pkg-config" ,pkg-config)
231 `(("guile" ,guile-2.2)))
233 ;; These are all in the 'Requires.private' field of gnutls.pc.
234 `(("libtasn1" ,libtasn1)
238 (home-page "https://www.gnu.org/software/gnutls/")
239 (synopsis "Transport layer security library")
241 "GnuTLS is a secure communications library implementing the SSL, TLS
242 and DTLS protocols. It is provided in the form of a C library to support the
243 protocols, as well as to parse and write X.5009, PKCS 12, OpenPGP and other
244 required structures.")
245 (license license:lgpl2.1+)
246 (properties '((ftp-server . "ftp.gnutls.org")
247 (ftp-directory . "/gcrypt/gnutls")))))
249 (define-public gnutls/guile-2.2
250 (deprecated-package "guile2.2-gnutls" gnutls))
252 (define-public gnutls/guile-2.0
253 ;; GnuTLS for Guile 2.0.
256 (name "guile2.0-gnutls")
257 (inputs `(("guile" ,guile-2.0)
258 ,@(alist-delete "guile" (package-inputs gnutls))))))
260 (define-public gnutls/dane
261 ;; GnuTLS with build libgnutls-dane, implementing DNS-based
262 ;; Authentication of Named Entities. This is required for GNS functionality
263 ;; by GNUnet and gnURL. This is done in an extra package definition
264 ;; to have the choice between GnuTLS with Dane and without Dane.
268 (inputs `(("unbound" ,unbound)
269 ,@(package-inputs gnutls)))))
271 (define-public openssl
274 (replacement openssl/fixed)
278 (uri (list (string-append "https://www.openssl.org/source/openssl-"
280 (string-append "ftp://ftp.openssl.org/source/"
281 "openssl-" version ".tar.gz")
282 (string-append "ftp://ftp.openssl.org/source/old/"
283 (string-trim-right version char-set:letter)
284 "/openssl-" version ".tar.gz")))
287 "003xh9f898i56344vpvpxxxzmikivxig4xwlm7vbi7m8n43qxaah"))
288 (patches (search-patches "openssl-runpath.patch"
289 "openssl-c-rehash-in.patch"))))
290 (build-system gnu-build-system)
292 "doc" ;1.5MiB of man3 pages
293 "static")) ;6MiB of .a files
294 (native-inputs `(("perl" ,perl)))
296 `(#:disallowed-references (,perl)
301 ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
302 ;; so we explicitly disallow it here.
303 #:disallowed-references ,(list (canonical-package perl))
305 (modify-phases %standard-phases
307 'configure 'patch-Makefile.org
308 (lambda* (#:key outputs #:allow-other-keys)
309 ;; The default MANDIR is some unusual place. Fix that.
310 (let ((out (assoc-ref outputs "out")))
311 (patch-makefile-SHELL "Makefile.org")
312 (substitute* "Makefile.org"
313 (("^MANDIR[[:blank:]]*=.*$")
314 (string-append "MANDIR = " out "/share/man\n")))
318 (lambda* (#:key outputs #:allow-other-keys)
319 (let ((out (assoc-ref outputs "out")))
321 "shared" ;build shared libraries
324 ;; The default for this catch-all directory is
325 ;; PREFIX/ssl. Change that to something more
327 (string-append "--openssldir=" out
328 "/share/openssl-" ,version)
330 (string-append "--prefix=" out)))))
332 'install 'make-libraries-writable
333 (lambda* (#:key outputs #:allow-other-keys)
334 ;; Make libraries writable so that 'strip' does its job.
335 (let ((out (assoc-ref outputs "out")))
336 (for-each (lambda (file)
338 (find-files (string-append out "/lib")
341 (add-after 'install 'move-static-libraries
342 (lambda* (#:key outputs #:allow-other-keys)
343 ;; Move static libraries to the "static" output.
344 (let* ((out (assoc-ref outputs "out"))
345 (lib (string-append out "/lib"))
346 (static (assoc-ref outputs "static"))
347 (slib (string-append static "/lib")))
348 (for-each (lambda (file)
349 (install-file file slib)
351 (find-files lib "\\.a$"))
353 (add-after 'install 'move-man3-pages
354 (lambda* (#:key outputs #:allow-other-keys)
355 ;; Move section 3 man pages to "doc".
356 (let* ((out (assoc-ref outputs "out"))
357 (man3 (string-append out "/share/man/man3"))
358 (doc (assoc-ref outputs "doc"))
359 (target (string-append doc "/share/man/man3")))
361 (for-each (lambda (file)
363 (string-append target "/"
366 (delete-file-recursively man3)
369 'patch-source-shebangs 'patch-tests
370 (lambda* (#:key inputs native-inputs #:allow-other-keys)
371 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
372 (substitute* (find-files "test" ".*")
374 (string-append bash "/bin/sh"))
379 'install 'remove-miscellany
380 (lambda* (#:key outputs #:allow-other-keys)
381 ;; The 'misc' directory contains random undocumented shell and Perl
382 ;; scripts. Remove them to avoid retaining a reference on Perl.
383 (let ((out (assoc-ref outputs "out")))
384 (delete-file-recursively (string-append out "/share/openssl-"
388 (list (search-path-specification
389 (variable "SSL_CERT_DIR")
390 (separator #f) ;single entry
391 (files '("etc/ssl/certs")))
392 (search-path-specification
393 (variable "SSL_CERT_FILE")
395 (separator #f) ;single entry
396 (files '("etc/ssl/certs/ca-certificates.crt")))))
397 (synopsis "SSL/TLS implementation")
399 "OpenSSL is an implementation of SSL/TLS.")
400 (license license:openssl)
401 (home-page "https://www.openssl.org/")))
403 (define-public openssl/fixed
408 (inherit (package-source openssl))
409 (patches (append (origin-patches (package-source openssl))
410 (search-patches "openssl-CVE-2019-1559.patch"))))))))
412 (define-public openssl-next
419 (uri (list (string-append "https://www.openssl.org/source/openssl-"
421 (string-append "ftp://ftp.openssl.org/source/"
422 "openssl-" version ".tar.gz")
423 (string-append "ftp://ftp.openssl.org/source/old/"
424 (string-trim-right version char-set:letter)
425 "/openssl-" version ".tar.gz")))
426 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
429 "0jza8cmznnyiia43056dij1jdmz62dx17wsn0zxksh9h6817nmaw"))))
431 "doc" ; 6.8 MiB of man3 pages and full HTML documentation
432 "static")) ; 6.4 MiB of .a files
434 (substitute-keyword-arguments (package-arguments openssl)
436 `(modify-phases ,phases
437 (delete 'patch-tests) ; These two phases are not needed by
438 (delete 'patch-Makefile.org) ; OpenSSL 1.1.
440 ;; Override configure phase since -rpath is now a configure option.
442 (lambda* (#:key outputs #:allow-other-keys)
443 (let* ((out (assoc-ref outputs "out"))
444 (lib (string-append out "/lib")))
445 ;; It's not a shebang so patch-source-shebangs misses it.
446 (substitute* "config"
448 (string-append (assoc-ref %build-inputs "coreutils")
451 "shared" ;build shared libraries
454 ;; The default for this catch-all directory is
455 ;; PREFIX/ssl. Change that to something more
457 (string-append "--openssldir=" out
458 "/share/openssl-" ,version)
460 (string-append "--prefix=" out)
461 (string-append "-Wl,-rpath," lib)))))
463 (delete 'move-man3-pages)
464 (add-after 'install 'move-extra-documentation
465 (lambda* (#:key outputs #:allow-other-keys)
466 ;; Move man3 pages and full HTML documentation to "doc".
467 (let* ((out (assoc-ref outputs "out"))
468 (man3 (string-append out "/share/man/man3"))
469 (html (string-append out "/share/doc/openssl"))
470 (doc (assoc-ref outputs "doc"))
471 (man-target (string-append doc "/share/man/man3"))
472 (html-target (string-append doc "/share/doc/openssl")))
473 (copy-recursively man3 man-target)
474 (delete-file-recursively man3)
475 (copy-recursively html html-target)
476 (delete-file-recursively html)
478 ;; XXX: Duplicate this phase to make sure 'version' evaluates
479 ;; in the current scope and not the inherited one.
480 (replace 'remove-miscellany
481 (lambda* (#:key outputs #:allow-other-keys)
482 ;; The 'misc' directory contains random undocumented shell and Perl
483 ;; scripts. Remove them to avoid retaining a reference on Perl.
484 (let ((out (assoc-ref outputs "out")))
485 (delete-file-recursively (string-append out "/share/openssl-"
489 (define-public libressl
495 (uri (string-append "mirror://openbsd/LibreSSL/"
496 name "-" version ".tar.gz"))
499 "19kxa5i97q7p6rrps9qm0nd8zqhdjvzx02j72400c73cl2nryfhy"))))
500 (build-system gnu-build-system)
502 ;; Do as if 'getentropy' was missing since older Linux kernels lack it
503 ;; and libc would return ENOSYS, which is not properly handled.
504 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
505 '(#:configure-flags '("ac_cv_func_getentropy=no"
506 ;; Provide a TLS-enabled netcat.
509 ;; FIXME: These two variables must designate a single file or directory
510 ;; and are not actually "search paths." In practice it works OK in
511 ;; user profiles because there's always just one item that matches the
513 (list (search-path-specification
514 (variable "SSL_CERT_DIR")
515 (files '("etc/ssl/certs")))
516 (search-path-specification
517 (variable "SSL_CERT_FILE")
518 (files '("etc/ssl/certs/ca-certificates.crt")))))
519 (home-page "https://www.libressl.org/")
520 (synopsis "SSL/TLS implementation")
521 (description "LibreSSL is a version of the TLS/crypto stack, forked from
522 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
523 and applying best practice development processes. This package also includes a
524 netcat implementation that supports TLS.")
525 ;; Files taken from OpenSSL keep their license, others are under various
526 ;; non-copyleft licenses.
527 (license (list license:openssl
528 (license:non-copyleft
530 "See COPYING in the distribution.")))))
532 (define-public python-acme
535 ;; Remember to update the hash of certbot when updating python-acme.
539 (uri (pypi-uri "acme" version))
542 "1v0skyrjnbxq0lfmia5k6jy29iig4sxbi9j9q367xsw0g25wxvqf"))))
543 (build-system python-build-system)
546 (modify-phases %standard-phases
547 (add-after 'build 'build-documentation
549 (invoke "make" "-C" "docs" "man" "info")))
550 (add-after 'install 'install-documentation
551 (lambda* (#:key outputs #:allow-other-keys)
552 (let* ((out (assoc-ref outputs "out"))
553 (man (string-append out "/share/man/man1"))
554 (info (string-append out "/info")))
555 (install-file "docs/_build/texinfo/acme-python.info" info)
556 (install-file "docs/_build/man/acme-python.1" man)
558 ;; TODO: Add optional inputs for testing.
560 `(("python-mock" ,python-mock)
561 ("python-pytest" ,python-pytest)
563 ("python-sphinx" ,python-sphinx)
564 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
565 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
566 ("texinfo" ,texinfo)))
568 `(("python-josepy" ,python-josepy)
569 ("python-six" ,python-six)
570 ("python-requests" ,python-requests)
571 ("python-requests-toolbelt" ,python-requests-toolbelt)
572 ("python-pytz" ,python-pytz)
573 ("python-pyrfc3339" ,python-pyrfc3339)
574 ("python-pyasn1" ,python-pyasn1)
575 ("python-cryptography" ,python-cryptography)
576 ("python-pyopenssl" ,python-pyopenssl)))
577 (home-page "https://github.com/certbot/certbot")
578 (synopsis "ACME protocol implementation in Python")
579 (description "ACME protocol implementation in Python")
580 (license license:asl2.0)))
582 (define-public certbot
585 ;; Certbot and python-acme are developed in the same repository, and their
586 ;; versions should remain synchronized.
587 (version (package-version python-acme))
590 (uri (pypi-uri name version))
593 "1j63i0j019q0d3l5rx14fv4nxy01nplhk7q2k2fq10vxl0jlxff0"))))
594 (build-system python-build-system)
596 `(,@(substitute-keyword-arguments (package-arguments python-acme)
598 `(modify-phases ,phases
599 (replace 'install-documentation
600 (lambda* (#:key outputs #:allow-other-keys)
601 (let* ((out (assoc-ref outputs "out"))
602 (man1 (string-append out "/share/man/man1"))
603 (man7 (string-append out "/share/man/man7"))
604 (info (string-append out "/info")))
605 (install-file "docs/_build/texinfo/Certbot.info" info)
606 (install-file "docs/_build/man/certbot.1" man1)
607 (install-file "docs/_build/man/certbot.7" man7)
609 ;; TODO: Add optional inputs for testing.
611 `(("python-mock" ,python-mock)
612 ("python-pytest" ,python-pytest)
614 ("python-sphinx" ,python-sphinx)
615 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
616 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
617 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
618 ("texinfo" ,texinfo)))
620 `(("python-acme" ,python-acme)
621 ("python-cryptography" ,python-cryptography)
622 ("python-zope-interface" ,python-zope-interface)
623 ("python-pyrfc3339" ,python-pyrfc3339)
624 ("python-pyopenssl" ,python-pyopenssl)
625 ("python-configobj" ,python-configobj)
626 ("python-configargparse" ,python-configargparse)
627 ("python-zope-component" ,python-zope-component)
628 ("python-parsedatetime" ,python-parsedatetime)
629 ("python-six" ,python-six)
630 ("python-psutil" ,python-psutil)
631 ("python-requests" ,python-requests)
632 ("python-pytz" ,python-pytz)))
633 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
634 (description "Certbot automatically receives and installs X.509 certificates
635 to enable Transport Layer Security (TLS) on servers. It interoperates with the
636 Let’s Encrypt certificate authority (CA), which issues browser-trusted
637 certificates for free.")
638 (home-page "https://certbot.eff.org/")
639 (license license:asl2.0)))
641 (define-public letsencrypt
642 (package (inherit certbot)
644 (properties `((superseded . ,certbot)))))
646 (define-public perl-net-ssleay
648 (name "perl-net-ssleay")
652 (uri (string-append "mirror://cpan/authors/id/M/MI/MIKEM/"
653 "Net-SSLeay-" version ".tar.gz"))
656 "1j5h4ycm8538397l204d2d5fkm9595aj174pj7bkpbhwzfwqi0cx"))))
657 (build-system perl-build-system)
658 (inputs `(("openssl" ,openssl)))
661 (modify-phases %standard-phases
663 'configure 'set-ssl-prefix
664 (lambda* (#:key inputs #:allow-other-keys)
665 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
667 (synopsis "Perl extension for using OpenSSL")
669 "This module offers some high level convenience functions for accessing
670 web pages on SSL servers (for symmetry, the same API is offered for accessing
671 http servers, too), an sslcat() function for writing your own clients, and
672 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
673 servers or clients for more complicated applications.")
674 (license license:perl-license)
675 (home-page "https://metacpan.org/release/Net-SSLeay")))
677 (define-public perl-crypt-openssl-rsa
679 (name "perl-crypt-openssl-rsa")
685 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
690 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
691 (build-system perl-build-system)
693 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
695 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
696 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
697 ("openssl" ,openssl)))
698 (arguments perl-crypt-arguments)
700 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
702 "RSA encoding and decoding, using the openSSL libraries")
703 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
704 OpenSSL libraries).")
705 (license license:perl-license)))
707 (define perl-crypt-arguments
708 `(#:phases (modify-phases %standard-phases
709 (add-before 'configure 'patch-Makefile.PL
710 (lambda* (#:key inputs #:allow-other-keys)
711 (substitute* "Makefile.PL"
712 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
713 (assoc-ref inputs "openssl")
714 "/lib -lcrypto'],")))
717 (define-public perl-crypt-openssl-bignum
719 (name "perl-crypt-openssl-bignum")
725 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
730 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
731 (build-system perl-build-system)
732 (inputs `(("openssl" ,openssl)))
733 (arguments perl-crypt-arguments)
735 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
737 "OpenSSL's multiprecision integer arithmetic in Perl")
738 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
739 arithmetic in Perl.")
740 ;; At your option either gpl1+ or the Artistic License
741 (license license:perl-license)))
743 (define-public perl-crypt-openssl-guess
745 (name "perl-crypt-openssl-guess")
751 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
755 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
756 (build-system perl-build-system)
757 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
758 (synopsis "Guess the OpenSSL include path")
760 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
761 correct OpenSSL include path. It is intended for use in your
762 @file{Makefile.PL}.")
763 (license license:perl-license)))
765 (define-public perl-crypt-openssl-random
767 (name "perl-crypt-openssl-random")
773 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
778 "0vmvrb3shrzjzri3qn524dzdasbq8zhhbpc1vmq8sx68n4jhizb0"))))
779 (build-system perl-build-system)
781 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
783 `(("openssl" ,openssl)))
784 (arguments perl-crypt-arguments)
786 "https://metacpan.org/release/Crypt-OpenSSL-Random")
788 "OpenSSL/LibreSSL pseudo-random number generator access")
789 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
791 (license license:perl-license)))
793 (define-public acme-client
799 (uri (string-append "https://kristaps.bsd.lv/" name "/"
800 "snapshots/" name "-portable-"
804 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
805 (build-system gnu-build-system)
807 '(#:tests? #f ; no test suite
810 (string-append "PREFIX=" (assoc-ref %outputs "out")))
812 (modify-phases %standard-phases
813 (add-after 'unpack 'patch-paths
814 (lambda* (#:key inputs #:allow-other-keys)
815 (let ((pem (string-append (assoc-ref inputs "libressl")
816 "/etc/ssl/cert.pem")))
817 (substitute* "http.c"
818 (("/etc/ssl/cert.pem") pem))
820 (delete 'configure)))) ; no './configure' script
822 `(("pkg-config" ,pkg-config)))
825 ("libressl" ,libressl)))
826 (synopsis "Let's Encrypt client by the OpenBSD project")
827 (description "acme-client is a Let's Encrypt client implemented in C. It
828 uses a modular design, and attempts to secure itself by dropping privileges and
829 operating in a chroot where possible. acme-client is developed on OpenBSD and
830 then ported to the GNU / Linux environment.")
831 (home-page "https://kristaps.bsd.lv/acme-client/")
832 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
833 ;; and 'jsmn.c' are distributed under the Expat license.
834 (license (list license:isc license:expat))))
836 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
837 ;; variant exists in addition to the "-apache" one.
838 (define-public mbedtls-apache
840 (name "mbedtls-apache")
845 ;; XXX: The download links on the website are script redirection links
846 ;; which effectively lead to the format listed in the uri here.
847 (uri (string-append "https://tls.mbed.org/download/mbedtls-"
848 version "-apache.tgz"))
851 "1qlscr0m97favkqmrlj90rlgw40h8lcypxz0snvr1iwkj1pbbnp3"))))
852 (build-system cmake-build-system)
855 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON")))
859 (synopsis "Small TLS library")
861 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
862 for developers to include cryptographic and SSL/TLS capabilities in their
863 (embedded) products, facilitating this functionality with a minimal
865 (home-page "https://tls.mbed.org")
866 (license license:asl2.0)))
868 ;; The Hiawatha Web server requires some specific features to be enabled.
869 (define-public mbedtls-for-hiawatha
872 (inherit mbedtls-apache)
874 (substitute-keyword-arguments
876 (modify-phases %standard-phases
877 (add-after 'configure 'configure-extra-features
879 (for-each (lambda (feature)
880 (invoke "scripts/config.pl" "set" feature))
881 (list "MBEDTLS_THREADING_C"
882 "MBEDTLS_THREADING_PTHREAD"))
884 ,@(package-arguments mbedtls-apache)))))))
886 (define-public ghc-tls
892 (uri (string-append "https://hackage.haskell.org/package/"
893 "tls/tls-" version ".tar.gz"))
896 "1y083724mym28n6xfaz7pcc7zqxdhjpaxpbvzxfbs25qq2px3smv"))))
897 (build-system haskell-build-system)
899 `(("ghc-cereal" ,ghc-cereal)
900 ("ghc-data-default-class" ,ghc-data-default-class)
901 ("ghc-memory" ,ghc-memory)
902 ("ghc-cryptonite" ,ghc-cryptonite)
903 ("ghc-asn1-types" ,ghc-asn1-types)
904 ("ghc-asn1-encoding" ,ghc-asn1-encoding)
905 ("ghc-x509" ,ghc-x509)
906 ("ghc-x509-store" ,ghc-x509-store)
907 ("ghc-x509-validation" ,ghc-x509-validation)
908 ("ghc-async" ,ghc-async)
909 ("ghc-network" ,ghc-network)
910 ("ghc-hourglass" ,ghc-hourglass)))
912 `(("ghc-tasty" ,ghc-tasty)
913 ("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)
914 ("ghc-quickcheck" ,ghc-quickcheck)))
915 (home-page "https://github.com/vincenthz/hs-tls")
917 "TLS/SSL protocol native implementation (Server and Client)")
919 "Native Haskell TLS and SSL protocol implementation for server and client.
920 This provides a high-level implementation of a sensitive security protocol,
921 eliminating a common set of security issues through the use of the advanced
922 type system, high level constructions and common Haskell features. Currently
923 implement the SSL3.0, TLS1.0, TLS1.1 and TLS1.2 protocol, and support RSA and
924 Ephemeral (Elliptic curve and regular) Diffie Hellman key exchanges, and many
926 (license license:bsd-3)))
928 (define-public dehydrated
935 "https://github.com/lukas2511/dehydrated/releases/download/"
936 "v" version "/dehydrated-" version ".tar.gz"))
939 "03p80yj6bnzjc6dkp5hb9wpplmlrla8n5src71cnzw4rj53q8cqn"))))
940 (build-system trivial-build-system)
942 `(#:modules ((guix build utils))
945 (use-modules (guix build utils))
946 (let* ((source (assoc-ref %build-inputs "source"))
947 (tar (assoc-ref %build-inputs "tar"))
948 (gz (assoc-ref %build-inputs "gzip"))
949 (out (assoc-ref %outputs "out"))
950 (bin (string-append out "/bin"))
951 (doc (string-append out "/share/doc/"))
952 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
954 (setenv "PATH" (string-append gz "/bin"))
955 (invoke (string-append tar "/bin/tar") "xvf" source)
956 (chdir (string-append ,name "-" ,version))
958 (install-file "dehydrated" bin)
959 (install-file "LICENSE" (string-append doc ,name "-" ,version))
960 (with-directory-excursion bin
961 (patch-shebang "dehydrated" (list bash))
963 ;; Do not try to write in the store.
964 (substitute* "dehydrated"
965 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
968 (wrap-program "dehydrated"
971 (string-append dir "/bin"))
973 (assoc-ref %build-inputs input))
984 ("coreutils" ,coreutils)
986 ("diffutils" ,diffutils)
994 (home-page "https://dehydrated.io/")
995 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
996 (description "Dehydrated is a client for signing certificates with an
997 ACME-server (currently only provided by Let's Encrypt) implemented as a
998 relatively simple Bash script.")
999 (license license:expat)))