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 Nils Gillmann <ng0@n0.is>
8 ;;; Copyright © 2016, 2017, 2018 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>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages dns)
30 #:use-module (gnu packages admin)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages crypto)
37 #:use-module (gnu packages datastructures)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages groff)
41 #:use-module (gnu packages groff)
42 #:use-module (gnu packages libedit)
43 #:use-module (gnu packages libevent)
44 #:use-module (gnu packages libidn)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages nettle)
48 #:use-module (gnu packages networking)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages protobuf)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages swig)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages web)
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages)
58 #:use-module ((guix licenses) #:prefix license:)
59 #:use-module (guix packages)
60 #:use-module (guix download)
61 #:use-module (guix utils)
62 #:use-module (guix build-system gnu)
63 #:use-module (guix build-system trivial))
65 (define-public dnsmasq
72 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
76 "07w6cw706yyahwvbvslhkrbjf2ynv567cgy9pal8bz8lrbsp9bbq"))))
77 (build-system gnu-build-system)
79 `(("pkg-config" ,pkg-config)))
84 (modify-phases %standard-phases (delete 'configure))
85 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
87 "COPTS=\"-DHAVE_DBUS\"")
88 #:tests? #f)) ; no ‘check’ target
89 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
90 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
92 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
93 to provide DNS and, optionally, DHCP to a small network. It can serve the
94 names of local machines which are not in the global DNS. The DHCP server
95 integrates with the DNS server and allows machines with DHCP-allocated
96 addresses to appear in the DNS with names configured either on each host or in
97 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
98 and BOOTP/TFTP for network booting of diskless machines.")
99 ;; Source files only say GPL2 and GPL3 are allowed.
100 (license (list license:gpl2 license:gpl3))))
102 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
103 ;; different name here.
104 (define-public isc-bind
107 (version "9.12.2-P2")
111 "https://ftp.isc.org/isc/bind9/" version "/" name "-"
115 "0gk9vwqlbdmn10m21f2awvmiccfbadvcwi8zsgm91awbx4k7h0l7"))))
116 (build-system gnu-build-system)
117 (outputs `("out" "utils"))
119 ;; it would be nice to add GeoIP and gssapi once there is package
123 ("p11-kit" ,p11-kit)))
124 (native-inputs `(("perl" ,perl)
125 ("net-tools" ,net-tools)))
128 (list (string-append "--with-openssl="
129 (assoc-ref %build-inputs "openssl"))
130 (string-append "--with-pkcs11="
131 (assoc-ref %build-inputs "p11-kit")))
133 (modify-phases %standard-phases
134 (add-after 'strip 'move-to-utils
138 (let ((target (string-append (assoc-ref %outputs "utils") file))
139 (src (string-append (assoc-ref %outputs "out") file)))
140 (mkdir-p (dirname target))
143 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
144 "/share/man/man1/dig.1"
145 "/share/man/man1/host.1"
146 "/share/man/man1/nslookup.1"
147 "/share/man/man1/nsupdate.1"))))
148 ;; When and if guix provides user namespaces for the build process,
149 ;; then the following can be uncommented and the subsequent "force-test"
150 ;; will not be necessary.
152 ;; (add-before 'check 'set-up-loopback
154 ;; (system "bin/tests/system/ifconfig.sh up")))
157 (invoke "make" "force-test")
159 (synopsis "An implementation of the Domain Name System")
160 (description "BIND is an implementation of the @dfn{Domain Name System}
161 (DNS) protocols for the Internet. It is a reference implementation of those
162 protocols, but it is also production-grade software, suitable for use in
163 high-volume and high-reliability applications. The name BIND stands for
164 \"Berkeley Internet Name Domain\", because the software originated in the early
165 1980s at the University of California at Berkeley.")
166 (home-page "https://www.isc.org/downloads/bind")
167 (license (list license:mpl2.0))))
169 (define-public dnscrypt-proxy
171 (name "dnscrypt-proxy")
176 "https://download.dnscrypt.org/dnscrypt-proxy/"
177 "dnscrypt-proxy-" version ".tar.bz2"))
180 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
181 (modules '((guix build utils)))
183 ;; Delete bundled libltdl. XXX: This package also bundles
184 ;; a modified libevent that cannot currently be removed.
186 (delete-file-recursively "libltdl")
188 (build-system gnu-build-system)
191 (modify-phases %standard-phases
192 (add-after 'unpack 'autoreconf
194 ;; Re-generate build files due to unbundling ltdl.
195 ;; TODO: Prevent generating new libltdl and building it.
196 ;; The system version is still favored and referenced.
197 (invoke "autoreconf" "-vif"))))))
199 `(("pkg-config" ,pkg-config)
200 ("automake" ,automake)
201 ("autoconf" ,autoconf)
202 ("libtool" ,libtool)))
204 `(("libltdl" ,libltdl)
205 ("libsodium" ,libsodium)))
206 (home-page "https://www.dnscrypt.org/")
207 (synopsis "Securely send DNS requests to a remote server")
209 "@command{dnscrypt-proxy} is a tool for securing communications
210 between a client and a DNS resolver. It verifies that responses you get
211 from a DNS provider was actually sent by that provider, and haven't been
212 tampered with. For optimal performance it is recommended to use this as
213 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
214 can also be used as a normal DNS \"server\". A list of public dnscrypt
215 servers is included, and an up-to-date version is available at
216 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
217 (license (list license:isc
218 ;; Libevent and src/ext/queue.h is 3-clause BSD.
221 (define-public dnscrypt-wrapper
223 (name "dnscrypt-wrapper")
228 "https://github.com/cofyc/dnscrypt-wrapper/releases"
229 "/download/v" version "/" name "-v" version ".tar.bz2"))
232 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
233 (build-system gnu-build-system)
235 `(#:make-flags '("CC=gcc")
236 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
239 (modify-phases %standard-phases
240 (add-after 'unpack 'create-configure
242 (invoke "make" "configure"))))))
244 `(("autoconf" ,autoconf)))
246 `(("libevent" ,libevent)
247 ("libsodium" ,libsodium)))
248 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
249 (synopsis "Server-side dnscrypt proxy")
251 "@command{dnscrypt-wrapper} is a tool to expose a name server over
252 the @code{dnscrypt} protocol. It can be used as an endpoint for the
253 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
255 (license (list license:isc
256 ;; Bundled argparse is MIT. TODO: package and unbundle.
258 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
262 (define-public libasr
265 (version "201602131606")
269 (uri (string-append "https://www.opensmtpd.org/archives/"
270 name "-" version ".tar.gz"))
273 "18kdmbjsxrfai16d66qslp48b1zf7gr8him2jj5dcqgbsl44ls75"))))
274 (build-system gnu-build-system)
276 `(("autoconf" ,autoconf)
277 ("automake" ,automake)
278 ("pkg-config" ,pkg-config)
280 (home-page "https://www.opensmtpd.org")
281 (synopsis "Asynchronous resolver library by the OpenBSD project")
283 "libasr is a free, simple and portable asynchronous resolver library.
284 It allows to run DNS queries and perform hostname resolutions in a fully
285 asynchronous fashion.")
286 (license (list license:isc
287 license:bsd-2 ; last part of getrrsetbyname_async.c
289 (license:non-copyleft "file://LICENSE") ; includes.h
299 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
303 "0zyzjd3wmq258jiry62ci1z23qfd0rc5ggnpmybc60xvpddgynwg"))))
304 (build-system gnu-build-system)
307 (list "--enable-pie" ; fully benefit from ASLR
310 "--enable-relro-now" ; protect GOT and .dtor areas
311 "--disable-radix-tree"
312 (string-append "--with-libevent="
313 (assoc-ref %build-inputs "libevent"))
314 (string-append "--with-ssl="
315 (assoc-ref %build-inputs "openssl"))
316 "--with-configdir=/etc"
317 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
318 "--with-logfile=/var/log/nsd.log"
319 "--with-pidfile=/var/db/nsd/nsd.pid"
320 "--with-dbfile=/var/db/nsd/nsd.db"
321 "--with-zonesdir=/etc/nsd"
322 "--with-xfrdfile=/var/db/nsd/xfrd.state"
323 "--with-zonelistfile=/var/db/nsd/zone.list")
325 (modify-phases %standard-phases
326 (add-before 'configure 'patch-installation-paths
327 (lambda* (#:key outputs #:allow-other-keys)
328 (let* ((out (assoc-ref outputs "out"))
329 (doc (string-append out "/share/doc/" ,name "-" ,version)))
330 ;; The ‘make install’ target tries to create the parent
331 ;; directories of run-time things like ‘pidfile’ above, and
332 ;; useless empty directories like 'configdir'. Remove such
333 ;; '$(INSTALL)' lines and install the example configuration file
334 ;; in an appropriate location.
335 (substitute* "Makefile.in"
336 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
337 (string-append "#" command))
338 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
339 (string-append doc "/examples/" file-name)))
341 #:tests? #f)) ; no tests
343 `(("libevent" ,libevent)
344 ("openssl" ,openssl)))
345 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
346 (synopsis "Authoritative DNS name server")
347 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
348 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
349 RFC-compliant nameserver.
351 NSD uses zone information compiled via @command{zonec} into a binary database
352 file (@file{nsd.db}). This allows fast startup of the name service daemon and
353 allows syntax-structural errors in zone files to be flagged at compile time,
354 before being made available to NSD service itself. However, most traditional
355 BIND-style zone files can be directly imported into NSD without modification.
357 The collection of programs and processes that make up NSD are designed so that
358 the daemon itself runs as a non-privileged user and can be easily configured to
359 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
360 to result in system-wide compromise.")
361 (license (list license:bsd-3))))
363 (define-public unbound
370 (uri (string-append "https://www.unbound.net/downloads/unbound-"
374 "0p9w6spar5dfi7fplxjcq4394wldabaws0ns30cqq6sxqfwv6qn3"))))
375 (build-system gnu-build-system)
376 (outputs '("out" "python"))
382 ("libevent" ,libevent)
383 ("protobuf" ,protobuf)
385 ("python-wrapper" ,python-wrapper)
386 ("openssl" ,openssl)))
389 (list "--disable-static" ;save space and non-determinism in libunbound.a
391 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
393 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
395 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
396 "--with-pythonmodule" "--with-pyunbound")
398 (modify-phases %standard-phases
399 (add-after 'configure 'fix-python-site-package-path
400 ;; Move python modules into their own output.
401 (lambda* (#:key outputs #:allow-other-keys)
402 (let ((pyout (assoc-ref outputs "python"))
403 (ver ,(version-major+minor (package-version python))))
404 (substitute* "Makefile"
405 (("^PYTHON_SITE_PKG=.*$")
408 pyout "/lib/python-" ver "/site-packages\n"))))
410 (add-before 'check 'fix-missing-nss-for-tests
411 ;; Unfortunately, the package's unittests involve some checks
412 ;; looking up protocols and services which are not provided
413 ;; by the minimalistic build environment, in particular,
414 ;; /etc/protocols and /etc/services are missing.
415 ;; Also, after plain substitution of protocol and service names
416 ;; in the test data, the tests still fail because the
417 ;; corresponding Resource Records have been signed by
419 ;; The following LD_PRELOAD library overwrites the glibc
420 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
421 ;; ‘getservbyport’ providing the few records required for the
422 ;; unit tests to pass.
423 (lambda* (#:key inputs outputs #:allow-other-keys)
424 (let* ((source (assoc-ref %build-inputs "source"))
425 (gcc (assoc-ref %build-inputs "gcc")))
426 (call-with-output-file "/tmp/nss_preload.c"
428 (display "#include <stdlib.h>
434 struct protoent *getprotobyname(const char *name) {
435 struct protoent *p = malloc(sizeof(struct protoent));
436 p->p_aliases = malloc(sizeof(char*));
437 if (strcasecmp(name, \"tcp\") == 0) {
440 p->p_aliases[0] = \"TCP\";
441 } else if (strcasecmp(name, \"udp\") == 0) {
444 p->p_aliases[0] = \"UDP\";
450 struct protoent *getprotobynumber(int proto) {
451 struct protoent *p = malloc(sizeof(struct protoent));
452 p->p_aliases = malloc(sizeof(char*));
457 p->p_aliases[0] = \"TCP\";
462 p->p_aliases[0] = \"UDP\";
471 struct servent *getservbyname(const char *name, const char *proto) {
472 struct servent *s = malloc(sizeof(struct servent));
473 char* buf = malloc((strlen(proto)+1)*sizeof(char));
475 s->s_aliases = malloc(sizeof(char*));
476 s->s_aliases[0] = NULL;
477 if (strcasecmp(name, \"domain\") == 0) {
478 s->s_name = \"domain\";
479 s->s_port = htons(53);
486 struct servent *getservbyport(int port, const char *proto) {
488 struct servent *s = malloc(sizeof(struct servent));
490 s->s_aliases = malloc(sizeof(char*));
491 s->s_aliases[0] = NULL;
494 s->s_name = \"domain\";
496 s->s_proto = \"udp\";
504 (invoke (string-append gcc "/bin/gcc")
505 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
506 "/tmp/nss_preload.c")
507 ;; The preload library only affects the unittests.
508 (substitute* "Makefile"
510 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
512 (home-page "https://www.unbound.net")
513 (synopsis "Validating, recursive, and caching DNS resolver")
515 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
516 validation of results. It implements only a minimal amount of authoritative
517 service to prevent leakage to the root nameservers: forward lookups for
518 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
519 served by AS112. Stub and forward zones are supported.")
520 (license license:bsd-4)))
522 (define-public yadifa
527 (let ((build "7713"))
531 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
532 name "-" version "-" build ".tar.gz"))
534 (base32 "15xhzg4crjcxascwpz6y8qpqcgypzv2p9bspdskp4nx1x1y4316c")))))
535 (build-system gnu-build-system)
539 `(("openssl" ,openssl)))
542 (modify-phases %standard-phases
543 (add-before 'configure 'omit-example-configurations
545 (substitute* "Makefile.in"
549 (list "--sysconfdir=/etc"
550 "--localstatedir=/var"
551 "--disable-build-timestamp" ; build reproducibly
556 "--enable-ctrl" ; enable remote control
560 (home-page "http://www.yadifa.eu/")
561 (synopsis "Authoritative DNS name server")
562 (description "YADIFA is an authoritative name server for the @dfn{Domain
563 Name System} (DNS). It aims for both higher performance and a smaller memory
564 footprint than other implementations, while remaining fully RFC-compliant.
565 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
566 Extensions} (DNSSEC).")
567 (license license:bsd-3)))
575 (uri (string-append "https://secure.nic.cz/files/knot-dns/"
576 name "-" version ".tar.xz"))
579 "1pwjcv7hzhqawisibybma160k77a6f1v94xw6ay9c7j49vrw05w7"))
580 (modules '((guix build utils)))
583 ;; Delete bundled libraries.
584 (with-directory-excursion "src/contrib"
585 (delete-file-recursively "lmdb"))
587 (build-system gnu-build-system)
589 `(("pkg-config" ,pkg-config)))
594 ("libcap-ng" ,libcap-ng)
600 ("protobuf-c" ,protobuf-c)))
603 (modify-phases %standard-phases
604 (add-before 'configure 'disable-directory-pre-creation
606 ;; Don't install empty directories like ‘/etc’ outside the store.
607 ;; This is needed even when using ‘make config_dir=... install’.
608 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
611 (lambda* (#:key outputs #:allow-other-keys)
612 (let* ((out (assoc-ref outputs "out"))
613 (doc (string-append out "/share/doc/" ,name "-" ,version))
614 (etc (string-append doc "/examples/etc")))
616 (string-append "config_dir=" etc)
619 (list "--sysconfdir=/etc"
620 "--localstatedir=/var"
621 "--enable-dnstap" ; let tools read/write capture files
622 "--with-module-dnstap=yes" ; detailed query capturing & logging
623 (string-append "--with-bash-completions="
624 (assoc-ref %outputs "out")
625 "/etc/bash_completion.d"))))
626 (home-page "https://www.knot-dns.cz/")
627 (synopsis "Authoritative DNS name server")
628 (description "Knot DNS is an authoritative name server for the @dfn{Domain
629 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
630 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
631 number of programming techniques to improve speed. For example, the responder
632 is completely lock-free, resulting in a very high response rate. Other features
633 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
634 synthesis, and on-the-fly re-configuration.")
637 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
638 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
640 license:lgpl2.0+ ; parts of scr/contrib/ucw
641 license:public-domain ; src/contrib/fnv and possibly murmurhash3
642 license:gpl3+)))) ; everything else
644 (define-public ddclient
650 (uri (string-append "mirror://sourceforge/ddclient/ddclient/ddclient-"
651 version "/ddclient-" version ".tar.gz"))
654 "0fwyhab8yga2yi1kdfkbqxa83wxhwpagmj1w1mwkg2iffh1fjjlw"))))
655 (build-system trivial-build-system) ; no Makefile.PL
662 `(("inetutils" ,inetutils) ; logger
663 ("net-tools" ,net-tools)
664 ("perl-data-validate-ip" ,perl-data-validate-ip)
665 ("perl-digest-sha1" ,perl-digest-sha1)
666 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
668 `(#:modules ((guix build utils)
673 (use-modules (guix build utils)
677 (setenv "PATH" (string-append
678 (assoc-ref %build-inputs "bash") "/bin" ":"
679 (assoc-ref %build-inputs "tar") "/bin" ":"
680 (assoc-ref %build-inputs "gzip") "/bin" ":"
681 (assoc-ref %build-inputs "perl") "/bin"))
683 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
685 (with-directory-excursion (string-append ,name "-" ,version)
686 (let* ((out (assoc-ref %outputs "out"))
687 (bin (string-append out "/bin")))
688 (let ((file "ddclient"))
690 (("/usr/bin/perl") (which "perl"))
691 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
692 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
693 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
694 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
695 (("\\$cachedir\\$program\\.cache")
696 "/var/cache/ddclient/ddclient.cache"))
697 (install-file file bin)
698 (wrap-program (string-append bin "/" file)
701 ,@(map (lambda (input)
704 (string-append store "/bin"))))
710 (((? (cut string-prefix? "perl-" <>) name) . dir)
711 (string-append dir "/lib/perl5/site_perl"))
714 (for-each (cut install-file <> (string-append out
716 (find-files "." "sample.*$")))))))
717 (home-page "https://sourceforge.net/projects/ddclient/")
718 (synopsis "Address updating utility for dynamic DNS services")
719 (description "This package provides a client to update dynamic IP
720 addresses with several dynamic DNS service providers, such as
721 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
723 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
724 access a machine with a dynamic IP address.
726 The client supports both dynamic and (near) static services, as well as MX
727 record and alternative name management. It caches the address, and only
728 attempts the update when it has changed.")
729 (license license:gpl2+)))