gnu: facter: Update to 4.0.33.
[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 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.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 ;; XXX Unversion openconnect's "gnutls" input when ungrafting.
169 (replacement gnutls-3.6.14)
170 (version "3.6.12")
171 (source (origin
172 (method url-fetch)
173 (uri
174 ;; Note: Releases are no longer on ftp.gnu.org since the
175 ;; schism (after version 3.1.5).
176 (string-append "mirror://gnupg/gnutls/v"
177 (version-major+minor version)
178 "/gnutls-" version ".tar.xz"))
179 (patches (search-patches "gnutls-skip-trust-store-test.patch"))
180 (sha256
181 (base32
182 "0jvca1qahn9lrwv6f5kfs95icirc15b2a8x9fzczyj996ipg3b5z"))))
183 (build-system gnu-build-system)
184 (arguments
185 `(#:tests? ,(not (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? "arm" target)
351 "linux-armv4")
352 ((string-prefix? "aarch64" target)
353 "linux-aarch64")))
354 #t)))
355 '())
356 (replace 'configure
357 (lambda* (#:key outputs #:allow-other-keys)
358 (let* ((out (assoc-ref outputs "out"))
359 (lib (string-append out "/lib")))
360 ;; It's not a shebang so patch-source-shebangs misses it.
361 (substitute* "config"
362 (("/usr/bin/env")
363 (string-append (assoc-ref %build-inputs "coreutils")
364 "/bin/env")))
365 (invoke ,@(if (%current-target-system)
366 '("./Configure")
367 '("./config"))
368 "shared" ;build shared libraries
369 "--libdir=lib"
370
371 ;; The default for this catch-all directory is
372 ;; PREFIX/ssl. Change that to something more
373 ;; conventional.
374 (string-append "--openssldir=" out
375 "/share/openssl-" ,version)
376
377 (string-append "--prefix=" out)
378 (string-append "-Wl,-rpath," lib)
379 ,@(if (%current-target-system)
380 '((getenv "CONFIGURE_TARGET_ARCH"))
381 '())))))
382 (add-after 'install 'move-static-libraries
383 (lambda* (#:key outputs #:allow-other-keys)
384 ;; Move static libraries to the "static" output.
385 (let* ((out (assoc-ref outputs "out"))
386 (lib (string-append out "/lib"))
387 (static (assoc-ref outputs "static"))
388 (slib (string-append static "/lib")))
389 (for-each (lambda (file)
390 (install-file file slib)
391 (delete-file file))
392 (find-files lib "\\.a$"))
393 #t)))
394 (add-after 'install 'move-extra-documentation
395 (lambda* (#:key outputs #:allow-other-keys)
396 ;; Move man3 pages and full HTML documentation to "doc".
397 (let* ((out (assoc-ref outputs "out"))
398 (man3 (string-append out "/share/man/man3"))
399 (html (string-append out "/share/doc/openssl"))
400 (doc (assoc-ref outputs "doc"))
401 (man-target (string-append doc "/share/man/man3"))
402 (html-target (string-append doc "/share/doc/openssl")))
403 (copy-recursively man3 man-target)
404 (delete-file-recursively man3)
405 (copy-recursively html html-target)
406 (delete-file-recursively html)
407 #t)))
408 (add-after
409 'install 'remove-miscellany
410 (lambda* (#:key outputs #:allow-other-keys)
411 ;; The 'misc' directory contains random undocumented shell and Perl
412 ;; scripts. Remove them to avoid retaining a reference on Perl.
413 (let ((out (assoc-ref outputs "out")))
414 (delete-file-recursively (string-append out "/share/openssl-"
415 ,version "/misc"))
416 #t))))))
417 (native-search-paths
418 (list (search-path-specification
419 (variable "SSL_CERT_DIR")
420 (separator #f) ;single entry
421 (files '("etc/ssl/certs")))
422 (search-path-specification
423 (variable "SSL_CERT_FILE")
424 (file-type 'regular)
425 (separator #f) ;single entry
426 (files '("etc/ssl/certs/ca-certificates.crt")))))
427 (synopsis "SSL/TLS implementation")
428 (description
429 "OpenSSL is an implementation of SSL/TLS.")
430 (license license:openssl)
431 (home-page "https://www.openssl.org/")))
432
433 (define openssl-1.1.1g
434 (package
435 (inherit openssl)
436 (version "1.1.1g")
437 (source (origin
438 (method url-fetch)
439 (uri (list (string-append "https://www.openssl.org/source/openssl-"
440 version ".tar.gz")
441 (string-append "ftp://ftp.openssl.org/source/"
442 "openssl-" version ".tar.gz")
443 (string-append "ftp://ftp.openssl.org/source/old/"
444 (string-trim-right version char-set:letter)
445 "/openssl-" version ".tar.gz")))
446 (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
447 (sha256
448 (base32
449 "0ikdcc038i7jk8h7asq5xcn8b1xc2rrbc88yfm4hqbz3y5s4gc6x"))))))
450
451 (define-public openssl-1.0
452 (package
453 (inherit openssl)
454 (name "openssl")
455 (version "1.0.2u")
456 (source (origin
457 (method url-fetch)
458 (uri (list (string-append "https://www.openssl.org/source/openssl-"
459 version ".tar.gz")
460 (string-append "ftp://ftp.openssl.org/source/"
461 "openssl-" version ".tar.gz")
462 (string-append "ftp://ftp.openssl.org/source/old/"
463 (string-trim-right version char-set:letter)
464 "/openssl-" version ".tar.gz")))
465 (sha256
466 (base32
467 "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c"))
468 (patches (search-patches "openssl-runpath.patch"
469 "openssl-c-rehash-in.patch"))))
470 (outputs '("out"
471 "doc" ;1.5MiB of man3 pages
472 "static")) ;6MiB of .a files
473 (arguments
474 (substitute-keyword-arguments (package-arguments openssl)
475 ;; Parallel build is not supported in 1.0.x.
476 ((#:parallel-build? _ #f) #f)
477 ((#:phases phases)
478 `(modify-phases ,phases
479 (add-before 'patch-source-shebangs 'patch-tests
480 (lambda* (#:key inputs native-inputs #:allow-other-keys)
481 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
482 (substitute* (find-files "test" ".*")
483 (("/bin/sh")
484 (string-append bash "/bin/sh"))
485 (("/bin/rm")
486 "rm"))
487 #t)))
488 (add-before 'configure 'patch-Makefile.org
489 (lambda* (#:key outputs #:allow-other-keys)
490 ;; The default MANDIR is some unusual place. Fix that.
491 (let ((out (assoc-ref outputs "out")))
492 (patch-makefile-SHELL "Makefile.org")
493 (substitute* "Makefile.org"
494 (("^MANDIR[[:blank:]]*=.*$")
495 (string-append "MANDIR = " out "/share/man\n")))
496 #t)))
497 (replace 'configure
498 ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
499 (lambda* (#:key outputs #:allow-other-keys)
500 (let ((out (assoc-ref outputs "out")))
501 (invoke ,@(if (%current-target-system)
502 '("./Configure")
503 '("./config"))
504 "shared" ;build shared libraries
505 "--libdir=lib"
506
507 ;; The default for this catch-all directory is
508 ;; PREFIX/ssl. Change that to something more
509 ;; conventional.
510 (string-append "--openssldir=" out
511 "/share/openssl-" ,version)
512
513 (string-append "--prefix=" out)
514 ,@(if (%current-target-system)
515 '((getenv "CONFIGURE_TARGET_ARCH"))
516 '())))))
517 (delete 'move-extra-documentation)
518 (add-after 'install 'move-man3-pages
519 (lambda* (#:key outputs #:allow-other-keys)
520 ;; Move section 3 man pages to "doc".
521 (let* ((out (assoc-ref outputs "out"))
522 (man3 (string-append out "/share/man/man3"))
523 (doc (assoc-ref outputs "doc"))
524 (target (string-append doc "/share/man/man3")))
525 (mkdir-p target)
526 (for-each (lambda (file)
527 (rename-file file
528 (string-append target "/"
529 (basename file))))
530 (find-files man3))
531 (delete-file-recursively man3)
532 #t)))
533 ;; XXX: Duplicate this phase to make sure 'version' evaluates
534 ;; in the current scope and not the inherited one.
535 (replace 'remove-miscellany
536 (lambda* (#:key outputs #:allow-other-keys)
537 ;; The 'misc' directory contains random undocumented shell and Perl
538 ;; scripts. Remove them to avoid retaining a reference on Perl.
539 (let ((out (assoc-ref outputs "out")))
540 (delete-file-recursively (string-append out "/share/openssl-"
541 ,version "/misc"))
542 #t)))))))))
543
544 (define-public libressl
545 (package
546 (name "libressl")
547 (version "3.0.2")
548 (source (origin
549 (method url-fetch)
550 (uri (string-append "mirror://openbsd/LibreSSL/"
551 "libressl-" version ".tar.gz"))
552 (sha256
553 (base32
554 "13ir2lpxz8y1m151k7lrx306498nzfhwlvgkgv97v5cvywmifyyz"))))
555 (build-system gnu-build-system)
556 (arguments
557 ;; Do as if 'getentropy' was missing since older Linux kernels lack it
558 ;; and libc would return ENOSYS, which is not properly handled.
559 ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
560 '(#:configure-flags '("ac_cv_func_getentropy=no"
561 ;; Provide a TLS-enabled netcat.
562 "--enable-nc")))
563 (native-search-paths
564 (list (search-path-specification
565 (variable "SSL_CERT_DIR")
566 (separator #f) ;single entry
567 (files '("etc/ssl/certs")))
568 (search-path-specification
569 (variable "SSL_CERT_FILE")
570 (separator #f) ;single entry
571 (files '("etc/ssl/certs/ca-certificates.crt")))))
572 (home-page "https://www.libressl.org/")
573 (synopsis "SSL/TLS implementation")
574 (description "LibreSSL is a version of the TLS/crypto stack, forked from
575 OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
576 and applying best practice development processes. This package also includes a
577 netcat implementation that supports TLS.")
578 ;; Files taken from OpenSSL keep their license, others are under various
579 ;; non-copyleft licenses.
580 (license (list license:openssl
581 (license:non-copyleft
582 "file://COPYING"
583 "See COPYING in the distribution.")))))
584
585 (define-public python-acme
586 (package
587 (name "python-acme")
588 ;; Remember to update the hash of certbot when updating python-acme.
589 (version "1.3.0")
590 (source (origin
591 (method url-fetch)
592 (uri (pypi-uri "acme" version))
593 (sha256
594 (base32
595 "03fjmg0fgfy7xfn3i8rzn9i0i4amajmijkash84qb8mlphgrxpn0"))))
596 (build-system python-build-system)
597 (arguments
598 `(#:phases
599 (modify-phases %standard-phases
600 (add-after 'build 'build-documentation
601 (lambda _
602 (invoke "make" "-C" "docs" "man" "info")))
603 (add-after 'install 'install-documentation
604 (lambda* (#:key outputs #:allow-other-keys)
605 (let* ((out (assoc-ref outputs "out"))
606 (man (string-append out "/share/man/man1"))
607 (info (string-append out "/info")))
608 (install-file "docs/_build/texinfo/acme-python.info" info)
609 (install-file "docs/_build/man/acme-python.1" man)
610 #t))))))
611 ;; TODO: Add optional inputs for testing.
612 (native-inputs
613 `(("python-mock" ,python-mock)
614 ("python-pytest" ,python-pytest)
615 ;; For documentation
616 ("python-sphinx" ,python-sphinx)
617 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
618 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
619 ("texinfo" ,texinfo)))
620 (propagated-inputs
621 `(("python-josepy" ,python-josepy)
622 ("python-six" ,python-six)
623 ("python-requests" ,python-requests)
624 ("python-requests-toolbelt" ,python-requests-toolbelt)
625 ("python-pytz" ,python-pytz)
626 ("python-pyrfc3339" ,python-pyrfc3339)
627 ("python-pyasn1" ,python-pyasn1)
628 ("python-cryptography" ,python-cryptography)
629 ("python-pyopenssl" ,python-pyopenssl)))
630 (home-page "https://github.com/certbot/certbot")
631 (synopsis "ACME protocol implementation in Python")
632 (description "ACME protocol implementation in Python")
633 (license license:asl2.0)))
634
635 (define-public certbot
636 (package
637 (name "certbot")
638 ;; Certbot and python-acme are developed in the same repository, and their
639 ;; versions should remain synchronized.
640 (version (package-version python-acme))
641 (source (origin
642 (method url-fetch)
643 (uri (pypi-uri "certbot" version))
644 (sha256
645 (base32
646 "1n5i0k6kwmd6wvivshfl3k4djwcpwx390c39xmr2hhrgpk5r285w"))))
647 (build-system python-build-system)
648 (arguments
649 `(,@(substitute-keyword-arguments (package-arguments python-acme)
650 ((#:phases phases)
651 `(modify-phases ,phases
652 (replace 'install-documentation
653 (lambda* (#:key outputs #:allow-other-keys)
654 (let* ((out (assoc-ref outputs "out"))
655 (man1 (string-append out "/share/man/man1"))
656 (man7 (string-append out "/share/man/man7"))
657 (info (string-append out "/info")))
658 (install-file "docs/_build/texinfo/Certbot.info" info)
659 (install-file "docs/_build/man/certbot.1" man1)
660 (install-file "docs/_build/man/certbot.7" man7)
661 #t))))))))
662 ;; TODO: Add optional inputs for testing.
663 (native-inputs
664 `(("python-mock" ,python-mock)
665 ("python-pytest" ,python-pytest)
666 ;; For documentation
667 ("python-sphinx" ,python-sphinx)
668 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
669 ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
670 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
671 ("texinfo" ,texinfo)))
672 (propagated-inputs
673 `(("python-acme" ,python-acme)
674 ("python-cryptography" ,python-cryptography)
675 ("python-zope-interface" ,python-zope-interface)
676 ("python-pyrfc3339" ,python-pyrfc3339)
677 ("python-pyopenssl" ,python-pyopenssl)
678 ("python-configobj" ,python-configobj)
679 ("python-configargparse" ,python-configargparse)
680 ("python-distro" ,python-distro)
681 ("python-zope-component" ,python-zope-component)
682 ("python-parsedatetime" ,python-parsedatetime)
683 ("python-six" ,python-six)
684 ("python-psutil" ,python-psutil)
685 ("python-requests" ,python-requests)
686 ("python-pytz" ,python-pytz)))
687 (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
688 (description "Certbot automatically receives and installs X.509 certificates
689 to enable Transport Layer Security (TLS) on servers. It interoperates with the
690 Let’s Encrypt certificate authority (CA), which issues browser-trusted
691 certificates for free.")
692 (home-page "https://certbot.eff.org/")
693 (license license:asl2.0)))
694
695 (define-public letsencrypt
696 (package (inherit certbot)
697 (name "letsencrypt")
698 (properties `((superseded . ,certbot)))))
699
700 (define-public perl-net-ssleay
701 (package
702 (name "perl-net-ssleay")
703 (version "1.88")
704 (source (origin
705 (method url-fetch)
706 (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
707 "Net-SSLeay-" version ".tar.gz"))
708 (sha256
709 (base32
710 "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
711 (build-system perl-build-system)
712 (inputs `(("openssl" ,openssl)))
713 (arguments
714 `(#:phases
715 (modify-phases %standard-phases
716 (add-before
717 'configure 'set-ssl-prefix
718 (lambda* (#:key inputs #:allow-other-keys)
719 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
720 #t)))))
721 (synopsis "Perl extension for using OpenSSL")
722 (description
723 "This module offers some high level convenience functions for accessing
724 web pages on SSL servers (for symmetry, the same API is offered for accessing
725 http servers, too), an sslcat() function for writing your own clients, and
726 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
727 servers or clients for more complicated applications.")
728 (license license:perl-license)
729 (home-page "https://metacpan.org/release/Net-SSLeay")))
730
731 (define-public perl-crypt-openssl-rsa
732 (package
733 (name "perl-crypt-openssl-rsa")
734 (version "0.31")
735 (source
736 (origin
737 (method url-fetch)
738 (uri (string-append
739 "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
740 version
741 ".tar.gz"))
742 (sha256
743 (base32
744 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
745 (build-system perl-build-system)
746 (native-inputs
747 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
748 (inputs
749 `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
750 ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
751 ("openssl" ,openssl)))
752 (arguments perl-crypt-arguments)
753 (home-page
754 "https://metacpan.org/release/Crypt-OpenSSL-RSA")
755 (synopsis
756 "RSA encoding and decoding, using the openSSL libraries")
757 (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
758 OpenSSL libraries).")
759 (license license:perl-license)))
760
761 (define perl-crypt-arguments
762 `(#:phases (modify-phases %standard-phases
763 (add-before 'configure 'patch-Makefile.PL
764 (lambda* (#:key inputs #:allow-other-keys)
765 (substitute* "Makefile.PL"
766 (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
767 (assoc-ref inputs "openssl")
768 "/lib -lcrypto'],")))
769 #t)))))
770
771 (define-public perl-crypt-openssl-bignum
772 (package
773 (name "perl-crypt-openssl-bignum")
774 (version "0.09")
775 (source
776 (origin
777 (method url-fetch)
778 (uri (string-append
779 "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
780 version
781 ".tar.gz"))
782 (sha256
783 (base32
784 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
785 (build-system perl-build-system)
786 (inputs `(("openssl" ,openssl)))
787 (arguments perl-crypt-arguments)
788 (home-page
789 "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
790 (synopsis
791 "OpenSSL's multiprecision integer arithmetic in Perl")
792 (description "Crypt::OpenSSL::Bignum provides multiprecision integer
793 arithmetic in Perl.")
794 ;; At your option either gpl1+ or the Artistic License
795 (license license:perl-license)))
796
797 (define-public perl-crypt-openssl-guess
798 (package
799 (name "perl-crypt-openssl-guess")
800 (version "0.11")
801 (source
802 (origin
803 (method url-fetch)
804 (uri (string-append
805 "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
806 version ".tar.gz"))
807 (sha256
808 (base32
809 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
810 (build-system perl-build-system)
811 (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
812 (synopsis "Guess the OpenSSL include path")
813 (description
814 "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
815 correct OpenSSL include path. It is intended for use in your
816 @file{Makefile.PL}.")
817 (license license:perl-license)))
818
819 (define-public perl-crypt-openssl-random
820 (package
821 (name "perl-crypt-openssl-random")
822 (version "0.15")
823 (source
824 (origin
825 (method url-fetch)
826 (uri (string-append
827 "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
828 version
829 ".tar.gz"))
830 (sha256
831 (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
832 (build-system perl-build-system)
833 (native-inputs
834 `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
835 (inputs
836 `(("openssl" ,openssl)))
837 (arguments perl-crypt-arguments)
838 (home-page
839 "https://metacpan.org/release/Crypt-OpenSSL-Random")
840 (synopsis
841 "OpenSSL/LibreSSL pseudo-random number generator access")
842 (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
843 number generator")
844 (license license:perl-license)))
845
846 (define-public acme-client
847 (package
848 (name "acme-client")
849 (version "0.1.16")
850 (source (origin
851 (method url-fetch)
852 (uri (string-append "https://kristaps.bsd.lv/" name "/"
853 "snapshots/" name "-portable-"
854 version ".tgz"))
855 (sha256
856 (base32
857 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
858 (build-system gnu-build-system)
859 (arguments
860 '(#:tests? #f ; no test suite
861 #:make-flags
862 (list "CC=gcc"
863 (string-append "PREFIX=" (assoc-ref %outputs "out")))
864 #:phases
865 (modify-phases %standard-phases
866 (add-after 'unpack 'patch-paths
867 (lambda* (#:key inputs #:allow-other-keys)
868 (let ((pem (string-append (assoc-ref inputs "libressl")
869 "/etc/ssl/cert.pem")))
870 (substitute* "http.c"
871 (("/etc/ssl/cert.pem") pem))
872 #t)))
873 (delete 'configure)))) ; no './configure' script
874 (native-inputs
875 `(("pkg-config" ,pkg-config)))
876 (inputs
877 `(("libbsd" ,libbsd)
878 ("libressl" ,libressl)))
879 (synopsis "Let's Encrypt client by the OpenBSD project")
880 (description "acme-client is a Let's Encrypt client implemented in C. It
881 uses a modular design, and attempts to secure itself by dropping privileges and
882 operating in a chroot where possible. acme-client is developed on OpenBSD and
883 then ported to the GNU / Linux environment.")
884 (home-page "https://kristaps.bsd.lv/acme-client/")
885 ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
886 ;; and 'jsmn.c' are distributed under the Expat license.
887 (license (list license:isc license:expat))))
888
889 ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
890 ;; variant exists in addition to the "-apache" one.
891 (define-public mbedtls-apache
892 (package
893 (name "mbedtls-apache")
894 ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha
895 ;; when updating.
896 (version "2.23.0")
897 (source
898 (origin
899 (method git-fetch)
900 (uri (git-reference
901 (url "https://github.com/ARMmbed/mbedtls")
902 (commit (string-append "mbedtls-" version))))
903 (sha256
904 (base32 "13fa9h2i989cbf8n8c0j019mshv6wg213va18my1s787lhcq2d62"))
905 (file-name (git-file-name name version))))
906 (build-system cmake-build-system)
907 (arguments
908 `(#:configure-flags
909 (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON"
910 "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF")
911 #:phases
912 (modify-phases %standard-phases
913 (add-after 'unpack 'make-source-writable
914 (lambda _
915 (for-each make-file-writable (find-files "."))
916 #t)))))
917 (native-inputs
918 `(("perl" ,perl)
919 ("python" ,python)))
920 (synopsis "Small TLS library")
921 (description
922 "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
923 for developers to include cryptographic and SSL/TLS capabilities in their
924 (embedded) products, facilitating this functionality with a minimal
925 coding footprint.")
926 (home-page "https://tls.mbed.org")
927 (license license:asl2.0)))
928
929 ;; The Hiawatha Web server requires some specific features to be enabled.
930 (define-public mbedtls-for-hiawatha
931 (hidden-package
932 (package
933 (inherit mbedtls-apache)
934 (arguments
935 (substitute-keyword-arguments (package-arguments mbedtls-apache)
936 ((#:phases phases)
937 `(modify-phases ,phases
938 (add-before 'configure 'configure-extra-features
939 (lambda _
940 (for-each (lambda (feature)
941 (invoke "scripts/config.pl" "set" feature))
942 (list "MBEDTLS_THREADING_C"
943 "MBEDTLS_THREADING_PTHREAD"))
944 ;; XXX The above enables code that breaks with -Werror…
945 (substitute* "CMakeLists.txt"
946 ((" -Wformat-signedness") ""))
947 #t)))))))))
948
949 (define-public dehydrated
950 (package
951 (name "dehydrated")
952 (version "0.6.5")
953 (source (origin
954 (method url-fetch)
955 (uri (string-append
956 "https://github.com/dehydrated-io/dehydrated/releases/download/"
957 "v" version "/dehydrated-" version ".tar.gz"))
958 (sha256
959 (base32
960 "0dgskgbdd95p13jx6s13p77y15wngb5cm6p4305cf2s54w0bvahh"))))
961 (build-system trivial-build-system)
962 (arguments
963 `(#:modules ((guix build utils)
964 (srfi srfi-26))
965 #:builder
966 (begin
967 (use-modules (guix build utils)
968 (srfi srfi-26))
969 (let* ((source (assoc-ref %build-inputs "source"))
970 (tar (assoc-ref %build-inputs "tar"))
971 (gz (assoc-ref %build-inputs "gzip"))
972 (out (assoc-ref %outputs "out"))
973 (bin (string-append out "/bin"))
974 (doc (string-append out "/share/doc/" ,name "-" ,version))
975 (man (string-append out "/share/man"))
976 (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
977
978 (setenv "PATH" (string-append gz "/bin"))
979 (invoke (string-append tar "/bin/tar") "xvf" source)
980 (chdir (string-append ,name "-" ,version))
981
982 (copy-recursively "docs" doc)
983 (install-file "LICENSE" doc)
984
985 (mkdir-p man)
986 (rename-file (string-append doc "/man")
987 (string-append man "/man1"))
988 (for-each (cut invoke "gzip" "-9" <>)
989 (find-files man ".*"))
990
991 (install-file "dehydrated" bin)
992 (with-directory-excursion bin
993 (patch-shebang "dehydrated" (list bash))
994
995 ;; Do not try to write to the store.
996 (substitute* "dehydrated"
997 (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
998
999 (setenv "PATH" bash)
1000 (wrap-program "dehydrated"
1001 `("PATH" ":" prefix
1002 ,(map (lambda (dir)
1003 (string-append dir "/bin"))
1004 (map (lambda (input)
1005 (assoc-ref %build-inputs input))
1006 '("coreutils"
1007 "curl"
1008 "diffutils"
1009 "gawk"
1010 "grep"
1011 "openssl"
1012 "sed"))))))
1013 #t))))
1014 (inputs
1015 `(("bash" ,bash)
1016 ("coreutils" ,coreutils)
1017 ("curl" ,curl)
1018 ("diffutils" ,diffutils)
1019 ("gawk" ,gawk)
1020 ("grep" ,grep)
1021 ("openssl" ,openssl)
1022 ("sed" ,sed)))
1023 (native-inputs
1024 `(("gzip" ,gzip)
1025 ("tar" ,tar)))
1026 (home-page "https://dehydrated.io/")
1027 (synopsis "Let's Encrypt/ACME client implemented as a shell script")
1028 (description "Dehydrated is a client for signing certificates with an
1029 ACME-server (currently only provided by Let's Encrypt) implemented as a
1030 relatively simple Bash script.")
1031 (license license:expat)))
1032
1033 (define-public go-github-com-certifi-gocertifi
1034 (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec")
1035 (revision "1"))
1036 (package
1037 (name "go-github-com-certifi-gocertifi")
1038 (version (git-version "2018.01.18" revision commit))
1039 (source (origin
1040 (method git-fetch)
1041 (uri (git-reference
1042 (url "https://github.com/certifi/gocertifi")
1043 (commit commit)))
1044 (file-name (git-file-name name version))
1045 (sha256
1046 (base32
1047 "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj"))))
1048 (build-system go-build-system)
1049 (arguments
1050 '(#:import-path "github.com/certifi/gocertifi"))
1051 (synopsis "X.509 TLS root certificate bundle for Go")
1052 (description "This package is a Go language X.509 TLS root certificate bundle,
1053 derived from Mozilla's collection.")
1054 (home-page "https://certifi.io")
1055 (license license:mpl2.0))))