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