1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016 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 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages tls)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system perl)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages guile)
36 #:use-module (gnu packages libffi)
37 #:use-module (gnu packages libidn)
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages nettle)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages texinfo)
44 #:use-module (gnu packages base))
46 (define-public libtasn1
53 (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
57 "1j8iixynchziw1y39lnibyl5h81m4p78w3i4f28q2vgwjgf801x4"))))
58 (build-system gnu-build-system)
59 (native-inputs `(("perl" ,perl)))
60 (home-page "http://www.gnu.org/software/libtasn1/")
61 (synopsis "ASN.1 library")
63 "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
64 for transmitting machine-neutral encodings of data objects in computer
65 networking, allowing for formal validation of data according to some
67 (license license:lgpl2.0+)))
69 (define-public p11-kit
76 (uri (string-append "https://p11-glue.freedesktop.org/releases/p11-kit-"
80 "1i3a1wdpagm0p3y1bwaz5x5rjhcpqbcrnhkcp10p259vkxk72wz5"))
81 (modules '((guix build utils))) ; for substitute*
84 ;; Drop one test that fails, also when trying to compile manually.
85 ;; Reported upstream at
86 ;; https://bugs.freedesktop.org/show_bug.cgi?id=89027
87 (substitute* "Makefile.in"
88 (("test-module\\$\\(EXEEXT\\) ") ""))))))
89 (build-system gnu-build-system)
91 `(("pkg-config" ,pkg-config)))
94 ("libtasn1" ,libtasn1)))
96 `(#:configure-flags '("--without-trust-paths")))
97 (home-page "http://p11-glue.freedesktop.org/p11-kit.html")
98 (synopsis "PKCS#11 library")
100 "p11-kit provides a way to load and enumerate PKCS#11 modules. It
101 provides a standard configuration setup for installing PKCS#11 modules
102 in such a way that they are discoverable. It also solves problems with
103 coordinating the use of PKCS#11 by different components or libraries
104 living in the same process.")
105 (license license:bsd-3)))
107 (define-public gnutls
114 ;; Note: Releases are no longer on ftp.gnu.org since the
115 ;; schism (after version 3.1.5).
116 (string-append "mirror://gnupg/gnutls/v"
117 (version-major+minor version)
118 "/gnutls-" version ".tar.xz"))
121 "0nifi3mr5jhz608pidkp8cjs4vwfj1m2qczsjrgpnp99615rxgn1"))))
122 (build-system gnu-build-system)
125 (list (string-append "--with-guile-site-dir="
126 (assoc-ref %outputs "out")
127 "/share/guile/site/2.0")
128 ;; GnuTLS doesn't consult any environment variables to specify
129 ;; the location of the system-wide trust store. Instead it has a
130 ;; configure-time option. Unless specified, its configure script
131 ;; attempts to auto-detect the location by looking for common
132 ;; places in the filesystem, none of which are present in our
133 ;; chroot build environment. If not found, then no default trust
134 ;; store is used, so each program has to provide its own
135 ;; fallback, and users have to configure each program
136 ;; independently. This seems suboptimal.
137 "--with-default-trust-store-dir=/etc/ssl/certs"
139 ;; FIXME: Temporarily disable p11-kit support since it is not
140 ;; working on mips64el.
143 #:phases (modify-phases %standard-phases
146 (lambda* (#:key outputs #:allow-other-keys)
147 ;; Copy the 4.1 MiB of section 3 man pages to "doc".
148 (let* ((out (assoc-ref outputs "out"))
149 (doc (assoc-ref outputs "doc"))
150 (mandir (string-append doc "/share/man/man3"))
151 (oldman (string-append out "/share/man/man3")))
153 (copy-recursively oldman mandir)
154 (delete-file-recursively oldman)
156 (outputs '("out" ;4.4 MiB
158 "doc")) ;4.1 MiB of man pages
160 `(("pkg-config" ,pkg-config)
163 `(("guile" ,guile-2.0)
166 ;; These are all in the 'Requires.private' field of gnutls.pc.
167 `(("libtasn1" ,libtasn1)
171 (home-page "http://www.gnu.org/software/gnutls/")
172 (synopsis "Transport layer security library")
174 "GnuTLS is a secure communications library implementing the SSL, TLS
175 and DTLS protocols. It is provided in the form of a C library to support the
176 protocols, as well as to parse and write X.5009, PKCS 12, OpenPGP and other
177 required structures.")
178 (license license:lgpl2.1+)))
180 (define-public openssl
182 (replacement openssl-1.0.2g)
187 (uri (list (string-append "ftp://ftp.openssl.org/source/"
188 name "-" version ".tar.gz")
189 (string-append "ftp://ftp.openssl.org/source/old/"
190 (string-trim-right version char-set:letter)
191 "/" name "-" version ".tar.gz")))
194 "171fkdg9v6j29d962nh6kb79kfm8kkhy7n9makw39d7jvvj4wawk"))
195 (patches (map search-patch
196 '("openssl-runpath.patch"
197 "openssl-c-rehash.patch")))))
198 (build-system gnu-build-system)
199 (native-inputs `(("perl" ,perl)))
201 `(#:parallel-build? #f
205 (modify-phases %standard-phases
207 'configure 'patch-Makefile.org
208 (lambda* (#:key outputs #:allow-other-keys)
209 ;; The default MANDIR is some unusual place. Fix that.
210 (let ((out (assoc-ref outputs "out")))
211 (patch-makefile-SHELL "Makefile.org")
212 (substitute* "Makefile.org"
213 (("^MANDIR[[:blank:]]*=.*$")
214 (string-append "MANDIR = " out "/share/man\n")))
218 (lambda* (#:key outputs #:allow-other-keys)
219 (let ((out (assoc-ref outputs "out")))
222 "shared" ;build shared libraries
225 ;; The default for this catch-all directory is
226 ;; PREFIX/ssl. Change that to something more
228 (string-append "--openssldir=" out
229 "/share/openssl-" ,version)
231 (string-append "--prefix=" out)
233 ;; XXX FIXME: Work around a code generation bug in GCC
234 ;; 4.9.3 on ARM when compiled with -mfpu=neon. See:
235 ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66917>
236 ,@(if (and (not (%current-target-system))
237 (string-prefix? "armhf" (%current-system)))
241 'install 'make-libraries-writable
242 (lambda* (#:key outputs #:allow-other-keys)
243 ;; Make libraries writable so that 'strip' does its job.
244 (let ((out (assoc-ref outputs "out")))
245 (for-each (lambda (file)
247 (find-files (string-append out "/lib")
251 'patch-source-shebangs 'patch-tests
252 (lambda* (#:key inputs native-inputs #:allow-other-keys)
253 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
254 (substitute* (find-files "test" ".*")
256 (string-append bash "/bin/bash"))
261 'install 'remove-miscellany
262 (lambda* (#:key outputs #:allow-other-keys)
263 ;; The 'misc' directory contains random undocumented shell and Perl
264 ;; scripts. Remove them to avoid retaining a reference on Perl.
265 (let ((out (assoc-ref outputs "out")))
266 (delete-file-recursively (string-append out "/share/openssl-"
270 ;; FIXME: These two variables must designate a single file or directory
271 ;; and are not actually "search paths." In practice it works OK in user
272 ;; profiles because there's always just one item that matches the
274 (list (search-path-specification
275 (variable "SSL_CERT_DIR")
276 (files '("etc/ssl/certs")))
277 (search-path-specification
278 (variable "SSL_CERT_FILE")
279 (files '("etc/ssl/certs/ca-certificates.crt")))))
280 (synopsis "SSL/TLS implementation")
282 "OpenSSL is an implementation of SSL/TLS.")
283 (license license:openssl)
284 (home-page "http://www.openssl.org/")))
286 (define openssl-1.0.2g
291 (let ((name "openssl") (version "1.0.2g"))
294 (uri (list (string-append "ftp://ftp.openssl.org/source/"
295 name "-" version ".tar.gz")
296 (string-append "ftp://ftp.openssl.org/source/old/"
297 (string-trim-right version char-set:letter)
298 "/" name "-" version ".tar.gz")))
301 "0cxajjayi859czi545ddafi24m9nwsnjsw4q82zrmqvwj2rv315p"))
302 (patches (map search-patch
303 '("openssl-runpath.patch"
304 "openssl-c-rehash-in.patch"))))))
306 (substitute-keyword-arguments (package-arguments openssl)
308 `(modify-phases ,phases
310 (lambda* (#:key outputs #:allow-other-keys)
311 (let ((out (assoc-ref outputs "out")))
316 ;; XXX TEMPORARY, FOR GRAFTING ONLY
317 ;; Enable ssl2 code to preserve
318 ;; ABI compatibility with 1.0.2f
321 "shared" ;build shared libraries
324 ;; The default for this catch-all directory is
325 ;; PREFIX/ssl. Change that to something more
327 (string-append "--openssldir=" out
328 "/share/openssl-" ,(package-version openssl))
330 (string-append "--prefix=" out)
332 ;; XXX FIXME: Work around a code generation bug in GCC
333 ;; 4.9.3 on ARM when compiled with -mfpu=neon. See:
334 ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66917>
335 ,@(if (and (not (%current-target-system))
336 (string-prefix? "armhf" (%current-system)))
340 (define-public libressl
348 "http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-"
351 "0kynb15l5gq1qgp3p4ncn20sc65sbl8lk89vyr07s17xrya9kq8y"))))
352 (build-system gnu-build-system)
354 ;; FIXME: These two variables must designate a single file or directory
355 ;; and are not actually "search paths." In practice it works OK in
356 ;; user profiles because there's always just one item that matches the
358 (list (search-path-specification
359 (variable "SSL_CERT_DIR")
360 (files '("etc/ssl/certs")))
361 (search-path-specification
362 (variable "SSL_CERT_FILE")
363 (files '("etc/ssl/certs/ca-certificates.crt")))))
364 (home-page "http://www.libressl.org/")
365 (synopsis "SSL/TLS implementation")
366 (description "LibreSSL is a version of the TLS/crypto stack forked
367 from OpenSSL in 2014, with the goals of modernizing the codebase, improving
368 security, and applying best practice development processes.")
369 ;; Files taken from OpenSSL keep their license, others are under various
370 ;; non-copyleft licenses.
371 (license (list license:openssl
372 (license:non-copyleft
374 "See COPYING in the distribution.")))))
376 (define-public python-acme
382 (uri (pypi-uri "acme" version))
385 "1dh0qlsi309b37wa0nw0h2gvs94yk12lc4mhr3rb9c4h46m0hn8a"))))
386 (build-system python-build-system)
389 (modify-phases %standard-phases
390 (add-before 'install 'disable-egg-compression
392 ;; Do not compress the egg.
393 ;; See <http://bugs.gnu.org/20765>.
394 (let ((port (open-file "setup.cfg" "a")))
395 (display "\n[easy_install]\nzip_ok = 0\n"
399 (add-after 'install 'docs
400 (lambda* (#:key outputs #:allow-other-keys)
401 (let* ((out (assoc-ref outputs "out"))
402 (man (string-append out "/share/man/man1"))
403 (info (string-append out "/info")))
404 (and (zero? (system* "make" "-C" "docs" "man" "info"))
405 (install-file "docs/_build/texinfo/acme-python.info" info)
406 (install-file "docs/_build/man/acme-python.1" man)
408 ;; TODO: Add optional inputs for testing.
410 `(("python-mock" ,python-mock)
412 ("python-sphinx" ,python-sphinx)
413 ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
414 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
415 ("python-setuptools" ,python-setuptools)
416 ("texinfo" ,texinfo)))
418 `(("python-ndg-httpsclient" ,python-ndg-httpsclient)
419 ("python-werkzeug" ,python-werkzeug)
420 ("python-six" ,python-six)
421 ("python-requests" ,python-requests)
422 ("python-pytz" ,python-pytz)
423 ("python-pyrfc3339" ,python-pyrfc3339)
424 ("python-pyasn1" ,python-pyasn1)
425 ("python-cryptography" ,python-cryptography)
426 ("python-pyopenssl" ,python-pyopenssl)))
427 (home-page "https://github.com/letsencrypt/letsencrypt")
428 (synopsis "ACME protocol implementation in Python")
429 (description "ACME protocol implementation in Python")
430 (license license:asl2.0)))
432 (define-public python2-acme
433 (package-with-python2 python-acme))
435 (define-public letsencrypt
441 (uri (pypi-uri "letsencrypt" version))
444 "1rjbblj60w7jwc5y04sy6fbxcynvakvazikg1pdmhyic5jmj9bg3"))))
445 (build-system python-build-system)
449 (modify-phases %standard-phases
450 (add-after 'install 'docs
451 (lambda* (#:key outputs #:allow-other-keys)
452 (let* ((out (assoc-ref outputs "out"))
453 (man1 (string-append out "/share/man/man1"))
454 (man7 (string-append out "/share/man/man7"))
455 (info (string-append out "/info")))
456 (substitute* "docs/man/letsencrypt.rst"
457 (("letsencrypt --help all")
458 (string-append out "/bin/letsencrypt" " --help all")))
460 (zero? (system* "make" "-C" "docs" "man" "info"))
461 (install-file "docs/_build/texinfo/LetsEncrypt.info" info)
462 (install-file "docs/_build/man/letsencrypt.1" man1)
463 (install-file "docs/_build/man/letsencrypt.7" man7)
465 ;; TODO: Add optional inputs for testing.
467 `(("python2-nose" ,python2-nose)
468 ("python2-mock" ,python2-mock)
470 ("python2-sphinx" ,python2-sphinx)
471 ("python2-sphinx-rtd-theme" ,python2-sphinx-rtd-theme)
472 ("python2-sphinx-repoze-autointerface" ,python2-sphinx-repoze-autointerface)
473 ("python2-sphinxcontrib-programoutput" ,python2-sphinxcontrib-programoutput)
474 ("texinfo" ,texinfo)))
476 `(("python2-acme" ,python2-acme)
477 ("python2-zope-interface" ,python2-zope-interface)
478 ("python2-pythondialog" ,python2-pythondialog)
479 ("python2-pyrfc3339" ,python2-pyrfc3339)
480 ("python2-pyopenssl" ,python2-pyopenssl)
481 ("python2-configobj" ,python2-configobj)
482 ("python2-configargparse" ,python2-configargparse)
483 ("python2-zope-component" ,python2-zope-component)
484 ("python2-parsedatetime" ,python2-parsedatetime)
485 ("python2-six" ,python2-six)
486 ("python2-psutil" ,python2-psutil)
487 ("python2-requests" ,python2-requests)
488 ("python2-pytz" ,python2-pytz)))
489 (synopsis "Let's Encrypt client")
490 (description "Tool to automatically receive and install X.509 certificates
491 to enable TLS on servers. The client will interoperate with the Let’s Encrypt CA which
492 will be issuing browser-trusted certificates for free.")
493 (home-page "https://letsencrypt.org/")
494 (license license:asl2.0)))
496 (define-public perl-net-ssleay
498 (name "perl-net-ssleay")
502 (uri (string-append "mirror://cpan/authors/id/M/MI/MIKEM/"
503 "Net-SSLeay-" version ".tar.gz"))
506 "1m2wwzhjwsg0drlhp9w12fl6bsgj69v8gdz72jqrqll3qr7f408p"))))
507 (build-system perl-build-system)
510 ("patch/disable-ede-test"
511 ,(search-patch "perl-net-ssleay-disable-ede-test.patch"))))
512 (inputs `(("openssl" ,openssl)))
515 (modify-phases %standard-phases
518 (lambda* (#:key inputs #:allow-other-keys)
519 ;; XXX We apply this patch here instead of in the 'origin' because
520 ;; this package's build system fails badly when the source file
522 ;; XXX Try removing this patch for perl-net-ssleay > 1.68
523 (zero? (system* "patch" "--force" "-p1" "-i"
524 (assoc-ref inputs "patch/disable-ede-test")))))
526 'configure 'set-ssl-prefix
527 (lambda* (#:key inputs #:allow-other-keys)
528 (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
530 (synopsis "Perl extension for using OpenSSL")
532 "This module offers some high level convenience functions for accessing
533 web pages on SSL servers (for symmetry, the same API is offered for accessing
534 http servers, too), an sslcat() function for writing your own clients, and
535 finally access to the SSL api of the SSLeay/OpenSSL package so you can write
536 servers or clients for more complicated applications.")
537 (license (package-license perl))
538 (home-page "http://search.cpan.org/~mikem/Net-SSLeay-1.66/")))