;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2021 Mark H Weaver ;;; Copyright © 2014 Ian Denhardt ;;; Copyright © 2013, 2015 Andreas Enge ;;; Copyright © 2015 David Thompson ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Leo Famulari ;;; Copyright © 2016, 2017, 2019 Efraim Flashner ;;; Copyright © 2016, 2017, 2018 Nikita ;;; Copyright © 2016 Hartmut Goebel ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Marius Bakke ;;; Copyright © 2017–2019, 2021 Tobias Geerinckx-Rice ;;; Copyright © 2017 Rutger Helling ;;; Copyright © 2018 Clément Lassieur ;;; Copyright © 2019 Mathieu Othacehe
aboutsummaryrefslogtreecommitdiff
blob: 741bab5a8c2e64ec6536e9e3ad8f3827d4d9a9ee (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020 Jesse Dowell <jessedowell@gmail.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu services docker)
  #:use-module (gnu services)
  #:use-module (gnu services configuration)
  #:use-module (gnu services base)
  #:use-module (gnu services dbus)
  #:use-module (gnu services shepherd)
  #:use-module (gnu system setuid)
  #:use-module (gnu system shadow)
  #:use-module (gnu packages docker)
  #:use-module (gnu packages linux)               ;singularity
  #:use-module (guix records)
  #:use-module (guix gexp)
  #:use-module (guix packages)

  #:export (docker-configuration
            docker-service-type
            singularity-service-type))

