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 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
7 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
8 ;;; Copyright © 2016, 2017 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>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages dns)
29 #:use-module (gnu packages admin)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages databases)
33 #:use-module (gnu packages crypto)
34 #:use-module (gnu packages datastructures)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages groff)
38 #:use-module (gnu packages groff)
39 #:use-module (gnu packages libedit)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages libidn)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages nettle)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages protobuf)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages swig)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages web)
52 #:use-module (gnu packages xml)
53 #:use-module ((guix licenses) #:prefix license:)
54 #:use-module (guix packages)
55 #:use-module (guix download)
56 #:use-module (guix utils)
57 #:use-module (guix build-system gnu))
59 (define-public dnsmasq
66 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
70 "15lzih6671gh9knzpl8mxchiml7z5lfqzr7jm2r0rjhrxs6nk4jb"))))
71 (build-system gnu-build-system)
73 `(("pkg-config" ,pkg-config)))
78 (modify-phases %standard-phases (delete 'configure))
79 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
81 "COPTS=\"-DHAVE_DBUS\"")
84 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
85 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
87 "Dnsmasq is a lightweight DNS forwarder and DHCP server. It is designed
88 to provide DNS and optionally, DHCP, to a small network. It can serve the
89 names of local machines which are not in the global DNS. The DHCP server
90 integrates with the DNS server and allows machines with DHCP-allocated
91 addresses to appear in the DNS with names configured either in each host or in
92 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
93 and BOOTP/TFTP for network booting of diskless machines.")
94 ;; Source files only say GPL2 and GPL3 are allowed.
95 (license (list license:gpl2 license:gpl3))))
97 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
98 ;; different name here.
99 (define-public isc-bind
106 "ftp://ftp.isc.org/isc/bind9/" version "/" name "-"
110 "0yn7wgi2y8mpmvbjbkl4va7p0xsnn48m4yjx6ynb1hzp423asikz"))))
111 (build-system gnu-build-system)
112 (outputs `("out" "utils"))
114 ;; it would be nice to add GeoIP and gssapi once there is package
118 ("p11-kit" ,p11-kit)))
119 (native-inputs `(("perl" ,perl)
120 ("net-tools" ,net-tools)))
123 (list (string-append "--with-openssl="
124 (assoc-ref %build-inputs "openssl"))
125 (string-append "--with-pkcs11="
126 (assoc-ref %build-inputs "p11-kit")))
128 (modify-phases %standard-phases
129 (add-after 'strip 'move-to-utils
133 (let ((target (string-append (assoc-ref %outputs "utils") file))
134 (src (string-append (assoc-ref %outputs "out") file)))
135 (mkdir-p (dirname target))
138 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
139 "/share/man/man1/dig.1"
140 "/share/man/man1/host.1"
141 "/share/man/man1/nslookup.1"
142 "/share/man/man1/nsupdate.1"))))
143 ;; When and if guix provides user namespaces for the build process,
144 ;; then the following can be uncommented and the subsequent "force-test"
145 ;; will not be necessary.
147 ;; (add-before 'check 'set-up-loopback
149 ;; (system "bin/tests/system/ifconfig.sh up")))
152 (zero? (system* "make" "force-test")))))))
153 (synopsis "An implementation of the Domain Name System")
154 (description "BIND is an implementation of the @dfn{Domain Name System}
155 (DNS) protocols for the Internet. It is a reference implementation of those
156 protocols, but it is also production-grade software, suitable for use in
157 high-volume and high-reliability applications. The name BIND stands for
158 \"Berkeley Internet Name Domain\", because the software originated in the early
159 1980s at the University of California at Berkeley.")
160 (home-page "https://www.isc.org/downloads/bind")
161 (license (list license:mpl2.0))))
163 (define-public dnscrypt-proxy
165 (name "dnscrypt-proxy")
170 "https://download.dnscrypt.org/dnscrypt-proxy/"
171 "dnscrypt-proxy-" version ".tar.bz2"))
174 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
175 (modules '((guix build utils)))
177 ;; Delete bundled libltdl. XXX: This package also bundles
178 ;; a modified libevent that cannot currently be removed.
179 '(delete-file-recursively "libltdl"))))
180 (build-system gnu-build-system)
183 (modify-phases %standard-phases
184 (add-after 'unpack 'autoreconf
186 ;; Re-generate build files due to unbundling ltdl.
187 ;; TODO: Prevent generating new libltdl and building it.
188 ;; The system version is still favored and referenced.
189 (zero? (system* "autoreconf" "-vif")))))))
191 `(("pkg-config" ,pkg-config)
192 ("automake" ,automake)
193 ("autoconf" ,autoconf)
194 ("libtool" ,libtool)))
196 `(("libltdl" ,libltdl)
197 ("libsodium" ,libsodium)))
198 (home-page "https://www.dnscrypt.org/")
199 (synopsis "Securely send DNS requests to a remote server")
201 "@command{dnscrypt-proxy} is a tool for securing communications
202 between a client and a DNS resolver. It verifies that responses you get
203 from a DNS provider was actually sent by that provider, and haven't been
204 tampered with. For optimal performance it is recommended to use this as
205 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
206 can also be used as a normal DNS \"server\". A list of public dnscrypt
207 servers is included, and an up-to-date version is available at
208 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
209 (license (list license:isc
210 ;; Libevent and src/ext/queue.h is 3-clause BSD.
213 (define-public dnscrypt-wrapper
215 (name "dnscrypt-wrapper")
220 "https://github.com/cofyc/dnscrypt-wrapper/releases"
221 "/download/v" version "/" name "-v" version ".tar.bz2"))
224 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
225 (build-system gnu-build-system)
227 `(#:make-flags '("CC=gcc")
228 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
231 (modify-phases %standard-phases
232 (add-after 'unpack 'create-configure
234 (zero? (system* "make" "configure")))))))
236 `(("autoconf" ,autoconf)))
238 `(("libevent" ,libevent)
239 ("libsodium" ,libsodium)))
240 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
241 (synopsis "Server-side dnscrypt proxy")
243 "@command{dnscrypt-wrapper} is a tool to expose a name server over
244 the @code{dnscrypt} protocol. It can be used as an endpoint for the
245 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
247 (license (list license:isc
248 ;; Bundled argparse is MIT. TODO: package and unbundle.
250 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
254 (define-public libasr
257 (version "201602131606")
261 (uri (string-append "https://www.opensmtpd.org/archives/"
262 name "-" version ".tar.gz"))
265 "18kdmbjsxrfai16d66qslp48b1zf7gr8him2jj5dcqgbsl44ls75"))))
266 (build-system gnu-build-system)
268 `(("autoconf" ,autoconf)
269 ("automake" ,automake)
270 ("pkg-config" ,pkg-config)
272 (home-page "https://www.opensmtpd.org")
273 (synopsis "Asynchronous resolver library by the OpenBSD project")
275 "libasr is a free, simple and portable asynchronous resolver library.
276 It allows to run DNS queries and perform hostname resolutions in a fully
277 asynchronous fashion.")
278 (license (list license:isc
279 license:bsd-2 ; last part of getrrsetbyname_async.c
281 (license:non-copyleft "file://LICENSE") ; includes.h
284 (define-public unbound
291 (uri (string-append "https://www.unbound.net/downloads/unbound-"
295 "0pw4m4z5qspsagxzbjb61xq5bhd57amw26xqvqzi6b8d3mf6azjc"))))
296 (build-system gnu-build-system)
297 (outputs '("out" "python"))
303 ("libevent" ,libevent)
304 ("protobuf" ,protobuf)
306 ("python-wrapper" ,python-wrapper)
307 ("openssl" ,openssl)))
310 (list "--disable-static" ;save space and non-determinism in libunbound.a
312 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
314 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
316 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
317 "--with-pythonmodule" "--with-pyunbound")
319 (modify-phases %standard-phases
320 (add-after 'configure 'fix-python-site-package-path
321 ;; Move python modules into their own output.
322 (lambda* (#:key outputs #:allow-other-keys)
323 (let ((pyout (assoc-ref outputs "python"))
324 (ver ,(version-major+minor (package-version python))))
325 (substitute* "Makefile"
326 (("^PYTHON_SITE_PKG=.*$")
329 pyout "/lib/python-" ver "/site-packages\n"))))
331 (add-before 'check 'fix-missing-nss-for-tests
332 ;; Unfortunately, the package's unittests involve some checks
333 ;; looking up protocols and services which are not provided
334 ;; by the minimalistic build environment, in particular,
335 ;; /etc/protocols and /etc/services are missing.
336 ;; Also, after plain substitution of protocol and service names
337 ;; in the test data, the tests still fail because the
338 ;; corresponding Resource Records have been signed by
340 ;; The following LD_PRELOAD library overwrites the glibc
341 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
342 ;; ‘getservbyport’ providing the few records required for the
343 ;; unit tests to pass.
344 (lambda* (#:key inputs outputs #:allow-other-keys)
345 (let* ((source (assoc-ref %build-inputs "source"))
346 (gcc (assoc-ref %build-inputs "gcc")))
347 (call-with-output-file "/tmp/nss_preload.c"
349 (display "#include <stdlib.h>
355 struct protoent *getprotobyname(const char *name) {
356 struct protoent *p = malloc(sizeof(struct protoent));
357 p->p_aliases = malloc(sizeof(char*));
358 if (strcasecmp(name, \"tcp\") == 0) {
361 p->p_aliases[0] = \"TCP\";
362 } else if (strcasecmp(name, \"udp\") == 0) {
365 p->p_aliases[0] = \"UDP\";
371 struct protoent *getprotobynumber(int proto) {
372 struct protoent *p = malloc(sizeof(struct protoent));
373 p->p_aliases = malloc(sizeof(char*));
378 p->p_aliases[0] = \"TCP\";
383 p->p_aliases[0] = \"UDP\";
392 struct servent *getservbyname(const char *name, const char *proto) {
393 struct servent *s = malloc(sizeof(struct servent));
394 char* buf = malloc((strlen(proto)+1)*sizeof(char));
396 s->s_aliases = malloc(sizeof(char*));
397 s->s_aliases[0] = NULL;
398 if (strcasecmp(name, \"domain\") == 0) {
399 s->s_name = \"domain\";
400 s->s_port = htons(53);
407 struct servent *getservbyport(int port, const char *proto) {
409 struct servent *s = malloc(sizeof(struct servent));
411 s->s_aliases = malloc(sizeof(char*));
412 s->s_aliases[0] = NULL;
415 s->s_name = \"domain\";
417 s->s_proto = \"udp\";
425 (system* (string-append gcc "/bin/gcc")
426 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
427 "/tmp/nss_preload.c")
428 ;; The preload library only affects the unittests.
429 (substitute* "Makefile"
431 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
433 (home-page "https://www.unbound.net")
434 (synopsis "Validating, recursive, and caching DNS resolver")
436 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
437 validation of results. It implements only a minimal amount of authoritative
438 service to prevent leakage to the root nameservers: forward lookups for
439 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
440 served by AS112. Stub and forward zones are supported.")
441 (license license:bsd-4)))
443 (define-public yadifa
448 (let ((build "6937"))
452 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
453 name "-" version "-" build ".tar.gz"))
456 "146fs52izf6dfwsxal3srpwin2yyl41g31cy4pyvbi5mqy2craj7")))))
457 (build-system gnu-build-system)
461 `(("openssl" ,openssl)))
463 `(#:phases (modify-phases %standard-phases
464 (add-before 'configure 'omit-example-configurations
466 (substitute* "Makefile.in"
469 #:configure-flags (list "--sysconfdir=/etc" "--localstatedir=/var"
470 "--enable-shared" "--disable-static"
471 "--enable-messages" "--enable-ctrl"
472 "--enable-nsec" "--enable-nsec3"
473 "--enable-tsig" "--enable-caching")))
474 (home-page "http://www.yadifa.eu/")
475 (synopsis "Authoritative DNS name server")
476 (description "YADIFA is an authoritative name server for the @dfn{Domain
477 Name System} (DNS). It aims for both higher performance and a smaller memory
478 footprint than other implementations, while remaining fully RFC-compliant.
479 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
480 Extensions} (DNSSEC).")
481 (license license:bsd-3)))
489 (uri (string-append "https://secure.nic.cz/files/knot-dns/"
490 name "-" version ".tar.xz"))
493 "1w14m9pmc8vl9mcgikvwbflwcxwz52l77jq98wvxyxab13lpdpiz"))
494 (modules '((guix build utils)))
497 ;; Remove bundled libraries and dependencies on them.
498 (substitute* "configure"
499 (("src/contrib/dnstap/Makefile") ""))
500 (substitute* "src/Makefile.in"
501 (("contrib/dnstap ") ""))
502 (with-directory-excursion "src/contrib"
503 (for-each delete-file-recursively
504 (list "dnstap" "lmdb")))
506 (build-system gnu-build-system)
508 `(("pkg-config" ,pkg-config)))
512 ("libcap-ng" ,libcap-ng)
520 ;; For ‘pykeymgr’, needed to migrate keys from versions <= 2.4.
522 ("python-lmdb" ,python2-lmdb)))
525 (modify-phases %standard-phases
526 (add-before 'configure 'disable-directory-pre-creation
528 ;; Don't install empty directories like ‘/etc’ outside the store.
529 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
532 (lambda* (#:key outputs #:allow-other-keys)
533 (let* ((out (assoc-ref outputs "out"))
534 (doc (string-append out "/share/doc/knot"))
535 (etc (string-append doc "/examples/etc")))
538 (string-append "config_dir=" etc)
540 (add-after 'install 'wrap-python-scripts
541 (lambda* (#:key outputs #:allow-other-keys)
542 (let* ((out (assoc-ref outputs "out"))
543 (path (getenv "PYTHONPATH")))
544 (wrap-program (string-append out "/sbin/pykeymgr")
545 `("PYTHONPATH" ":" prefix (,path))))
548 (list "--sysconfdir=/etc"
549 "--localstatedir=/var"
550 "--with-module-rosedb=yes" ; serve static records from a database
551 (string-append "--with-bash-completions="
552 (assoc-ref %outputs "out")
553 "/etc/bash_completion.d"))))
554 (home-page "https://www.knot-dns.cz/")
555 (synopsis "Authoritative DNS name server")
556 (description "Knot DNS is an authoritative name server for the @dfn{Domain
557 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
558 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
559 number of programming techniques to improve speed. For example, the responder
560 is completely lock-free, resulting in a very high response rate. Other features
561 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
562 synthesis, and on-the-fly re-configuration.")
563 (license (list license:expat ; src/contrib/{hat-trie,murmurhash3}
564 license:lgpl2.0+ ; parts of scr/contrib/ucw
565 license:gpl3+)))) ; everything else