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