1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2021 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, 2019, 2020 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017, 2018 Nikita <nikita@n0.is>
10 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
11 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
13 ;;; Copyright © 2017–2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
14 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
15 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
16 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
17 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
18 ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
19 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
21 ;;; This file is part of GNU Guix.
23 ;;; GNU Guix is free software; you can redistribute it and/or modify it
24 ;;; under the terms of the GNU General Public License as published by
25 ;;; the Free Software Foundation; either version 3 of the License, or (at
26 ;;; your option) any later version.
28 ;;; GNU Guix is distributed in the hope that it will be useful, but
29 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 ;;; GNU General Public License for more details.
33 ;;; You should have received a copy of the GNU General Public License
34 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
36 (define-module (gnu packages tls)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix utils)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system perl)
45 #:use-module (guix build-system python)
46 #:use-module (guix build-system cmake)
47 #:use-module (guix build-system trivial)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages)
50 #:use-module (gnu packages bash)
51 #:use-module (gnu packages check)
52 #:use-module (gnu packages curl)
53 #:use-module (gnu packages dns)
54 #:use-module (gnu packages gawk)
55 #:use-module (gnu packages guile)
56 #:use-module (gnu packages hurd)
57 #:use-module (gnu packages libbsd)
58 #:use-module (gnu packages libffi)
59 #:use-module (gnu packages libidn)
60 #:use-module (gnu packages linux)
61 #:use-module (gnu packages ncurses)
62 #:use-module (gnu packages nettle)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages python-crypto)
67 #:use-module (gnu packages python-web)
68 #:use-module (gnu packages python-xyz)
69 #:use-module (gnu packages sphinx)
70 #:use-module (gnu packages texinfo)
71 #:use-module (gnu packages time)
72 #:use-module (gnu packages base)
73 #:use-module (srfi srfi-1))
75 (define-public libtasn1
82 (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
86 "179jskl7dmfp1rd2khkzmlibzgki4wi6hvmmwfv7q49r728b03qf"))))
87 (build-system gnu-build-system)
89 `(#:configure-flags '("--disable-static")))
90 (native-inputs `(("perl" ,perl)))
91 (home-page "https://www.gnu.org/software/libtasn1/")
92 (synopsis "ASN.1 library")
94 "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
95 for transmitting machine-neutral encodings of data objects in computer
96 networking, allowing for formal validation of data according to some
98 (license license:lgpl2.0+)))
106 (uri (string-append "https://lionet.info/soft/asn1c-"
110 "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0"))))
111 (build-system gnu-build-system)
114 (home-page "https://lionet.info/asn1c")
115 (synopsis "ASN.1 to C compiler")
116 (description "The ASN.1 to C compiler takes ASN.1 module
117 files and generates C++ compatible C source code. That code can be
118 used to serialize the native C structures into compact and unambiguous
119 BER/XER/PER-based data files, and deserialize the files back.
121 Various ASN.1 based formats are widely used in the industry, such as to encode
122 the X.509 certificates employed in the HTTPS handshake, to exchange control
123 data between mobile phones and cellular networks, to car-to-car communication
124 in intelligent transportation networks.")
125 (license license:bsd-2)))
127 (define-public p11-kit
134 (uri (string-append "https://github.com/p11-glue/p11-kit/releases/"
135 "download/" version "/p11-kit-" version ".tar.xz"))
137 (base32 "1dn6br4v033d3gp2max9lsr3y4q0nj6iyr1yq3kzi8ym7lal13wa"))))
138 (build-system gnu-build-system)
140 `(("pkg-config" ,pkg-config)))
143 ("libtasn1" ,libtasn1)))
145 `(#:configure-flags '("--without-trust-paths")
146 #:phases (modify-phases %standard-phases
147 (add-before 'check 'prepare-tests
149 ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
150 ;; and looks for .cache and other directories (only).
151 ;; For simplicity just drop it since it is irrelevant
152 ;; in the build container.
153 (substitute* "Makefile"
154 (("test-runtime\\$\\(EXEEXT\\)") ""))
156 (home-page "https://p11-glue.freedesktop.org/p11-kit.html")
157 (synopsis "PKCS#11 library")
159 "p11-kit provides a way to load and enumerate PKCS#11 modules. It
160 provides a standard configuration setup for installing PKCS#11 modules
161 in such a way that they are discoverable. It also solves problems with
162 coordinating the use of PKCS#11 by different components or libraries
163 living in the same process.")
164 (license license:bsd-3)))
166 (define-public gnutls
170 (replacement gnutls-3.6.16)
173 ;; Note: Releases are no longer on ftp.gnu.org since the
174 ;; schism (after version 3.1.5).
175 (uri (string-append "mirror://gnupg/gnutls/v"
176 (version-major+minor version)
177 "/gnutls-" version ".tar.xz"))
178 (patches (search-patches "gnutls-skip-trust-store-test.patch"
180 "gnutls-CVE-2021-20231.patch"
181 "gnutls-CVE-2021-20232.patch"))
184 "0n0m93ymzd0q9hbknxc2ycanz49sqlkyyf73g9fk7n787llc7a0f"))))
185 (build-system gnu-build-system)
187 `(#:tests? ,(not (or (%current-target-system)
189 ;; Ensure we don't keep a reference to net-tools.
190 #:disallowed-references ,(if (hurd-target?) '() (list net-tools))
193 ;; GnuTLS doesn't consult any environment variables to specify
194 ;; the location of the system-wide trust store. Instead it has a
195 ;; configure-time option. Unless specified, its configure script
196 ;; attempts to auto-detect the location by looking for common
197 ;; places in the file system, none of which are present in our
198 ;; chroot build environment. If not found, then no default trust
199 ;; store is used, so each program has to provide its own
200 ;; fallback, and users have to configure each program
201 ;; independently. This seems suboptimal.
202 "--with-default-trust-store-dir=/etc/ssl/certs"
204 ;; Tell the build system that we want Guile bindings installed to
205 ;; the output instead of Guiles own module directory.
206 (string-append "--with-guile-site-dir="
207 "$(datarootdir)/guile/site/$(GUILE_EFFECTIVE_VERSION)")
208 (string-append "--with-guile-site-ccache-dir="
209 "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache")
210 (string-append "--with-guile-extension-dir="
211 "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/extensions")
213 ;; FIXME: Temporarily disable p11-kit support since it is not
214 ;; working on mips64el.
217 #:phases (modify-phases %standard-phases
220 (lambda* (#:key outputs #:allow-other-keys)
221 ;; Copy the 4.1 MiB of section 3 man pages to "doc".
222 (let* ((out (assoc-ref outputs "out"))
223 (doc (assoc-ref outputs "doc"))
224 (mandir (string-append doc "/share/man/man3"))
225 (oldman (string-append out "/share/man/man3")))
227 (copy-recursively oldman mandir)
228 (delete-file-recursively oldman)
230 (outputs '("out" ;4.4 MiB
232 "doc")) ;4.1 MiB of man pages
234 `(,@(if (%current-target-system) ;for cross-build
235 `(("guile" ,guile-3.0)) ;to create .go files
239 `(("net-tools" ,net-tools)))
240 ("pkg-config" ,pkg-config)
242 ,@(if (hurd-target?) '()
243 `(("datefudge" ,datefudge))) ;tests rely on 'datefudge'
244 ("util-linux" ,util-linux))) ;one test needs 'setsid'
246 `(("guile" ,guile-3.0)))
248 ;; These are all in the 'Requires.private' field of gnutls.pc.
249 `(("libtasn1" ,libtasn1)
253 (home-page "https://www.gnu.org/software/gnutls/")
254 (synopsis "Transport layer security library")
256 "GnuTLS is a secure communications library implementing the SSL, TLS
257 and DTLS protocols. It is provided in the form of a C library to support the
258 protocols, as well as to parse and write X.509, PKCS #12, OpenPGP and other
259 required structures.")
260 (license license:lgpl2.1+)
261 (properties '((ftp-server . "ftp.gnutls.org")
262 (ftp-directory . "/gcrypt/gnutls")))))
264 ;; Replacement package to fix CVE-2021-20305.
265 (define gnutls-3.6.16
271 (uri (string-append "mirror://gnupg/gnutls/v"
272 (version-major+minor version)
273 "/gnutls-" version ".tar.xz"))
274 (patches (search-patches "gnutls-skip-trust-store-test.patch"
275 "gnutls-cross.patch"))
278 "1czk511pslz367shf32f2jvvkp7y1323bcv88c2qng98mj0v6y8v"))))
280 (if (%current-target-system)
281 (substitute-keyword-arguments (package-arguments gnutls)
282 ((#:phases phases '%standard-phases)
283 `(modify-phases ,phases
284 (add-before 'configure 'build-eccdata-headers
285 (lambda* (#:key configure-flags #:allow-other-keys)
286 ;; Build the 'ecc/eccdata' program using the native
287 ;; compiler, not the cross-compiler as happens by default,
288 ;; and use it to build lib/nettle/ecc/ecc-*.h. In GnuTLS
289 ;; 3.6.15, this was not necessary because the tarball
290 ;; contained pre-generated lib/nettle/ecc/ecc-*.h files as
291 ;; well as 'ecc/eccdata.stamp'.
292 (let ((jobs (number->string (parallel-job-count)))
293 (patch (assoc-ref %standard-phases
294 'patch-generated-file-shebangs)))
295 (mkdir "+native-build")
296 (with-directory-excursion "+native-build"
297 ;; Build natively, with the native compiler, GMP, etc.
298 (invoke "../configure"
299 (string-append "SHELL=" (which "sh"))
300 (string-append "CONFIG_SHELL=" (which "sh"))
301 "NETTLE_CFLAGS= " "NETTLE_LIBS= "
302 "HOGWEED_CFLAGS= " "HOGWEED_LIBS= "
303 "LIBTASN1_CFLAGS= " "LIBTASN1_LIBS= "
304 "ac_cv_func_nettle_rsa_sec_decrypt=yes"
305 "--without-p11-kit" "--disable-guile")
307 (invoke "make" "-C" "gl" "-j" jobs)
308 (invoke "make" "-C" "lib/nettle" "V=1" "-j" jobs))
310 ;; Copy the files we obtained during native build.
311 (for-each (lambda (file)
312 (install-file file "lib/nettle/ecc"))
314 "+native-build/lib/nettle/ecc"
315 "^(eccdata\\.stamp|ecc-.*\\.h)$"))))))))
316 (package-arguments gnutls)))
318 (if (%current-target-system)
319 `(("libtasn1" ,libtasn1) ;for 'ecc/eccdata'
323 ,@(package-native-inputs gnutls))
324 (package-native-inputs gnutls)))))
326 (define-public gnutls/guile-2.0
327 ;; GnuTLS for Guile 2.0.
328 (package/inherit gnutls
329 (name "guile2.0-gnutls")
330 (inputs `(("guile" ,guile-2.0)
331 ,@(alist-delete "guile" (package-inputs gnutls))))))
333 (define-public gnutls/dane
334 ;; GnuTLS with build libgnutls-dane, implementing DNS-based
335 ;; Authentication of Named Entities. This is required for GNS functionality
336 ;; by GNUnet and gnURL. This is done in an extra package definition
337 ;; to have the choice between GnuTLS with Dane and without Dane.
338 (package/inherit gnutls
340 (inputs `(("unbound" ,unbound)
341 ,@(package-inputs gnutls)))))
343 (define-public guile2.2-gnutls
344 (package/inherit gnutls
345 (name "guile2.2-gnutls")
346 (inputs `(("guile" ,guile-2.2)
347 ,@(alist-delete "guile"
348 (package-inputs gnutls))))))
350 (define-public guile3.0-gnutls
351 (deprecated-package "guile3.0-gnutls" gnutls))
353 (define-public openssl
357 (replacement openssl-1.1.1k)
360 (uri (list (string-append "https://www.openssl.org/source/openssl-"
362 (string-append "ftp://ftp.openssl.org/source/"
363 "openssl-" version ".tar.gz")
364 (string-append "ftp://ftp.openssl.org/source/old/"
365 (string-trim-right version char-set:letter)
366 "/openssl-" version ".tar.gz")))
367 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
370 "1gw17520vh13izy1xf5q0a2fqgcayymjjj5bk0dlkxndfnszrwma"))))
371 (build-system gnu-build-system)
373 "doc" ;6.8 MiB of man3 pages and full HTML documentation
374 "static")) ;6.4 MiB of .a files
375 (native-inputs `(("perl" ,perl)))
377 `(#:parallel-tests? #f
380 ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
381 ;; so we explicitly disallow it here.
382 #:disallowed-references ,(list (canonical-package perl))
384 (modify-phases %standard-phases
385 ,@(if (%current-target-system)
387 'configure 'set-cross-compile
388 (lambda* (#:key target outputs #:allow-other-keys)
389 (setenv "CROSS_COMPILE" (string-append target "-"))
390 (setenv "CONFIGURE_TARGET_ARCH"
392 ((string-prefix? "i586" target)
394 ((string-prefix? "i686" target)
396 ((string-prefix? "x86_64" target)
398 ((string-prefix? "mips64el" target)
400 ((string-prefix? "arm" target)
402 ((string-prefix? "aarch64" target)
404 ((string-prefix? "powerpc64le" target)
406 ((string-prefix? "powerpc64" target)
408 ((string-prefix? "powerpc" target)
413 (lambda* (#:key outputs #:allow-other-keys)
414 (let* ((out (assoc-ref outputs "out"))
415 (lib (string-append out "/lib")))
416 ;; It's not a shebang so patch-source-shebangs misses it.
417 (substitute* "config"
419 (string-append (assoc-ref %build-inputs "coreutils")
421 (invoke ,@(if (%current-target-system)
424 "shared" ;build shared libraries
427 ;; The default for this catch-all directory is
428 ;; PREFIX/ssl. Change that to something more
430 (string-append "--openssldir=" out
432 ,(package-version this-package))
434 (string-append "--prefix=" out)
435 (string-append "-Wl,-rpath," lib)
436 ,@(if (%current-target-system)
437 '((getenv "CONFIGURE_TARGET_ARCH"))
439 (add-after 'install 'move-static-libraries
440 (lambda* (#:key outputs #:allow-other-keys)
441 ;; Move static libraries to the "static" output.
442 (let* ((out (assoc-ref outputs "out"))
443 (lib (string-append out "/lib"))
444 (static (assoc-ref outputs "static"))
445 (slib (string-append static "/lib")))
446 (for-each (lambda (file)
447 (install-file file slib)
449 (find-files lib "\\.a$"))
451 (add-after 'install 'move-extra-documentation
452 (lambda* (#:key outputs #:allow-other-keys)
453 ;; Move man3 pages and full HTML documentation to "doc".
454 (let* ((out (assoc-ref outputs "out"))
455 (man3 (string-append out "/share/man/man3"))
456 (html (string-append out "/share/doc/openssl"))
457 (doc (assoc-ref outputs "doc"))
458 (man-target (string-append doc "/share/man/man3"))
459 (html-target (string-append doc "/share/doc/openssl")))
460 (copy-recursively man3 man-target)
461 (delete-file-recursively man3)
462 (copy-recursively html html-target)
463 (delete-file-recursively html)
466 'install 'remove-miscellany
467 (lambda* (#:key outputs #:allow-other-keys)
468 ;; The 'misc' directory contains random undocumented shell and Perl
469 ;; scripts. Remove them to avoid retaining a reference on Perl.
470 (let ((out (assoc-ref outputs "out")))
471 (delete-file-recursively (string-append out "/share/openssl-"
472 ,(package-version this-package)
476 (list (search-path-specification
477 (variable "SSL_CERT_DIR")
478 (separator #f) ;single entry
479 (files '("etc/ssl/certs")))
480 (search-path-specification
481 (variable "SSL_CERT_FILE")
483 (separator #f) ;single entry
484 (files '("etc/ssl/certs/ca-certificates.crt")))))
485 (synopsis "SSL/TLS implementation")
487 "OpenSSL is an implementation of SSL/TLS.")
488 (license license:openssl)
489 (home-page "https://www.openssl.org/")))
491 ;; Replacement package to fix CVE-2021-3449 and CVE-2021-3450.
492 (define openssl-1.1.1k
498 (uri (list (string-append "https://www.openssl.org/source/openssl-"
500 (string-append "ftp://ftp.openssl.org/source/"
501 "openssl-" version ".tar.gz")
502 (string-append "ftp://ftp.openssl.org/source/old/"
503 (string-trim-right version char-set:letter)
504 "/openssl-" version ".tar.gz")))
505 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
508 "1rdfzcrxy9y38wqdw5942vmdax9hjhgrprzxm42csal7p5shhal9"))))))
510 (define-public openssl-1.0
517 (uri (list (string-append "https://www.openssl.org/source/openssl-"
519 (string-append "ftp://ftp.openssl.org/source/"
520 "openssl-" version ".tar.gz")
521 (string-append "ftp://ftp.openssl.org/source/old/"
522 (string-trim-right version char-set:letter)
523 "/openssl-" version ".tar.gz")))
526 "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c"))
527 (patches (search-patches "openssl-runpath.patch"
528 "openssl-c-rehash-in.patch"))))
530 "doc" ;1.5MiB of man3 pages
531 "static")) ;6MiB of .a files
533 (substitute-keyword-arguments (package-arguments openssl)
534 ;; Parallel build is not supported in 1.0.x.
535 ((#:parallel-build? _ #f) #f)
537 `(modify-phases ,phases
538 (add-before 'patch-source-shebangs 'patch-tests
539 (lambda* (#:key inputs native-inputs #:allow-other-keys)
540 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
541 (substitute* (find-files "test" ".*")
543 (string-append bash "/bin/sh"))
547 (add-before 'configure 'patch-Makefile.org
548 (lambda* (#:key outputs #:allow-other-keys)
549 ;; The default MANDIR is some unusual place. Fix that.
550 (let ((out (assoc-ref outputs "out")))
551 (patch-makefile-SHELL "Makefile.org")
552 (substitute* "Makefile.org"
553 (("^MANDIR[[:blank:]]*=.*$")
554 (string-append "MANDIR = " out "/share/man\n")))
557 ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
558 (lambda* (#:key outputs #:allow-other-keys)
559 (let ((out (assoc-ref outputs "out")))
560 (invoke ,@(if (%current-target-system)
563 "shared" ;build shared libraries
566 ;; The default for this catch-all directory is
567 ;; PREFIX/ssl. Change that to something more
569 (string-append "--openssldir=" out
570 "/share/openssl-" ,version)
572 (string-append "--prefix=" out)
573 ,@(if (%current-target-system)
574 '((getenv "CONFIGURE_TARGET_ARCH"))
576 (delete 'move-extra-documentation)
577 (add-after 'install 'move-man3-pages
578 (lambda* (#:key outputs #:allow-other-keys)
579 ;; Move section 3 man pages to "doc".
580 (let* ((out (assoc-ref outputs "out"))
581 (man3 (string-append out "/share/man/man3"))
582 (doc (assoc-ref outputs "doc"))
583 (target (string-append doc "/share/man/man3")))
585 (for-each (lambda (file)
587 (string-append target "/"
590 (delete-file-recursively man3)
592 ;; XXX: Duplicate this phase to make sure 'version' evaluates
593 ;; in the current scope and not the inherited one.
594 (replace 'remove-miscellany
595 (lambda* (#:key outputs #:allow-other-keys)
596 ;; The 'misc' directory contains random undocumented shell and Perl
597 ;; scripts. Remove them to avoid retaining a reference on Perl.
598 (let ((out (assoc-ref outputs "out")))
599 (delete-file-recursively (string-append out "/share/openssl-"
603 (define-public libressl
609 (uri (string-append "mirror://openbsd/LibreSSL/"
610 "libressl-" version ".tar.gz"))
613 "0rihprcgxsydsbcqgd1952k2cfn4jmp7rlyp1c6sglfc6rdmcwd4"))))
614 (build-system gnu-build-system)
618 ;; Do as if 'getentropy' were missing: Linux kernels before 3.17 lack its
619 ;; underlying 'getrandom' system call and ENOSYS isn't properly handled.
620 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
621 "ac_cv_func_getentropy=no"
622 ;; FIXME It's using it's own bundled certificate, instead it should
623 ;; behave like OpenSSL by using environment variables.
624 (string-append "--with-openssldir=" %output
626 ,(package-version this-package))
627 ;; Provide a TLS-enabled netcat.
629 (home-page "https://www.libressl.org/")
630 (synopsis "SSL/TLS implementation")
631 (description "LibreSSL is a version of the TLS/crypto stack, forked from
632 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
633 and applying best practice development processes. This package also includes a
634 netcat implementation that supports TLS.")
635 ;; Files taken from OpenSSL keep their license, others are under various
636 ;; non-copyleft licenses.
637 (license (list license:openssl
638 (license:non-copyleft
640 "See COPYING in the distribution.")))))
642 (define-public python-acme
645 ;; Remember to update the hash of certbot when updating python-acme.
649 (uri (pypi-uri "acme" version))
652 "0kgf1d3gl7dg1rz3q4093kf8g0p2d0m40c7qmn96ihz2224wa307"))))
653 (build-system python-build-system)
656 (modify-phases %standard-phases
657 (add-after 'build 'build-documentation
659 (invoke "make" "-C" "docs" "man" "info")))
660 (add-after 'install 'install-documentation
661 (lambda* (#:key outputs #:allow-other-keys)
662 (let* ((out (assoc-ref outputs "out"))
663 (man (string-append out "/share/man/man1"))
664 (info (string-append out "/info")))
665 (install-file "docs/_build/texinfo/acme-python.info" info)
666 (install-file "docs/_build/man/acme-python.1" man)
669 `(("python-pytest" ,python-pytest)
671 ("python-sphinx" ,python-sphinx)
672 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
673 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
674 ("texinfo" ,texinfo)))
676 `(("python-josepy" ,python-josepy)
677 ("python-requests" ,python-requests)
678 ("python-requests-toolbelt" ,python-requests-toolbelt)
679 ("python-pytz" ,python-pytz)
680 ("python-pyrfc3339" ,python-pyrfc3339)
681 ("python-pyasn1" ,python-pyasn1)
682 ("python-cryptography" ,python-cryptography)
683 ("python-pyopenssl" ,python-pyopenssl)))
684 (home-page "https://github.com/certbot/certbot")
685 (synopsis "ACME protocol implementation in Python")
686 (description "ACME protocol implementation in Python")
687 (license license:asl2.0)))
689 (define-public certbot
692 ;; Certbot and python-acme are developed in the same repository, and their
693 ;; versions should remain synchronized.
694 (version (package-version python-acme))
697 (uri (pypi-uri "certbot" version))
700 "1qcznszgqdgx1nhk4vdi896gknvx8rg4w8iw15lwqg6byhiyazyv"))))
701 (build-system python-build-system)
703 `(,@(substitute-keyword-arguments (package-arguments python-acme)
705 `(modify-phases ,phases
706 (replace 'install-documentation
707 (lambda* (#:key outputs #:allow-other-keys)
708 (let* ((out (assoc-ref outputs "out"))
709 (man1 (string-append out "/share/man/man1"))
710 (man7 (string-append out "/share/man/man7"))
711 (info (string-append out "/info")))
712 (install-file "docs/_build/texinfo/Certbot.info" info)
713 (install-file "docs/_build/man/certbot.1" man1)
714 (install-file "docs/_build/man/certbot.7" man7)
717 `(("python-mock" ,python-mock)
718 ("python-pytest" ,python-pytest)
720 ("python-sphinx" ,python-sphinx)
721 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
722 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
723 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
724 ("texinfo" ,texinfo)))
726 `(("python-acme" ,python-acme)
727 ("python-cryptography" ,python-cryptography)
728 ("python-zope-interface" ,python-zope-interface)
729 ("python-pyrfc3339" ,python-pyrfc3339)
730 ("python-pyopenssl" ,python-pyopenssl)
731 ("python-configobj" ,python-configobj)
732 ("python-configargparse" ,python-configargparse)
733 ("python-distro" ,python-distro)
734 ("python-zope-component" ,python-zope-component)
735 ("python-parsedatetime" ,python-parsedatetime)
736 ("python-psutil" ,python-psutil)
737 ("python-requests" ,python-requests)
738 ("python-pytz" ,python-pytz)))
739 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
740 (description "Certbot automatically receives and installs X.509 certificates
741 to enable Transport Layer Security (TLS) on servers. It interoperates with the
742 Let’s Encrypt certificate authority (CA), which issues browser-trusted
743 certificates for free.")
744 (home-page "https://certbot.eff.org/")
745 (license license:asl2.0)))
747 (define-public letsencrypt
748 (package (inherit certbot)
750 (properties `((superseded . ,certbot)))))
752 (define-public perl-net-ssleay
754 (name "perl-net-ssleay")
758 (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
759 "Net-SSLeay-" version ".tar.gz"))
762 "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
763 (build-system perl-build-system)
764 (inputs `(("openssl" ,openssl)))
767 (modify-phases %standard-phases
769 'configure 'set-ssl-prefix
770 (lambda* (#:key inputs #:allow-other-keys)
771 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
773 (synopsis "Perl extension for using OpenSSL")
775 "This module offers some high level convenience functions for accessing
776 web pages on SSL servers (for symmetry, the same API is offered for accessing
777 http servers, too), an sslcat() function for writing your own clients, and
778 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
779 servers or clients for more complicated applications.")
780 (license license:perl-license)
781 (home-page "https://metacpan.org/release/Net-SSLeay")))
783 (define-public perl-crypt-openssl-rsa
785 (name "perl-crypt-openssl-rsa")
791 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
796 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
797 (build-system perl-build-system)
799 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
801 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
802 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
803 ("openssl" ,openssl)))
804 (arguments perl-crypt-arguments)
806 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
808 "RSA encoding and decoding, using the openSSL libraries")
809 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
810 OpenSSL libraries).")
811 (license license:perl-license)))
813 (define perl-crypt-arguments
814 `(#:phases (modify-phases %standard-phases
815 (add-before 'configure 'patch-Makefile.PL
816 (lambda* (#:key inputs #:allow-other-keys)
817 (substitute* "Makefile.PL"
818 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
819 (assoc-ref inputs "openssl")
820 "/lib -lcrypto'],")))
823 (define-public perl-crypt-openssl-bignum
825 (name "perl-crypt-openssl-bignum")
831 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
836 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
837 (build-system perl-build-system)
838 (inputs `(("openssl" ,openssl)))
839 (arguments perl-crypt-arguments)
841 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
843 "OpenSSL's multiprecision integer arithmetic in Perl")
844 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
845 arithmetic in Perl.")
846 ;; At your option either gpl1+ or the Artistic License
847 (license license:perl-license)))
849 (define-public perl-crypt-openssl-guess
851 (name "perl-crypt-openssl-guess")
857 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
861 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
862 (build-system perl-build-system)
863 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
864 (synopsis "Guess the OpenSSL include path")
866 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
867 correct OpenSSL include path. It is intended for use in your
868 @file{Makefile.PL}.")
869 (license license:perl-license)))
871 (define-public perl-crypt-openssl-random
873 (name "perl-crypt-openssl-random")
879 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
883 (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
884 (build-system perl-build-system)
886 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
888 `(("openssl" ,openssl)))
889 (arguments perl-crypt-arguments)
891 "https://metacpan.org/release/Crypt-OpenSSL-Random")
893 "OpenSSL/LibreSSL pseudo-random number generator access")
894 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
896 (license license:perl-license)))
898 (define-public acme-client
904 (uri (string-append "https://kristaps.bsd.lv/" name "/"
905 "snapshots/" name "-portable-"
909 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
910 (build-system gnu-build-system)
912 '(#:tests? #f ; no test suite
915 (string-append "PREFIX=" (assoc-ref %outputs "out")))
917 (modify-phases %standard-phases
918 (add-after 'unpack 'patch-paths
919 (lambda* (#:key inputs #:allow-other-keys)
920 (let ((pem (string-append (assoc-ref inputs "libressl")
921 "/etc/ssl/cert.pem")))
922 (substitute* "http.c"
923 (("/etc/ssl/cert.pem") pem))
925 (delete 'configure)))) ; no './configure' script
927 `(("pkg-config" ,pkg-config)))
930 ("libressl" ,libressl)))
931 (synopsis "Let's Encrypt client by the OpenBSD project")
932 (description "acme-client is a Let's Encrypt client implemented in C. It
933 uses a modular design, and attempts to secure itself by dropping privileges and
934 operating in a chroot where possible. acme-client is developed on OpenBSD and
935 then ported to the GNU / Linux environment.")
936 (home-page "https://kristaps.bsd.lv/acme-client/")
937 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
938 ;; and 'jsmn.c' are distributed under the Expat license.
939 (license (list license:isc license:expat))))
941 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
942 ;; variant exists in addition to the "-apache" one.
943 (define-public mbedtls-apache
945 (name "mbedtls-apache")
946 ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha
953 (url "https://github.com/ARMmbed/mbedtls")
954 (commit (string-append "mbedtls-" version))))
956 (base32 "13fa9h2i989cbf8n8c0j019mshv6wg213va18my1s787lhcq2d62"))
957 (file-name (git-file-name name version))))
958 (build-system cmake-build-system)
961 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON"
962 "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF")
964 (modify-phases %standard-phases
965 (add-after 'unpack 'make-source-writable
967 (for-each make-file-writable (find-files "."))
972 (synopsis "Small TLS library")
974 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
975 for developers to include cryptographic and SSL/TLS capabilities in their
976 (embedded) products, facilitating this functionality with a minimal
978 (home-page "https://tls.mbed.org")
979 (license license:asl2.0)))
981 ;; The Hiawatha Web server requires some specific features to be enabled.
982 (define-public mbedtls-for-hiawatha
985 (inherit mbedtls-apache)
987 (substitute-keyword-arguments (package-arguments mbedtls-apache)
989 `(modify-phases ,phases
990 (add-before 'configure 'configure-extra-features
992 (for-each (lambda (feature)
993 (invoke "scripts/config.pl" "set" feature))
994 (list "MBEDTLS_THREADING_C"
995 "MBEDTLS_THREADING_PTHREAD"))
996 ;; XXX The above enables code that breaks with -Werror…
997 (substitute* "CMakeLists.txt"
998 ((" -Wformat-signedness") ""))
1001 (define-public dehydrated
1008 "https://github.com/dehydrated-io/dehydrated/releases/download/"
1009 "v" version "/dehydrated-" version ".tar.gz"))
1012 "1yf4kldyd5y13r6qxrkcbbk74ykngq7jzy0351vb2r3ywp114pqw"))))
1013 (build-system trivial-build-system)
1015 `(#:modules ((guix build utils)
1019 (use-modules (guix build utils)
1021 (let* ((source (assoc-ref %build-inputs "source"))
1022 (tar (assoc-ref %build-inputs "tar"))
1023 (gz (assoc-ref %build-inputs "gzip"))
1024 (out (assoc-ref %outputs "out"))
1025 (bin (string-append out "/bin"))
1026 (doc (string-append out "/share/doc/" ,name "-" ,version))
1027 (man (string-append out "/share/man"))
1028 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
1030 (setenv "PATH" (string-append gz "/bin"))
1031 (invoke (string-append tar "/bin/tar") "xvf" source)
1032 (chdir (string-append ,name "-" ,version))
1034 (copy-recursively "docs" doc)
1035 (install-file "LICENSE" doc)
1038 (rename-file (string-append doc "/man")
1039 (string-append man "/man1"))
1040 (for-each (cut invoke "gzip" "-9" <>)
1041 (find-files man ".*"))
1043 (install-file "dehydrated" bin)
1044 (with-directory-excursion bin
1045 (patch-shebang "dehydrated" (list bash))
1047 ;; Do not try to write to the store.
1048 (substitute* "dehydrated"
1049 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
1051 (setenv "PATH" bash)
1052 (wrap-program "dehydrated"
1055 (string-append dir "/bin"))
1056 (map (lambda (input)
1057 (assoc-ref %build-inputs input))
1068 ("coreutils" ,coreutils)
1070 ("diffutils" ,diffutils)
1073 ("openssl" ,openssl)
1078 (home-page "https://dehydrated.io/")
1079 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
1080 (description "Dehydrated is a client for signing certificates with an
1081 ACME-server (currently only provided by Let's Encrypt) implemented as a
1082 relatively simple Bash script.")
1083 (license license:expat)))
1085 (define-public go-github-com-certifi-gocertifi
1086 (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec")
1089 (name "go-github-com-certifi-gocertifi")
1090 (version (git-version "2018.01.18" revision commit))
1094 (url "https://github.com/certifi/gocertifi")
1096 (file-name (git-file-name name version))
1099 "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj"))))
1100 (build-system go-build-system)
1102 '(#:import-path "github.com/certifi/gocertifi"))
1103 (synopsis "X.509 TLS root certificate bundle for Go")
1104 (description "This package is a Go language X.509 TLS root certificate bundle,
1105 derived from Mozilla's collection.")
1106 (home-page "https://certifi.io")
1107 (license license:mpl2.0))))
1116 (url (string-append "https://github.com/awslabs/" name))
1117 (commit (string-append "v" version))))
1118 (file-name (git-file-name name version))
1121 "1q6kmgwb8jxmc4ijzk9pkqzz8lsbfsv9hyzqvy944w7306zx1r5h"))))
1122 (build-system cmake-build-system)
1124 '(#:tests? #f ; tests fail to build for static library
1126 '("-DBUILD_TESTING=OFF"
1127 "-DBUILD_SHARED_LIBS=ON")))
1129 `(("openssl" ,openssl)
1130 ("openssl:static" ,openssl "static")))
1131 (synopsis "SSL/TLS implementation")
1132 (description "This library provides a C99 implementation of SSL/TLS.")
1133 (home-page "https://github.com/awslabs/s2n")
1134 (license license:asl2.0)))