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 Nikita <nikita@n0.is>
8 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2016, 2020 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 ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
15 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
16 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
17 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
18 ;;; Copyright © 2020 Leo Famulari <leo@famulari.name>
19 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
20 ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
22 ;;; This file is part of GNU Guix.
24 ;;; GNU Guix is free software; you can redistribute it and/or modify it
25 ;;; under the terms of the GNU General Public License as published by
26 ;;; the Free Software Foundation; either version 3 of the License, or (at
27 ;;; your option) any later version.
29 ;;; GNU Guix is distributed in the hope that it will be useful, but
30 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
31 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 ;;; GNU General Public License for more details.
34 ;;; You should have received a copy of the GNU General Public License
35 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
37 (define-module (gnu packages dns)
38 #:use-module (gnu packages admin)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages base)
41 #:use-module (gnu packages bash)
42 #:use-module (gnu packages certs)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages databases)
45 #:use-module (gnu packages documentation)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages crypto)
48 #:use-module (gnu packages datastructures)
49 #:use-module (gnu packages flex)
50 #:use-module (gnu packages freedesktop)
51 #:use-module (gnu packages gcc)
52 #:use-module (gnu packages glib)
53 #:use-module (gnu packages groff)
54 #:use-module (gnu packages groff)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages libedit)
57 #:use-module (gnu packages libevent)
58 #:use-module (gnu packages libidn)
59 #:use-module (gnu packages linux)
60 #:use-module (gnu packages lua)
61 #:use-module (gnu packages ncurses)
62 #:use-module (gnu packages nettle)
63 #:use-module (gnu packages networking)
64 #:use-module (gnu packages perl)
65 #:use-module (gnu packages pkg-config)
66 #:use-module (gnu packages protobuf)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages python-xyz)
69 #:use-module (gnu packages ragel)
70 #:use-module (gnu packages shells)
71 #:use-module (gnu packages sphinx)
72 #:use-module (gnu packages swig)
73 #:use-module (gnu packages texinfo)
74 #:use-module (gnu packages tls)
75 #:use-module (gnu packages web)
76 #:use-module (gnu packages xml)
77 #:use-module (gnu packages)
78 #:use-module ((guix licenses) #:prefix license:)
79 #:use-module (guix packages)
80 #:use-module (guix download)
81 #:use-module (guix git-download)
82 #:use-module (guix utils)
83 #:use-module (guix build-system glib-or-gtk)
84 #:use-module (guix build-system gnu)
85 #:use-module (guix build-system meson)
86 #:use-module (guix build-system trivial))
96 (string-append "https://www.nlnetlabs.nl/downloads/"
97 name "/" name "-" version ".tar.gz"))
99 (base32 "0ac242n7996fswq1a3nlh1bbbhrsdwsq4mx7xq8ffq6aplb4rj4a"))
102 ;; To create make-flag vairables,
103 ;; for splitting installation of drill and examples.
104 "ldns-drill-examples.patch"))))
105 (build-system gnu-build-system)
106 (outputs '("out" "drill" "examples" "pyldns"))
108 `( ;; Tests require Tpkg.
109 ;; https://tpkg.github.io/
114 "--enable-gost-anyway"
115 "--enable-rrtype-ninfo"
116 "--enable-rrtype-rkey"
118 "--enable-rrtype-avc"
119 "--enable-rrtype-doa"
120 "--enable-rrtype-amtrelay"
124 ;; Perl module DNS::LDNS not available.
125 ;; https://github.com/erikoest/DNS-LDNS.git
126 ;; "--with-p5-dns-ldns"
127 (string-append "--with-ssl="
128 (assoc-ref %build-inputs "openssl"))
129 (string-append "--with-ca-path="
130 (assoc-ref %build-inputs "nss-certs")
134 (string-append "drillbindir="
135 (assoc-ref %outputs "drill")
137 (string-append "drillmandir="
138 (assoc-ref %outputs "drill")
140 (string-append "examplesbindir="
141 (assoc-ref %outputs "examples")
143 (string-append "examplesmandir="
144 (assoc-ref %outputs "examples")
146 (string-append "python_site="
147 (assoc-ref %outputs "pyldns")
149 ,(version-major+minor
150 (package-version python))
153 `(("doxygen" ,doxygen)
156 ("perl-devel-checklib" ,perl-devel-checklib)
157 ("pkg-config" ,pkg-config)
158 ("python" ,python-wrapper)
161 `(("libpcap" ,libpcap)
162 ("nss-certs" ,nss-certs)
163 ("openssl" ,openssl)))
164 (synopsis "DNS library that facilitates DNS tool programming")
165 (description "LDNS aims to simplify DNS programming, it supports recent
166 RFCs like the DNSSEC documents, and allows developers to easily create
167 software conforming to current RFCs, and experimental software for current
168 Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
169 C it should be a lot faster than Perl.")
170 (home-page "https://nlnetlabs.nl/projects/ldns/about/")
171 (license license:bsd-3)))
173 (define-public dnssec-trigger
175 (name "dnssec-trigger")
181 (string-append "https://www.nlnetlabs.nl/downloads/"
182 name "/" name "-" version ".tar.gz"))
184 (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
185 (build-system glib-or-gtk-build-system)
186 (outputs '("out" "gui" "nm"))
188 `(#:test-target "test"
191 (string-append "--with-ssl="
192 (assoc-ref %build-inputs "openssl"))
193 "--with-hooks=networkmanager"
194 (string-append "--with-networkmanager-dispatch="
195 (assoc-ref %outputs "nm")
196 "/etc/NetworkManager/dispatcher.d")
197 (string-append "--with-xdg-autostart="
198 (assoc-ref %outputs "gui")
199 "/etc/xdg/autostart")
200 (string-append "--with-uidir="
201 (assoc-ref %outputs "gui")
202 "/share/dnssec-trigger")
203 (string-append "--with-python="
204 (assoc-ref %build-inputs "python")
206 (string-append "--with-unbound-control="
207 (assoc-ref %build-inputs "unbound")
208 "/sbin/unbound-control")
209 "--with-forward-zones-support")
211 (modify-phases %standard-phases
212 (add-after 'unpack 'patch-configure
214 (substitute* "configure"
215 (("appindicator-0.1")
216 "appindicator3-0.1"))
218 (add-before 'configure 'patch-makefile
220 (substitute* "Makefile.in"
225 ((".*gtk-update-icon-cache.*")
228 (add-after 'install 'remove-systemd
229 (lambda* (#:key outputs #:allow-other-keys)
230 (let* ((out (assoc-ref outputs "out")))
231 (delete-file-recursively
232 (string-append out "/lib/systemd"))
234 (add-after 'remove-systemd 'move-gui
235 (lambda* (#:key outputs #:allow-other-keys)
236 (let* ((out (assoc-ref outputs "out"))
237 (gui (assoc-ref outputs "gui")))
238 (mkdir-p (string-append gui "/bin"))
239 (mkdir-p (string-append gui "/share"))
241 (string-append out "/bin")
242 (string-append gui "/bin"))
244 (string-append out "/share/icons")
245 (string-append gui "/share/icons"))
247 (add-after 'move-gui 'move-nm
248 (lambda* (#:key outputs #:allow-other-keys)
249 (let* ((out (assoc-ref outputs "out"))
250 (nm (assoc-ref outputs "nm")))
251 (mkdir-p (string-append nm "/libexec"))
253 (string-append out "/libexec")
254 (string-append nm "/libexec"))
258 ("pkg-config" ,pkg-config)
259 ("python" ,python-wrapper)))
263 ("libappindicator" ,libappindicator)
265 ("unbound" ,unbound)))
266 (synopsis "DNSSEC protection for the DNS traffic")
267 (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
268 for the DNS traffic. It relies on the Unbound DNS resolver running locally on
269 your system, which performs DNSSEC validation. It reconfigures Unbound in such
270 a way that it will signal it to to use the DHCP obtained forwarders if possible,
271 fallback to doing its own AUTH queries if that fails, and if that fails it will
272 prompt the user with the option to go with insecure DNS only.")
273 (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
274 (license license:bsd-3)))
276 (define-public dnsmasq
283 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
287 "0cn1xd1s6xs78jmrmwjnh9m6w3q38pk6dyqy2phvasqiyd33cll4"))))
288 (build-system gnu-build-system)
290 `(("pkg-config" ,pkg-config)))
295 (modify-phases %standard-phases (delete 'configure))
296 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
298 "COPTS=\"-DHAVE_DBUS\"")
299 #:tests? #f)) ; no ‘check’ target
300 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
301 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
303 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
304 to provide DNS and, optionally, DHCP to a small network. It can serve the
305 names of local machines which are not in the global DNS. The DHCP server
306 integrates with the DNS server and allows machines with DHCP-allocated
307 addresses to appear in the DNS with names configured either on each host or in
308 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
309 and BOOTP/TFTP for network booting of diskless machines.")
310 ;; Source files only say GPL2 and GPL3 are allowed.
311 (license (list license:gpl2 license:gpl3))))
313 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
314 ;; different name here.
315 (define-public isc-bind
318 ;; When updating, check whether isc-dhcp's bundled copy should be as well.
323 "https://ftp.isc.org/isc/bind9/" version
324 "/bind-" version ".tar.xz"))
327 "1l8lhgnkj3fnl1101bs3pzj5gv2x5m9ahvrbyscsc9mxxc91hzcz"))))
328 (build-system gnu-build-system)
329 (outputs `("out" "utils"))
331 ;; It would be nice to add GeoIP and gssapi once there are packages.
338 ("python-ply" ,python-ply)))
341 ("pkg-config" ,pkg-config)))
344 (list (string-append "--with-pkcs11="
345 (assoc-ref %build-inputs "p11-kit")))
347 (modify-phases %standard-phases
348 (add-after 'strip 'move-to-utils
352 (let ((target (string-append (assoc-ref %outputs "utils") file))
353 (src (string-append (assoc-ref %outputs "out") file)))
354 (mkdir-p (dirname target))
357 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
358 "/share/man/man1/dig.1"
359 "/share/man/man1/host.1"
360 "/share/man/man1/nslookup.1"
361 "/share/man/man1/nsupdate.1"))
363 ;; When and if guix provides user namespaces for the build process,
364 ;; then the following can be uncommented and the subsequent "force-test"
365 ;; will not be necessary.
367 ;; (add-before 'check 'set-up-loopback
369 ;; (system "bin/tests/system/ifconfig.sh up")))
372 ;; XXX Even ‘make force-test’ tries to create network interfaces
373 ;; and fails. The only working target is the (trivial) fuzz test.
374 (with-directory-excursion "fuzz"
375 (invoke "make" "check"))
377 (synopsis "Domain Name System (DNS) implementation")
378 (description "BIND is an implementation of the @dfn{Domain Name System}
379 (DNS) protocols for the Internet. It is a reference implementation of those
380 protocols, but it is also production-grade software, suitable for use in
381 high-volume and high-reliability applications. The name BIND stands for
382 \"Berkeley Internet Name Domain\", because the software originated in the
383 early 1980s at the University of California at Berkeley. The @code{utils}
384 output of this package contains the following DNS name servers related command
388 DNS lookup and validation utility
394 Internet name servers interactive query utility
396 Dynamic DNS update utility
398 (home-page "https://www.isc.org/bind/")
399 (license (list license:mpl2.0))))
401 (define-public dnscrypt-proxy
403 (name "dnscrypt-proxy")
408 "https://download.dnscrypt.org/dnscrypt-proxy/"
409 "dnscrypt-proxy-" version ".tar.bz2"))
412 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
413 (modules '((guix build utils)))
415 ;; Delete bundled libltdl. XXX: This package also bundles
416 ;; a modified libevent that cannot currently be removed.
418 (delete-file-recursively "libltdl")
420 (build-system gnu-build-system)
423 (modify-phases %standard-phases
424 (add-after 'unpack 'autoreconf
426 ;; Re-generate build files due to unbundling ltdl.
427 ;; TODO: Prevent generating new libltdl and building it.
428 ;; The system version is still favored and referenced.
429 (invoke "autoreconf" "-vif"))))))
431 `(("pkg-config" ,pkg-config)
432 ("automake" ,automake)
433 ("autoconf" ,autoconf)
434 ("libtool" ,libtool)))
436 `(("libltdl" ,libltdl)
437 ("libsodium" ,libsodium)))
438 (home-page "https://www.dnscrypt.org/")
439 (synopsis "Securely send DNS requests to a remote server")
441 "@command{dnscrypt-proxy} is a tool for securing communications
442 between a client and a DNS resolver. It verifies that responses you get
443 from a DNS provider was actually sent by that provider, and haven't been
444 tampered with. For optimal performance it is recommended to use this as
445 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
446 can also be used as a normal DNS \"server\". A list of public dnscrypt
447 servers is included, and an up-to-date version is available at
448 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
449 (license (list license:isc
450 ;; Libevent and src/ext/queue.h is 3-clause BSD.
453 (define-public dnscrypt-wrapper
455 (name "dnscrypt-wrapper")
460 "https://github.com/cofyc/dnscrypt-wrapper/releases"
461 "/download/v" version "/" name "-v" version ".tar.bz2"))
464 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
465 (build-system gnu-build-system)
467 `(#:make-flags '("CC=gcc")
468 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
471 (modify-phases %standard-phases
472 (add-after 'unpack 'create-configure
474 (invoke "make" "configure"))))))
476 `(("autoconf" ,autoconf)))
478 `(("libevent" ,libevent)
479 ("libsodium" ,libsodium)))
480 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
481 (synopsis "Server-side dnscrypt proxy")
483 "@command{dnscrypt-wrapper} is a tool to expose a name server over
484 the @code{dnscrypt} protocol. It can be used as an endpoint for the
485 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
487 (license (list license:isc
488 ;; Bundled argparse is MIT. TODO: package and unbundle.
490 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
494 (define-public libasr
501 (uri (string-append "https://www.opensmtpd.org/archives/"
502 "libasr-" version ".tar.gz"))
504 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
505 (build-system gnu-build-system)
508 (modify-phases %standard-phases
509 (add-after 'install 'install-documentation
510 (lambda* (#:key outputs #:allow-other-keys)
511 (let ((out (assoc-ref outputs "out")))
512 (install-file "src/asr_run.3"
513 (string-append out "/share/man/man3"))
516 `(("autoconf" ,autoconf)
517 ("automake" ,automake)
519 ("pkg-config" ,pkg-config)))
520 (home-page "https://www.opensmtpd.org")
521 (synopsis "Asynchronous resolver library by the OpenBSD project")
523 "libasr is a free, simple and portable asynchronous resolver library.
524 It runs DNS queries and performs hostname resolution in a fully
525 asynchronous fashion.")
526 (license (list license:isc
527 license:bsd-2 ; last part of getrrsetbyname_async.c
529 (license:non-copyleft "file://LICENSE") ; includes.h
539 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
542 (base32 "0ac3mbn5z4nc18782m9aswdpi2m9f4665vidw0ciyigdh0pywp2v"))))
543 (build-system gnu-build-system)
546 (list "--enable-pie" ; fully benefit from ASLR
549 "--enable-relro-now" ; protect GOT and .dtor areas
550 "--disable-radix-tree"
551 (string-append "--with-libevent="
552 (assoc-ref %build-inputs "libevent"))
553 (string-append "--with-ssl="
554 (assoc-ref %build-inputs "openssl"))
555 "--with-configdir=/etc"
556 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
557 "--with-logfile=/var/log/nsd.log"
558 "--with-pidfile=/var/db/nsd/nsd.pid"
559 "--with-dbfile=/var/db/nsd/nsd.db"
560 "--with-zonesdir=/etc/nsd"
561 "--with-xfrdfile=/var/db/nsd/xfrd.state"
562 "--with-zonelistfile=/var/db/nsd/zone.list")
564 (modify-phases %standard-phases
565 (add-before 'configure 'patch-installation-paths
566 (lambda* (#:key outputs #:allow-other-keys)
567 (let* ((out (assoc-ref outputs "out"))
568 (doc (string-append out "/share/doc/" ,name "-" ,version)))
569 ;; The ‘make install’ target tries to create the parent
570 ;; directories of run-time things like ‘pidfile’ above, and
571 ;; useless empty directories like 'configdir'. Remove such
572 ;; '$(INSTALL)' lines and install the example configuration file
573 ;; in an appropriate location.
574 (substitute* "Makefile.in"
575 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
576 (string-append "#" command))
577 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
578 (string-append doc "/examples/" file-name)))
580 #:tests? #f)) ; no tests
582 `(("libevent" ,libevent)
583 ("openssl" ,openssl)))
584 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
585 (synopsis "Authoritative DNS name server")
586 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
587 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
588 RFC-compliant nameserver.
590 NSD uses zone information compiled via @command{zonec} into a binary database
591 file (@file{nsd.db}). This allows fast startup of the name service daemon and
592 allows syntax-structural errors in zone files to be flagged at compile time,
593 before being made available to NSD service itself. However, most traditional
594 BIND-style zone files can be directly imported into NSD without modification.
596 The collection of programs and processes that make up NSD are designed so that
597 the daemon itself runs as a non-privileged user and can be easily configured to
598 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
599 to result in system-wide compromise.")
600 (license (list license:bsd-3))))
602 (define-public unbound
609 (uri (string-append "https://www.unbound.net/downloads/unbound-"
612 (base32 "0dnmh9jjh2v274f0hl31bgv40pl77mmfgky8bkqr5kvi3b17fdmp"))))
613 (build-system gnu-build-system)
614 (outputs '("out" "python"))
620 ("libevent" ,libevent)
621 ("protobuf" ,protobuf)
622 ("python-wrapper" ,python-wrapper)
623 ("openssl" ,openssl)))
626 (list "--disable-static" ; save space and non-determinism in libunbound.a
628 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
630 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
632 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
633 "--with-pythonmodule" "--with-pyunbound")
635 (modify-phases %standard-phases
636 (add-after 'configure 'fix-python-site-package-path
637 ;; Move python modules into their own output.
638 (lambda* (#:key outputs #:allow-other-keys)
639 (let ((pyout (assoc-ref outputs "python"))
640 (ver ,(version-major+minor (package-version python))))
641 (substitute* "Makefile"
642 (("^PYTHON_SITE_PKG=.*$")
645 pyout "/lib/python-" ver "/site-packages\n"))))
647 (add-before 'check 'fix-missing-nss-for-tests
648 ;; Unfortunately, the package's unittests involve some checks
649 ;; looking up protocols and services which are not provided
650 ;; by the minimalistic build environment, in particular,
651 ;; /etc/protocols and /etc/services are missing.
652 ;; Also, after plain substitution of protocol and service names
653 ;; in the test data, the tests still fail because the
654 ;; corresponding Resource Records have been signed by
656 ;; The following LD_PRELOAD library overwrites the glibc
657 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
658 ;; ‘getservbyport’ providing the few records required for the
659 ;; unit tests to pass.
660 (lambda* (#:key inputs outputs #:allow-other-keys)
661 (let* ((source (assoc-ref %build-inputs "source"))
662 (gcc (assoc-ref %build-inputs "gcc")))
663 (call-with-output-file "/tmp/nss_preload.c"
665 (display "#include <stdlib.h>
671 struct protoent *getprotobyname(const char *name) {
672 struct protoent *p = malloc(sizeof(struct protoent));
673 p->p_aliases = malloc(sizeof(char*));
674 if (strcasecmp(name, \"tcp\") == 0) {
677 p->p_aliases[0] = \"TCP\";
678 } else if (strcasecmp(name, \"udp\") == 0) {
681 p->p_aliases[0] = \"UDP\";
687 struct protoent *getprotobynumber(int proto) {
688 struct protoent *p = malloc(sizeof(struct protoent));
689 p->p_aliases = malloc(sizeof(char*));
694 p->p_aliases[0] = \"TCP\";
699 p->p_aliases[0] = \"UDP\";
708 struct servent *getservbyname(const char *name, const char *proto) {
709 struct servent *s = malloc(sizeof(struct servent));
710 char* buf = malloc((strlen(proto)+1)*sizeof(char));
712 s->s_aliases = malloc(sizeof(char*));
713 s->s_aliases[0] = NULL;
714 if (strcasecmp(name, \"domain\") == 0) {
715 s->s_name = \"domain\";
716 s->s_port = htons(53);
723 struct servent *getservbyport(int port, const char *proto) {
725 struct servent *s = malloc(sizeof(struct servent));
727 s->s_aliases = malloc(sizeof(char*));
728 s->s_aliases[0] = NULL;
731 s->s_name = \"domain\";
733 s->s_proto = \"udp\";
741 (invoke (string-append gcc "/bin/gcc")
742 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
743 "/tmp/nss_preload.c")
744 ;; The preload library only affects the unittests.
745 (substitute* "Makefile"
747 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
749 (home-page "https://www.unbound.net")
750 (synopsis "Validating, recursive, and caching DNS resolver")
752 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
753 validation of results. It implements only a minimal amount of authoritative
754 service to prevent leakage to the root nameservers: forward lookups for
755 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
756 served by AS112. Stub and forward zones are supported.")
757 (license license:bsd-4)))
759 (define-public yadifa
764 (let ((build "9729"))
768 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
769 "yadifa-" version "-" build ".tar.gz"))
771 (base32 "0azaignqmylfdzr4x02s8y3pkn4f0xkpz3d1pkiiz8mwk92zgybn")))))
772 (build-system gnu-build-system)
776 `(("openssl" ,openssl)))
779 (modify-phases %standard-phases
780 (add-before 'configure 'omit-example-configurations
782 (substitute* "Makefile.in"
786 (list "--sysconfdir=/etc"
787 "--localstatedir=/var"
788 "--disable-build-timestamp" ; build reproducibly
793 "--enable-ctrl" ; enable remote control
797 (home-page "https://www.yadifa.eu/")
798 (synopsis "Authoritative DNS name server")
799 (description "YADIFA is an authoritative name server for the @dfn{Domain
800 Name System} (DNS). It aims for both higher performance and a smaller memory
801 footprint than other implementations, while remaining fully RFC-compliant.
802 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
803 Extensions} (DNSSEC).")
804 (license license:bsd-3)))
814 (url "https://gitlab.nic.cz/knot/knot-dns")
815 (commit (string-append "v" version))))
816 (file-name (git-file-name name version))
818 (base32 "0fkvip7n5ihjfwnnivdc3jf44y8p85ifglvq7b0anxvj9cg1m78f"))
820 (search-patches "knot-test_net_shortwrite-ensure-connection.patch"))
821 (modules '((guix build utils)))
824 ;; Remove Ragel-generated C files. We'll recreate them below.
825 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
826 (delete-file "src/libknot/yparser/ypbody.c")
828 (build-system gnu-build-system)
831 (list "--sysconfdir=/etc"
832 "--localstatedir=/var"
833 "--enable-dnstap" ; let tools read/write capture files
834 "--enable-fastparser" ; disabled by default when .git/ exists
835 "--with-module-dnstap=yes") ; detailed query capturing & logging
837 (modify-phases %standard-phases
838 (add-before 'bootstrap 'update-parser
840 (with-directory-excursion "src"
841 (invoke "sh" "../scripts/update-parser.sh"))))
842 (add-before 'configure 'disable-directory-pre-creation
844 ;; Don't install empty directories like ‘/etc’ outside the store.
845 ;; This is needed even when using ‘make config_dir=... install’.
846 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
848 (add-after 'build 'build-info
850 (invoke "make" "info")))
852 (lambda* (#:key outputs #:allow-other-keys)
853 (let* ((out (assoc-ref outputs "out"))
854 (doc (string-append out "/share/doc/" ,name "-" ,version))
855 (etc (string-append doc "/examples/etc")))
857 (string-append "config_dir=" etc)
859 (add-after 'install 'install-info
861 (invoke "make" "install-info"))))))
863 `(("autoconf" ,autoconf)
864 ("automake" ,automake)
866 ("pkg-config" ,pkg-config)
867 ("python-sphinx" ,python-sphinx)
869 ("texinfo" ,texinfo)))
874 ("libcap-ng" ,libcap-ng)
877 ("libnghttp2" ,nghttp2 "lib")
881 ("protobuf-c" ,protobuf-c)))
882 (home-page "https://www.knot-dns.cz/")
883 (synopsis "Authoritative DNS name server")
884 (description "Knot DNS is an authoritative name server for the @dfn{Domain
885 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
886 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
887 number of programming techniques to improve speed. For example, the responder
888 is completely lock-free, resulting in a very high response rate. Other features
889 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
890 synthesis, and on-the-fly re-configuration.")
893 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
894 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
896 license:lgpl2.0+ ; parts of scr/contrib/ucw
897 license:public-domain ; src/contrib/fnv and possibly murmurhash3
898 license:gpl3+)))) ; everything else
900 (define-public knot-resolver
902 (name "knot-resolver")
906 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
907 "knot-resolver-" version ".tar.xz"))
910 "12s5070nqqf599s1mb6rjas2as481rjf751qk5yrz6p34y885k90"))))
911 (build-system meson-build-system)
913 '(#:configure-flags '("-Ddoc=enabled")
915 (modify-phases %standard-phases
916 (add-before 'configure 'disable-default-ta
918 ;; Disable the default managed root TA, since we don't have
919 ;; write access to the keyfile and its directory in store.
920 (substitute* "daemon/lua/sandbox.lua.in"
921 (("^trust_anchors\\.add_file.*") ""))
923 (add-after 'build 'build-doc
925 (invoke "ninja" "doc")))
926 (add-after 'install 'wrap-binary
927 (lambda* (#:key inputs outputs #:allow-other-keys)
928 (let* ((out (assoc-ref outputs "out"))
929 (lua-* (map cdr (filter
931 (string-prefix? "lua-" (car input)))
933 (lua-path (lambda (p)
934 (string-append p "/share/lua/5.1/?.lua")))
935 (lua-cpath (lambda (p)
936 (string-append p "/lib/lua/5.1/?.so"))))
937 (wrap-program (string-append out "/sbin/kresd")
938 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
939 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
942 `(("cmocka" ,cmocka) ; for unit tests
944 ("protobuf-c" ,protobuf-c)
945 ("pkg-config" ,pkg-config)
946 ("python-breathe" ,python-breathe)
947 ("python-sphinx" ,python-sphinx)
948 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
956 ;; TODO: Add optional lua modules: basexx and psl.
957 ("lua-bitop" ,lua5.1-bitop)))
958 (home-page "https://www.knot-resolver.cz/")
959 (synopsis "Caching validating DNS resolver")
961 "Knot Resolver is a caching full resolver implementation written in C and
962 LuaJIT, both a resolver library and a daemon.")
963 (license (list license:gpl3+
964 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
969 (define-public ddclient
977 (url "https://github.com/ddclient/ddclient")
978 (commit (string-append "v" version))))
979 (file-name (git-file-name name version))
981 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
982 (build-system trivial-build-system) ; no Makefile.PL
987 `(("inetutils" ,inetutils) ; logger
988 ("net-tools" ,net-tools)
989 ("perl-data-validate-ip" ,perl-data-validate-ip)
990 ("perl-digest-sha1" ,perl-digest-sha1)
991 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
993 `(#:modules ((guix build utils)
998 (use-modules (guix build utils)
1001 (setenv "PATH" (string-append
1002 (assoc-ref %build-inputs "bash") "/bin" ":"
1003 (assoc-ref %build-inputs "perl") "/bin"))
1005 ;; Copy the (read-only) source into the (writable) build directory.
1006 (copy-recursively (assoc-ref %build-inputs "source") ".")
1009 (let* ((out (assoc-ref %outputs "out"))
1010 (bin (string-append out "/bin")))
1011 (let ((file "ddclient"))
1013 (("/usr/bin/perl") (which "perl"))
1014 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1015 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1016 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1017 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1018 (("\\$cachedir\\$program\\.cache")
1019 "/var/cache/ddclient/ddclient.cache"))
1020 (install-file file bin)
1021 (wrap-program (string-append bin "/" file)
1024 ,@(map (lambda (input)
1027 (string-append store "/bin"))))
1033 (((? (cut string-prefix? "perl-" <>) name) . dir)
1034 (string-append dir "/lib/perl5/site_perl"))
1037 (for-each (cut install-file <> (string-append out
1039 (find-files "." "sample.*$"))))))
1040 (home-page "https://ddclient.net/")
1041 (synopsis "Address updating utility for dynamic DNS services")
1042 (description "This package provides a client to update dynamic IP
1043 addresses with several dynamic DNS service providers, such as
1044 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1046 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1047 access a machine with a dynamic IP address.
1049 The client supports both dynamic and (near) static services, as well as MX
1050 record and alternative name management. It caches the address, and only
1051 attempts the update when it has changed.")
1052 (license license:gpl2+)))
1055 ;; There have been no releases yet, hence this commit.
1056 (let ((revision "0")
1057 (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
1060 (version (git-version "0.0" revision commit))
1064 (url "https://github.com/handshake-org/hnsd")
1068 "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
1069 (file-name (git-file-name name version))
1070 (modules '((guix build utils)))
1073 ;; Delete the bundled copy of libuv.
1074 (delete-file-recursively "uv")
1075 (substitute* "configure.ac"
1076 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1077 (substitute* "Makefile.am"
1078 (("SUBDIRS = uv") "\n")
1079 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1081 ;; Make sure the 'hnsd' binary is installed and
1082 ;; dynamically-linked.
1083 (("noinst_PROGRAMS") "bin_PROGRAMS")
1084 (("hnsd_LDFLAGS = -static") ""))
1086 ;; This script tries to chdir to "uv" and doesn't do more
1087 ;; than "autoreconf" so remove it.
1088 (delete-file "autogen.sh")
1090 (build-system gnu-build-system)
1092 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1094 `(("autoconf" ,autoconf)
1095 ("automake" ,automake)
1096 ("libtool" ,libtool)))
1098 `(("unbound" ,unbound)
1100 (home-page "https://www.handshake.org/")
1101 (synopsis "Resolver daemon for the Handshake naming protocol")
1103 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1104 System (HNS) peer-to-peer network.")
1105 (license license:expat))))
1107 (define-public libmicrodns
1109 (name "libmicrodns")
1113 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1114 "releases/download/" version "/microdns-"
1118 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1119 (build-system meson-build-system)
1120 (home-page "https://github.com/videolabs/libmicrodns")
1121 (synopsis "Minimal mDNS resolver library")
1122 (description "@code{libmicrodns} provides a minimal implementation of a
1123 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1124 a zero-config service that allows one to resolve host names to IP addresses in
1126 (license license:lgpl2.1)))
1128 (define-public public-suffix-list
1129 ;; Mozilla releases the official list here:
1131 ;; https://publicsuffix.org/list/public_suffix_list.dat
1133 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1134 ;; so its contents will change over time. If you update this commit, please
1135 ;; make sure that the new commit refers to a list which is identical to the
1136 ;; officially published list available from the URL above.
1137 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1139 (name "public-suffix-list")
1140 (version (git-version "0" "1" commit))
1144 (url "https://github.com/publicsuffix/list")
1146 (file-name (git-file-name name version))
1149 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1150 (build-system trivial-build-system)
1152 `(#:modules ((guix build utils))
1155 (use-modules (guix build utils))
1156 (let* ((out (assoc-ref %outputs "out"))
1157 ;; Install to /share because that is where "read-only
1158 ;; architecture-independent data files" should go (see:
1159 ;; (standards) Directory Variables). Include the version in
1160 ;; the directory name so that if multiple versions are ever
1161 ;; installed in the same profile, they will not conflict.
1162 (destination (string-append
1163 out "/share/public-suffix-list-" ,version))
1164 (source (assoc-ref %build-inputs "source")))
1165 (with-directory-excursion source
1166 (install-file "public_suffix_list.dat" destination)
1167 (install-file "LICENSE" destination))
1169 (home-page "https://publicsuffix.org/")
1170 (synopsis "Database of current and historical DNS suffixes")
1171 (description "This is the Public Suffix List maintained by Mozilla. A
1172 \"public suffix\" is one under which Internet users can (or historically
1173 could) directly register names in the Domain Name System (DNS). Some examples
1174 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1175 known public suffixes.")
1176 (license license:mpl2.0))))
1178 (define-public maradns
1181 (version "3.5.0007")
1185 (uri (string-append "https://maradns.samiam.org/download/"
1186 (version-major+minor version) "/"
1187 version "/maradns-" version ".tar.xz"))
1189 (base32 "0bc19xylg4whww9qaj5i4izwxcrh0c0ja7l1pfcn2la02hlvg1a6"))))
1190 (build-system gnu-build-system)
1192 `(#:tests? #f ; need to be root to run tests
1195 ,(string-append "CC=" (cc-for-target))
1196 (string-append "PREFIX=" %output)
1197 (string-append "RPM_BUILD_ROOT=" %output))
1199 (modify-phases %standard-phases
1201 (lambda* (#:key native-inputs target #:allow-other-keys)
1202 ;; make_32bit_tables generates a header file that is used during
1203 ;; compilation. Hence, during cross compilation, it should be
1204 ;; built for the host system.
1206 (substitute* "rng/Makefile"
1207 (("\\$\\(CC\\) -o make_32bit_tables")
1208 (string-append (assoc-ref native-inputs "gcc")
1209 "/bin/gcc -o make_32bit_tables"))))
1210 (invoke "./configure")))
1211 (add-before 'install 'create-install-directories
1212 (lambda* (#:key outputs #:allow-other-keys)
1213 (let ((out (assoc-ref outputs "out")))
1214 (for-each (lambda (dir)
1215 (mkdir-p (string-append out dir)))
1216 (list "/bin" "/sbin" "/etc"
1221 (home-page "https://maradns.samiam.org")
1222 (synopsis "Small lightweight DNS server")
1223 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1224 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1225 and TCP-capable recursive DNS server for finding domains on the internet.")
1226 (license license:bsd-2)))
1228 (define-public openresolv
1234 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1235 "openresolv-" version ".tar.xz"))
1238 "01ms6c087la4hk0f0w6n2vpsb7dg4kklah2rqyhz88p0vr9bqy20"))
1240 (search-patches "openresolv-restartcmd-guix.patch"))))
1241 (build-system gnu-build-system)
1243 `(#:tests? #f ; No test suite
1245 (list (string-append "--sysconfdir=/etc"))
1247 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
1248 (home-page "https://roy.marples.name/projects/openresolv/")
1249 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1250 (description "openresolv is an implementation of @command{resolvconf}, the
1251 middleman between the network configuration services and
1252 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1253 stores, removes and lists a full @file{resolv.conf} generated for the
1254 interface. It then calls all the helper scripts it knows about so it can
1255 configure the real @file{/etc/resolv.conf} and optionally any local
1256 nameservers other than libc.")
1257 (license license:bsd-2)))