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