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