gnu: bind: Update to 9.12.4-P1 [fixes CVE-2018-5743, CVE-2019-6467].
[guix.git] / gnu / packages / dns.scm
blob6a8f49fbe8d2a497948f919a12b3b81bf9b85a26
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
3 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
7 ;;; Copyright © 2016 ng0 <ng0@n0.is>
8 ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
11 ;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
12 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
13 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages dns)
31   #:use-module (gnu packages admin)
32   #:use-module (gnu packages autotools)
33   #:use-module (gnu packages base)
34   #:use-module (gnu packages bash)
35   #:use-module (gnu packages databases)
36   #:use-module (gnu packages compression)
37   #:use-module (gnu packages crypto)
38   #:use-module (gnu packages datastructures)
39   #:use-module (gnu packages flex)
40   #:use-module (gnu packages glib)
41   #:use-module (gnu packages groff)
42   #:use-module (gnu packages groff)
43   #:use-module (gnu packages libedit)
44   #:use-module (gnu packages libevent)
45   #:use-module (gnu packages libidn)
46   #:use-module (gnu packages linux)
47   #:use-module (gnu packages ncurses)
48   #:use-module (gnu packages nettle)
49   #:use-module (gnu packages networking)
50   #:use-module (gnu packages perl)
51   #:use-module (gnu packages pkg-config)
52   #:use-module (gnu packages protobuf)
53   #:use-module (gnu packages python)
54   #:use-module (gnu packages python-xyz)
55   #:use-module (gnu packages swig)
56   #:use-module (gnu packages tls)
57   #:use-module (gnu packages web)
58   #:use-module (gnu packages xml)
59   #:use-module (gnu packages)
60   #:use-module ((guix licenses) #:prefix license:)
61   #:use-module (guix packages)
62   #:use-module (guix download)
63   #:use-module (guix git-download)
64   #:use-module (guix utils)
65   #:use-module (guix build-system gnu)
66   #:use-module (guix build-system trivial))
68 (define-public dnsmasq
69   (package
70     (name "dnsmasq")
71     (version "2.80")
72     (source (origin
73               (method url-fetch)
74               (uri (string-append
75                     "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
76                     version ".tar.xz"))
77               (sha256
78                (base32
79                 "1fv3g8vikj3sn37x1j6qsywn09w1jipvlv34j3q5qrljbrwa5ayd"))))
80     (build-system gnu-build-system)
81     (native-inputs
82      `(("pkg-config" ,pkg-config)))
83     (inputs
84      `(("dbus" ,dbus)))
85     (arguments
86      `(#:phases
87        (modify-phases %standard-phases (delete 'configure))
88        #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
89                           "CC=gcc"
90                           "COPTS=\"-DHAVE_DBUS\"")
91        #:tests? #f))                    ; no ‘check’ target
92     (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
93     (synopsis "Small caching DNS proxy and DHCP/TFTP server")
94     (description
95      "Dnsmasq is a light-weight DNS forwarder and DHCP server.  It is designed
96 to provide DNS and, optionally, DHCP to a small network.  It can serve the
97 names of local machines which are not in the global DNS.  The DHCP server
98 integrates with the DNS server and allows machines with DHCP-allocated
99 addresses to appear in the DNS with names configured either on each host or in
100 a central configuration file.  Dnsmasq supports static and dynamic DHCP leases
101 and BOOTP/TFTP for network booting of diskless machines.")
102     ;; Source files only say GPL2 and GPL3 are allowed.
103     (license (list license:gpl2 license:gpl3))))
105 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
106 ;; different name here.
107 (define-public isc-bind
108   (package
109     (name "bind")
110     (version "9.12.4-P1")
111     (source (origin
112               (method url-fetch)
113               (uri (string-append
114                     "https://ftp.isc.org/isc/bind9/" version
115                     "/bind-" version ".tar.gz"))
116               (sha256
117                (base32
118                 "1if7zc5gzrfd28csc63v9bjwrc0rgvm1x9yx058946hc5gp5lyp2"))
119               (patches
120                (search-patches "bind-fix-unused-pk11-ecc-constants.patch"))))
121     (build-system gnu-build-system)
122     (outputs `("out" "utils"))
123     (inputs
124      ;; It would be nice to add GeoIP and gssapi once there are packages.
125      `(("libcap" ,libcap)
126        ("libxml2" ,libxml2)
127        ("openssl" ,openssl)
128        ("p11-kit" ,p11-kit)
129        ("python" ,python)
130        ("python-ply" ,python-ply)))
131     (native-inputs `(("perl" ,perl)
132                      ("net-tools" ,net-tools)))
133     (arguments
134      `(#:configure-flags
135        (list (string-append "--with-openssl="
136                             (assoc-ref %build-inputs "openssl"))
137              (string-append "--with-pkcs11="
138                             (assoc-ref %build-inputs "p11-kit")))
139        #:phases
140        (modify-phases %standard-phases
141          (add-after 'strip 'move-to-utils
142            (lambda _
143              (for-each
144               (lambda (file)
145                 (let ((target  (string-append (assoc-ref %outputs "utils") file))
146                       (src  (string-append (assoc-ref %outputs "out") file)))
147                   (mkdir-p (dirname target))
148                   (link src target)
149                   (delete-file src)))
150               '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
151                 "/share/man/man1/dig.1"
152                 "/share/man/man1/host.1"
153                 "/share/man/man1/nslookup.1"
154                 "/share/man/man1/nsupdate.1"))
155              #t))
156          ;; When and if guix provides user namespaces for the build process,
157          ;; then the following can be uncommented and the subsequent "force-test"
158          ;; will not be necessary.
159          ;;
160          ;;   (add-before 'check 'set-up-loopback
161          ;;     (lambda _
162          ;;          (system "bin/tests/system/ifconfig.sh up")))
163          (replace 'check
164            (lambda _
165              (invoke "make" "force-test"))))))
166     (synopsis "An implementation of the Domain Name System")
167     (description "BIND is an implementation of the @dfn{Domain Name System}
168 (DNS) protocols for the Internet.  It is a reference implementation of those
169 protocols, but it is also production-grade software, suitable for use in
170 high-volume and high-reliability applications. The name BIND stands for
171 \"Berkeley Internet Name Domain\", because the software originated in the early
172 1980s at the University of California at Berkeley.")
173     (home-page "https://www.isc.org/downloads/bind")
174     (license (list license:mpl2.0))))
176 (define-public dnscrypt-proxy
177   (package
178     (name "dnscrypt-proxy")
179     (version "1.9.5")
180     (source (origin
181               (method url-fetch)
182               (uri (string-append
183                     "https://download.dnscrypt.org/dnscrypt-proxy/"
184                     "dnscrypt-proxy-" version ".tar.bz2"))
185               (sha256
186                (base32
187                 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
188               (modules '((guix build utils)))
189               (snippet
190                ;; Delete bundled libltdl. XXX: This package also bundles
191                ;; a modified libevent that cannot currently be removed.
192                '(begin
193                   (delete-file-recursively "libltdl")
194                   #t))))
195     (build-system gnu-build-system)
196     (arguments
197      `(#:phases
198        (modify-phases %standard-phases
199          (add-after 'unpack 'autoreconf
200            (lambda _
201              ;; Re-generate build files due to unbundling ltdl.
202              ;; TODO: Prevent generating new libltdl and building it.
203              ;; The system version is still favored and referenced.
204              (invoke "autoreconf" "-vif"))))))
205     (native-inputs
206      `(("pkg-config" ,pkg-config)
207        ("automake" ,automake)
208        ("autoconf" ,autoconf)
209        ("libtool" ,libtool)))
210     (inputs
211      `(("libltdl" ,libltdl)
212        ("libsodium" ,libsodium)))
213     (home-page "https://www.dnscrypt.org/")
214     (synopsis "Securely send DNS requests to a remote server")
215     (description
216      "@command{dnscrypt-proxy} is a tool for securing communications
217 between a client and a DNS resolver.  It verifies that responses you get
218 from a DNS provider was actually sent by that provider, and haven't been
219 tampered with.  For optimal performance it is recommended to use this as
220 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
221 can also be used as a normal DNS \"server\".  A list of public dnscrypt
222 servers is included, and an up-to-date version is available at
223 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
224     (license (list license:isc
225                    ;; Libevent and src/ext/queue.h is 3-clause BSD.
226                    license:bsd-3))))
228 (define-public dnscrypt-wrapper
229   (package
230     (name "dnscrypt-wrapper")
231     (version "0.2.2")
232     (source (origin
233               (method url-fetch)
234               (uri (string-append
235                     "https://github.com/cofyc/dnscrypt-wrapper/releases"
236                     "/download/v" version "/" name "-v" version ".tar.bz2"))
237               (sha256
238                (base32
239                 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
240     (build-system gnu-build-system)
241     (arguments
242      `(#:make-flags '("CC=gcc")
243        ;; TODO: Tests require ruby-cucumber and ruby-aruba.
244        #:tests? #f
245        #:phases
246        (modify-phases %standard-phases
247          (add-after 'unpack 'create-configure
248            (lambda _
249              (invoke "make" "configure"))))))
250     (native-inputs
251      `(("autoconf" ,autoconf)))
252     (inputs
253      `(("libevent" ,libevent)
254        ("libsodium" ,libsodium)))
255     (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
256     (synopsis "Server-side dnscrypt proxy")
257     (description
258      "@command{dnscrypt-wrapper} is a tool to expose a name server over
259 the @code{dnscrypt} protocol.  It can be used as an endpoint for the
260 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
261 the two.")
262     (license (list license:isc
263                    ;; Bundled argparse is MIT. TODO: package and unbundle.
264                    license:expat
265                    ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
266                    license:gpl2
267                    license:gpl3))))
269 (define-public libasr
270   (package
271     (name "libasr")
272     (version "201602131606")
273     (source
274      (origin
275        (method url-fetch)
276        (uri (string-append "https://www.opensmtpd.org/archives/"
277                            name "-" version ".tar.gz"))
278        (sha256
279         (base32
280          "18kdmbjsxrfai16d66qslp48b1zf7gr8him2jj5dcqgbsl44ls75"))))
281     (build-system gnu-build-system)
282     (native-inputs
283      `(("autoconf" ,autoconf)
284        ("automake" ,automake)
285        ("pkg-config" ,pkg-config)
286        ("groff" ,groff)))
287     (home-page "https://www.opensmtpd.org")
288     (synopsis "Asynchronous resolver library by the OpenBSD project")
289     (description
290      "libasr is a free, simple and portable asynchronous resolver library.
291 It allows to run DNS queries and perform hostname resolutions in a fully
292 asynchronous fashion.")
293     (license (list license:isc
294                    license:bsd-2 ; last part of getrrsetbyname_async.c
295                    license:bsd-3
296                    (license:non-copyleft "file://LICENSE") ; includes.h
297                    license:openssl))))
299 (define-public nsd
300   (package
301     (name "nsd")
302     (version "4.1.27")
303     (source
304      (origin
305        (method url-fetch)
306        (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
307                            version ".tar.gz"))
308        (sha256
309         (base32 "1sjfbwr4vq25304hr9vmd9j821g2vzv8lpy95hpsravc80q5zaqv"))))
310     (build-system gnu-build-system)
311     (arguments
312      `(#:configure-flags
313        (list "--enable-pie"             ; fully benefit from ASLR
314              "--enable-ratelimit"
315              "--enable-recvmmsg"
316              "--enable-relro-now"       ; protect GOT and .dtor areas
317              "--disable-radix-tree"
318              (string-append "--with-libevent="
319                             (assoc-ref %build-inputs "libevent"))
320              (string-append "--with-ssl="
321                             (assoc-ref %build-inputs "openssl"))
322              "--with-configdir=/etc"
323              "--with-nsd_conf_file=/etc/nsd/nsd.conf"
324              "--with-logfile=/var/log/nsd.log"
325              "--with-pidfile=/var/db/nsd/nsd.pid"
326              "--with-dbfile=/var/db/nsd/nsd.db"
327              "--with-zonesdir=/etc/nsd"
328              "--with-xfrdfile=/var/db/nsd/xfrd.state"
329              "--with-zonelistfile=/var/db/nsd/zone.list")
330        #:phases
331        (modify-phases %standard-phases
332          (add-before 'configure 'patch-installation-paths
333            (lambda* (#:key outputs #:allow-other-keys)
334              (let* ((out (assoc-ref outputs "out"))
335                     (doc (string-append out "/share/doc/" ,name "-" ,version)))
336                ;; The ‘make install’ target tries to create the parent
337                ;; directories of run-time things like ‘pidfile’ above, and
338                ;; useless empty directories like 'configdir'.  Remove such
339                ;; '$(INSTALL)' lines and install the example configuration file
340                ;; in an appropriate location.
341                (substitute* "Makefile.in"
342                  ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
343                   (string-append "#" command))
344                  (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
345                   (string-append doc "/examples/" file-name)))
346                #t))))
347        #:tests? #f))                    ; no tests
348     (inputs
349      `(("libevent" ,libevent)
350        ("openssl" ,openssl)))
351     (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
352     (synopsis "Authoritative DNS name server")
353     (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
354 name server for the Domain Name System (@dfn{DNS}).  It aims to be a fast and
355 RFC-compliant nameserver.
357 NSD uses zone information compiled via @command{zonec} into a binary database
358 file (@file{nsd.db}).  This allows fast startup of the name service daemon and
359 allows syntax-structural errors in zone files to be flagged at compile time,
360 before being made available to NSD service itself.  However, most traditional
361 BIND-style zone files can be directly imported into NSD without modification.
363 The collection of programs and processes that make up NSD are designed so that
364 the daemon itself runs as a non-privileged user and can be easily configured to
365 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
366 to result in system-wide compromise.")
367     (license (list license:bsd-3))))
369 (define-public unbound
370   (package
371     (name "unbound")
372     (version "1.9.1")
373     (source
374      (origin
375        (method url-fetch)
376        (uri (string-append "https://www.unbound.net/downloads/unbound-"
377                            version ".tar.gz"))
378        (sha256
379         (base32 "1iarvk0i92asvrkpla9z55aan20k6pklzpck9yk4rfnchsdvzh63"))))
380     (build-system gnu-build-system)
381     (outputs '("out" "python"))
382     (native-inputs
383      `(("flex" ,flex)
384        ("swig" ,swig)))
385     (inputs
386      `(("expat" ,expat)
387        ("libevent" ,libevent)
388        ("protobuf" ,protobuf)
389        ("python" ,python-3)
390        ("python-wrapper" ,python-wrapper)
391        ("openssl" ,openssl)))
392     (arguments
393      `(#:configure-flags
394        (list "--disable-static" ; save space and non-determinism in libunbound.a
395              (string-append
396               "--with-ssl=" (assoc-ref %build-inputs "openssl"))
397              (string-append
398               "--with-libevent=" (assoc-ref %build-inputs "libevent"))
399              (string-append
400               "--with-libexpat=" (assoc-ref %build-inputs "expat"))
401              "--with-pythonmodule" "--with-pyunbound")
402        #:phases
403        (modify-phases %standard-phases
404          (add-after 'configure 'fix-python-site-package-path
405            ;; Move python modules into their own output.
406            (lambda* (#:key outputs #:allow-other-keys)
407              (let ((pyout (assoc-ref outputs "python"))
408                    (ver ,(version-major+minor (package-version python))))
409                (substitute* "Makefile"
410                  (("^PYTHON_SITE_PKG=.*$")
411                   (string-append
412                    "PYTHON_SITE_PKG="
413                    pyout "/lib/python-" ver "/site-packages\n"))))
414              #t))
415          (add-before 'check 'fix-missing-nss-for-tests
416            ;; Unfortunately, the package's unittests involve some checks
417            ;; looking up protocols and services which are not provided
418            ;; by the minimalistic build environment, in particular,
419            ;; /etc/protocols and /etc/services are missing.
420            ;; Also, after plain substitution of protocol and service names
421            ;; in the test data, the tests still fail because the
422            ;; corresponding Resource Records have been signed by
423            ;; RRSIG records.
424            ;; The following LD_PRELOAD library overwrites the glibc
425            ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
426            ;; ‘getservbyport’ providing the few records required for the
427            ;; unit tests to pass.
428            (lambda* (#:key inputs outputs #:allow-other-keys)
429              (let* ((source (assoc-ref %build-inputs "source"))
430                     (gcc (assoc-ref %build-inputs "gcc")))
431                (call-with-output-file "/tmp/nss_preload.c"
432                  (lambda (port)
433                    (display "#include <stdlib.h>
434 #include <string.h>
435 #include <strings.h>
437 #include <netdb.h>
439 struct protoent *getprotobyname(const char *name) {
440   struct protoent *p = malloc(sizeof(struct protoent));
441   p->p_aliases = malloc(sizeof(char*));
442   if (strcasecmp(name, \"tcp\") == 0) {
443     p->p_name = \"tcp\";
444     p->p_proto = 6;
445     p->p_aliases[0] = \"TCP\";
446   } else if (strcasecmp(name, \"udp\") == 0) {
447     p->p_name = \"udp\";
448     p->p_proto = 17;
449     p->p_aliases[0] = \"UDP\";
450   } else 
451     p = NULL;
452   return p;
455 struct protoent *getprotobynumber(int proto) {
456   struct protoent *p = malloc(sizeof(struct protoent));
457   p->p_aliases = malloc(sizeof(char*));
458   switch(proto) {
459   case 6:
460     p->p_name = \"tcp\";
461     p->p_proto = 6;
462     p->p_aliases[0] = \"TCP\";
463     break;
464   case 17:
465     p->p_name = \"udp\";
466     p->p_proto = 17;
467     p->p_aliases[0] = \"UDP\";
468     break;
469   default:
470     p = NULL;
471     break;
472   }
473   return p;
476 struct servent *getservbyname(const char *name, const char *proto) {
477   struct servent *s = malloc(sizeof(struct servent));
478   char* buf = malloc((strlen(proto)+1)*sizeof(char));
479   strcpy(buf, proto);
480   s->s_aliases = malloc(sizeof(char*));
481   s->s_aliases[0] = NULL;
482   if (strcasecmp(name, \"domain\") == 0) {
483     s->s_name = \"domain\";
484     s->s_port = htons(53);
485     s->s_proto = buf;
486   } else 
487     s = NULL;
488   return s;
491 struct servent *getservbyport(int port, const char *proto) {
492   char buf[32];
493   struct servent *s = malloc(sizeof(struct servent));
494   strcpy(buf, proto);
495   s->s_aliases = malloc(sizeof(char*));
496   s->s_aliases[0] = NULL;
497   switch(port) {
498   case 53:
499     s->s_name = \"domain\";
500     s->s_port = 53;
501     s->s_proto = \"udp\";
502     break;
503   default:
504     s = NULL;
505     break;
506   }
507   return s;
508 }" port)))
509                (invoke (string-append gcc "/bin/gcc")
510                        "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
511                        "/tmp/nss_preload.c")
512                ;; The preload library only affects the unittests.
513                (substitute* "Makefile"
514                  (("./unittest")
515                   "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
516              #t)))))
517     (home-page "https://www.unbound.net")
518     (synopsis "Validating, recursive, and caching DNS resolver")
519     (description
520      "Unbound is a recursive-only caching DNS server which can perform DNSSEC
521 validation of results.  It implements only a minimal amount of authoritative
522 service to prevent leakage to the root nameservers: forward lookups for
523 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
524 served by AS112.  Stub and forward zones are supported.")
525     (license license:bsd-4)))
527 (define-public yadifa
528   (package
529     (name "yadifa")
530     (version "2.3.9")
531     (source
532      (let ((build "8497"))
533        (origin
534          (method url-fetch)
535          (uri
536           (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
537                          "yadifa-" version "-" build ".tar.gz"))
538          (sha256
539           (base32 "0xvyr91sfgzkpw6g3h893ldbwnki3w2472n56rr18w67qghs1sa5")))))
540     (build-system gnu-build-system)
541     (native-inputs
542      `(("which" ,which)))
543     (inputs
544      `(("openssl" ,openssl)))
545     (arguments
546      `(#:phases
547        (modify-phases %standard-phases
548          (add-before 'configure 'omit-example-configurations
549            (lambda _
550              (substitute* "Makefile.in"
551                ((" (etc|var)") ""))
552              #t)))
553        #:configure-flags
554        (list "--sysconfdir=/etc"
555              "--localstatedir=/var"
556              "--disable-build-timestamp" ; build reproducibly
557              "--enable-shared"
558              "--disable-static"
559              "--enable-acl"
560              "--enable-caching"
561              "--enable-ctrl"            ; enable remote control
562              "--enable-nsec"
563              "--enable-nsec3"
564              "--enable-tsig")))
565     (home-page "http://www.yadifa.eu/")
566     (synopsis "Authoritative DNS name server")
567     (description "YADIFA is an authoritative name server for the @dfn{Domain
568 Name System} (DNS).  It aims for both higher performance and a smaller memory
569 footprint than other implementations, while remaining fully RFC-compliant.
570 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
571 Extensions} (DNSSEC).")
572     (license license:bsd-3)))
574 (define-public knot
575   (package
576     (name "knot")
577     (version "2.8.1")
578     (source
579      (origin
580        (method url-fetch)
581        (uri (string-append "https://secure.nic.cz/files/knot-dns/"
582                            "knot-" version ".tar.xz"))
583        (sha256
584         (base32 "1im2wb8hl394mzni1wavmvfqd7il8s28kcz8w3s4v05nbhzg06xj"))
585        (modules '((guix build utils)))
586        (snippet
587         '(begin
588            ;; Delete bundled libraries.
589            (with-directory-excursion "src/contrib"
590              (delete-file-recursively "lmdb"))
591            #t))))
592     (build-system gnu-build-system)
593     (native-inputs
594      `(("pkg-config" ,pkg-config)))
595     (inputs
596      `(("fstrm" ,fstrm)
597        ("gnutls" ,gnutls)
598        ("jansson" ,jansson)
599        ("libcap-ng" ,libcap-ng)
600        ("libedit" ,libedit)
601        ("libidn" ,libidn)
602        ("liburcu" ,liburcu)
603        ("lmdb" ,lmdb)
604        ("ncurses" ,ncurses)
605        ("protobuf-c" ,protobuf-c)))
606     (arguments
607      `(#:phases
608        (modify-phases %standard-phases
609          (add-before 'configure 'disable-directory-pre-creation
610            (lambda _
611              ;; Don't install empty directories like ‘/etc’ outside the store.
612              ;; This is needed even when using ‘make config_dir=... install’.
613              (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
614              #t))
615          (replace 'install
616            (lambda* (#:key outputs #:allow-other-keys)
617              (let* ((out (assoc-ref outputs "out"))
618                     (doc (string-append out "/share/doc/" ,name "-" ,version))
619                     (etc (string-append doc "/examples/etc")))
620                (invoke "make"
621                        (string-append "config_dir=" etc)
622                        "install")))))
623        #:configure-flags
624        (list "--sysconfdir=/etc"
625              "--localstatedir=/var"
626              "--enable-dnstap"          ; let tools read/write capture files
627              "--with-module-dnstap=yes" ; detailed query capturing & logging
628              (string-append "--with-bash-completions="
629                             (assoc-ref %outputs "out")
630                             "/etc/bash_completion.d"))))
631     (home-page "https://www.knot-dns.cz/")
632     (synopsis "Authoritative DNS name server")
633     (description "Knot DNS is an authoritative name server for the @dfn{Domain
634 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
635 domain} (TLD) name servers.  It is implemented as a threaded daemon and uses a
636 number of programming techniques to improve speed.  For example, the responder
637 is completely lock-free, resulting in a very high response rate.  Other features
638 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
639 synthesis, and on-the-fly re-configuration.")
640     (license
641      (list
642       ;; src/contrib/{hat-trie,murmurhash3,openbsd},
643       ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
644       license:expat
645       license:lgpl2.0+              ; parts of scr/contrib/ucw
646       license:public-domain         ; src/contrib/fnv and possibly murmurhash3
647       license:gpl3+))))             ; everything else
649 (define-public ddclient
650   (package
651     (name "ddclient")
652     (version "3.9.0")
653     (source (origin
654               (method url-fetch)
655               (uri (string-append "mirror://sourceforge/ddclient/ddclient/ddclient-"
656                                   version "/ddclient-" version ".tar.gz"))
657               (sha256
658                (base32
659                 "0fwyhab8yga2yi1kdfkbqxa83wxhwpagmj1w1mwkg2iffh1fjjlw"))))
660     (build-system trivial-build-system) ; no Makefile.PL
661     (native-inputs
662      `(("bash" ,bash)
663        ("gzip" ,gzip)
664        ("perl" ,perl)
665        ("tar" ,tar)))
666     (inputs
667      `(("inetutils" ,inetutils)         ; logger
668        ("net-tools" ,net-tools)
669        ("perl-data-validate-ip" ,perl-data-validate-ip)
670        ("perl-digest-sha1" ,perl-digest-sha1)
671        ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
672     (arguments
673      `(#:modules ((guix build utils)
674                   (ice-9 match)
675                   (srfi srfi-26))
676        #:builder
677        (begin
678          (use-modules (guix build utils)
679                       (ice-9 match)
680                       (srfi srfi-26))
681          ;; bootstrap
682          (setenv "PATH" (string-append
683                          (assoc-ref %build-inputs "bash") "/bin" ":"
684                          (assoc-ref %build-inputs "tar") "/bin" ":"
685                          (assoc-ref %build-inputs "gzip") "/bin" ":"
686                          (assoc-ref %build-inputs "perl") "/bin"))
687          ;; extract source
688          (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
689          ;; package
690          (with-directory-excursion (string-append ,name "-" ,version)
691            (let* ((out (assoc-ref %outputs "out"))
692                   (bin (string-append out "/bin")))
693              (let ((file "ddclient"))
694                (substitute* file
695                  (("/usr/bin/perl") (which "perl"))
696                  ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
697                  (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
698                  (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
699                  ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
700                  (("\\$cachedir\\$program\\.cache")
701                   "/var/cache/ddclient/ddclient.cache"))
702                (install-file file bin)
703                (wrap-program (string-append bin "/" file)
704                  `("PATH" ":" =
705                    ("$PATH"
706                     ,@(map (lambda (input)
707                              (match input
708                                ((name . store)
709                                 (string-append store "/bin"))))
710                            %build-inputs)))
711                  `("PERL5LIB" ":" =
712                    ,(delete
713                      ""
714                      (map (match-lambda
715                             (((? (cut string-prefix? "perl-" <>) name) . dir)
716                              (string-append dir "/lib/perl5/site_perl"))
717                             (_ ""))
718                           %build-inputs)))))
719              (for-each (cut install-file <> (string-append out
720                                                            "/share/ddclient"))
721                        (find-files "." "sample.*$")))))))
722     (home-page "https://sourceforge.net/projects/ddclient/")
723     (synopsis "Address updating utility for dynamic DNS services")
724     (description "This package provides a client to update dynamic IP
725 addresses with several dynamic DNS service providers, such as
726 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
728 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
729 access a machine with a dynamic IP address.
731 The client supports both dynamic and (near) static services, as well as MX
732 record and alternative name management.  It caches the address, and only
733 attempts the update when it has changed.")
734     (license license:gpl2+)))
736 (define-public hnsd
737   ;; There have been no releases yet, hence this commit.
738   (let ((revision "0")
739         (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
740    (package
741      (name "hnsd")
742      (version (git-version "0.0" revision commit))
743      (source (origin
744                (method git-fetch)
745                (uri (git-reference
746                      (url "https://github.com/handshake-org/hnsd")
747                      (commit commit)))
748                (sha256
749                 (base32
750                  "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
751                (file-name (git-file-name name version))
752                (modules '((guix build utils)))
753                (snippet
754                 '(begin
755                    ;; Delete the bundled copy of libuv.
756                    (delete-file-recursively "uv")
757                    (substitute* "configure.ac"
758                      (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
759                    (substitute* "Makefile.am"
760                      (("SUBDIRS = uv") "\n")
761                      (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
763                      ;; Make sure the 'hnsd' binary is installed and
764                      ;; dynamically-linked.
765                      (("noinst_PROGRAMS") "bin_PROGRAMS")
766                      (("hnsd_LDFLAGS = -static") ""))
768                    ;; This script tries to chdir to "uv" and doesn't do more
769                    ;; than "autoreconf" so remove it.
770                    (delete-file "autogen.sh")
771                    #t))))
772      (build-system gnu-build-system)
773      (arguments
774       '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
775      (native-inputs
776       `(("autoconf" ,autoconf)
777         ("automake" ,automake)
778         ("libtool" ,libtool)))
779      (inputs
780       `(("unbound" ,unbound)
781         ("libuv" ,libuv)))
782      (home-page "https://www.handshake.org/")
783      (synopsis "Resolver daemon for the Handshake naming protocol")
784      (description
785       "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
786 System (HNS) peer-to-peer network.")
787      (license license:expat))))
789 (define-public libmicrodns
790   (package
791     (name "libmicrodns")
792     (version "0.0.10")
793     (source (origin
794               (method git-fetch)
795               (uri (git-reference
796                     (url "https://github.com/videolabs/libmicrodns")
797                     (commit version)))
798               (file-name (git-file-name name version))
799               (sha256
800                (base32
801                 "1xvl9k49ng35wbsqmnjnyqvkyjf8dcq2ywsq3jp3wh0rgmxhq2fh"))))
802     (build-system gnu-build-system)
803     (native-inputs
804      `(("pkg-config" ,pkg-config)
805        ("autoconf" ,autoconf)
806        ("automake" ,automake)
807        ("libtool" ,libtool)))
808     (home-page "https://github.com/videolabs/libmicrodns")
809     (synopsis "Minimal mDNS resolver library")
810     (description "@code{libmicrodns} provides a minimal implementation of a
811 mDNS resolver as well as an announcer.  mDNS (Multicast Domain Name System) is
812 a zero-config service that allows one to resolve host names to IP addresses in
813 local networks.")
814     (license license:lgpl2.1)))