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-P1")
111 "https://ftp.isc.org/isc/bind9/" version "/" name "-"
115 "192ld6w8f4n46hvdmmzzrfkd28apf4dwmbpbi3j2q1d2p315ajww"))))
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
292 (define-public unbound
299 (uri (string-append "https://www.unbound.net/downloads/unbound-"
303 "0gxqc4ynd2g1a5dwaazqh9n8injh49a7dz0l9bbxqgv47dnrvxvq"))))
304 (build-system gnu-build-system)
305 (outputs '("out" "python"))
311 ("libevent" ,libevent)
312 ("protobuf" ,protobuf)
314 ("python-wrapper" ,python-wrapper)
315 ("openssl" ,openssl)))
318 (list "--disable-static" ;save space and non-determinism in libunbound.a
320 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
322 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
324 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
325 "--with-pythonmodule" "--with-pyunbound")
327 (modify-phases %standard-phases
328 (add-after 'configure 'fix-python-site-package-path
329 ;; Move python modules into their own output.
330 (lambda* (#:key outputs #:allow-other-keys)
331 (let ((pyout (assoc-ref outputs "python"))
332 (ver ,(version-major+minor (package-version python))))
333 (substitute* "Makefile"
334 (("^PYTHON_SITE_PKG=.*$")
337 pyout "/lib/python-" ver "/site-packages\n"))))
339 (add-before 'check 'fix-missing-nss-for-tests
340 ;; Unfortunately, the package's unittests involve some checks
341 ;; looking up protocols and services which are not provided
342 ;; by the minimalistic build environment, in particular,
343 ;; /etc/protocols and /etc/services are missing.
344 ;; Also, after plain substitution of protocol and service names
345 ;; in the test data, the tests still fail because the
346 ;; corresponding Resource Records have been signed by
348 ;; The following LD_PRELOAD library overwrites the glibc
349 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
350 ;; ‘getservbyport’ providing the few records required for the
351 ;; unit tests to pass.
352 (lambda* (#:key inputs outputs #:allow-other-keys)
353 (let* ((source (assoc-ref %build-inputs "source"))
354 (gcc (assoc-ref %build-inputs "gcc")))
355 (call-with-output-file "/tmp/nss_preload.c"
357 (display "#include <stdlib.h>
363 struct protoent *getprotobyname(const char *name) {
364 struct protoent *p = malloc(sizeof(struct protoent));
365 p->p_aliases = malloc(sizeof(char*));
366 if (strcasecmp(name, \"tcp\") == 0) {
369 p->p_aliases[0] = \"TCP\";
370 } else if (strcasecmp(name, \"udp\") == 0) {
373 p->p_aliases[0] = \"UDP\";
379 struct protoent *getprotobynumber(int proto) {
380 struct protoent *p = malloc(sizeof(struct protoent));
381 p->p_aliases = malloc(sizeof(char*));
386 p->p_aliases[0] = \"TCP\";
391 p->p_aliases[0] = \"UDP\";
400 struct servent *getservbyname(const char *name, const char *proto) {
401 struct servent *s = malloc(sizeof(struct servent));
402 char* buf = malloc((strlen(proto)+1)*sizeof(char));
404 s->s_aliases = malloc(sizeof(char*));
405 s->s_aliases[0] = NULL;
406 if (strcasecmp(name, \"domain\") == 0) {
407 s->s_name = \"domain\";
408 s->s_port = htons(53);
415 struct servent *getservbyport(int port, const char *proto) {
417 struct servent *s = malloc(sizeof(struct servent));
419 s->s_aliases = malloc(sizeof(char*));
420 s->s_aliases[0] = NULL;
423 s->s_name = \"domain\";
425 s->s_proto = \"udp\";
433 (invoke (string-append gcc "/bin/gcc")
434 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
435 "/tmp/nss_preload.c")
436 ;; The preload library only affects the unittests.
437 (substitute* "Makefile"
439 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
441 (home-page "https://www.unbound.net")
442 (synopsis "Validating, recursive, and caching DNS resolver")
444 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
445 validation of results. It implements only a minimal amount of authoritative
446 service to prevent leakage to the root nameservers: forward lookups for
447 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
448 served by AS112. Stub and forward zones are supported.")
449 (license license:bsd-4)))
451 (define-public yadifa
456 (let ((build "7713"))
460 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
461 name "-" version "-" build ".tar.gz"))
463 (base32 "15xhzg4crjcxascwpz6y8qpqcgypzv2p9bspdskp4nx1x1y4316c")))))
464 (build-system gnu-build-system)
468 `(("openssl" ,openssl)))
471 (modify-phases %standard-phases
472 (add-before 'configure 'omit-example-configurations
474 (substitute* "Makefile.in"
478 (list "--sysconfdir=/etc"
479 "--localstatedir=/var"
480 "--disable-build-timestamp" ; build reproducibly
485 "--enable-ctrl" ; enable remote control
489 (home-page "http://www.yadifa.eu/")
490 (synopsis "Authoritative DNS name server")
491 (description "YADIFA is an authoritative name server for the @dfn{Domain
492 Name System} (DNS). It aims for both higher performance and a smaller memory
493 footprint than other implementations, while remaining fully RFC-compliant.
494 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
495 Extensions} (DNSSEC).")
496 (license license:bsd-3)))
504 (uri (string-append "https://secure.nic.cz/files/knot-dns/"
505 name "-" version ".tar.xz"))
508 "0cc4wgb02ch09x99a1fnr7vsdik8k920q7jafzcamjvy3kpb4w6b"))
509 (modules '((guix build utils)))
512 ;; Delete bundled libraries.
513 (with-directory-excursion "src/contrib"
514 (delete-file-recursively "lmdb"))
516 (build-system gnu-build-system)
518 `(("pkg-config" ,pkg-config)))
523 ("libcap-ng" ,libcap-ng)
529 ("protobuf-c" ,protobuf-c)))
532 (modify-phases %standard-phases
533 (add-before 'configure 'disable-directory-pre-creation
535 ;; Don't install empty directories like ‘/etc’ outside the store.
536 ;; This is needed even when using ‘make config_dir=... install’.
537 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
540 (lambda* (#:key outputs #:allow-other-keys)
541 (let* ((out (assoc-ref outputs "out"))
542 (doc (string-append out "/share/doc/" ,name "-" ,version))
543 (etc (string-append doc "/examples/etc")))
545 (string-append "config_dir=" etc)
548 (list "--sysconfdir=/etc"
549 "--localstatedir=/var"
550 "--enable-dnstap" ; let tools read/write capture files
551 "--with-module-dnstap=yes" ; detailed query capturing & logging
552 (string-append "--with-bash-completions="
553 (assoc-ref %outputs "out")
554 "/etc/bash_completion.d"))))
555 (home-page "https://www.knot-dns.cz/")
556 (synopsis "Authoritative DNS name server")
557 (description "Knot DNS is an authoritative name server for the @dfn{Domain
558 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
559 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
560 number of programming techniques to improve speed. For example, the responder
561 is completely lock-free, resulting in a very high response rate. Other features
562 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
563 synthesis, and on-the-fly re-configuration.")
566 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
567 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
569 license:lgpl2.0+ ; parts of scr/contrib/ucw
570 license:public-domain ; src/contrib/fnv and possibly murmurhash3
571 license:gpl3+)))) ; everything else
573 (define-public ddclient
579 (uri (string-append "mirror://sourceforge/ddclient/ddclient/ddclient-"
580 version "/ddclient-" version ".tar.gz"))
583 "0fwyhab8yga2yi1kdfkbqxa83wxhwpagmj1w1mwkg2iffh1fjjlw"))))
584 (build-system trivial-build-system) ; no Makefile.PL
591 `(("inetutils" ,inetutils) ; logger
592 ("net-tools" ,net-tools)
593 ("perl-data-validate-ip" ,perl-data-validate-ip)
594 ("perl-digest-sha1" ,perl-digest-sha1)
595 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
597 `(#:modules ((guix build utils)
602 (use-modules (guix build utils)
606 (setenv "PATH" (string-append
607 (assoc-ref %build-inputs "bash") "/bin" ":"
608 (assoc-ref %build-inputs "tar") "/bin" ":"
609 (assoc-ref %build-inputs "gzip") "/bin" ":"
610 (assoc-ref %build-inputs "perl") "/bin"))
612 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
614 (with-directory-excursion (string-append ,name "-" ,version)
615 (let* ((out (assoc-ref %outputs "out"))
616 (bin (string-append out "/bin")))
617 (let ((file "ddclient"))
619 (("/usr/bin/perl") (which "perl"))
620 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
621 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
622 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
623 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
624 (("\\$cachedir\\$program\\.cache")
625 "/var/cache/ddclient/ddclient.cache"))
626 (install-file file bin)
627 (wrap-program (string-append bin "/" file)
630 ,@(map (lambda (input)
633 (string-append store "/bin"))))
639 (((? (cut string-prefix? "perl-" <>) name) . dir)
640 (string-append dir "/lib/perl5/site_perl"))
643 (for-each (cut install-file <> (string-append out
645 (find-files "." "sample.*$")))))))
646 (home-page "https://sourceforge.net/projects/ddclient/")
647 (synopsis "Address updating utility for dynamic DNS services")
648 (description "This package provides a client to update dynamic IP
649 addresses with several dynamic DNS service providers, such as
650 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
652 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
653 access a machine with a dynamic IP address.
655 The client supports both dynamic and (near) static services, as well as MX
656 record and alternative name management. It caches the address, and only
657 attempts the update when it has changed.")
658 (license license:gpl2+)))