gnu: OpenSSL: Update replacement to 1.1.1e [fixes CVE-2019-1551].
[jackhill/guix/guix.git] / gnu / packages / tls.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019 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, 2019 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016, 2017, 2018 ng0 <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, 2019, 2020 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>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
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.
23 ;;;
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.
28 ;;;
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/>.
31
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 git-download)
37 #:use-module (guix utils)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system go)
40 #:use-module (guix build-system perl)
41 #:use-module (guix build-system python)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system trivial)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages curl)
49 #:use-module (gnu packages dns)
50 #:use-module (gnu packages gawk)
51 #:use-module (gnu packages guile)
52 #:use-module (gnu packages libbsd)
53 #:use-module (gnu packages libffi)
54 #:use-module (gnu packages libidn)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages ncurses)
57 #:use-module (gnu packages nettle)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages python-crypto)
62 #:use-module (gnu packages python-web)
63 #:use-module (gnu packages python-xyz)
64 #:use-module (gnu packages sphinx)
65 #:use-module (gnu packages texinfo)
66 #:use-module (gnu packages time)
67 #:use-module (gnu packages base)
68 #:use-module (srfi srfi-1))
69
70 (define-public libtasn1
71 (package
72 (name "libtasn1")
73 (version "4.14")
74 (source
75 (origin
76 (method url-fetch)
77 (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
78 version ".tar.gz"))
79 (sha256
80 (base32
81 "025sqnlzji78ss2fi78dajc0v0h5fi02wp39hws41sn8qnjlnq4y"))))
82 (build-system gnu-build-system)
83 (arguments
84 `(#:configure-flags '("--disable-static")))
85 (native-inputs `(("perl" ,perl)))
86 (home-page "https://www.gnu.org/software/libtasn1/")
87 (synopsis "ASN.1 library")
88 (description
89 "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
90 for transmitting machine-neutral encodings of data objects in computer
91 networking, allowing for formal validation of data according to some
92 specifications.")
93 (license license:lgpl2.0+)))
94
95 (define-public asn1c
96 (package
97 (name "asn1c")
98 (version "0.9.28")
99 (source (origin
100 (method url-fetch)
101 (uri (string-append "https://lionet.info/soft/asn1c-"
102 version ".tar.gz"))
103 (sha256
104 (base32
105 "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0"))))
106 (build-system gnu-build-system)
107 (native-inputs
108 `(("perl" ,perl)))
109 (home-page "https://lionet.info/asn1c")
110 (synopsis "ASN.1 to C compiler")
111 (description "The ASN.1 to C compiler takes ASN.1 module
112 files and generates C++ compatible C source code. That code can be
113 used to serialize the native C structures into compact and unambiguous
114 BER/XER/PER-based data files, and deserialize the files back.
115
116 Various ASN.1 based formats are widely used in the industry, such as to encode
117 the X.509 certificates employed in the HTTPS handshake, to exchange control
118 data between mobile phones and cellular networks, to car-to-car communication
119 in intelligent transportation networks.")
120 (license license:bsd-2)))
121
122 (define-public p11-kit
123 (package
124 (name "p11-kit")
125 (version "0.23.20")
126 (source
127 (origin
128 (method url-fetch)
129 (uri (string-append "https://github.com/p11-glue/p11-kit/releases/"
130 "download/" version "/p11-kit-" version ".tar.xz"))
131 (sha256
132 (base32
133 "0131maw666ha4d6iyj13fkz18c4pnb3lw2xwv5kvkmnzqcj61n0l"))))
134 (build-system gnu-build-system)
135 (native-inputs
136 `(("pkg-config" ,pkg-config)))
137 (inputs
138 `(("libffi" ,libffi)
139 ("libtasn1" ,libtasn1)))
140 (arguments
141 `(#:configure-flags '("--without-trust-paths")
142 #:phases (modify-phases %standard-phases
143 (add-before 'check 'prepare-tests
144 (lambda _
145 ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
146 ;; and looks for .cache and other directories (only).
147 ;; For simplicity just drop it since it is irrelevant
148 ;; in the build container.
149 (substitute* "Makefile"
150 (("test-runtime\\$\\(EXEEXT\\)") ""))
151 #t)))))
152 (home-page "https://p11-glue.freedesktop.org/p11-kit.html")
153 (synopsis "PKCS#11 library")
154 (description
155 "p11-kit provides a way to load and enumerate PKCS#11 modules. It
156 provides a standard configuration setup for installing PKCS#11 modules
157 in such a way that they are discoverable. It also solves problems with
158 coordinating the use of PKCS#11 by different components or libraries
159 living in the same process.")
160 (license license:bsd-3)))
161
162 (define-public gnutls
163 (package
164 (name "gnutls")
165 (version "3.6.9")
166 (source (origin
167 (method url-fetch)
168 (uri
169 ;; Note: Releases are no longer on ftp.gnu.org since the
170 ;; schism (after version 3.1.5).
171 (string-append "mirror://gnupg/gnutls/v"
172 (version-major+minor version)
173 "/gnutls-" version ".tar.xz"))
174 (patches (search-patches "gnutls-skip-trust-store-test.patch"))
175 (sha256
176 (base32
177 "1jqz5s3lv8sa53348cfi9nr5pw5l55n8m40b8msdvv0pb2jzqca3"))))
178 (build-system gnu-build-system)
179 (arguments
180 `(; Ensure we don't keep a reference to this buggy software.
181 #:disallowed-references (,net-tools)
182 #:configure-flags
183 (list
184 ;; GnuTLS doesn't consult any environment variables to specify
185 ;; the location of the system-wide trust store. Instead it has a
186 ;; configure-time option. Unless specified, its configure script
187 ;; attempts to auto-detect the location by looking for common
188 ;; places in the file system, none of which are present in our
189 ;; chroot build environment. If not found, then no default trust
190 ;; store is used, so each program has to provide its own
191 ;; fallback, and users have to configure each program
192 ;; independently. This seems suboptimal.
193 "--with-default-trust-store-dir=/etc/ssl/certs"
194
195 ;; Tell the build system that we want Guile bindings installed to
196 ;; the output instead of Guiles own module directory.
197 (string-append "--with-guile-site-dir="
198 "$(datarootdir)/guile/site/$(GUILE_EFFECTIVE_VERSION)")
199 (string-append "--with-guile-site-ccache-dir="
200 "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache")
201 (string-append "--with-guile-extension-dir="
202 "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/extensions")
203
204 ;; FIXME: Temporarily disable p11-kit support since it is not
205 ;; working on mips64el.
206 "--without-p11-kit")
207
208 #:phases (modify-phases %standard-phases
209 (add-after
210 'install 'move-doc
211 (lambda* (#:key outputs #:allow-other-keys)
212 ;; Copy the 4.1 MiB of section 3 man pages to "doc".
213 (let* ((out (assoc-ref outputs "out"))
214 (doc (assoc-ref outputs "doc"))
215 (mandir (string-append doc "/share/man/man3"))
216 (oldman (string-append out "/share/man/man3")))
217 (mkdir-p mandir)
218 (copy-recursively oldman mandir)
219 (delete-file-recursively oldman)
220 #t))))))
221 (outputs '("out" ;4.4 MiB
222 "debug"
223 "doc")) ;4.1 MiB of man pages
224 (native-inputs
225 `(("net-tools" ,net-tools)
226 ("pkg-config" ,pkg-config)
227 ("which" ,which)))
228 (inputs
229 `(("guile" ,guile-2.2)))
230 (propagated-inputs
231 ;; These are all in the 'Requires.private' field of gnutls.pc.
232 `(("libtasn1" ,libtasn1)
233 ("libidn2" ,libidn2)
234 ("nettle" ,nettle)
235 ("zlib" ,zlib)))
236 (home-page "https://www.gnu.org/software/gnutls/")
237 (synopsis "Transport layer security library")
238 (description
239 "GnuTLS is a secure communications library implementing the SSL, TLS
240 and DTLS protocols. It is provided in the form of a C library to support the
241 protocols, as well as to parse and write X.5009, PKCS 12, OpenPGP and other
242 required structures.")
243 (license license:lgpl2.1+)
244 (properties '((ftp-server . "ftp.gnutls.org")
245 (ftp-directory . "/gcrypt/gnutls")))))
246
247 (define-public gnutls/guile-2.0
248 ;; GnuTLS for Guile 2.0.
249 (package
250 (inherit gnutls)
251 (name "guile2.0-gnutls")
252 (inputs `(("guile" ,guile-2.0)
253 ,@(alist-delete "guile" (package-inputs gnutls))))))
254
255 (define-public gnutls/dane
256 ;; GnuTLS with build libgnutls-dane, implementing DNS-based
257 ;; Authentication of Named Entities. This is required for GNS functionality
258 ;; by GNUnet and gnURL. This is done in an extra package definition
259 ;; to have the choice between GnuTLS with Dane and without Dane.
260 (package
261 (inherit gnutls)
262 (name "gnutls-dane")
263 (inputs `(("unbound" ,unbound)
264 ,@(package-inputs gnutls)))))
265
266 (define gnutls-3.6.10
267 ;; This is for 'guile3.0-gnutls', below. Version 3.6.10 is the first to
268 ;; introduce Guile 2.9/3.0 support.
269 (package
270 (inherit gnutls)
271 (version "3.6.10")
272 (source (origin
273 (inherit (package-source gnutls))
274 (uri (string-append "mirror://gnupg/gnutls/v"
275 (version-major+minor version)
276 "/gnutls-" version ".tar.xz"))
277 (sha256
278 (base32
279 "14r2h73yfj66cm14k9mnb3kgzq5a7qjg5b31m53bf19vcxkwmwxi"))))
280 (native-inputs
281 `(,@(package-native-inputs gnutls)
282
283 ;; Datefudge is used to fuzz time for tests, and its presence
284 ;; enables a test that uses 'setsid' from util-linux.
285 ("datefudge" ,datefudge)
286 ("util-linux" ,util-linux)))))
287
288 (define-public guile3.0-gnutls
289 (package
290 (inherit gnutls-3.6.10)
291 (name "guile3.0-gnutls")
292 (arguments
293 (substitute-keyword-arguments (package-arguments gnutls-3.6.10)
294 ((#:phases phases '%standard-phases)
295 `(modify-phases ,phases
296 (add-before 'build 'leave-guile-stdout-open
297 (lambda _
298 ;; Work around <https://bugs.gnu.org/38348>.
299 (substitute* "guile/Makefile"
300 (("out=-") "out=/dev/null"))
301 #t))))))
302 (inputs `(("guile" ,guile-next)
303 ,@(alist-delete "guile"
304 (package-inputs gnutls-3.6.10))))))
305
306 (define-public openssl
307 (package
308 (name "openssl")
309 (version "1.1.1c")
310 (replacement openssl-1.1.1e)
311 (source (origin
312 (method url-fetch)
313 (uri (list (string-append "https://www.openssl.org/source/openssl-"
314 version ".tar.gz")
315 (string-append "ftp://ftp.openssl.org/source/"
316 "openssl-" version ".tar.gz")
317 (string-append "ftp://ftp.openssl.org/source/old/"
318 (string-trim-right version char-set:letter)
319 "/openssl-" version ".tar.gz")))
320 (sha256
321 (base32
322 "142c7zdlz06hjrrvinb9f276czc78bnkyhd9xma621qmmmwk1yzn"))
323 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))))
324 (build-system gnu-build-system)
325 (outputs '("out"
326 "doc" ;6.8 MiB of man3 pages and full HTML documentation
327 "static")) ;6.4 MiB of .a files
328 (native-inputs `(("perl" ,perl)))
329 (arguments
330 `(#:disallowed-references (,perl)
331 #:parallel-build? #f
332 #:parallel-tests? #f
333 #:test-target "test"
334
335 ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
336 ;; so we explicitly disallow it here.
337 #:disallowed-references ,(list (canonical-package perl))
338 #:phases
339 (modify-phases %standard-phases
340 (replace 'configure
341 (lambda* (#:key outputs #:allow-other-keys)
342 (let* ((out (assoc-ref outputs "out"))
343 (lib (string-append out "/lib")))
344 ;; It's not a shebang so patch-source-shebangs misses it.
345 (substitute* "config"
346 (("/usr/bin/env")
347 (string-append (assoc-ref %build-inputs "coreutils")
348 "/bin/env")))
349 (invoke "./config"
350 "shared" ;build shared libraries
351 "--libdir=lib"
352
353 ;; The default for this catch-all directory is
354 ;; PREFIX/ssl. Change that to something more
355 ;; conventional.
356 (string-append "--openssldir=" out
357 "/share/openssl-" ,version)
358
359 (string-append "--prefix=" out)
360 (string-append "-Wl,-rpath," lib)))))
361 (add-after 'install 'move-static-libraries
362 (lambda* (#:key outputs #:allow-other-keys)
363 ;; Move static libraries to the "static" output.
364 (let* ((out (assoc-ref outputs "out"))
365 (lib (string-append out "/lib"))
366 (static (assoc-ref outputs "static"))
367 (slib (string-append static "/lib")))
368 (for-each (lambda (file)
369 (install-file file slib)
370 (delete-file file))
371 (find-files lib "\\.a$"))
372 #t)))
373 (add-after 'install 'move-extra-documentation
374 (lambda* (#:key outputs #:allow-other-keys)
375 ;; Move man3 pages and full HTML documentation to "doc".
376 (let* ((out (assoc-ref outputs "out"))
377 (man3 (string-append out "/share/man/man3"))
378 (html (string-append out "/share/doc/openssl"))
379 (doc (assoc-ref outputs "doc"))
380 (man-target (string-append doc "/share/man/man3"))
381 (html-target (string-append doc "/share/doc/openssl")))
382 (copy-recursively man3 man-target)
383 (delete-file-recursively man3)
384 (copy-recursively html html-target)
385 (delete-file-recursively html)
386 #t)))
387 (add-after
388 'install 'remove-miscellany
389 (lambda* (#:key outputs #:allow-other-keys)
390 ;; The 'misc' directory contains random undocumented shell and Perl
391 ;; scripts. Remove them to avoid retaining a reference on Perl.
392 (let ((out (assoc-ref outputs "out")))
393 (delete-file-recursively (string-append out "/share/openssl-"
394 ,version "/misc"))
395 #t))))))
396 (native-search-paths
397 (list (search-path-specification
398 (variable "SSL_CERT_DIR")
399 (separator #f) ;single entry
400 (files '("etc/ssl/certs")))
401 (search-path-specification
402 (variable "SSL_CERT_FILE")
403 (file-type 'regular)
404 (separator #f) ;single entry
405 (files '("etc/ssl/certs/ca-certificates.crt")))))
406 (synopsis "SSL/TLS implementation")
407 (description
408 "OpenSSL is an implementation of SSL/TLS.")
409 (license license:openssl)
410 (home-page "https://www.openssl.org/")))
411
412 (define openssl-1.1.1e
413 (package
414 (inherit openssl)
415 (version "1.1.1e")
416 (source (origin
417 (method url-fetch)
418 (uri (list (string-append "https://www.openssl.org/source/openssl-"
419 version ".tar.gz")
420 (string-append "ftp://ftp.openssl.org/source/"
421 "openssl-" version ".tar.gz")
422 (string-append "ftp://ftp.openssl.org/source/old/"
423 (string-trim-right version char-set:letter)
424 "/openssl-" version ".tar.gz")))
425 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
426 (sha256
427 (base32
428 "1gnwlri1dphr5wdzmg9vlhkh6aq2yqgpfkpmffzwjlfb26n62kv9"))))))
429
430 (define-public openssl-1.0
431 (package
432 (inherit openssl)
433 (name "openssl")
434 (version "1.0.2u")
435 (source (origin
436 (method url-fetch)
437 (uri (list (string-append "https://www.openssl.org/source/openssl-"
438 version ".tar.gz")
439 (string-append "ftp://ftp.openssl.org/source/"
440 "openssl-" version ".tar.gz")
441 (string-append "ftp://ftp.openssl.org/source/old/"
442 (string-trim-right version char-set:letter)
443 "/openssl-" version ".tar.gz")))
444 (sha256
445 (base32
446 "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c"))
447 (patches (search-patches "openssl-runpath.patch"
448 "openssl-c-rehash-in.patch"))))
449 (outputs '("out"
450 "doc" ;1.5MiB of man3 pages
451 "static")) ;6MiB of .a files
452 (arguments
453 (substitute-keyword-arguments (package-arguments openssl)
454 ;; Parallel build is not supported in 1.0.x.
455 ((#:parallel-build? _ #f) #f)
456 ((#:phases phases)
457 `(modify-phases ,phases
458 (add-before 'patch-source-shebangs 'patch-tests
459 (lambda* (#:key inputs native-inputs #:allow-other-keys)
460 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
461 (substitute* (find-files "test" ".*")
462 (("/bin/sh")
463 (string-append bash "/bin/sh"))
464 (("/bin/rm")
465 "rm"))
466 #t)))
467 (add-before 'configure 'patch-Makefile.org
468 (lambda* (#:key outputs #:allow-other-keys)
469 ;; The default MANDIR is some unusual place. Fix that.
470 (let ((out (assoc-ref outputs "out")))
471 (patch-makefile-SHELL "Makefile.org")
472 (substitute* "Makefile.org"
473 (("^MANDIR[[:blank:]]*=.*$")
474 (string-append "MANDIR = " out "/share/man\n")))
475 #t)))
476 (replace 'configure
477 ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
478 (lambda* (#:key outputs #:allow-other-keys)
479 (let ((out (assoc-ref outputs "out")))
480 (invoke "./config"
481 "shared" ;build shared libraries
482 "--libdir=lib"
483
484 ;; The default for this catch-all directory is
485 ;; PREFIX/ssl. Change that to something more
486 ;; conventional.
487 (string-append "--openssldir=" out
488 "/share/openssl-" ,version)
489
490 (string-append "--prefix=" out)))))
491 (delete 'move-extra-documentation)
492 (add-after 'install 'move-man3-pages
493 (lambda* (#:key outputs #:allow-other-keys)
494 ;; Move section 3 man pages to "doc".
495 (let* ((out (assoc-ref outputs "out"))
496 (man3 (string-append out "/share/man/man3"))
497 (doc (assoc-ref outputs "doc"))
498 (target (string-append doc "/share/man/man3")))
499 (mkdir-p target)
500 (for-each (lambda (file)
501 (rename-file file
502 (string-append target "/"
503 (basename file))))
504 (find-files man3))
505 (delete-file-recursively man3)
506 #t)))
507 ;; XXX: Duplicate this phase to make sure 'version' evaluates
508 ;; in the current scope and not the inherited one.
509 (replace 'remove-miscellany
510 (lambda* (#:key outputs #:allow-other-keys)
511 ;; The 'misc' directory contains random undocumented shell and Perl
512 ;; scripts. Remove them to avoid retaining a reference on Perl.
513 (let ((out (assoc-ref outputs "out")))
514 (delete-file-recursively (string-append out "/share/openssl-"
515 ,version "/misc"))
516 #t)))))))))
517
518 (define-public libressl
519 (package
520 (name "libressl")
521 (version "3.0.2")
522 (source (origin
523 (method url-fetch)
524 (uri (string-append "mirror://openbsd/LibreSSL/"
525 "libressl-" version ".tar.gz"))
526 (sha256
527 (base32
528 "13ir2lpxz8y1m151k7lrx306498nzfhwlvgkgv97v5cvywmifyyz"))))
529 (build-system gnu-build-system)
530 (arguments
531 ;; Do as if 'getentropy' was missing since older Linux kernels lack it
532 ;; and libc would return ENOSYS, which is not properly handled.
533 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
534 '(#:configure-flags '("ac_cv_func_getentropy=no"
535 ;; Provide a TLS-enabled netcat.
536 "--enable-nc")))
537 (native-search-paths
538 (list (search-path-specification
539 (variable "SSL_CERT_DIR")
540 (separator #f) ;single entry
541 (files '("etc/ssl/certs")))
542 (search-path-specification
543 (variable "SSL_CERT_FILE")
544 (separator #f) ;single entry
545 (files '("etc/ssl/certs/ca-certificates.crt")))))
546 (home-page "https://www.libressl.org/")
547 (synopsis "SSL/TLS implementation")
548 (description "LibreSSL is a version of the TLS/crypto stack, forked from
549 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
550 and applying best practice development processes. This package also includes a
551 netcat implementation that supports TLS.")
552 ;; Files taken from OpenSSL keep their license, others are under various
553 ;; non-copyleft licenses.
554 (license (list license:openssl
555 (license:non-copyleft
556 "file://COPYING"
557 "See COPYING in the distribution.")))))
558
559 (define-public python-acme
560 (package
561 (name "python-acme")
562 ;; Remember to update the hash of certbot when updating python-acme.
563 (version "1.3.0")
564 (source (origin
565 (method url-fetch)
566 (uri (pypi-uri "acme" version))
567 (sha256
568 (base32
569 "03fjmg0fgfy7xfn3i8rzn9i0i4amajmijkash84qb8mlphgrxpn0"))))
570 (build-system python-build-system)
571 (arguments
572 `(#:phases
573 (modify-phases %standard-phases
574 (add-after 'build 'build-documentation
575 (lambda _
576 (invoke "make" "-C" "docs" "man" "info")))
577 (add-after 'install 'install-documentation
578 (lambda* (#:key outputs #:allow-other-keys)
579 (let* ((out (assoc-ref outputs "out"))
580 (man (string-append out "/share/man/man1"))
581 (info (string-append out "/info")))
582 (install-file "docs/_build/texinfo/acme-python.info" info)
583 (install-file "docs/_build/man/acme-python.1" man)
584 #t))))))
585 ;; TODO: Add optional inputs for testing.
586 (native-inputs
587 `(("python-mock" ,python-mock)
588 ("python-pytest" ,python-pytest)
589 ;; For documentation
590 ("python-sphinx" ,python-sphinx)
591 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
592 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
593 ("texinfo" ,texinfo)))
594 (propagated-inputs
595 `(("python-josepy" ,python-josepy)
596 ("python-six" ,python-six)
597 ("python-requests" ,python-requests)
598 ("python-requests-toolbelt" ,python-requests-toolbelt)
599 ("python-pytz" ,python-pytz)
600 ("python-pyrfc3339" ,python-pyrfc3339)
601 ("python-pyasn1" ,python-pyasn1)
602 ("python-cryptography" ,python-cryptography)
603 ("python-pyopenssl" ,python-pyopenssl)))
604 (home-page "https://github.com/certbot/certbot")
605 (synopsis "ACME protocol implementation in Python")
606 (description "ACME protocol implementation in Python")
607 (license license:asl2.0)))
608
609 (define-public certbot
610 (package
611 (name "certbot")
612 ;; Certbot and python-acme are developed in the same repository, and their
613 ;; versions should remain synchronized.
614 (version (package-version python-acme))
615 (source (origin
616 (method url-fetch)
617 (uri (pypi-uri "certbot" version))
618 (sha256
619 (base32
620 "1n5i0k6kwmd6wvivshfl3k4djwcpwx390c39xmr2hhrgpk5r285w"))))
621 (build-system python-build-system)
622 (arguments
623 `(,@(substitute-keyword-arguments (package-arguments python-acme)
624 ((#:phases phases)
625 `(modify-phases ,phases
626 (replace 'install-documentation
627 (lambda* (#:key outputs #:allow-other-keys)
628 (let* ((out (assoc-ref outputs "out"))
629 (man1 (string-append out "/share/man/man1"))
630 (man7 (string-append out "/share/man/man7"))
631 (info (string-append out "/info")))
632 (install-file "docs/_build/texinfo/Certbot.info" info)
633 (install-file "docs/_build/man/certbot.1" man1)
634 (install-file "docs/_build/man/certbot.7" man7)
635 #t))))))))
636 ;; TODO: Add optional inputs for testing.
637 (native-inputs
638 `(("python-mock" ,python-mock)
639 ("python-pytest" ,python-pytest)
640 ;; For documentation
641 ("python-sphinx" ,python-sphinx)
642 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
643 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
644 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
645 ("texinfo" ,texinfo)))
646 (propagated-inputs
647 `(("python-acme" ,python-acme)
648 ("python-cryptography" ,python-cryptography)
649 ("python-zope-interface" ,python-zope-interface)
650 ("python-pyrfc3339" ,python-pyrfc3339)
651 ("python-pyopenssl" ,python-pyopenssl)
652 ("python-configobj" ,python-configobj)
653 ("python-configargparse" ,python-configargparse)
654 ("python-distro" ,python-distro)
655 ("python-zope-component" ,python-zope-component)
656 ("python-parsedatetime" ,python-parsedatetime)
657 ("python-six" ,python-six)
658 ("python-psutil" ,python-psutil)
659 ("python-requests" ,python-requests)
660 ("python-pytz" ,python-pytz)))
661 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
662 (description "Certbot automatically receives and installs X.509 certificates
663 to enable Transport Layer Security (TLS) on servers. It interoperates with the
664 Let’s Encrypt certificate authority (CA), which issues browser-trusted
665 certificates for free.")
666 (home-page "https://certbot.eff.org/")
667 (license license:asl2.0)))
668
669 (define-public letsencrypt
670 (package (inherit certbot)
671 (name "letsencrypt")
672 (properties `((superseded . ,certbot)))))
673
674 (define-public perl-net-ssleay
675 (package
676 (name "perl-net-ssleay")
677 (version "1.88")
678 (source (origin
679 (method url-fetch)
680 (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
681 "Net-SSLeay-" version ".tar.gz"))
682 (sha256
683 (base32
684 "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
685 (build-system perl-build-system)
686 (inputs `(("openssl" ,openssl)))
687 (arguments
688 `(#:phases
689 (modify-phases %standard-phases
690 (add-before
691 'configure 'set-ssl-prefix
692 (lambda* (#:key inputs #:allow-other-keys)
693 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
694 #t)))))
695 (synopsis "Perl extension for using OpenSSL")
696 (description
697 "This module offers some high level convenience functions for accessing
698 web pages on SSL servers (for symmetry, the same API is offered for accessing
699 http servers, too), an sslcat() function for writing your own clients, and
700 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
701 servers or clients for more complicated applications.")
702 (license license:perl-license)
703 (home-page "https://metacpan.org/release/Net-SSLeay")))
704
705 (define-public perl-crypt-openssl-rsa
706 (package
707 (name "perl-crypt-openssl-rsa")
708 (version "0.31")
709 (source
710 (origin
711 (method url-fetch)
712 (uri (string-append
713 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
714 version
715 ".tar.gz"))
716 (sha256
717 (base32
718 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
719 (build-system perl-build-system)
720 (native-inputs
721 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
722 (inputs
723 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
724 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
725 ("openssl" ,openssl)))
726 (arguments perl-crypt-arguments)
727 (home-page
728 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
729 (synopsis
730 "RSA encoding and decoding, using the openSSL libraries")
731 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
732 OpenSSL libraries).")
733 (license license:perl-license)))
734
735 (define perl-crypt-arguments
736 `(#:phases (modify-phases %standard-phases
737 (add-before 'configure 'patch-Makefile.PL
738 (lambda* (#:key inputs #:allow-other-keys)
739 (substitute* "Makefile.PL"
740 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
741 (assoc-ref inputs "openssl")
742 "/lib -lcrypto'],")))
743 #t)))))
744
745 (define-public perl-crypt-openssl-bignum
746 (package
747 (name "perl-crypt-openssl-bignum")
748 (version "0.09")
749 (source
750 (origin
751 (method url-fetch)
752 (uri (string-append
753 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
754 version
755 ".tar.gz"))
756 (sha256
757 (base32
758 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
759 (build-system perl-build-system)
760 (inputs `(("openssl" ,openssl)))
761 (arguments perl-crypt-arguments)
762 (home-page
763 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
764 (synopsis
765 "OpenSSL's multiprecision integer arithmetic in Perl")
766 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
767 arithmetic in Perl.")
768 ;; At your option either gpl1+ or the Artistic License
769 (license license:perl-license)))
770
771 (define-public perl-crypt-openssl-guess
772 (package
773 (name "perl-crypt-openssl-guess")
774 (version "0.11")
775 (source
776 (origin
777 (method url-fetch)
778 (uri (string-append
779 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
780 version ".tar.gz"))
781 (sha256
782 (base32
783 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
784 (build-system perl-build-system)
785 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
786 (synopsis "Guess the OpenSSL include path")
787 (description
788 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
789 correct OpenSSL include path. It is intended for use in your
790 @file{Makefile.PL}.")
791 (license license:perl-license)))
792
793 (define-public perl-crypt-openssl-random
794 (package
795 (name "perl-crypt-openssl-random")
796 (version "0.15")
797 (source
798 (origin
799 (method url-fetch)
800 (uri (string-append
801 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
802 version
803 ".tar.gz"))
804 (sha256
805 (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
806 (build-system perl-build-system)
807 (native-inputs
808 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
809 (inputs
810 `(("openssl" ,openssl)))
811 (arguments perl-crypt-arguments)
812 (home-page
813 "https://metacpan.org/release/Crypt-OpenSSL-Random")
814 (synopsis
815 "OpenSSL/LibreSSL pseudo-random number generator access")
816 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
817 number generator")
818 (license license:perl-license)))
819
820 (define-public acme-client
821 (package
822 (name "acme-client")
823 (version "0.1.16")
824 (source (origin
825 (method url-fetch)
826 (uri (string-append "https://kristaps.bsd.lv/" name "/"
827 "snapshots/" name "-portable-"
828 version ".tgz"))
829 (sha256
830 (base32
831 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
832 (build-system gnu-build-system)
833 (arguments
834 '(#:tests? #f ; no test suite
835 #:make-flags
836 (list "CC=gcc"
837 (string-append "PREFIX=" (assoc-ref %outputs "out")))
838 #:phases
839 (modify-phases %standard-phases
840 (add-after 'unpack 'patch-paths
841 (lambda* (#:key inputs #:allow-other-keys)
842 (let ((pem (string-append (assoc-ref inputs "libressl")
843 "/etc/ssl/cert.pem")))
844 (substitute* "http.c"
845 (("/etc/ssl/cert.pem") pem))
846 #t)))
847 (delete 'configure)))) ; no './configure' script
848 (native-inputs
849 `(("pkg-config" ,pkg-config)))
850 (inputs
851 `(("libbsd" ,libbsd)
852 ("libressl" ,libressl)))
853 (synopsis "Let's Encrypt client by the OpenBSD project")
854 (description "acme-client is a Let's Encrypt client implemented in C. It
855 uses a modular design, and attempts to secure itself by dropping privileges and
856 operating in a chroot where possible. acme-client is developed on OpenBSD and
857 then ported to the GNU / Linux environment.")
858 (home-page "https://kristaps.bsd.lv/acme-client/")
859 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
860 ;; and 'jsmn.c' are distributed under the Expat license.
861 (license (list license:isc license:expat))))
862
863 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
864 ;; variant exists in addition to the "-apache" one.
865 (define-public mbedtls-apache
866 (package
867 (name "mbedtls-apache")
868 (version "2.16.5")
869 (source
870 (origin
871 (method url-fetch)
872 ;; XXX: The download links on the website are script redirection links
873 ;; which effectively lead to the format listed in the uri here.
874 (uri (string-append "https://tls.mbed.org/download/mbedtls-"
875 version "-apache.tgz"))
876 (sha256
877 (base32
878 "0kdhwy241xsk4isbadqx6z80m8sf76da5sbmqv8qy11yr37cdd35"))))
879 (build-system cmake-build-system)
880 (arguments
881 `(#:configure-flags
882 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON"
883 "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF")))
884 (native-inputs
885 `(("perl" ,perl)
886 ("python" ,python)))
887 (synopsis "Small TLS library")
888 (description
889 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
890 for developers to include cryptographic and SSL/TLS capabilities in their
891 (embedded) products, facilitating this functionality with a minimal
892 coding footprint.")
893 (home-page "https://tls.mbed.org")
894 (license license:asl2.0)))
895
896 ;; The Hiawatha Web server requires some specific features to be enabled.
897 (define-public mbedtls-for-hiawatha
898 (hidden-package
899 (package
900 (inherit mbedtls-apache)
901 (arguments
902 (substitute-keyword-arguments
903 `(#:phases
904 (modify-phases %standard-phases
905 (add-after 'configure 'configure-extra-features
906 (lambda _
907 (for-each (lambda (feature)
908 (invoke "scripts/config.pl" "set" feature))
909 (list "MBEDTLS_THREADING_C"
910 "MBEDTLS_THREADING_PTHREAD"))
911 #t)))
912 ,@(package-arguments mbedtls-apache)))))))
913
914 (define-public dehydrated
915 (package
916 (name "dehydrated")
917 (version "0.6.5")
918 (source (origin
919 (method url-fetch)
920 (uri (string-append
921 "https://github.com/dehydrated-io/dehydrated/releases/download/"
922 "v" version "/dehydrated-" version ".tar.gz"))
923 (sha256
924 (base32
925 "0dgskgbdd95p13jx6s13p77y15wngb5cm6p4305cf2s54w0bvahh"))))
926 (build-system trivial-build-system)
927 (arguments
928 `(#:modules ((guix build utils)
929 (srfi srfi-26))
930 #:builder
931 (begin
932 (use-modules (guix build utils)
933 (srfi srfi-26))
934 (let* ((source (assoc-ref %build-inputs "source"))
935 (tar (assoc-ref %build-inputs "tar"))
936 (gz (assoc-ref %build-inputs "gzip"))
937 (out (assoc-ref %outputs "out"))
938 (bin (string-append out "/bin"))
939 (doc (string-append out "/share/doc/" ,name "-" ,version))
940 (man (string-append out "/share/man"))
941 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
942
943 (setenv "PATH" (string-append gz "/bin"))
944 (invoke (string-append tar "/bin/tar") "xvf" source)
945 (chdir (string-append ,name "-" ,version))
946
947 (copy-recursively "docs" doc)
948 (install-file "LICENSE" doc)
949
950 (mkdir-p man)
951 (rename-file (string-append doc "/man")
952 (string-append man "/man1"))
953 (for-each (cut invoke "gzip" "-9" <>)
954 (find-files man ".*"))
955
956 (install-file "dehydrated" bin)
957 (with-directory-excursion bin
958 (patch-shebang "dehydrated" (list bash))
959
960 ;; Do not try to write to the store.
961 (substitute* "dehydrated"
962 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
963
964 (setenv "PATH" bash)
965 (wrap-program "dehydrated"
966 `("PATH" ":" prefix
967 ,(map (lambda (dir)
968 (string-append dir "/bin"))
969 (map (lambda (input)
970 (assoc-ref %build-inputs input))
971 '("coreutils"
972 "curl"
973 "diffutils"
974 "gawk"
975 "grep"
976 "openssl"
977 "sed"))))))
978 #t))))
979 (inputs
980 `(("bash" ,bash)
981 ("coreutils" ,coreutils)
982 ("curl" ,curl)
983 ("diffutils" ,diffutils)
984 ("gawk" ,gawk)
985 ("grep" ,grep)
986 ("openssl" ,openssl)
987 ("sed" ,sed)))
988 (native-inputs
989 `(("gzip" ,gzip)
990 ("tar" ,tar)))
991 (home-page "https://dehydrated.io/")
992 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
993 (description "Dehydrated is a client for signing certificates with an
994 ACME-server (currently only provided by Let's Encrypt) implemented as a
995 relatively simple Bash script.")
996 (license license:expat)))
997
998 (define-public go-github-com-certifi-gocertifi
999 (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec")
1000 (revision "1"))
1001 (package
1002 (name "go-github-com-certifi-gocertifi")
1003 (version (git-version "2018.01.18" revision commit))
1004 (source (origin
1005 (method git-fetch)
1006 (uri (git-reference
1007 (url "https://github.com/certifi/gocertifi")
1008 (commit commit)))
1009 (file-name (git-file-name name version))
1010 (sha256
1011 (base32
1012 "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj"))))
1013 (build-system go-build-system)
1014 (arguments
1015 '(#:import-path "github.com/certifi/gocertifi"))
1016 (synopsis "X.509 TLS root certificate bundle for Go")
1017 (description "This package is a Go language X.509 TLS root certificate bundle,
1018 derived from Mozilla's collection.")
1019 (home-page "https://certifi.io")
1020 (license license:mpl2.0))))