(define-configuration docker-configuration
  (docker
   (file-like docker)
   "Docker daemon package.")
  (docker-cli
   (file-like docker-cli)
   "Docker client package.")
  (containerd
   (file-like containerd)
   "containerd package.")
  (proxy
   (file-like docker-libnetwork-cmd-proxy)
   "The proxy package to support inter-container and outside-container
loop-back communications.")
  (enable-proxy?
   (boolean #t)
   "Enable or disable the user-land proxy (enabled by default).")
  (debug?
   (boolean #f)
   "Enable or disable debug output.")
  (enable-iptables?
   (boolean #t)
   "Enable addition of iptables rules (enabled by default).")
  (environment-variables
   (list '())
   "Environment variables to set for dockerd")
  (no-serialization))

(define %docker-accounts
  (list (user-group (name "docker") (system? #t))))

(define (%containerd-activation config)
  (let ((state-dir "/var/lib/containerd"))
    #~(begin
        (use-modules (guix build utils))
        (mkdir-p #$state-dir))))

(define (%docker-activation config)
  (%containerd-activation config)
  (let ((state-dir "/var/lib/docker"))
    #~(begin
        (use-modules (guix build utils))
        (mkdir-p #$state-dir))))

(define (containerd-shepherd-service config)
  (let* ((package (docker-configuration-containerd config))
         (debug? (docker-configuration-debug? config))
         (containerd (docker-configuration-containerd config)))
    (shepherd-service
           (documentation "containerd daemon.")
           (provision '(containerd))
           (start #~(make-forkexec-constructor
                     (list (string-append #$package "/bin/containerd")
                           #$@(if debug?
                                  '("--log-level=debug")
                                  '()))
                     ;; For finding containerd-shim binary.
                     #:environment-variables
                     (list (string-append "PATH=" #$containerd "/bin"))
                     #:pid-file "/run/containerd/containerd.pid"
                     #:pid-file-timeout 300
                     #:log-file "/var/log/containerd.log"))
           (stop #~(make-kill-destructor)))))

(define (docker-shepherd-service config)
  (let* ((docker (docker-configuration-docker config))
         (enable-proxy? (docker-configuration-enable-proxy? config))
         (enable-iptables? (docker-configuration-enable-iptables? config))
         (environment-variables (docker-configuration-environment-variables config))
         (proxy (docker-configuration-proxy config))
         (debug? (docker-configuration-debug? config)))
    (shepherd-service
           (documentation "Docker daemon.")
           (provision '(dockerd))
           (requirement '(containerd
                          dbus-system
                          elogind
                          file-system-/sys/fs/cgroup/blkio
                          file-system-/sys/fs/cgroup/cpu
                          file-system-/sys/fs/cgroup/cpuset
                          file-system-/sys/fs/cgroup/devices
                          file-system-/sys/fs/cgroup/memory
                          file-system-/sys/fs/cgroup/pids
                          networking
                          udev))
           (start #~(make-forkexec-constructor
                     (list (string-append #$docker "/bin/dockerd")
                           "-p" "/var/run/docker.pid"
                           #$@(if debug?
                                  '("--debug" "--log-level=debug")
                                  '())
                           #$@(if enable-proxy?
                                  (list "--userland-proxy=true"
                                        #~(string-append
                                           "--userland-proxy-path=" #$proxy "/bin/proxy"))
                                  '("--userland-proxy=false"))
                           (if #$enable-iptables?
                               "--iptables"
                               "--iptables=false")
                           "--containerd" "/run/containerd/containerd.sock")
                     #:environment-variables
                     (list #$@environment-variables)
                     #:pid-file "/var/run/docker.pid"
                     #:log-file "/var/log/docker.log"))
           (stop #~(make-kill-destructor)))))

(define docker-service-type
  (service-type (name 'docker)
                (description "Provide capability to run Docker application
bundles in Docker containers.")
                (extensions
                 (list
                  ;; Make sure the 'docker' command is available.
                  (service-extension profile-service-type
                                     (compose list docker-configuration-docker-cli))
                  (service-extension activation-service-type
                                     %docker-activation)
                  (service-extension shepherd-root-service-type
                                     (lambda (config)
                                       (list (containerd-shepherd-service config)
                                             (docker-shepherd-service config))))
                  (service-extension account-service-type
                                     (const %docker-accounts))))
                (default-value (docker-configuration))))


;;;
;;; Singularity.
;;;

(define %singularity-activation
  (with-imported-modules '((guix build utils))
    #~(begin
        (use-modules (guix build utils))

        (define %mount-directory
          "/var/singularity/mnt/")

        ;; Create the directories that Singularity 2.6 expects to find.  Make
        ;; them #o755 like the 'install-data-hook' rule in 'Makefile.am' of
        ;; Singularity 2.6.1.
        (for-each (lambda (directory)
                    (let ((directory (string-append %mount-directory
                                                    directory)))
                      (mkdir-p directory)
                      (chmod directory #o755)))
                  '("container" "final" "overlay" "session"))
        (chmod %mount-directory #o755))))

(define (singularity-setuid-programs singularity)
  "Return the setuid-root programs that SINGULARITY needs."
  (define helpers
    ;; The helpers, under a meaningful name.
    (computed-file "singularity-setuid-helpers"
                   #~(begin
                       (mkdir #$output)
                       (for-each (lambda (program)
                                   (symlink (string-append #$singularity
                                                           "/libexec/singularity"
                                                           "/bin/"
                                                           program "-suid")
                                            (string-append #$output
                                                           "/singularity-"
                                                           program
                                                           "-helper")))
                                 '("action" "mount" "start")))))

  (map file-like->setuid-program
       (list (file-append helpers "/singularity-action-helper")
             (file-append helpers "/singularity-mount-helper")
             (file-append helpers "/singularity-start-helper"))))

(define singularity-service-type
  (service-type (name 'singularity)
                (description
                 "Install the Singularity application bundle tool.")
                (extensions
                 (list (service-extension setuid-program-service-type
                                          singularity-setuid-programs)
                       (service-extension activation-service-type
                                          (const %singularity-activation))))
                (default-value singularity)))
version ".tar.gz") (string-append "ftp://ftp.openssl.org/source/" "openssl-" version ".tar.gz") (string-append "ftp://ftp.openssl.org/source/old/" (string-trim-right version char-set:letter) "/openssl-" version ".tar.gz"))) (sha256 (base32 "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c")) (patches (search-patches "openssl-runpath.patch" "openssl-c-rehash-in.patch")))) (outputs '("out" "doc" ;1.5MiB of man3 pages "static")) ;6MiB of .a files (arguments (substitute-keyword-arguments (package-arguments openssl) ;; Parallel build is not supported in 1.0.x. ((#:parallel-build? _ #f) #f) ((#:phases phases) `(modify-phases ,phases (add-before 'patch-source-shebangs 'patch-tests (lambda* (#:key inputs native-inputs #:allow-other-keys) (let ((bash (assoc-ref (or native-inputs inputs) "bash"))) (substitute* (find-files "test" ".*") (("/bin/sh") (string-append bash "/bin/sh")) (("/bin/rm") "rm")) #t))) (add-before 'configure 'patch-Makefile.org (lambda* (#:key outputs #:allow-other-keys) ;; The default MANDIR is some unusual place. Fix that. (let ((out (assoc-ref outputs "out"))) (patch-makefile-SHELL "Makefile.org") (substitute* "Makefile.org" (("^MANDIR[[:blank:]]*=.*$") (string-append "MANDIR = " out "/share/man\n"))) #t))) (replace 'configure ;; Override this phase because OpenSSL 1.0 does not understand -rpath. (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (invoke ,@(if (%current-target-system) '("./Configure") '("./config")) "shared" ;build shared libraries "--libdir=lib" ;; The default for this catch-all directory is ;; PREFIX/ssl. Change that to something more ;; conventional. (string-append "--openssldir=" out "/share/openssl-" ,version) (string-append "--prefix=" out) ,@(if (%current-target-system) '((getenv "CONFIGURE_TARGET_ARCH")) '()))))) (delete 'move-extra-documentation) (add-after 'install 'move-man3-pages (lambda* (#:key outputs #:allow-other-keys) ;; Move section 3 man pages to "doc". (let* ((out (assoc-ref outputs "out")) (man3 (string-append out "/share/man/man3")) (doc (assoc-ref outputs "doc")) (target (string-append doc "/share/man/man3"))) (mkdir-p target) (for-each (lambda (file) (rename-file file (string-append target "/" (basename file)))) (find-files man3)) (delete-file-recursively man3) #t))) ;; XXX: Duplicate this phase to make sure 'version' evaluates ;; in the current scope and not the inherited one. (replace 'remove-miscellany (lambda* (#:key outputs #:allow-other-keys) ;; The 'misc' directory contains random undocumented shell and Perl ;; scripts. Remove them to avoid retaining a reference on Perl. (let ((out (assoc-ref outputs "out"))) (delete-file-recursively (string-append out "/share/openssl-" ,version "/misc")) #t))))))))) (define-public libressl (package (name "libressl") (version "3.1.5") (source (origin (method url-fetch) (uri (string-append "mirror://openbsd/LibreSSL/" "libressl-" version ".tar.gz")) (sha256 (base32 "1504a1sf43frw43j14pij0q1f48rm5q86ggrlxxhw708qp7ds4rc")))) (build-system gnu-build-system) (arguments ;; Do as if 'getentropy' were missing: Linux kernels before 3.17 lack its ;; underlying 'getrandom' system call and ENOSYS isn't properly handled. ;; See . '(#:configure-flags '("ac_cv_func_getentropy=no" ;; Provide a TLS-enabled netcat. "--enable-nc"))) (native-search-paths (list (search-path-specification (variable "SSL_CERT_DIR") (separator #f) ;single entry (files '("etc/ssl/certs"))) (search-path-specification (variable "SSL_CERT_FILE") (separator #f) ;single entry (files '("etc/ssl/certs/ca-certificates.crt"))))) (home-page "https://www.libressl.org/") (synopsis "SSL/TLS implementation") (description "LibreSSL is a version of the TLS/crypto stack, forked from OpenSSL in 2014 with the goals of modernizing the codebase, improving security, and applying best practice development processes. This package also includes a netcat implementation that supports TLS.") ;; Files taken from OpenSSL keep their license, others are under various ;; non-copyleft licenses. (license (list license:openssl (license:non-copyleft "file://COPYING" "See COPYING in the distribution."))))) (define-public python-acme (package (name "python-acme") ;; Remember to update the hash of certbot when updating python-acme. (version "1.15.0") (source (origin (method url-fetch) (uri (pypi-uri "acme" version)) (sha256 (base32 "0kgf1d3gl7dg1rz3q4093kf8g0p2d0m40c7qmn96ihz2224wa307")))) (build-system python-build-system) (arguments `(#:phases (modify-phases %standard-phases (add-after 'build 'build-documentation (lambda _ (invoke "make" "-C" "docs" "man" "info"))) (add-after 'install 'install-documentation (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (man (string-append out "/share/man/man1")) (info (string-append out "/info"))) (install-file "docs/_build/texinfo/acme-python.info" info) (install-file "docs/_build/man/acme-python.1" man) #t)))))) (native-inputs `(("python-pytest" ,python-pytest) ;; For documentation ("python-sphinx" ,python-sphinx) ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput) ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme) ("texinfo" ,texinfo))) (propagated-inputs `(("python-josepy" ,python-josepy) ("python-requests" ,python-requests) ("python-requests-toolbelt" ,python-requests-toolbelt) ("python-pytz" ,python-pytz) ("python-pyrfc3339" ,python-pyrfc3339) ("python-pyasn1" ,python-pyasn1) ("python-cryptography" ,python-cryptography) ("python-pyopenssl" ,python-pyopenssl))) (home-page "https://github.com/certbot/certbot") (synopsis "ACME protocol implementation in Python") (description "ACME protocol implementation in Python") (license license:asl2.0))) (define-public certbot (package (name "certbot") ;; Certbot and python-acme are developed in the same repository, and their ;; versions should remain synchronized. (version (package-version python-acme)) (source (origin (method url-fetch) (uri (pypi-uri "certbot" version)) (sha256 (base32 "1qcznszgqdgx1nhk4vdi896gknvx8rg4w8iw15lwqg6byhiyazyv")))) (build-system python-build-system) (arguments `(,@(substitute-keyword-arguments (package-arguments python-acme) ((#:phases phases) `(modify-phases ,phases (replace 'install-documentation (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (man1 (string-append out "/share/man/man1")) (man7 (string-append out "/share/man/man7")) (info (string-append out "/info"))) (install-file "docs/_build/texinfo/Certbot.info" info) (install-file "docs/_build/man/certbot.1" man1) (install-file "docs/_build/man/certbot.7" man7) #t)))))))) (native-inputs `(("python-mock" ,python-mock) ("python-pytest" ,python-pytest) ;; For documentation ("python-sphinx" ,python-sphinx) ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme) ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface) ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput) ("texinfo" ,texinfo))) (propagated-inputs `(("python-acme" ,python-acme) ("python-cryptography" ,python-cryptography) ("python-zope-interface" ,python-zope-interface) ("python-pyrfc3339" ,python-pyrfc3339) ("python-pyopenssl" ,python-pyopenssl) ("python-configobj" ,python-configobj) ("python-configargparse" ,python-configargparse) ("python-distro" ,python-distro) ("python-zope-component" ,python-zope-component) ("python-parsedatetime" ,python-parsedatetime) ("python-psutil" ,python-psutil) ("python-requests" ,python-requests) ("python-pytz" ,python-pytz))) (synopsis "Let's Encrypt client by the Electronic Frontier Foundation") (description "Certbot automatically receives and installs X.509 certificates to enable Transport Layer Security (TLS) on servers. It interoperates with the Let’s Encrypt certificate authority (CA), which issues browser-trusted certificates for free.") (home-page "https://certbot.eff.org/") (license license:asl2.0))) (define-public letsencrypt (package (inherit certbot) (name "letsencrypt") (properties `((superseded . ,certbot))))) (define-public perl-net-ssleay (package (name "perl-net-ssleay") (version "1.88") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/" "Net-SSLeay-" version ".tar.gz")) (sha256 (base32 "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010")))) (build-system perl-build-system) (inputs `(("openssl" ,openssl))) (arguments `(#:phases (modify-phases %standard-phases (add-before 'configure 'set-ssl-prefix (lambda* (#:key inputs #:allow-other-keys) (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl")) #t))))) (synopsis "Perl extension for using OpenSSL") (description "This module offers some high level convenience functions for accessing web pages on SSL servers (for symmetry, the same API is offered for accessing http servers, too), an sslcat() function for writing your own clients, and finally access to the SSL api of the SSLeay/OpenSSL package so you can write servers or clients for more complicated applications.") (license license:perl-license) (home-page "https://metacpan.org/release/Net-SSLeay"))) (define-public perl-crypt-openssl-rsa (package (name "perl-crypt-openssl-rsa") (version "0.31") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-" version ".tar.gz")) (sha256 (base32 "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1")))) (build-system perl-build-system) (native-inputs `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess))) (inputs `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum) ("perl-crypt-openssl-random" ,perl-crypt-openssl-random) ("openssl" ,openssl))) (arguments perl-crypt-arguments) (home-page "https://metacpan.org/release/Crypt-OpenSSL-RSA") (synopsis "RSA encoding and decoding, using the openSSL libraries") (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the OpenSSL libraries).") (license license:perl-license))) (define perl-crypt-arguments `(#:phases (modify-phases %standard-phases (add-before 'configure 'patch-Makefile.PL (lambda* (#:key inputs #:allow-other-keys) (substitute* "Makefile.PL" (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L" (assoc-ref inputs "openssl") "/lib -lcrypto'],"))) #t))))) (define-public perl-crypt-openssl-bignum (package (name "perl-crypt-openssl-bignum") (version "0.09") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-" version ".tar.gz")) (sha256 (base32 "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3")))) (build-system perl-build-system) (inputs `(("openssl" ,openssl))) (arguments perl-crypt-arguments) (home-page "https://metacpan.org/release/Crypt-OpenSSL-Bignum") (synopsis "OpenSSL's multiprecision integer arithmetic in Perl") (description "Crypt::OpenSSL::Bignum provides multiprecision integer arithmetic in Perl.") ;; At your option either gpl1+ or the Artistic License (license license:perl-license))) (define-public perl-crypt-openssl-guess (package (name "perl-crypt-openssl-guess") (version "0.11") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-" version ".tar.gz")) (sha256 (base32 "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa")))) (build-system perl-build-system) (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess") (synopsis "Guess the OpenSSL include path") (description "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the correct OpenSSL include path. It is intended for use in your @file{Makefile.PL}.") (license license:perl-license))) (define-public perl-crypt-openssl-random (package (name "perl-crypt-openssl-random") (version "0.15") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-" version ".tar.gz")) (sha256 (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh")))) (build-system perl-build-system) (native-inputs `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess))) (inputs `(("openssl" ,openssl))) (arguments perl-crypt-arguments) (home-page "https://metacpan.org/release/Crypt-OpenSSL-Random") (synopsis "OpenSSL/LibreSSL pseudo-random number generator access") (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random number generator") (license license:perl-license))) (define-public acme-client (package (name "acme-client") (version "0.1.16") (source (origin (method url-fetch) (uri (string-append "https://kristaps.bsd.lv/" name "/" "snapshots/" name "-portable-" version ".tgz")) (sha256 (base32 "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9")))) (build-system gnu-build-system) (arguments '(#:tests? #f ; no test suite #:make-flags (list "CC=gcc" (string-append "PREFIX=" (assoc-ref %outputs "out"))) #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-paths (lambda* (#:key inputs #:allow-other-keys) (let ((pem (string-append (assoc-ref inputs "libressl") "/etc/ssl/cert.pem"))) (substitute* "http.c" (("/etc/ssl/cert.pem") pem)) #t))) (delete 'configure)))) ; no './configure' script (native-inputs `(("pkg-config" ,pkg-config))) (inputs `(("libbsd" ,libbsd) ("libressl" ,libressl))) (synopsis "Let's Encrypt client by the OpenBSD project") (description "acme-client is a Let's Encrypt client implemented in C. It uses a modular design, and attempts to secure itself by dropping privileges and operating in a chroot where possible. acme-client is developed on OpenBSD and then ported to the GNU / Linux environment.") (home-page "https://kristaps.bsd.lv/acme-client/") ;; acme-client is distributed under the ISC license, but the files 'jsmn.h' ;; and 'jsmn.c' are distributed under the Expat license. (license (list license:isc license:expat)))) ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl" ;; variant exists in addition to the "-apache" one. (define-public mbedtls-apache (package (name "mbedtls-apache") ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha ;; when updating. (version "2.23.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ARMmbed/mbedtls") (commit (string-append "mbedtls-" version)))) (sha256 (base32 "13fa9h2i989cbf8n8c0j019mshv6wg213va18my1s787lhcq2d62")) (file-name (git-file-name name version)))) (build-system cmake-build-system) (arguments `(#:configure-flags (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON" "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF") #:phases (modify-phases %standard-phases (add-after 'unpack 'make-source-writable (lambda _ (for-each make-file-writable (find-files ".")) #t))))) (native-inputs `(("perl" ,perl) ("python" ,python))) (synopsis "Small TLS library") (description "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products, facilitating this functionality with a minimal coding footprint.") (home-page "https://tls.mbed.org") (license license:asl2.0))) ;; The Hiawatha Web server requires some specific features to be enabled. (define-public mbedtls-for-hiawatha (hidden-package (package (inherit mbedtls-apache) (arguments (substitute-keyword-arguments (package-arguments mbedtls-apache) ((#:phases phases) `(modify-phases ,phases (add-before 'configure 'configure-extra-features (lambda _ (for-each (lambda (feature) (invoke "scripts/config.pl" "set" feature)) (list "MBEDTLS_THREADING_C" "MBEDTLS_THREADING_PTHREAD")) ;; XXX The above enables code that breaks with -Werror… (substitute* "CMakeLists.txt" ((" -Wformat-signedness") "")) #t))))))))) (define-public dehydrated (package (name "dehydrated") (version "0.7.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/dehydrated-io/dehydrated/releases/download/" "v" version "/dehydrated-" version ".tar.gz")) (sha256 (base32 "1yf4kldyd5y13r6qxrkcbbk74ykngq7jzy0351vb2r3ywp114pqw")))) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils) (srfi srfi-26)) #:builder (begin (use-modules (guix build utils) (srfi srfi-26)) (let* ((source (assoc-ref %build-inputs "source")) (tar (assoc-ref %build-inputs "tar")) (gz (assoc-ref %build-inputs "gzip")) (out (assoc-ref %outputs "out")) (bin (string-append out "/bin")) (doc (string-append out "/share/doc/" ,name "-" ,version)) (man (string-append out "/share/man")) (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin"))) (setenv "PATH" (string-append gz "/bin")) (invoke (string-append tar "/bin/tar") "xvf" source) (chdir (string-append ,name "-" ,version)) (copy-recursively "docs" doc) (install-file "LICENSE" doc) (mkdir-p man) (rename-file (string-append doc "/man") (string-append man "/man1")) (for-each (cut invoke "gzip" "-9" <>) (find-files man ".*")) (install-file "dehydrated" bin) (with-directory-excursion bin (patch-shebang "dehydrated" (list bash)) ;; Do not try to write to the store. (substitute* "dehydrated" (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated")) (setenv "PATH" bash) (wrap-program "dehydrated" `("PATH" ":" prefix ,(map (lambda (dir) (string-append dir "/bin")) (map (lambda (input) (assoc-ref %build-inputs input)) '("coreutils" "curl" "diffutils" "gawk" "grep" "openssl" "sed")))))) #t)))) (inputs `(("bash" ,bash) ("coreutils" ,coreutils) ("curl" ,curl) ("diffutils" ,diffutils) ("gawk" ,gawk) ("grep" ,grep) ("openssl" ,openssl) ("sed" ,sed))) (native-inputs `(("gzip" ,gzip) ("tar" ,tar))) (home-page "https://dehydrated.io/") (synopsis "Let's Encrypt/ACME client implemented as a shell script") (description "Dehydrated is a client for signing certificates with an ACME-server (currently only provided by Let's Encrypt) implemented as a relatively simple Bash script.") (license license:expat))) (define-public go-github-com-certifi-gocertifi (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec") (revision "1")) (package (name "go-github-com-certifi-gocertifi") (version (git-version "2018.01.18" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/certifi/gocertifi") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj")))) (build-system go-build-system) (arguments '(#:import-path "github.com/certifi/gocertifi")) (synopsis "X.509 TLS root certificate bundle for Go") (description "This package is a Go language X.509 TLS root certificate bundle, derived from Mozilla's collection.") (home-page "https://certifi.io") (license license:mpl2.0)))) (define-public s2n (package (name "s2n") (version "1.0.0") (source (origin (method git-fetch) (uri (git-reference (url (string-append "https://github.com/awslabs/" name)) (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1q6kmgwb8jxmc4ijzk9pkqzz8lsbfsv9hyzqvy944w7306zx1r5h")))) (build-system cmake-build-system) (arguments '(#:tests? #f ; tests fail to build for static library #:configure-flags '("-DBUILD_TESTING=OFF" "-DBUILD_SHARED_LIBS=ON"))) (propagated-inputs `(("openssl" ,openssl) ("openssl:static" ,openssl "static"))) (synopsis "SSL/TLS implementation") (description "This library provides a C99 implementation of SSL/TLS.") (home-page "https://github.com/awslabs/s2n") (license license:asl2.0)))