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