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