tls.scm 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2021 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
  5. ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
  6. ;;; Copyright © 2015 David Thompson <davet@gnu.org>
  7. ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Leo Famulari <leo@famulari.name>
  8. ;;; Copyright © 2016, 2017, 2019, 2021 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, 2021 Marius Bakke <marius@gnu.org>
  13. ;;; Copyright © 2017–2021 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. ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  19. ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
  20. ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
  21. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  22. ;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
  23. ;;;
  24. ;;; This file is part of GNU Guix.
  25. ;;;
  26. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  27. ;;; under the terms of the GNU General Public License as published by
  28. ;;; the Free Software Foundation; either version 3 of the License, or (at
  29. ;;; your option) any later version.
  30. ;;;
  31. ;;; GNU Guix is distributed in the hope that it will be useful, but
  32. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  33. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. ;;; GNU General Public License for more details.
  35. ;;;
  36. ;;; You should have received a copy of the GNU General Public License
  37. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  38. (define-module (gnu packages tls)
  39. #:use-module ((guix licenses) #:prefix license:)
  40. #:use-module (guix packages)
  41. #:use-module (guix download)
  42. #:use-module (guix git-download)
  43. #:use-module (guix utils)
  44. #:use-module (guix gexp)
  45. #:use-module (guix build-system gnu)
  46. #:use-module (guix build-system go)
  47. #:use-module (guix build-system perl)
  48. #:use-module (guix build-system python)
  49. #:use-module (guix build-system cmake)
  50. #:use-module (guix build-system trivial)
  51. #:use-module (gnu packages compression)
  52. #:use-module (gnu packages)
  53. #:use-module (gnu packages autotools)
  54. #:use-module (gnu packages bash)
  55. #:use-module (gnu packages check)
  56. #:use-module (gnu packages curl)
  57. #:use-module (gnu packages dns)
  58. #:use-module (gnu packages gawk)
  59. #:use-module (gnu packages gettext)
  60. #:use-module (gnu packages guile)
  61. #:use-module (gnu packages hurd)
  62. #:use-module (gnu packages libbsd)
  63. #:use-module (gnu packages libffi)
  64. #:use-module (gnu packages libidn)
  65. #:use-module (gnu packages linux)
  66. #:use-module (gnu packages ncurses)
  67. #:use-module (gnu packages nettle)
  68. #:use-module (gnu packages networking)
  69. #:use-module (gnu packages perl)
  70. #:use-module (gnu packages pkg-config)
  71. #:use-module (gnu packages python)
  72. #:use-module (gnu packages python-crypto)
  73. #:use-module (gnu packages python-web)
  74. #:use-module (gnu packages python-xyz)
  75. #:use-module (gnu packages sphinx)
  76. #:use-module (gnu packages texinfo)
  77. #:use-module (gnu packages time)
  78. #:use-module (gnu packages base)
  79. #:use-module (srfi srfi-1))
  80. (define-public libtasn1
  81. (package
  82. (name "libtasn1")
  83. (version "4.17.0")
  84. (source
  85. (origin
  86. (method url-fetch)
  87. (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
  88. version ".tar.gz"))
  89. (sha256
  90. (base32
  91. "19a53i1ajs4dd8nnlr2i6gbzvla84ay71g3y1phvh8krx8f5brzc"))))
  92. (build-system gnu-build-system)
  93. (arguments
  94. `(#:configure-flags '("--disable-static")))
  95. (native-inputs `(("perl" ,perl)))
  96. (home-page "https://www.gnu.org/software/libtasn1/")
  97. (synopsis "ASN.1 library")
  98. (description
  99. "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
  100. for transmitting machine-neutral encodings of data objects in computer
  101. networking, allowing for formal validation of data according to some
  102. specifications.")
  103. (license license:lgpl2.0+)))
  104. (define-public asn1c
  105. (package
  106. (name "asn1c")
  107. (version "0.9.28")
  108. (source (origin
  109. (method url-fetch)
  110. (uri (string-append "https://lionet.info/soft/asn1c-"
  111. version ".tar.gz"))
  112. (sha256
  113. (base32
  114. "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0"))))
  115. (build-system gnu-build-system)
  116. (native-inputs
  117. `(("perl" ,perl)))
  118. (home-page "https://lionet.info/asn1c")
  119. (synopsis "ASN.1 to C compiler")
  120. (description "The ASN.1 to C compiler takes ASN.1 module
  121. files and generates C++ compatible C source code. That code can be
  122. used to serialize the native C structures into compact and unambiguous
  123. BER/XER/PER-based data files, and deserialize the files back.
  124. Various ASN.1 based formats are widely used in the industry, such as to encode
  125. the X.509 certificates employed in the HTTPS handshake, to exchange control
  126. data between mobile phones and cellular networks, to car-to-car communication
  127. in intelligent transportation networks.")
  128. (license license:bsd-2)))
  129. (define-public p11-kit
  130. (package
  131. (name "p11-kit")
  132. (version "0.23.22")
  133. (source
  134. (origin
  135. (method url-fetch)
  136. (uri (string-append "https://github.com/p11-glue/p11-kit/releases/"
  137. "download/" version "/p11-kit-" version ".tar.xz"))
  138. (sha256
  139. (base32 "1dn6br4v033d3gp2max9lsr3y4q0nj6iyr1yq3kzi8ym7lal13wa"))))
  140. (build-system gnu-build-system)
  141. (native-inputs
  142. `(,@(if (hurd-target?)
  143. `(("autoconf" ,autoconf)
  144. ("automake" ,automake)
  145. ("gettext" ,gettext-minimal) ;for autopoint
  146. ("libtool" ,libtool))
  147. '())
  148. ("pkg-config" ,pkg-config)))
  149. (inputs
  150. `(("libffi" ,libffi)
  151. ,@(if (hurd-target?)
  152. `(("libbsd" ,libbsd)
  153. ("hurd-patch" ,(search-patch "p11-kit-hurd.patch")))
  154. '())
  155. ("libtasn1" ,libtasn1)))
  156. (arguments
  157. `(#:configure-flags '("--without-trust-paths")
  158. #:phases (modify-phases %standard-phases
  159. ,@(if (hurd-target?)
  160. '((add-after 'unpack 'apply-hurd-patch
  161. (lambda* (#:key inputs #:allow-other-keys)
  162. (let ((patch (assoc-ref inputs "hurd-patch")))
  163. (invoke "patch" "-p1" "--batch" "-i"
  164. patch))))
  165. (replace 'bootstrap
  166. (lambda _
  167. (invoke "autoreconf" "-fiv"))))
  168. '())
  169. (add-before 'check 'prepare-tests
  170. (lambda _
  171. ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
  172. ;; and looks for .cache and other directories (only).
  173. ;; For simplicity just drop it since it is irrelevant
  174. ;; in the build container.
  175. (substitute* "Makefile"
  176. (("test-runtime\\$\\(EXEEXT\\)") ""))
  177. #t)))))
  178. (home-page "https://p11-glue.freedesktop.org/p11-kit.html")
  179. (synopsis "PKCS#11 library")
  180. (description
  181. "p11-kit provides a way to load and enumerate PKCS#11 modules. It
  182. provides a standard configuration setup for installing PKCS#11 modules
  183. in such a way that they are discoverable. It also solves problems with
  184. coordinating the use of PKCS#11 by different components or libraries
  185. living in the same process.")
  186. (license license:bsd-3)))
  187. (define-public gnutls
  188. (package
  189. (name "gnutls")
  190. (version "3.7.2")
  191. (source (origin
  192. (method url-fetch)
  193. ;; Note: Releases are no longer on ftp.gnu.org since the
  194. ;; schism (after version 3.1.5).
  195. (uri (string-append "mirror://gnupg/gnutls/v"
  196. (version-major+minor version)
  197. "/gnutls-" version ".tar.xz"))
  198. (patches (search-patches "gnutls-skip-trust-store-test.patch"
  199. "gnutls-cross.patch"
  200. "gnutls-guile-eintr-eagain.patch"))
  201. (sha256
  202. (base32
  203. "0li7mwjnm64mbxhacz0rpf6i9qd83f53fvbrx96alpqqk9d6qvk4"))))
  204. (build-system gnu-build-system)
  205. (arguments
  206. `(#:tests? ,(not (or (%current-target-system)
  207. (hurd-target?)))
  208. ;; Ensure we don't keep a reference to the tools used for testing.
  209. #:disallowed-references ,(if (hurd-target?)
  210. '()
  211. (list net-tools iproute socat))
  212. #:configure-flags
  213. (cons*
  214. ;; GnuTLS doesn't consult any environment variables to specify
  215. ;; the location of the system-wide trust store. Instead it has a
  216. ;; configure-time option. Unless specified, its configure script
  217. ;; attempts to auto-detect the location by looking for common
  218. ;; places in the file system, none of which are present in our
  219. ;; chroot build environment. If not found, then no default trust
  220. ;; store is used, so each program has to provide its own
  221. ;; fallback, and users have to configure each program
  222. ;; independently. This seems suboptimal.
  223. "--with-default-trust-store-dir=/etc/ssl/certs"
  224. ;; Tell the build system that we want Guile bindings installed to
  225. ;; the output instead of Guiles own module directory.
  226. (string-append "--with-guile-site-dir="
  227. "$(datarootdir)/guile/site/$(GUILE_EFFECTIVE_VERSION)")
  228. (string-append "--with-guile-site-ccache-dir="
  229. "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache")
  230. (string-append "--with-guile-extension-dir="
  231. "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/extensions")
  232. (let ((system ,(or (%current-target-system)
  233. (%current-system))))
  234. (if (string-prefix? "mips64el" system)
  235. (list
  236. ;; FIXME: Temporarily disable p11-kit support since it is
  237. ;; not working on mips64el.
  238. "--without-p11-kit")
  239. '())))
  240. #:phases (modify-phases %standard-phases
  241. ;; fastopen.sh fails to connect to the server in the builder
  242. ;; environment (see:
  243. ;; https://gitlab.com/gnutls/gnutls/-/issues/1095).
  244. (add-after 'unpack 'disable-failing-tests
  245. (lambda _
  246. (substitute* "tests/fastopen.sh"
  247. (("^unset RETCODE")
  248. "exit 77\n")))) ;skip
  249. (add-after 'install 'move-doc
  250. (lambda* (#:key outputs #:allow-other-keys)
  251. ;; Copy the 4.1 MiB of section 3 man pages to "doc".
  252. (let* ((out (assoc-ref outputs "out"))
  253. (doc (assoc-ref outputs "doc"))
  254. (mandir (string-append doc "/share/man/man3"))
  255. (oldman (string-append out "/share/man/man3")))
  256. (mkdir-p mandir)
  257. (copy-recursively oldman mandir)
  258. (delete-file-recursively oldman)))))))
  259. (outputs '("out" ;4.4 MiB
  260. "debug"
  261. "doc")) ;4.1 MiB of man pages
  262. (native-inputs
  263. `(,@(if (%current-target-system) ;for cross-build
  264. `(("guile" ,guile-3.0)) ;to create .go files
  265. '())
  266. ,@(if (hurd-target?)
  267. '()
  268. `(("net-tools" ,net-tools)
  269. ("iproute" ,iproute) ;for 'ss'
  270. ("socat" ,socat))) ;several tests rely on it
  271. ("pkg-config" ,pkg-config)
  272. ("texinfo" ,texinfo)
  273. ("which" ,which)
  274. ,@(if (hurd-target?)
  275. '()
  276. `(("datefudge" ,datefudge))) ;tests rely on 'datefudge'
  277. ("util-linux" ,util-linux))) ;one test needs 'setsid'
  278. (inputs
  279. `(("guile" ,guile-3.0)))
  280. (propagated-inputs
  281. ;; These are all in the 'Requires.private' field of gnutls.pc.
  282. `(("libtasn1" ,libtasn1)
  283. ("libidn2" ,libidn2)
  284. ("nettle" ,nettle)
  285. ("zlib" ,zlib)
  286. ,@(let ((system (or (%current-target-system)
  287. (%current-system))))
  288. (if (string-prefix? "mips64el" system)
  289. '()
  290. `(("p11-kit" ,p11-kit))))))
  291. (home-page "https://www.gnu.org/software/gnutls/")
  292. (synopsis "Transport layer security library")
  293. (description
  294. "GnuTLS is a secure communications library implementing the SSL, TLS
  295. and DTLS protocols. It is provided in the form of a C library to support the
  296. protocols, as well as to parse and write X.509, PKCS #12, OpenPGP and other
  297. required structures.")
  298. (license license:lgpl2.1+)
  299. (properties '((ftp-server . "ftp.gnutls.org")
  300. (ftp-directory . "/gcrypt/gnutls")))))
  301. (define-public gnutls/guile-2.0
  302. ;; GnuTLS for Guile 2.0.
  303. (package/inherit gnutls
  304. (name "guile2.0-gnutls")
  305. (inputs `(("guile" ,guile-2.0)
  306. ,@(alist-delete "guile" (package-inputs gnutls))))))
  307. (define-public gnutls/dane
  308. ;; GnuTLS with build libgnutls-dane, implementing DNS-based
  309. ;; Authentication of Named Entities. This is required for GNS functionality
  310. ;; by GNUnet and gnURL. This is done in an extra package definition
  311. ;; to have the choice between GnuTLS with Dane and without Dane.
  312. (package/inherit gnutls
  313. (name "gnutls-dane")
  314. (inputs `(("unbound" ,unbound)
  315. ,@(package-inputs gnutls)))))
  316. (define-public guile2.2-gnutls
  317. (package/inherit gnutls
  318. (name "guile2.2-gnutls")
  319. (inputs `(("guile" ,guile-2.2)
  320. ,@(alist-delete "guile"
  321. (package-inputs gnutls))))))
  322. (define-public guile3.0-gnutls
  323. (deprecated-package "guile3.0-gnutls" gnutls))
  324. (define (target->openssl-target target)
  325. "Return the value to set CONFIGURE_TARGET_ARCH to when cross-compiling
  326. OpenSSL for TARGET."
  327. ;; Keep this code outside the build code,
  328. ;; such that new targets can be added
  329. ;; without causing rebuilds for other targets.
  330. (cond ((string-prefix? "i586" target)
  331. "hurd-x86")
  332. ((string-prefix? "i686" target)
  333. "linux-x86")
  334. ((string-prefix? "x86_64" target)
  335. "linux-x86_64")
  336. ((string-prefix? "mips64el" target)
  337. "linux-mips64")
  338. ((string-prefix? "arm" target)
  339. "linux-armv4")
  340. ((string-prefix? "aarch64" target)
  341. "linux-aarch64")
  342. ((string-prefix? "powerpc64le" target)
  343. "linux-ppc64le")
  344. ((string-prefix? "powerpc64" target)
  345. "linux-ppc64")
  346. ((string-prefix? "powerpc" target)
  347. "linux-ppc")))
  348. (define-public openssl
  349. (package
  350. (name "openssl")
  351. (version "1.1.1k")
  352. (replacement openssl-1.1.1l)
  353. (source (origin
  354. (method url-fetch)
  355. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  356. version ".tar.gz")
  357. (string-append "ftp://ftp.openssl.org/source/"
  358. "openssl-" version ".tar.gz")
  359. (string-append "ftp://ftp.openssl.org/source/old/"
  360. (string-trim-right version char-set:letter)
  361. "/openssl-" version ".tar.gz")))
  362. (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
  363. (sha256
  364. (base32
  365. "1rdfzcrxy9y38wqdw5942vmdax9hjhgrprzxm42csal7p5shhal9"))))
  366. (build-system gnu-build-system)
  367. (outputs '("out"
  368. "doc" ;6.8 MiB of man3 pages and full HTML documentation
  369. "static")) ;6.4 MiB of .a files
  370. (native-inputs `(("perl" ,perl)))
  371. (arguments
  372. `(#:parallel-tests? #f
  373. #:test-target "test"
  374. ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
  375. ;; so we explicitly disallow it here.
  376. #:disallowed-references ,(list (canonical-package perl))
  377. #:phases
  378. ,#~
  379. (modify-phases %standard-phases
  380. #$@(if (%current-target-system)
  381. #~((add-before
  382. 'configure 'set-cross-compile
  383. (lambda* (#:key target #:allow-other-keys)
  384. (setenv "CROSS_COMPILE" (string-append target "-"))
  385. (setenv "CONFIGURE_TARGET_ARCH"
  386. #$(target->openssl-target
  387. (%current-target-system))))))
  388. #~())
  389. ;; This test seems to be dependant on kernel features.
  390. ;; https://github.com/openssl/openssl/issues/12242
  391. #$@(if (target-arm?)
  392. #~((replace 'check
  393. (lambda* (#:key tests? test-target #:allow-other-keys)
  394. (when tests?
  395. (invoke "make" "TESTS=-test_afalg" test-target)))))
  396. #~())
  397. (replace 'configure
  398. (lambda* (#:key configure-flags #:allow-other-keys)
  399. (let* ((out #$output)
  400. (lib (string-append out "/lib")))
  401. ;; It's not a shebang so patch-source-shebangs misses it.
  402. (substitute* "config"
  403. (("/usr/bin/env")
  404. (string-append (assoc-ref %build-inputs "coreutils")
  405. "/bin/env")))
  406. (apply
  407. invoke #$@(if (%current-target-system)
  408. #~("./Configure")
  409. #~("./config"))
  410. "shared" ;build shared libraries
  411. "--libdir=lib"
  412. ;; The default for this catch-all directory is
  413. ;; PREFIX/ssl. Change that to something more
  414. ;; conventional.
  415. (string-append "--openssldir=" out
  416. "/share/openssl-"
  417. #$(package-version this-package))
  418. (string-append "--prefix=" out)
  419. (string-append "-Wl,-rpath," lib)
  420. #$@(if (%current-target-system)
  421. #~((getenv "CONFIGURE_TARGET_ARCH"))
  422. #~())
  423. configure-flags)
  424. ;; Output the configure variables.
  425. (invoke "perl" "configdata.pm" "--dump"))))
  426. (add-after 'install 'move-static-libraries
  427. (lambda _
  428. ;; Move static libraries to the "static" output.
  429. (let* ((out #$output)
  430. (lib (string-append out "/lib"))
  431. (static #$output:static)
  432. (slib (string-append static "/lib")))
  433. (for-each (lambda (file)
  434. (install-file file slib)
  435. (delete-file file))
  436. (find-files lib "\\.a$")))))
  437. (add-after 'install 'move-extra-documentation
  438. (lambda _
  439. ;; Move man pages and full HTML documentation to "doc".
  440. (let* ((out #$output)
  441. (man (string-append out "/share/man"))
  442. (html (string-append out "/share/doc/openssl"))
  443. (doc #$output:doc)
  444. (man-target (string-append doc "/share/man"))
  445. (html-target (string-append doc "/share/doc/openssl")))
  446. (mkdir-p (dirname man-target))
  447. (mkdir-p (dirname html-target))
  448. (rename-file man man-target)
  449. (rename-file html html-target))))
  450. (add-after
  451. 'install 'remove-miscellany
  452. (lambda _
  453. ;; The 'misc' directory contains random undocumented shell and Perl
  454. ;; scripts. Remove them to avoid retaining a reference on Perl.
  455. (delete-file-recursively (string-append #$output "/share/openssl-"
  456. #$(package-version this-package)
  457. "/misc")))))))
  458. (native-search-paths
  459. (list (search-path-specification
  460. (variable "SSL_CERT_DIR")
  461. (separator #f) ;single entry
  462. (files '("etc/ssl/certs")))
  463. (search-path-specification
  464. (variable "SSL_CERT_FILE")
  465. (file-type 'regular)
  466. (separator #f) ;single entry
  467. (files '("etc/ssl/certs/ca-certificates.crt")))))
  468. (synopsis "SSL/TLS implementation")
  469. (description
  470. "OpenSSL is an implementation of SSL/TLS.")
  471. (license license:openssl)
  472. (home-page "https://www.openssl.org/")))
  473. ;; Replacement package to fix multiple CVEs.
  474. (define openssl-1.1.1l
  475. (package
  476. (inherit openssl)
  477. (version "1.1.1l")
  478. (source (origin
  479. (method url-fetch)
  480. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  481. version ".tar.gz")
  482. (string-append "ftp://ftp.openssl.org/source/"
  483. "openssl-" version ".tar.gz")
  484. (string-append "ftp://ftp.openssl.org/source/old/"
  485. (string-trim-right version char-set:letter)
  486. "/openssl-" version ".tar.gz")))
  487. (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
  488. (sha256
  489. (base32
  490. "1lbblxps2fhmz7bqh058iywh5wxfignbfx1s1kz2fj63b5g3wyhb"))))))
  491. ;; We will not add any new uses of this package. If you add new code that uses
  492. ;; this package, your change will be reverted!
  493. ;;
  494. ;; The only acceptable use for this package is to bootstrap Rust, in
  495. ;; ((gnu packages rust) rust-1.19).
  496. ;;
  497. ;; OpenSSL 1.0 is no longer suppported upstream [0] and has several security
  498. ;; vulnerabilities that will not be fixed [1].
  499. ;;
  500. ;; For more information from the Guix point of view, see
  501. ;; <https://bugs.gnu.org/46602>.
  502. ;;
  503. ;; [0] https://www.openssl.org/policies/releasestrat.html
  504. ;; [1] https://www.openssl.org/news/vulnerabilities.html
  505. (define-public openssl-1.0
  506. (hidden-package
  507. (package
  508. (inherit openssl)
  509. (name "openssl")
  510. (version "1.0.2u")
  511. (source (origin
  512. (method url-fetch)
  513. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  514. version ".tar.gz")
  515. (string-append "ftp://ftp.openssl.org/source/"
  516. "openssl-" version ".tar.gz")
  517. (string-append "ftp://ftp.openssl.org/source/old/"
  518. (string-trim-right version char-set:letter)
  519. "/openssl-" version ".tar.gz")))
  520. (sha256
  521. (base32
  522. "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c"))
  523. (patches (search-patches "openssl-runpath.patch"
  524. "openssl-c-rehash-in.patch"))))
  525. (outputs '("out"
  526. "doc" ;1.5MiB of man3 pages
  527. "static")) ;6MiB of .a files
  528. (arguments
  529. (substitute-keyword-arguments (package-arguments openssl)
  530. ;; Parallel build is not supported in 1.0.x.
  531. ((#:parallel-build? _ #f) #f)
  532. ((#:phases phases)
  533. #~(modify-phases #$phases
  534. (add-before 'patch-source-shebangs 'patch-tests
  535. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  536. (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
  537. (substitute* (find-files "test" ".*")
  538. (("/bin/sh")
  539. (string-append bash "/bin/sh"))
  540. (("/bin/rm")
  541. "rm"))
  542. #t)))
  543. (add-before 'configure 'patch-Makefile.org
  544. (lambda* (#:key outputs #:allow-other-keys)
  545. ;; The default MANDIR is some unusual place. Fix that.
  546. (let ((out (assoc-ref outputs "out")))
  547. (patch-makefile-SHELL "Makefile.org")
  548. (substitute* "Makefile.org"
  549. (("^MANDIR[[:blank:]]*=.*$")
  550. (string-append "MANDIR = " out "/share/man\n")))
  551. #t)))
  552. (replace 'configure
  553. ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
  554. (lambda* (#:key outputs #:allow-other-keys)
  555. (let ((out (assoc-ref outputs "out")))
  556. (invoke #$@(if (%current-target-system)
  557. #~("./Configure")
  558. #~("./config"))
  559. "shared" ;build shared libraries
  560. "--libdir=lib"
  561. ;; The default for this catch-all directory is
  562. ;; PREFIX/ssl. Change that to something more
  563. ;; conventional.
  564. (string-append "--openssldir=" out
  565. "/share/openssl-" #$version)
  566. (string-append "--prefix=" out)
  567. #$@(if (%current-target-system)
  568. '((getenv "CONFIGURE_TARGET_ARCH"))
  569. '())))))
  570. (delete 'move-extra-documentation)
  571. (add-after 'install 'move-man3-pages
  572. (lambda* (#:key outputs #:allow-other-keys)
  573. ;; Move section 3 man pages to "doc".
  574. (let* ((out (assoc-ref outputs "out"))
  575. (man3 (string-append out "/share/man/man3"))
  576. (doc (assoc-ref outputs "doc"))
  577. (target (string-append doc "/share/man/man3")))
  578. (mkdir-p target)
  579. (for-each (lambda (file)
  580. (rename-file file
  581. (string-append target "/"
  582. (basename file))))
  583. (find-files man3))
  584. (delete-file-recursively man3)
  585. #t)))
  586. ;; XXX: Duplicate this phase to make sure 'version' evaluates
  587. ;; in the current scope and not the inherited one.
  588. (replace 'remove-miscellany
  589. (lambda* (#:key outputs #:allow-other-keys)
  590. ;; The 'misc' directory contains random undocumented shell and Perl
  591. ;; scripts. Remove them to avoid retaining a reference on Perl.
  592. (let ((out (assoc-ref outputs "out")))
  593. (delete-file-recursively (string-append out "/share/openssl-"
  594. #$version "/misc"))
  595. #t))))))))))
  596. (define-public libressl
  597. (package
  598. (name "libressl")
  599. (version "3.3.3")
  600. (source (origin
  601. (method url-fetch)
  602. (uri (string-append "mirror://openbsd/LibreSSL/"
  603. "libressl-" version ".tar.gz"))
  604. (sha256
  605. (base32
  606. "0rihprcgxsydsbcqgd1952k2cfn4jmp7rlyp1c6sglfc6rdmcwd4"))))
  607. (build-system gnu-build-system)
  608. (arguments
  609. `(#:configure-flags
  610. (list
  611. ;; Do as if 'getentropy' were missing: Linux kernels before 3.17 lack its
  612. ;; underlying 'getrandom' system call and ENOSYS isn't properly handled.
  613. ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
  614. "ac_cv_func_getentropy=no"
  615. ;; FIXME It's using it's own bundled certificate, instead it should
  616. ;; behave like OpenSSL by using environment variables.
  617. (string-append "--with-openssldir=" %output
  618. "/share/libressl-"
  619. ,(package-version this-package))
  620. ;; Provide a TLS-enabled netcat.
  621. "--enable-nc")))
  622. (home-page "https://www.libressl.org/")
  623. (synopsis "SSL/TLS implementation")
  624. (description "LibreSSL is a version of the TLS/crypto stack, forked from
  625. OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
  626. and applying best practice development processes. This package also includes a
  627. netcat implementation that supports TLS.")
  628. ;; Files taken from OpenSSL keep their license, others are under various
  629. ;; non-copyleft licenses.
  630. (license (list license:openssl
  631. (license:non-copyleft
  632. "file://COPYING"
  633. "See COPYING in the distribution.")))))
  634. (define-public python-acme
  635. (package
  636. (name "python-acme")
  637. ;; Remember to update the hash of certbot when updating python-acme.
  638. (version "1.17.0")
  639. (source (origin
  640. (method url-fetch)
  641. (uri (pypi-uri "acme" version))
  642. (sha256
  643. (base32
  644. "03ij1wp7jwvppv70qbjkgdg7w824yh6j4gfb68jj20wicx08xx1a"))))
  645. (build-system python-build-system)
  646. (arguments
  647. `(#:phases
  648. (modify-phases %standard-phases
  649. (add-after 'build 'build-documentation
  650. (lambda _
  651. (invoke "make" "-C" "docs" "man" "info")))
  652. (add-after 'install 'install-documentation
  653. (lambda* (#:key outputs #:allow-other-keys)
  654. (let* ((out (assoc-ref outputs "out"))
  655. (man (string-append out "/share/man/man1"))
  656. (info (string-append out "/info")))
  657. (install-file "docs/_build/texinfo/acme-python.info" info)
  658. (install-file "docs/_build/man/acme-python.1" man)
  659. #t))))))
  660. (native-inputs
  661. `(("python-pytest" ,python-pytest)
  662. ;; For documentation
  663. ("python-sphinx" ,python-sphinx)
  664. ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
  665. ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
  666. ("texinfo" ,texinfo)))
  667. (propagated-inputs
  668. `(("python-josepy" ,python-josepy)
  669. ("python-requests" ,python-requests)
  670. ("python-requests-toolbelt" ,python-requests-toolbelt)
  671. ("python-pytz" ,python-pytz)
  672. ("python-pyrfc3339" ,python-pyrfc3339)
  673. ("python-pyasn1" ,python-pyasn1)
  674. ("python-cryptography" ,python-cryptography)
  675. ("python-pyopenssl" ,python-pyopenssl)))
  676. (home-page "https://github.com/certbot/certbot")
  677. (synopsis "ACME protocol implementation in Python")
  678. (description "ACME protocol implementation in Python")
  679. (license license:asl2.0)))
  680. (define-public certbot
  681. (package
  682. (name "certbot")
  683. ;; Certbot and python-acme are developed in the same repository, and their
  684. ;; versions should remain synchronized.
  685. (version (package-version python-acme))
  686. (source (origin
  687. (method url-fetch)
  688. (uri (pypi-uri "certbot" version))
  689. (sha256
  690. (base32
  691. "0wyipx6q78fmvngf1i6g50s01qpjqh07qlk1b5vyxwgl3080lhgg"))))
  692. (build-system python-build-system)
  693. (arguments
  694. `(,@(substitute-keyword-arguments (package-arguments python-acme)
  695. ((#:phases phases)
  696. `(modify-phases ,phases
  697. (replace 'install-documentation
  698. (lambda* (#:key outputs #:allow-other-keys)
  699. (let* ((out (assoc-ref outputs "out"))
  700. (man1 (string-append out "/share/man/man1"))
  701. (man7 (string-append out "/share/man/man7"))
  702. (info (string-append out "/info")))
  703. (install-file "docs/_build/texinfo/Certbot.info" info)
  704. (install-file "docs/_build/man/certbot.1" man1)
  705. (install-file "docs/_build/man/certbot.7" man7)
  706. #t))))))))
  707. (native-inputs
  708. `(("python-mock" ,python-mock)
  709. ("python-pytest" ,python-pytest)
  710. ;; For documentation
  711. ("python-sphinx" ,python-sphinx)
  712. ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
  713. ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
  714. ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
  715. ("texinfo" ,texinfo)))
  716. (propagated-inputs
  717. `(("python-acme" ,python-acme)
  718. ("python-cryptography" ,python-cryptography)
  719. ("python-zope-interface" ,python-zope-interface)
  720. ("python-pyrfc3339" ,python-pyrfc3339)
  721. ("python-pyopenssl" ,python-pyopenssl)
  722. ("python-configobj" ,python-configobj)
  723. ("python-configargparse" ,python-configargparse)
  724. ("python-distro" ,python-distro)
  725. ("python-zope-component" ,python-zope-component)
  726. ("python-parsedatetime" ,python-parsedatetime)
  727. ("python-psutil" ,python-psutil)
  728. ("python-requests" ,python-requests)
  729. ("python-pytz" ,python-pytz)))
  730. (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
  731. (description "Certbot automatically receives and installs X.509 certificates
  732. to enable Transport Layer Security (TLS) on servers. It interoperates with the
  733. Let’s Encrypt certificate authority (CA), which issues browser-trusted
  734. certificates for free.")
  735. (home-page "https://certbot.eff.org/")
  736. (license license:asl2.0)))
  737. (define-public letsencrypt
  738. (package (inherit certbot)
  739. (name "letsencrypt")
  740. (properties `((superseded . ,certbot)))))
  741. (define-public perl-net-ssleay
  742. (package
  743. (name "perl-net-ssleay")
  744. (version "1.88")
  745. (source (origin
  746. (method url-fetch)
  747. (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
  748. "Net-SSLeay-" version ".tar.gz"))
  749. (sha256
  750. (base32
  751. "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
  752. (build-system perl-build-system)
  753. (inputs `(("openssl" ,openssl)))
  754. (arguments
  755. `(#:phases
  756. (modify-phases %standard-phases
  757. (add-before
  758. 'configure 'set-ssl-prefix
  759. (lambda* (#:key inputs #:allow-other-keys)
  760. (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
  761. #t)))))
  762. (synopsis "Perl extension for using OpenSSL")
  763. (description
  764. "This module offers some high level convenience functions for accessing
  765. web pages on SSL servers (for symmetry, the same API is offered for accessing
  766. http servers, too), an sslcat() function for writing your own clients, and
  767. finally access to the SSL api of the SSLeay/OpenSSL package so you can write
  768. servers or clients for more complicated applications.")
  769. (license license:perl-license)
  770. (home-page "https://metacpan.org/release/Net-SSLeay")))
  771. (define-public perl-crypt-openssl-rsa
  772. (package
  773. (name "perl-crypt-openssl-rsa")
  774. (version "0.31")
  775. (source
  776. (origin
  777. (method url-fetch)
  778. (uri (string-append
  779. "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
  780. version
  781. ".tar.gz"))
  782. (sha256
  783. (base32
  784. "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
  785. (build-system perl-build-system)
  786. (native-inputs
  787. `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
  788. (inputs
  789. `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
  790. ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
  791. ("openssl" ,openssl)))
  792. (arguments perl-crypt-arguments)
  793. (home-page
  794. "https://metacpan.org/release/Crypt-OpenSSL-RSA")
  795. (synopsis
  796. "RSA encoding and decoding, using the openSSL libraries")
  797. (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
  798. OpenSSL libraries).")
  799. (license license:perl-license)))
  800. (define perl-crypt-arguments
  801. `(#:phases (modify-phases %standard-phases
  802. (add-before 'configure 'patch-Makefile.PL
  803. (lambda* (#:key inputs #:allow-other-keys)
  804. (substitute* "Makefile.PL"
  805. (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
  806. (assoc-ref inputs "openssl")
  807. "/lib -lcrypto'],")))
  808. #t)))))
  809. (define-public perl-crypt-openssl-bignum
  810. (package
  811. (name "perl-crypt-openssl-bignum")
  812. (version "0.09")
  813. (source
  814. (origin
  815. (method url-fetch)
  816. (uri (string-append
  817. "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
  818. version
  819. ".tar.gz"))
  820. (sha256
  821. (base32
  822. "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
  823. (build-system perl-build-system)
  824. (inputs `(("openssl" ,openssl)))
  825. (arguments perl-crypt-arguments)
  826. (home-page
  827. "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
  828. (synopsis
  829. "OpenSSL's multiprecision integer arithmetic in Perl")
  830. (description "Crypt::OpenSSL::Bignum provides multiprecision integer
  831. arithmetic in Perl.")
  832. ;; At your option either gpl1+ or the Artistic License
  833. (license license:perl-license)))
  834. (define-public perl-crypt-openssl-guess
  835. (package
  836. (name "perl-crypt-openssl-guess")
  837. (version "0.11")
  838. (source
  839. (origin
  840. (method url-fetch)
  841. (uri (string-append
  842. "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
  843. version ".tar.gz"))
  844. (sha256
  845. (base32
  846. "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
  847. (build-system perl-build-system)
  848. (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
  849. (synopsis "Guess the OpenSSL include path")
  850. (description
  851. "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
  852. correct OpenSSL include path. It is intended for use in your
  853. @file{Makefile.PL}.")
  854. (license license:perl-license)))
  855. (define-public perl-crypt-openssl-random
  856. (package
  857. (name "perl-crypt-openssl-random")
  858. (version "0.15")
  859. (source
  860. (origin
  861. (method url-fetch)
  862. (uri (string-append
  863. "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
  864. version
  865. ".tar.gz"))
  866. (sha256
  867. (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
  868. (build-system perl-build-system)
  869. (native-inputs
  870. `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
  871. (inputs
  872. `(("openssl" ,openssl)))
  873. (arguments perl-crypt-arguments)
  874. (home-page
  875. "https://metacpan.org/release/Crypt-OpenSSL-Random")
  876. (synopsis
  877. "OpenSSL/LibreSSL pseudo-random number generator access")
  878. (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
  879. number generator")
  880. (license license:perl-license)))
  881. (define-public acme-client
  882. (package
  883. (name "acme-client")
  884. (version "0.1.16")
  885. (source (origin
  886. (method url-fetch)
  887. (uri (string-append "https://kristaps.bsd.lv/" name "/"
  888. "snapshots/" name "-portable-"
  889. version ".tgz"))
  890. (sha256
  891. (base32
  892. "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
  893. (build-system gnu-build-system)
  894. (arguments
  895. '(#:tests? #f ; no test suite
  896. #:make-flags
  897. (list "CC=gcc"
  898. (string-append "PREFIX=" (assoc-ref %outputs "out")))
  899. #:phases
  900. (modify-phases %standard-phases
  901. (add-after 'unpack 'patch-paths
  902. (lambda* (#:key inputs #:allow-other-keys)
  903. (let ((pem (search-input-file inputs "/etc/ssl/cert.pem")))
  904. (substitute* "http.c"
  905. (("/etc/ssl/cert.pem") pem))
  906. #t)))
  907. (delete 'configure)))) ; no './configure' script
  908. (native-inputs
  909. `(("pkg-config" ,pkg-config)))
  910. (inputs
  911. `(("libbsd" ,libbsd)
  912. ("libressl" ,libressl)))
  913. (synopsis "Let's Encrypt client by the OpenBSD project")
  914. (description "acme-client is a Let's Encrypt client implemented in C. It
  915. uses a modular design, and attempts to secure itself by dropping privileges and
  916. operating in a chroot where possible. acme-client is developed on OpenBSD and
  917. then ported to the GNU / Linux environment.")
  918. (home-page "https://kristaps.bsd.lv/acme-client/")
  919. ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
  920. ;; and 'jsmn.c' are distributed under the Expat license.
  921. (license (list license:isc license:expat))))
  922. ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
  923. ;; variant exists in addition to the "-apache" one.
  924. (define-public mbedtls-apache
  925. (package
  926. (name "mbedtls-apache")
  927. ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha
  928. ;; when updating.
  929. (version "2.26.0")
  930. (source
  931. (origin
  932. (method git-fetch)
  933. (uri (git-reference
  934. (url "https://github.com/ARMmbed/mbedtls")
  935. (commit (string-append "mbedtls-" version))))
  936. (sha256
  937. (base32 "0scwpmrgvg6q7rvqkc352d2fqlsx0aylcbyibcp1f1rsn8iiif2m"))
  938. (file-name (git-file-name name version))
  939. (modules '((guix build utils)))
  940. (snippet
  941. '(begin
  942. ;; Can be removed with the next version.
  943. ;; Reduce level of format truncation warnings due to false positives.
  944. ;; https://github.com/ARMmbed/mbedtls/commit/2065a8d8af27c6cb1e40c9462b5933336dca7434
  945. (substitute* "CMakeLists.txt"
  946. (("Wformat-truncation=2") "Wformat-truncation"))
  947. #t))))
  948. (build-system cmake-build-system)
  949. (arguments
  950. `(#:configure-flags
  951. (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON"
  952. "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF")
  953. #:phases
  954. (modify-phases %standard-phases
  955. (add-after 'unpack 'make-source-writable
  956. (lambda _
  957. (for-each make-file-writable (find-files "."))
  958. #t)))))
  959. (native-inputs
  960. `(("perl" ,perl)
  961. ("python" ,python)))
  962. (synopsis "Small TLS library")
  963. (description
  964. "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
  965. for developers to include cryptographic and SSL/TLS capabilities in their
  966. (embedded) products, facilitating this functionality with a minimal
  967. coding footprint.")
  968. (home-page "https://www.trustedfirmware.org/projects/mbed-tls/")
  969. (license license:asl2.0)))
  970. ;; The Hiawatha Web server requires some specific features to be enabled.
  971. (define-public mbedtls-for-hiawatha
  972. (hidden-package
  973. (package
  974. (inherit mbedtls-apache)
  975. (arguments
  976. (substitute-keyword-arguments (package-arguments mbedtls-apache)
  977. ((#:phases phases)
  978. `(modify-phases ,phases
  979. (add-before 'configure 'configure-extra-features
  980. (lambda _
  981. (for-each (lambda (feature)
  982. (invoke "scripts/config.pl" "set" feature))
  983. (list "MBEDTLS_THREADING_C"
  984. "MBEDTLS_THREADING_PTHREAD"))
  985. ;; XXX The above enables code that breaks with -Werror…
  986. (substitute* "CMakeLists.txt"
  987. ((" -Wformat-signedness") ""))
  988. #t)))))))))
  989. (define-public dehydrated
  990. (package
  991. (name "dehydrated")
  992. (version "0.7.0")
  993. (source (origin
  994. (method url-fetch)
  995. (uri (string-append
  996. "https://github.com/dehydrated-io/dehydrated/releases/download/"
  997. "v" version "/dehydrated-" version ".tar.gz"))
  998. (sha256
  999. (base32
  1000. "1yf4kldyd5y13r6qxrkcbbk74ykngq7jzy0351vb2r3ywp114pqw"))))
  1001. (build-system trivial-build-system)
  1002. (arguments
  1003. `(#:modules ((guix build utils)
  1004. (srfi srfi-26))
  1005. #:builder
  1006. (begin
  1007. (use-modules (guix build utils)
  1008. (srfi srfi-26))
  1009. (let* ((source (assoc-ref %build-inputs "source"))
  1010. (tar (assoc-ref %build-inputs "tar"))
  1011. (gz (assoc-ref %build-inputs "gzip"))
  1012. (out (assoc-ref %outputs "out"))
  1013. (bin (string-append out "/bin"))
  1014. (doc (string-append out "/share/doc/" ,name "-" ,version))
  1015. (man (string-append out "/share/man"))
  1016. (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
  1017. (setenv "PATH" (string-append gz "/bin"))
  1018. (invoke (string-append tar "/bin/tar") "xvf" source)
  1019. (chdir (string-append ,name "-" ,version))
  1020. (copy-recursively "docs" doc)
  1021. (install-file "LICENSE" doc)
  1022. (mkdir-p man)
  1023. (rename-file (string-append doc "/man")
  1024. (string-append man "/man1"))
  1025. (for-each (cut invoke "gzip" "-9" <>)
  1026. (find-files man ".*"))
  1027. (install-file "dehydrated" bin)
  1028. (with-directory-excursion bin
  1029. (patch-shebang "dehydrated" (list bash))
  1030. ;; Do not try to write to the store.
  1031. (substitute* "dehydrated"
  1032. (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
  1033. (setenv "PATH" bash)
  1034. (wrap-program "dehydrated"
  1035. `("PATH" ":" prefix
  1036. ,(map (lambda (dir)
  1037. (string-append dir "/bin"))
  1038. (map (lambda (input)
  1039. (assoc-ref %build-inputs input))
  1040. '("coreutils"
  1041. "curl"
  1042. "diffutils"
  1043. "gawk"
  1044. "grep"
  1045. "openssl"
  1046. "sed"))))))
  1047. #t))))
  1048. (inputs
  1049. `(("bash" ,bash)
  1050. ("coreutils" ,coreutils)
  1051. ("curl" ,curl)
  1052. ("diffutils" ,diffutils)
  1053. ("gawk" ,gawk)
  1054. ("grep" ,grep)
  1055. ("openssl" ,openssl)
  1056. ("sed" ,sed)))
  1057. (native-inputs
  1058. `(("gzip" ,gzip)
  1059. ("tar" ,tar)))
  1060. ;; The following definition is copied from the cURL package to prevent a
  1061. ;; cycle between the curl and tls modules.
  1062. (native-search-paths
  1063. (list (search-path-specification
  1064. (variable "CURL_CA_BUNDLE")
  1065. (file-type 'regular)
  1066. (separator #f)
  1067. (files '("etc/ssl/certs/ca-certificates.crt")))))
  1068. (home-page "https://dehydrated.io/")
  1069. (synopsis "Let's Encrypt/ACME client implemented as a shell script")
  1070. (description "Dehydrated is a client for signing certificates with an
  1071. ACME-server (currently only provided by Let's Encrypt) implemented as a
  1072. relatively simple Bash script.")
  1073. (license license:expat)))
  1074. (define-public go-github-com-certifi-gocertifi
  1075. (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec")
  1076. (revision "1"))
  1077. (package
  1078. (name "go-github-com-certifi-gocertifi")
  1079. (version (git-version "2018.01.18" revision commit))
  1080. (source (origin
  1081. (method git-fetch)
  1082. (uri (git-reference
  1083. (url "https://github.com/certifi/gocertifi")
  1084. (commit commit)))
  1085. (file-name (git-file-name name version))
  1086. (sha256
  1087. (base32
  1088. "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj"))))
  1089. (build-system go-build-system)
  1090. (arguments
  1091. '(#:import-path "github.com/certifi/gocertifi"))
  1092. (synopsis "X.509 TLS root certificate bundle for Go")
  1093. (description "This package is a Go language X.509 TLS root certificate bundle,
  1094. derived from Mozilla's collection.")
  1095. (home-page "https://certifi.io")
  1096. (license license:mpl2.0))))
  1097. (define-public s2n
  1098. (package
  1099. (name "s2n")
  1100. (version "1.0.10")
  1101. (source (origin
  1102. (method git-fetch)
  1103. (uri (git-reference
  1104. (url (string-append "https://github.com/awslabs/" name))
  1105. (commit (string-append "v" version))))
  1106. (file-name (git-file-name name version))
  1107. (sha256
  1108. (base32
  1109. "0ampvh2n235hhd9nabgjjvja7d5r5kj45q56ass1k8g52a6xg0jq"))))
  1110. (build-system cmake-build-system)
  1111. (arguments
  1112. '(#:tests? #f ; tests fail to build for static library
  1113. #:configure-flags
  1114. '("-DBUILD_TESTING=OFF"
  1115. "-DBUILD_SHARED_LIBS=ON")))
  1116. (propagated-inputs
  1117. `(("openssl" ,openssl)
  1118. ("openssl:static" ,openssl "static")))
  1119. (synopsis "SSL/TLS implementation in C99")
  1120. (description
  1121. "This library provides a C99 implementation of SSL/TLS. It is designed to
  1122. be familiar to users of the widely-used POSIX I/O APIs. It supports blocking,
  1123. non-blocking, and full-duplex I/O. There are no locks or mutexes.
  1124. As it can be difficult to keep track of which encryption algorithms and
  1125. protocols are best to use, s2n-tls features a simple API to use the latest
  1126. default set of preferences. Remaining on a specific version for backwards
  1127. compatibility is also supported.")
  1128. (home-page "https://github.com/awslabs/s2n")
  1129. (license license:asl2.0)))
  1130. (define-public wolfssl
  1131. (package
  1132. (name "wolfssl")
  1133. (version "4.8.0")
  1134. (source (origin
  1135. (method git-fetch)
  1136. (uri (git-reference
  1137. (url "https://github.com/wolfSSL/wolfssl")
  1138. (commit (string-append "v" version "-stable"))))
  1139. (file-name (git-file-name name version))
  1140. (sha256
  1141. (base32
  1142. "1w9gs9cq2yhj5s3diz3x1l15pgrc1pbm00jccizvcjyibmwyyf2h"))))
  1143. (build-system gnu-build-system)
  1144. (arguments
  1145. '(#:configure-flags
  1146. '("--enable-reproducible-build")))
  1147. (native-inputs
  1148. `(("autoconf" ,autoconf)
  1149. ("automake" ,automake)
  1150. ("libtool" ,libtool)))
  1151. (synopsis "SSL/TLS implementation")
  1152. (description "The wolfSSL embedded SSL library (formerly CyaSSL) is an
  1153. SSL/TLS library written in ANSI C and targeted for embedded, RTOS, and
  1154. resource-constrained environments - primarily because of its small size, speed,
  1155. and feature set. wolfSSL supports industry standards up to the current TLS 1.3
  1156. and DTLS 1.2, is up to 20 times smaller than OpenSSL, and offers progressive
  1157. ciphers such as ChaCha20, Curve25519, NTRU, and Blake2b.")
  1158. (home-page "https://www.wolfssl.com/")
  1159. (license license:gpl2+))) ; Audit