Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / tls.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
5 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
6 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
7 ;;; Copyright © 2015, 2016, 2017, 2018, 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 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.17")
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.gz"))
131 (sha256
132 (base32
133 "07kwdlw07jk9833k43kkhv0q9gkll3vmd25wwp68cpy0crfv4isl"))))
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.2
248 (deprecated-package "guile2.2-gnutls" gnutls))
249
250 (define-public gnutls/guile-2.0
251 ;; GnuTLS for Guile 2.0.
252 (package
253 (inherit gnutls)
254 (name "guile2.0-gnutls")
255 (inputs `(("guile" ,guile-2.0)
256 ,@(alist-delete "guile" (package-inputs gnutls))))))
257
258 (define-public gnutls/dane
259 ;; GnuTLS with build libgnutls-dane, implementing DNS-based
260 ;; Authentication of Named Entities. This is required for GNS functionality
261 ;; by GNUnet and gnURL. This is done in an extra package definition
262 ;; to have the choice between GnuTLS with Dane and without Dane.
263 (package
264 (inherit gnutls)
265 (name "gnutls-dane")
266 (inputs `(("unbound" ,unbound)
267 ,@(package-inputs gnutls)))))
268
269 (define-public openssl
270 (package
271 (name "openssl")
272 (version "1.1.1c")
273 (replacement openssl-1.1.1d)
274 (source (origin
275 (method url-fetch)
276 (uri (list (string-append "https://www.openssl.org/source/openssl-"
277 version ".tar.gz")
278 (string-append "ftp://ftp.openssl.org/source/"
279 "openssl-" version ".tar.gz")
280 (string-append "ftp://ftp.openssl.org/source/old/"
281 (string-trim-right version char-set:letter)
282 "/openssl-" version ".tar.gz")))
283 (sha256
284 (base32
285 "142c7zdlz06hjrrvinb9f276czc78bnkyhd9xma621qmmmwk1yzn"))
286 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))))
287 (build-system gnu-build-system)
288 (outputs '("out"
289 "doc" ;6.8 MiB of man3 pages and full HTML documentation
290 "static")) ;6.4 MiB of .a files
291 (native-inputs `(("perl" ,perl)))
292 (arguments
293 `(#:disallowed-references (,perl)
294 #:parallel-build? #f
295 #:parallel-tests? #f
296 #:test-target "test"
297
298 ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
299 ;; so we explicitly disallow it here.
300 #:disallowed-references ,(list (canonical-package perl))
301 #:phases
302 (modify-phases %standard-phases
303 (replace 'configure
304 (lambda* (#:key outputs #:allow-other-keys)
305 (let* ((out (assoc-ref outputs "out"))
306 (lib (string-append out "/lib")))
307 ;; It's not a shebang so patch-source-shebangs misses it.
308 (substitute* "config"
309 (("/usr/bin/env")
310 (string-append (assoc-ref %build-inputs "coreutils")
311 "/bin/env")))
312 (invoke "./config"
313 "shared" ;build shared libraries
314 "--libdir=lib"
315
316 ;; The default for this catch-all directory is
317 ;; PREFIX/ssl. Change that to something more
318 ;; conventional.
319 (string-append "--openssldir=" out
320 "/share/openssl-" ,version)
321
322 (string-append "--prefix=" out)
323 (string-append "-Wl,-rpath," lib)))))
324 (add-after 'install 'move-static-libraries
325 (lambda* (#:key outputs #:allow-other-keys)
326 ;; Move static libraries to the "static" output.
327 (let* ((out (assoc-ref outputs "out"))
328 (lib (string-append out "/lib"))
329 (static (assoc-ref outputs "static"))
330 (slib (string-append static "/lib")))
331 (for-each (lambda (file)
332 (install-file file slib)
333 (delete-file file))
334 (find-files lib "\\.a$"))
335 #t)))
336 (add-after 'install 'move-extra-documentation
337 (lambda* (#:key outputs #:allow-other-keys)
338 ;; Move man3 pages and full HTML documentation to "doc".
339 (let* ((out (assoc-ref outputs "out"))
340 (man3 (string-append out "/share/man/man3"))
341 (html (string-append out "/share/doc/openssl"))
342 (doc (assoc-ref outputs "doc"))
343 (man-target (string-append doc "/share/man/man3"))
344 (html-target (string-append doc "/share/doc/openssl")))
345 (copy-recursively man3 man-target)
346 (delete-file-recursively man3)
347 (copy-recursively html html-target)
348 (delete-file-recursively html)
349 #t)))
350 (add-after
351 'install 'remove-miscellany
352 (lambda* (#:key outputs #:allow-other-keys)
353 ;; The 'misc' directory contains random undocumented shell and Perl
354 ;; scripts. Remove them to avoid retaining a reference on Perl.
355 (let ((out (assoc-ref outputs "out")))
356 (delete-file-recursively (string-append out "/share/openssl-"
357 ,version "/misc"))
358 #t))))))
359 (native-search-paths
360 (list (search-path-specification
361 (variable "SSL_CERT_DIR")
362 (separator #f) ;single entry
363 (files '("etc/ssl/certs")))
364 (search-path-specification
365 (variable "SSL_CERT_FILE")
366 (file-type 'regular)
367 (separator #f) ;single entry
368 (files '("etc/ssl/certs/ca-certificates.crt")))))
369 (synopsis "SSL/TLS implementation")
370 (description
371 "OpenSSL is an implementation of SSL/TLS.")
372 (license license:openssl)
373 (home-page "https://www.openssl.org/")))
374
375 (define openssl-1.1.1d
376 (package/inherit
377 openssl
378 (version "1.1.1d")
379 (source (origin
380 (method url-fetch)
381 (uri (list (string-append "https://www.openssl.org/source/openssl-"
382 version ".tar.gz")
383 (string-append "ftp://ftp.openssl.org/source/"
384 "openssl-" version ".tar.gz")
385 (string-append "ftp://ftp.openssl.org/source/old/"
386 (string-trim-right version char-set:letter)
387 "/openssl-" version ".tar.gz")))
388 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
389 (sha256
390 (base32
391 "1whinyw402z3b9xlb3qaxv4b9sk4w1bgh9k0y8df1z4x3yy92fhy"))))))
392
393 (define-public openssl-1.0
394 (package
395 (inherit openssl)
396 (name "openssl")
397 (version "1.0.2s")
398 (source (origin
399 (method url-fetch)
400 (uri (list (string-append "https://www.openssl.org/source/openssl-"
401 version ".tar.gz")
402 (string-append "ftp://ftp.openssl.org/source/"
403 "openssl-" version ".tar.gz")
404 (string-append "ftp://ftp.openssl.org/source/old/"
405 (string-trim-right version char-set:letter)
406 "/openssl-" version ".tar.gz")))
407 (sha256
408 (base32
409 "15mbmg8hf7s12vr3v2bdc0pi9y4pdbnsxhzk4fyyap42jaa5rgfa"))
410 (patches (search-patches "openssl-runpath.patch"
411 "openssl-c-rehash-in.patch"))))
412 (outputs '("out"
413 "doc" ;1.5MiB of man3 pages
414 "static")) ;6MiB of .a files
415 (arguments
416 (substitute-keyword-arguments (package-arguments openssl)
417 ((#:phases phases)
418 `(modify-phases ,phases
419 (add-before 'patch-source-shebangs 'patch-tests
420 (lambda* (#:key inputs native-inputs #:allow-other-keys)
421 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
422 (substitute* (find-files "test" ".*")
423 (("/bin/sh")
424 (string-append bash "/bin/sh"))
425 (("/bin/rm")
426 "rm"))
427 #t)))
428 (add-before 'configure 'patch-Makefile.org
429 (lambda* (#:key outputs #:allow-other-keys)
430 ;; The default MANDIR is some unusual place. Fix that.
431 (let ((out (assoc-ref outputs "out")))
432 (patch-makefile-SHELL "Makefile.org")
433 (substitute* "Makefile.org"
434 (("^MANDIR[[:blank:]]*=.*$")
435 (string-append "MANDIR = " out "/share/man\n")))
436 #t)))
437 (replace 'configure
438 ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
439 (lambda* (#:key outputs #:allow-other-keys)
440 (let ((out (assoc-ref outputs "out")))
441 (invoke "./config"
442 "shared" ;build shared libraries
443 "--libdir=lib"
444
445 ;; The default for this catch-all directory is
446 ;; PREFIX/ssl. Change that to something more
447 ;; conventional.
448 (string-append "--openssldir=" out
449 "/share/openssl-" ,version)
450
451 (string-append "--prefix=" out)))))
452 (delete 'move-extra-documentation)
453 (add-after 'install 'move-man3-pages
454 (lambda* (#:key outputs #:allow-other-keys)
455 ;; Move section 3 man pages to "doc".
456 (let* ((out (assoc-ref outputs "out"))
457 (man3 (string-append out "/share/man/man3"))
458 (doc (assoc-ref outputs "doc"))
459 (target (string-append doc "/share/man/man3")))
460 (mkdir-p target)
461 (for-each (lambda (file)
462 (rename-file file
463 (string-append target "/"
464 (basename file))))
465 (find-files man3))
466 (delete-file-recursively man3)
467 #t)))
468 ;; XXX: Duplicate this phase to make sure 'version' evaluates
469 ;; in the current scope and not the inherited one.
470 (replace 'remove-miscellany
471 (lambda* (#:key outputs #:allow-other-keys)
472 ;; The 'misc' directory contains random undocumented shell and Perl
473 ;; scripts. Remove them to avoid retaining a reference on Perl.
474 (let ((out (assoc-ref outputs "out")))
475 (delete-file-recursively (string-append out "/share/openssl-"
476 ,version "/misc"))
477 #t)))))))))
478
479 (define-public libressl
480 (package
481 (name "libressl")
482 (version "2.7.4")
483 (source (origin
484 (method url-fetch)
485 (uri (string-append "mirror://openbsd/LibreSSL/"
486 name "-" version ".tar.gz"))
487 (sha256
488 (base32
489 "19kxa5i97q7p6rrps9qm0nd8zqhdjvzx02j72400c73cl2nryfhy"))))
490 (build-system gnu-build-system)
491 (arguments
492 ;; Do as if 'getentropy' was missing since older Linux kernels lack it
493 ;; and libc would return ENOSYS, which is not properly handled.
494 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
495 '(#:configure-flags '("ac_cv_func_getentropy=no"
496 ;; Provide a TLS-enabled netcat.
497 "--enable-nc")))
498 (native-search-paths
499 ;; FIXME: These two variables must designate a single file or directory
500 ;; and are not actually "search paths." In practice it works OK in
501 ;; user profiles because there's always just one item that matches the
502 ;; specification.
503 (list (search-path-specification
504 (variable "SSL_CERT_DIR")
505 (files '("etc/ssl/certs")))
506 (search-path-specification
507 (variable "SSL_CERT_FILE")
508 (files '("etc/ssl/certs/ca-certificates.crt")))))
509 (home-page "https://www.libressl.org/")
510 (synopsis "SSL/TLS implementation")
511 (description "LibreSSL is a version of the TLS/crypto stack, forked from
512 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
513 and applying best practice development processes. This package also includes a
514 netcat implementation that supports TLS.")
515 ;; Files taken from OpenSSL keep their license, others are under various
516 ;; non-copyleft licenses.
517 (license (list license:openssl
518 (license:non-copyleft
519 "file://COPYING"
520 "See COPYING in the distribution.")))))
521
522 (define-public python-acme
523 (package
524 (name "python-acme")
525 ;; Remember to update the hash of certbot when updating python-acme.
526 (version "0.37.2")
527 (source (origin
528 (method url-fetch)
529 (uri (pypi-uri "acme" version))
530 (sha256
531 (base32
532 "0p3zqhna9p8iy5i9mfhzdf5bmjigs05r6rlwnxykk4n67fp8yyc8"))))
533 (build-system python-build-system)
534 (arguments
535 `(#:phases
536 (modify-phases %standard-phases
537 (add-after 'build 'build-documentation
538 (lambda _
539 (invoke "make" "-C" "docs" "man" "info")))
540 (add-after 'install 'install-documentation
541 (lambda* (#:key outputs #:allow-other-keys)
542 (let* ((out (assoc-ref outputs "out"))
543 (man (string-append out "/share/man/man1"))
544 (info (string-append out "/info")))
545 (install-file "docs/_build/texinfo/acme-python.info" info)
546 (install-file "docs/_build/man/acme-python.1" man)
547 #t))))))
548 ;; TODO: Add optional inputs for testing.
549 (native-inputs
550 `(("python-mock" ,python-mock)
551 ("python-pytest" ,python-pytest)
552 ;; For documentation
553 ("python-sphinx" ,python-sphinx)
554 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
555 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
556 ("texinfo" ,texinfo)))
557 (propagated-inputs
558 `(("python-josepy" ,python-josepy)
559 ("python-six" ,python-six)
560 ("python-requests" ,python-requests)
561 ("python-requests-toolbelt" ,python-requests-toolbelt)
562 ("python-pytz" ,python-pytz)
563 ("python-pyrfc3339" ,python-pyrfc3339)
564 ("python-pyasn1" ,python-pyasn1)
565 ("python-cryptography" ,python-cryptography)
566 ("python-pyopenssl" ,python-pyopenssl)))
567 (home-page "https://github.com/certbot/certbot")
568 (synopsis "ACME protocol implementation in Python")
569 (description "ACME protocol implementation in Python")
570 (license license:asl2.0)))
571
572 (define-public certbot
573 (package
574 (name "certbot")
575 ;; Certbot and python-acme are developed in the same repository, and their
576 ;; versions should remain synchronized.
577 (version (package-version python-acme))
578 (source (origin
579 (method url-fetch)
580 (uri (pypi-uri "certbot" version))
581 (sha256
582 (base32
583 "1xbfv4fwkgfp9qqzlk8wxbhchc61349m26q9fg35j9fnm253cm74"))))
584 (build-system python-build-system)
585 (arguments
586 `(,@(substitute-keyword-arguments (package-arguments python-acme)
587 ((#:phases phases)
588 `(modify-phases ,phases
589 (replace 'install-documentation
590 (lambda* (#:key outputs #:allow-other-keys)
591 (let* ((out (assoc-ref outputs "out"))
592 (man1 (string-append out "/share/man/man1"))
593 (man7 (string-append out "/share/man/man7"))
594 (info (string-append out "/info")))
595 (install-file "docs/_build/texinfo/Certbot.info" info)
596 (install-file "docs/_build/man/certbot.1" man1)
597 (install-file "docs/_build/man/certbot.7" man7)
598 #t))))))))
599 ;; TODO: Add optional inputs for testing.
600 (native-inputs
601 `(("python-mock" ,python-mock)
602 ("python-pytest" ,python-pytest)
603 ;; For documentation
604 ("python-sphinx" ,python-sphinx)
605 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
606 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
607 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
608 ("texinfo" ,texinfo)))
609 (propagated-inputs
610 `(("python-acme" ,python-acme)
611 ("python-cryptography" ,python-cryptography)
612 ("python-zope-interface" ,python-zope-interface)
613 ("python-pyrfc3339" ,python-pyrfc3339)
614 ("python-pyopenssl" ,python-pyopenssl)
615 ("python-configobj" ,python-configobj)
616 ("python-configargparse" ,python-configargparse)
617 ("python-zope-component" ,python-zope-component)
618 ("python-parsedatetime" ,python-parsedatetime)
619 ("python-six" ,python-six)
620 ("python-psutil" ,python-psutil)
621 ("python-requests" ,python-requests)
622 ("python-pytz" ,python-pytz)))
623 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
624 (description "Certbot automatically receives and installs X.509 certificates
625 to enable Transport Layer Security (TLS) on servers. It interoperates with the
626 Let’s Encrypt certificate authority (CA), which issues browser-trusted
627 certificates for free.")
628 (home-page "https://certbot.eff.org/")
629 (license license:asl2.0)))
630
631 (define-public letsencrypt
632 (package (inherit certbot)
633 (name "letsencrypt")
634 (properties `((superseded . ,certbot)))))
635
636 (define-public perl-net-ssleay
637 (package
638 (name "perl-net-ssleay")
639 (version "1.88")
640 (source (origin
641 (method url-fetch)
642 (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
643 "Net-SSLeay-" version ".tar.gz"))
644 (sha256
645 (base32
646 "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
647 (build-system perl-build-system)
648 (inputs `(("openssl" ,openssl)))
649 (arguments
650 `(#:phases
651 (modify-phases %standard-phases
652 (add-before
653 'configure 'set-ssl-prefix
654 (lambda* (#:key inputs #:allow-other-keys)
655 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
656 #t)))))
657 (synopsis "Perl extension for using OpenSSL")
658 (description
659 "This module offers some high level convenience functions for accessing
660 web pages on SSL servers (for symmetry, the same API is offered for accessing
661 http servers, too), an sslcat() function for writing your own clients, and
662 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
663 servers or clients for more complicated applications.")
664 (license license:perl-license)
665 (home-page "https://metacpan.org/release/Net-SSLeay")))
666
667 (define-public perl-crypt-openssl-rsa
668 (package
669 (name "perl-crypt-openssl-rsa")
670 (version "0.31")
671 (source
672 (origin
673 (method url-fetch)
674 (uri (string-append
675 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
676 version
677 ".tar.gz"))
678 (sha256
679 (base32
680 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
681 (build-system perl-build-system)
682 (native-inputs
683 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
684 (inputs
685 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
686 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
687 ("openssl" ,openssl)))
688 (arguments perl-crypt-arguments)
689 (home-page
690 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
691 (synopsis
692 "RSA encoding and decoding, using the openSSL libraries")
693 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
694 OpenSSL libraries).")
695 (license license:perl-license)))
696
697 (define perl-crypt-arguments
698 `(#:phases (modify-phases %standard-phases
699 (add-before 'configure 'patch-Makefile.PL
700 (lambda* (#:key inputs #:allow-other-keys)
701 (substitute* "Makefile.PL"
702 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
703 (assoc-ref inputs "openssl")
704 "/lib -lcrypto'],")))
705 #t)))))
706
707 (define-public perl-crypt-openssl-bignum
708 (package
709 (name "perl-crypt-openssl-bignum")
710 (version "0.09")
711 (source
712 (origin
713 (method url-fetch)
714 (uri (string-append
715 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
716 version
717 ".tar.gz"))
718 (sha256
719 (base32
720 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
721 (build-system perl-build-system)
722 (inputs `(("openssl" ,openssl)))
723 (arguments perl-crypt-arguments)
724 (home-page
725 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
726 (synopsis
727 "OpenSSL's multiprecision integer arithmetic in Perl")
728 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
729 arithmetic in Perl.")
730 ;; At your option either gpl1+ or the Artistic License
731 (license license:perl-license)))
732
733 (define-public perl-crypt-openssl-guess
734 (package
735 (name "perl-crypt-openssl-guess")
736 (version "0.11")
737 (source
738 (origin
739 (method url-fetch)
740 (uri (string-append
741 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
742 version ".tar.gz"))
743 (sha256
744 (base32
745 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
746 (build-system perl-build-system)
747 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
748 (synopsis "Guess the OpenSSL include path")
749 (description
750 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
751 correct OpenSSL include path. It is intended for use in your
752 @file{Makefile.PL}.")
753 (license license:perl-license)))
754
755 (define-public perl-crypt-openssl-random
756 (package
757 (name "perl-crypt-openssl-random")
758 (version "0.15")
759 (source
760 (origin
761 (method url-fetch)
762 (uri (string-append
763 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
764 version
765 ".tar.gz"))
766 (sha256
767 (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
768 (build-system perl-build-system)
769 (native-inputs
770 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
771 (inputs
772 `(("openssl" ,openssl)))
773 (arguments perl-crypt-arguments)
774 (home-page
775 "https://metacpan.org/release/Crypt-OpenSSL-Random")
776 (synopsis
777 "OpenSSL/LibreSSL pseudo-random number generator access")
778 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
779 number generator")
780 (license license:perl-license)))
781
782 (define-public acme-client
783 (package
784 (name "acme-client")
785 (version "0.1.16")
786 (source (origin
787 (method url-fetch)
788 (uri (string-append "https://kristaps.bsd.lv/" name "/"
789 "snapshots/" name "-portable-"
790 version ".tgz"))
791 (sha256
792 (base32
793 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
794 (build-system gnu-build-system)
795 (arguments
796 '(#:tests? #f ; no test suite
797 #:make-flags
798 (list "CC=gcc"
799 (string-append "PREFIX=" (assoc-ref %outputs "out")))
800 #:phases
801 (modify-phases %standard-phases
802 (add-after 'unpack 'patch-paths
803 (lambda* (#:key inputs #:allow-other-keys)
804 (let ((pem (string-append (assoc-ref inputs "libressl")
805 "/etc/ssl/cert.pem")))
806 (substitute* "http.c"
807 (("/etc/ssl/cert.pem") pem))
808 #t)))
809 (delete 'configure)))) ; no './configure' script
810 (native-inputs
811 `(("pkg-config" ,pkg-config)))
812 (inputs
813 `(("libbsd" ,libbsd)
814 ("libressl" ,libressl)))
815 (synopsis "Let's Encrypt client by the OpenBSD project")
816 (description "acme-client is a Let's Encrypt client implemented in C. It
817 uses a modular design, and attempts to secure itself by dropping privileges and
818 operating in a chroot where possible. acme-client is developed on OpenBSD and
819 then ported to the GNU / Linux environment.")
820 (home-page "https://kristaps.bsd.lv/acme-client/")
821 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
822 ;; and 'jsmn.c' are distributed under the Expat license.
823 (license (list license:isc license:expat))))
824
825 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
826 ;; variant exists in addition to the "-apache" one.
827 (define-public mbedtls-apache
828 (package
829 (name "mbedtls-apache")
830 (version "2.16.3")
831 (source
832 (origin
833 (method url-fetch)
834 ;; XXX: The download links on the website are script redirection links
835 ;; which effectively lead to the format listed in the uri here.
836 (uri (string-append "https://tls.mbed.org/download/mbedtls-"
837 version "-apache.tgz"))
838 (sha256
839 (base32
840 "0qd65lnr63vmx2gxla6lcmm5gawlnaj4wy4h4vmdc3h9h9nyw6zc"))))
841 (build-system cmake-build-system)
842 (arguments
843 `(#:configure-flags
844 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON")))
845 (native-inputs
846 `(("perl" ,perl)
847 ("python" ,python)))
848 (synopsis "Small TLS library")
849 (description
850 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
851 for developers to include cryptographic and SSL/TLS capabilities in their
852 (embedded) products, facilitating this functionality with a minimal
853 coding footprint.")
854 (home-page "https://tls.mbed.org")
855 (license license:asl2.0)))
856
857 ;; The Hiawatha Web server requires some specific features to be enabled.
858 (define-public mbedtls-for-hiawatha
859 (hidden-package
860 (package
861 (inherit mbedtls-apache)
862 (arguments
863 (substitute-keyword-arguments
864 `(#:phases
865 (modify-phases %standard-phases
866 (add-after 'configure 'configure-extra-features
867 (lambda _
868 (for-each (lambda (feature)
869 (invoke "scripts/config.pl" "set" feature))
870 (list "MBEDTLS_THREADING_C"
871 "MBEDTLS_THREADING_PTHREAD"))
872 #t)))
873 ,@(package-arguments mbedtls-apache)))))))
874
875 (define-public dehydrated
876 (package
877 (name "dehydrated")
878 (version "0.6.5")
879 (source (origin
880 (method url-fetch)
881 (uri (string-append
882 "https://github.com/lukas2511/dehydrated/releases/download/"
883 "v" version "/dehydrated-" version ".tar.gz"))
884 (sha256
885 (base32
886 "0dgskgbdd95p13jx6s13p77y15wngb5cm6p4305cf2s54w0bvahh"))))
887 (build-system trivial-build-system)
888 (arguments
889 `(#:modules ((guix build utils))
890 #:builder
891 (begin
892 (use-modules (guix build utils))
893 (let* ((source (assoc-ref %build-inputs "source"))
894 (tar (assoc-ref %build-inputs "tar"))
895 (gz (assoc-ref %build-inputs "gzip"))
896 (out (assoc-ref %outputs "out"))
897 (bin (string-append out "/bin"))
898 (doc (string-append out "/share/doc/"))
899 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
900
901 (setenv "PATH" (string-append gz "/bin"))
902 (invoke (string-append tar "/bin/tar") "xvf" source)
903 (chdir (string-append ,name "-" ,version))
904
905 (install-file "dehydrated" bin)
906 (install-file "LICENSE" (string-append doc ,name "-" ,version))
907 (with-directory-excursion bin
908 (patch-shebang "dehydrated" (list bash))
909
910 ;; Do not try to write in the store.
911 (substitute* "dehydrated"
912 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
913
914 (setenv "PATH" bash)
915 (wrap-program "dehydrated"
916 `("PATH" ":" prefix
917 ,(map (lambda (dir)
918 (string-append dir "/bin"))
919 (map (lambda (input)
920 (assoc-ref %build-inputs input))
921 '("coreutils"
922 "curl"
923 "diffutils"
924 "gawk"
925 "grep"
926 "openssl"
927 "sed"))))))
928 #t))))
929 (inputs
930 `(("bash" ,bash)
931 ("coreutils" ,coreutils)
932 ("curl" ,curl)
933 ("diffutils" ,diffutils)
934 ("gawk" ,gawk)
935 ("grep" ,grep)
936 ("openssl" ,openssl)
937 ("sed" ,sed)))
938 (native-inputs
939 `(("gzip" ,gzip)
940 ("tar" ,tar)))
941 (home-page "https://dehydrated.io/")
942 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
943 (description "Dehydrated is a client for signing certificates with an
944 ACME-server (currently only provided by Let's Encrypt) implemented as a
945 relatively simple Bash script.")
946 (license license:expat)))
947
948 (define-public go-github-com-certifi-gocertifi
949 (let ((commit "d2eda712971317d7dd278bc2a52acda7e945f97e")
950 (revision "0"))
951 (package
952 (name "go-github-com-certifi-gocertifi")
953 (version (git-version "2018.01.18" revision commit))
954 (source (origin
955 (method git-fetch)
956 (uri (git-reference
957 (url "https://github.com/certifi/gocertifi")
958 (commit commit)))
959 (file-name (git-file-name name version))
960 (sha256
961 (base32
962 "0f3v26xps7gadw4qfmh1kxbpgp0cgqdd61a257xnnvnd7ll6k8dh"))))
963 (build-system go-build-system)
964 (arguments
965 '(#:import-path "github.com/certifi/gocertifi"))
966 (synopsis "X.509 TLS root certificate bundle for Go")
967 (description "This package is a Go language X.509 TLS root certificate bundle,
968 derived from Mozilla's collection.")
969 (home-page "https://certifi.io")
970 (license license:mpl2.0))))