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–2021 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, 2021 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 elf)
50 #:use-module (gnu packages flex)
51 #:use-module (gnu packages freedesktop)
52 #:use-module (gnu packages gcc)
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages groff)
55 #:use-module (gnu packages groff)
56 #:use-module (gnu packages gtk)
57 #:use-module (gnu packages libedit)
58 #:use-module (gnu packages libevent)
59 #:use-module (gnu packages libidn)
60 #:use-module (gnu packages linux)
61 #:use-module (gnu packages lua)
62 #:use-module (gnu packages ncurses)
63 #:use-module (gnu packages nettle)
64 #:use-module (gnu packages networking)
65 #:use-module (gnu packages perl)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages protobuf)
68 #:use-module (gnu packages python)
69 #:use-module (gnu packages python-xyz)
70 #:use-module (gnu packages ragel)
71 #:use-module (gnu packages shells)
72 #:use-module (gnu packages sphinx)
73 #:use-module (gnu packages swig)
74 #:use-module (gnu packages texinfo)
75 #:use-module (gnu packages tls)
76 #:use-module (gnu packages web)
77 #:use-module (gnu packages xml)
78 #:use-module (gnu packages)
79 #:use-module ((guix licenses) #:prefix license:)
80 #:use-module (guix packages)
81 #:use-module (guix download)
82 #:use-module (guix git-download)
83 #:use-module (guix utils)
84 #:use-module (guix build-system glib-or-gtk)
85 #:use-module (guix build-system gnu)
86 #:use-module (guix build-system meson)
87 #:use-module (guix build-system trivial))
97 (string-append "https://www.nlnetlabs.nl/downloads/"
98 name "/" name "-" version ".tar.gz"))
100 (base32 "0ac242n7996fswq1a3nlh1bbbhrsdwsq4mx7xq8ffq6aplb4rj4a"))
103 ;; To create make-flag vairables,
104 ;; for splitting installation of drill and examples.
105 "ldns-drill-examples.patch"))))
106 (build-system gnu-build-system)
107 (outputs '("out" "drill" "examples" "pyldns"))
109 `( ;; Tests require Tpkg.
110 ;; https://tpkg.github.io/
115 "--enable-gost-anyway"
116 "--enable-rrtype-ninfo"
117 "--enable-rrtype-rkey"
119 "--enable-rrtype-avc"
120 "--enable-rrtype-doa"
121 "--enable-rrtype-amtrelay"
125 ;; Perl module DNS::LDNS not available.
126 ;; https://github.com/erikoest/DNS-LDNS.git
127 ;; "--with-p5-dns-ldns"
128 (string-append "--with-ssl="
129 (assoc-ref %build-inputs "openssl"))
130 (string-append "--with-ca-path="
131 (assoc-ref %build-inputs "nss-certs")
135 (string-append "drillbindir="
136 (assoc-ref %outputs "drill")
138 (string-append "drillmandir="
139 (assoc-ref %outputs "drill")
141 (string-append "examplesbindir="
142 (assoc-ref %outputs "examples")
144 (string-append "examplesmandir="
145 (assoc-ref %outputs "examples")
147 (string-append "python_site="
148 (assoc-ref %outputs "pyldns")
150 ,(version-major+minor
151 (package-version python))
154 `(("doxygen" ,doxygen)
157 ("perl-devel-checklib" ,perl-devel-checklib)
158 ("pkg-config" ,pkg-config)
159 ("python" ,python-wrapper)
162 `(("libpcap" ,libpcap)
163 ("nss-certs" ,nss-certs)
164 ("openssl" ,openssl)))
165 (synopsis "DNS library that facilitates DNS tool programming")
166 (description "LDNS aims to simplify DNS programming, it supports recent
167 RFCs like the DNSSEC documents, and allows developers to easily create
168 software conforming to current RFCs, and experimental software for current
169 Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
170 C it should be a lot faster than Perl.")
171 (home-page "https://nlnetlabs.nl/projects/ldns/about/")
172 (license license:bsd-3)))
174 (define-public dnssec-trigger
176 (name "dnssec-trigger")
182 (string-append "https://www.nlnetlabs.nl/downloads/"
183 name "/" name "-" version ".tar.gz"))
185 (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
186 (build-system glib-or-gtk-build-system)
187 (outputs '("out" "gui" "nm"))
189 `(#:test-target "test"
192 (string-append "--with-ssl="
193 (assoc-ref %build-inputs "openssl"))
194 "--with-hooks=networkmanager"
195 (string-append "--with-networkmanager-dispatch="
196 (assoc-ref %outputs "nm")
197 "/etc/NetworkManager/dispatcher.d")
198 (string-append "--with-xdg-autostart="
199 (assoc-ref %outputs "gui")
200 "/etc/xdg/autostart")
201 (string-append "--with-uidir="
202 (assoc-ref %outputs "gui")
203 "/share/dnssec-trigger")
204 (string-append "--with-python="
205 (assoc-ref %build-inputs "python")
207 (string-append "--with-unbound-control="
208 (assoc-ref %build-inputs "unbound")
209 "/sbin/unbound-control")
210 "--with-forward-zones-support")
212 (modify-phases %standard-phases
213 (add-after 'unpack 'patch-configure
215 (substitute* "configure"
216 (("appindicator-0.1")
217 "appindicator3-0.1"))
219 (add-before 'configure 'patch-makefile
221 (substitute* "Makefile.in"
226 ((".*gtk-update-icon-cache.*")
229 (add-after 'install 'remove-systemd
230 (lambda* (#:key outputs #:allow-other-keys)
231 (let* ((out (assoc-ref outputs "out")))
232 (delete-file-recursively
233 (string-append out "/lib/systemd"))
235 (add-after 'remove-systemd 'move-gui
236 (lambda* (#:key outputs #:allow-other-keys)
237 (let* ((out (assoc-ref outputs "out"))
238 (gui (assoc-ref outputs "gui")))
239 (mkdir-p (string-append gui "/bin"))
240 (mkdir-p (string-append gui "/share"))
242 (string-append out "/bin")
243 (string-append gui "/bin"))
245 (string-append out "/share/icons")
246 (string-append gui "/share/icons"))
248 (add-after 'move-gui 'move-nm
249 (lambda* (#:key outputs #:allow-other-keys)
250 (let* ((out (assoc-ref outputs "out"))
251 (nm (assoc-ref outputs "nm")))
252 (mkdir-p (string-append nm "/libexec"))
254 (string-append out "/libexec")
255 (string-append nm "/libexec"))
259 ("pkg-config" ,pkg-config)
260 ("python" ,python-wrapper)))
264 ("libappindicator" ,libappindicator)
266 ("unbound" ,unbound)))
267 (synopsis "DNSSEC protection for the DNS traffic")
268 (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
269 for the DNS traffic. It relies on the Unbound DNS resolver running locally on
270 your system, which performs DNSSEC validation. It reconfigures Unbound in such
271 a way that it will signal it to to use the DHCP obtained forwarders if possible,
272 fallback to doing its own AUTH queries if that fails, and if that fails it will
273 prompt the user with the option to go with insecure DNS only.")
274 (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
275 (license license:bsd-3)))
277 (define-public dnsmasq
284 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
288 "1sjamz1v588qf35m8z6wcqkjk5w12bqhj7d7p48dj8jyn3lgghgz"))))
289 (build-system gnu-build-system)
291 `(("pkg-config" ,pkg-config)))
296 (modify-phases %standard-phases (delete 'configure))
297 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
299 "COPTS=\"-DHAVE_DBUS\"")
300 #:tests? #f)) ; no ‘check’ target
301 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
302 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
304 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
305 to provide DNS and, optionally, DHCP to a small network. It can serve the
306 names of local machines which are not in the global DNS. The DHCP server
307 integrates with the DNS server and allows machines with DHCP-allocated
308 addresses to appear in the DNS with names configured either on each host or in
309 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
310 and BOOTP/TFTP for network booting of diskless machines.")
311 ;; Source files only say GPL2 and GPL3 are allowed.
312 (license (list license:gpl2 license:gpl3))))
314 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
315 ;; different name here.
316 (define-public isc-bind
319 ;; When updating, check whether isc-dhcp's bundled copy should be as well.
324 "https://ftp.isc.org/isc/bind9/" version
325 "/bind-" version ".tar.xz"))
328 "1hcr0q6i2mk83yi12zxjs5q21y3gx7683q99l77ibxfqsx6zc481"))))
329 (build-system gnu-build-system)
330 (outputs `("out" "utils"))
332 ;; It would be nice to add GeoIP and gssapi once there are packages.
339 ("python-ply" ,python-ply)))
342 ("pkg-config" ,pkg-config)))
345 (list (string-append "--with-pkcs11="
346 (assoc-ref %build-inputs "p11-kit")))
348 (modify-phases %standard-phases
349 (add-after 'strip 'move-to-utils
353 (let ((target (string-append (assoc-ref %outputs "utils") file))
354 (src (string-append (assoc-ref %outputs "out") file)))
355 (mkdir-p (dirname target))
358 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
359 "/share/man/man1/dig.1"
360 "/share/man/man1/host.1"
361 "/share/man/man1/nslookup.1"
362 "/share/man/man1/nsupdate.1"))
364 ;; When and if guix provides user namespaces for the build process,
365 ;; then the following can be uncommented and the subsequent "force-test"
366 ;; will not be necessary.
368 ;; (add-before 'check 'set-up-loopback
370 ;; (system "bin/tests/system/ifconfig.sh up")))
373 ;; XXX Even ‘make force-test’ tries to create network interfaces
374 ;; and fails. The only working target is the (trivial) fuzz test.
375 (with-directory-excursion "fuzz"
376 (invoke "make" "check"))
378 (synopsis "Domain Name System (DNS) implementation")
379 (description "BIND is an implementation of the @dfn{Domain Name System}
380 (DNS) protocols for the Internet. It is a reference implementation of those
381 protocols, but it is also production-grade software, suitable for use in
382 high-volume and high-reliability applications. The name BIND stands for
383 \"Berkeley Internet Name Domain\", because the software originated in the
384 early 1980s at the University of California at Berkeley. The @code{utils}
385 output of this package contains the following DNS name servers related command
389 DNS lookup and validation utility
395 Internet name servers interactive query utility
397 Dynamic DNS update utility
399 (home-page "https://www.isc.org/bind/")
400 (license (list license:mpl2.0))))
402 (define-public dnscrypt-proxy
404 (name "dnscrypt-proxy")
409 "https://download.dnscrypt.org/dnscrypt-proxy/"
410 "dnscrypt-proxy-" version ".tar.bz2"))
413 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
414 (modules '((guix build utils)))
416 ;; Delete bundled libltdl. XXX: This package also bundles
417 ;; a modified libevent that cannot currently be removed.
419 (delete-file-recursively "libltdl")
421 (build-system gnu-build-system)
424 (modify-phases %standard-phases
425 (add-after 'unpack 'autoreconf
427 ;; Re-generate build files due to unbundling ltdl.
428 ;; TODO: Prevent generating new libltdl and building it.
429 ;; The system version is still favored and referenced.
430 (invoke "autoreconf" "-vif"))))))
432 `(("pkg-config" ,pkg-config)
433 ("automake" ,automake)
434 ("autoconf" ,autoconf)
435 ("libtool" ,libtool)))
437 `(("libltdl" ,libltdl)
438 ("libsodium" ,libsodium)))
439 (home-page "https://www.dnscrypt.org/")
440 (synopsis "Securely send DNS requests to a remote server")
442 "@command{dnscrypt-proxy} is a tool for securing communications
443 between a client and a DNS resolver. It verifies that responses you get
444 from a DNS provider was actually sent by that provider, and haven't been
445 tampered with. For optimal performance it is recommended to use this as
446 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
447 can also be used as a normal DNS \"server\". A list of public dnscrypt
448 servers is included, and an up-to-date version is available at
449 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
450 (license (list license:isc
451 ;; Libevent and src/ext/queue.h is 3-clause BSD.
454 (define-public dnscrypt-wrapper
456 (name "dnscrypt-wrapper")
461 "https://github.com/cofyc/dnscrypt-wrapper/releases"
462 "/download/v" version "/" name "-v" version ".tar.bz2"))
465 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
466 (build-system gnu-build-system)
468 `(#:make-flags '("CC=gcc")
469 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
472 (modify-phases %standard-phases
473 (add-after 'unpack 'create-configure
475 (invoke "make" "configure"))))))
477 `(("autoconf" ,autoconf)))
479 `(("libevent" ,libevent)
480 ("libsodium" ,libsodium)))
481 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
482 (synopsis "Server-side dnscrypt proxy")
484 "@command{dnscrypt-wrapper} is a tool to expose a name server over
485 the @code{dnscrypt} protocol. It can be used as an endpoint for the
486 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
488 (license (list license:isc
489 ;; Bundled argparse is MIT. TODO: package and unbundle.
491 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
495 (define-public libasr
502 (uri (string-append "https://www.opensmtpd.org/archives/"
503 "libasr-" version ".tar.gz"))
505 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
506 (build-system gnu-build-system)
509 (modify-phases %standard-phases
510 (add-after 'install 'install-documentation
511 (lambda* (#:key outputs #:allow-other-keys)
512 (let ((out (assoc-ref outputs "out")))
513 (install-file "src/asr_run.3"
514 (string-append out "/share/man/man3"))
517 `(("autoconf" ,autoconf)
518 ("automake" ,automake)
520 ("pkg-config" ,pkg-config)))
521 (home-page "https://www.opensmtpd.org")
522 (synopsis "Asynchronous resolver library by the OpenBSD project")
524 "libasr is a free, simple and portable asynchronous resolver library.
525 It runs DNS queries and performs hostname resolution in a fully
526 asynchronous fashion.")
527 (license (list license:isc
528 license:bsd-2 ; last part of getrrsetbyname_async.c
530 (license:non-copyleft "file://LICENSE") ; includes.h
540 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
543 (base32 "0l4ba80ihwg3s2ifhnkmk7rjabrcy5zw6sz4hn0vm9sif6lk9s1v"))))
544 (build-system gnu-build-system)
547 (list "--enable-pie" ; fully benefit from ASLR
550 "--enable-relro-now" ; protect GOT and .dtor areas
551 "--disable-radix-tree"
552 (string-append "--with-libevent="
553 (assoc-ref %build-inputs "libevent"))
554 (string-append "--with-ssl="
555 (assoc-ref %build-inputs "openssl"))
556 "--with-configdir=/etc"
557 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
558 "--with-logfile=/var/log/nsd.log"
559 "--with-pidfile=/var/db/nsd/nsd.pid"
560 "--with-dbfile=/var/db/nsd/nsd.db"
561 "--with-zonesdir=/etc/nsd"
562 "--with-xfrdfile=/var/db/nsd/xfrd.state"
563 "--with-zonelistfile=/var/db/nsd/zone.list")
565 (modify-phases %standard-phases
566 (add-before 'configure 'patch-installation-paths
567 (lambda* (#:key outputs #:allow-other-keys)
568 (let* ((out (assoc-ref outputs "out"))
569 (doc (string-append out "/share/doc/" ,name "-" ,version)))
570 ;; The ‘make install’ target tries to create the parent
571 ;; directories of run-time things like ‘pidfile’ above, and
572 ;; useless empty directories like 'configdir'. Remove such
573 ;; '$(INSTALL)' lines and install the example configuration file
574 ;; in an appropriate location.
575 (substitute* "Makefile.in"
576 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
577 (string-append "#" command))
578 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
579 (string-append doc "/examples/" file-name)))
581 #:tests? #f)) ; no tests
583 `(("libevent" ,libevent)
584 ("openssl" ,openssl)))
585 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
586 (synopsis "Authoritative DNS name server")
587 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
588 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
589 RFC-compliant nameserver.
591 NSD uses zone information compiled via @command{zonec} into a binary database
592 file (@file{nsd.db}). This allows fast startup of the name service daemon and
593 allows syntax-structural errors in zone files to be flagged at compile time,
594 before being made available to NSD service itself. However, most traditional
595 BIND-style zone files can be directly imported into NSD without modification.
597 The collection of programs and processes that make up NSD are designed so that
598 the daemon itself runs as a non-privileged user and can be easily configured to
599 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
600 to result in system-wide compromise.")
601 (license (list license:bsd-3))))
603 (define-public unbound
610 (uri (string-append "https://www.unbound.net/downloads/unbound-"
613 (base32 "18dj7migq6379hps59793457l81s3z7dll3y0fj6qcmhjlx08m59"))))
614 (build-system gnu-build-system)
615 (outputs '("out" "python"))
621 ("libevent" ,libevent)
622 ("protobuf" ,protobuf)
623 ("python-wrapper" ,python-wrapper)
624 ("openssl" ,openssl)))
627 (list "--disable-static" ; save space and non-determinism in libunbound.a
629 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
631 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
633 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
634 "--with-pythonmodule" "--with-pyunbound")
636 (modify-phases %standard-phases
637 (add-after 'configure 'fix-python-site-package-path
638 ;; Move python modules into their own output.
639 (lambda* (#:key outputs #:allow-other-keys)
640 (let ((pyout (assoc-ref outputs "python"))
641 (ver ,(version-major+minor (package-version python))))
642 (substitute* "Makefile"
643 (("^PYTHON_SITE_PKG=.*$")
646 pyout "/lib/python-" ver "/site-packages\n"))))
648 (add-before 'check 'fix-missing-nss-for-tests
649 ;; Unfortunately, the package's unittests involve some checks
650 ;; looking up protocols and services which are not provided
651 ;; by the minimalistic build environment, in particular,
652 ;; /etc/protocols and /etc/services are missing.
653 ;; Also, after plain substitution of protocol and service names
654 ;; in the test data, the tests still fail because the
655 ;; corresponding Resource Records have been signed by
657 ;; The following LD_PRELOAD library overwrites the glibc
658 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
659 ;; ‘getservbyport’ providing the few records required for the
660 ;; unit tests to pass.
661 (lambda* (#:key inputs outputs #:allow-other-keys)
662 (let* ((source (assoc-ref %build-inputs "source"))
663 (gcc (assoc-ref %build-inputs "gcc")))
664 (call-with-output-file "/tmp/nss_preload.c"
666 (display "#include <stdlib.h>
672 struct protoent *getprotobyname(const char *name) {
673 struct protoent *p = malloc(sizeof(struct protoent));
674 p->p_aliases = malloc(sizeof(char*));
675 if (strcasecmp(name, \"tcp\") == 0) {
678 p->p_aliases[0] = \"TCP\";
679 } else if (strcasecmp(name, \"udp\") == 0) {
682 p->p_aliases[0] = \"UDP\";
688 struct protoent *getprotobynumber(int proto) {
689 struct protoent *p = malloc(sizeof(struct protoent));
690 p->p_aliases = malloc(sizeof(char*));
695 p->p_aliases[0] = \"TCP\";
700 p->p_aliases[0] = \"UDP\";
709 struct servent *getservbyname(const char *name, const char *proto) {
710 struct servent *s = malloc(sizeof(struct servent));
711 char* buf = malloc((strlen(proto)+1)*sizeof(char));
713 s->s_aliases = malloc(sizeof(char*));
714 s->s_aliases[0] = NULL;
715 if (strcasecmp(name, \"domain\") == 0) {
716 s->s_name = \"domain\";
717 s->s_port = htons(53);
724 struct servent *getservbyport(int port, const char *proto) {
726 struct servent *s = malloc(sizeof(struct servent));
728 s->s_aliases = malloc(sizeof(char*));
729 s->s_aliases[0] = NULL;
732 s->s_name = \"domain\";
734 s->s_proto = \"udp\";
742 (invoke (string-append gcc "/bin/gcc")
743 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
744 "/tmp/nss_preload.c")
745 ;; The preload library only affects the unittests.
746 (substitute* "Makefile"
748 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
750 (home-page "https://www.unbound.net")
751 (synopsis "Validating, recursive, and caching DNS resolver")
753 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
754 validation of results. It implements only a minimal amount of authoritative
755 service to prevent leakage to the root nameservers: forward lookups for
756 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
757 served by AS112. Stub and forward zones are supported.")
758 (license license:bsd-4)))
760 (define-public yadifa
765 (let ((build "9916"))
769 (string-append "https://www.yadifa.eu/sites/default/files/releases/"
770 "yadifa-" version "-" build ".tar.gz"))
772 (base32 "1m1j7q1f0682xig8qign5ms52igix8pd45fds7p5j285dvrfa4xd")))))
773 (build-system gnu-build-system)
777 `(("openssl" ,openssl)))
780 (modify-phases %standard-phases
781 (add-before 'configure 'omit-example-configurations
783 (substitute* "Makefile.in"
786 (add-after 'configure 'omit-spurious-references
788 ;; The many Makefile.in grep this(!) to #define BUILD_OPTIONS.
789 (substitute* "config.log"
790 (("(=/gnu/store/)[^-]*" _ match)
791 (string-append match "...")))
794 (list "--sysconfdir=/etc"
795 "--localstatedir=/var"
796 "--enable-shared" "--disable-static"
797 "--disable-build-timestamp"))) ; build reproducibly
798 (home-page "https://www.yadifa.eu/")
799 (synopsis "Authoritative DNS name server")
800 (description "YADIFA is an authoritative name server for the @dfn{Domain
801 Name System} (DNS). It aims for both higher performance and a smaller memory
802 footprint than other implementations, while remaining fully RFC-compliant.
803 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
804 Extensions} (DNSSEC).")
805 (license license:bsd-3)))
815 (url "https://gitlab.nic.cz/knot/knot-dns")
816 (commit (string-append "v" version))))
817 (file-name (git-file-name name version))
819 (base32 "0xzig9l91wj6x23mh75vw2r51ihrgx916c7wxvpcfnwrqsv4f3hy"))
820 (modules '((guix build utils)))
823 ;; Remove Ragel-generated C files. We'll recreate them below.
824 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
825 (delete-file "src/libknot/yparser/ypbody.c")
826 ;; Remove bundled library to ensure we always use the system's.
827 (delete-file-recursively "src/contrib/libbpf")
829 (build-system gnu-build-system)
830 (outputs (list "out" "doc" "lib" "tools"))
833 (list (string-append "--docdir=" (assoc-ref %outputs "doc")
834 "/share/" ,name "-" ,version)
835 (string-append "--infodir=" (assoc-ref %outputs "doc")
837 (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib")
839 "--localstatedir=/var"
840 "--enable-dnstap" ; let tools read/write capture files
841 "--enable-fastparser" ; disabled by default when .git/ exists
842 "--enable-xdp=auto" ; XXX [=yes] currently means =embedded
843 "--with-module-dnstap=yes") ; detailed query capturing & logging
845 (modify-phases %standard-phases
846 (add-after 'unpack 'link-missing-libbpf-dependency
847 ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
848 ;; zlib in its Requires.private (not Requires) field. Add it here.
850 (substitute* "configure.ac"
851 (("enable_xdp=yes" match)
852 (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))
854 (add-before 'bootstrap 'update-parser
856 (with-directory-excursion "src"
857 (invoke "sh" "../scripts/update-parser.sh"))))
858 (add-before 'configure 'disable-directory-pre-creation
860 ;; Don't install empty directories like ‘/etc’ outside the store.
861 ;; This is needed even when using ‘make config_dir=... install’.
862 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
864 (add-after 'build 'build-info
866 (invoke "make" "info")))
868 (lambda* (#:key outputs #:allow-other-keys)
869 (let* ((out (assoc-ref outputs "out"))
870 (doc (string-append out "/share/doc/" ,name "-" ,version))
871 (etc (string-append doc "/examples/etc")))
873 (string-append "config_dir=" etc)
875 (add-after 'install 'install-info
877 (invoke "make" "install-info")))
878 (add-after 'install 'break-circular-:lib->:out-reference
879 (lambda* (#:key outputs #:allow-other-keys)
880 (let ((lib (assoc-ref outputs "lib")))
881 (for-each (lambda (file)
883 (("(prefix=).*" _ assign)
884 (string-append assign lib "\n"))))
885 (find-files lib "\\.pc$"))
887 (add-after 'install 'split-:tools
888 (lambda* (#:key outputs #:allow-other-keys)
889 (let* ((out (assoc-ref outputs "out"))
890 (tools (assoc-ref outputs "tools")))
891 (mkdir-p (string-append tools "/share/man"))
892 (rename-file (string-append out "/bin")
893 (string-append tools "/bin"))
894 (rename-file (string-append out "/share/man/man1")
895 (string-append tools "/share/man/man1"))
898 `(("autoconf" ,autoconf)
899 ("automake" ,automake)
901 ("pkg-config" ,pkg-config)
902 ("python-sphinx" ,python-sphinx)
904 ("texinfo" ,texinfo)))
910 ("libcap-ng" ,libcap-ng)
914 ("libnghttp2" ,nghttp2 "lib")
918 ("protobuf-c" ,protobuf-c)))
919 (home-page "https://www.knot-dns.cz/")
920 (synopsis "Authoritative DNS name server")
921 (description "Knot DNS is an authoritative name server for the @dfn{Domain
922 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
923 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
924 number of programming techniques to improve speed. For example, the responder
925 is completely lock-free, resulting in a very high response rate. Other features
926 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
927 synthesis, and on-the-fly re-configuration.")
930 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
931 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
933 license:lgpl2.0+ ; parts of scr/contrib/ucw
934 license:public-domain ; src/contrib/fnv and possibly murmurhash3
935 license:gpl3+)))) ; everything else
937 (define-public knot-resolver
939 (name "knot-resolver")
943 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
944 "knot-resolver-" version ".tar.xz"))
947 "09jqy23q1pgj76y2qd1xfk72wwmypnyawm3span3gx00qi2bfdxa"))))
948 (build-system meson-build-system)
949 (outputs '("out" "doc"))
951 '(#:configure-flags '("-Ddoc=enabled")
953 (modify-phases %standard-phases
954 (add-before 'configure 'disable-default-ta
956 ;; Disable the default managed root TA, since we don't have
957 ;; write access to the keyfile and its directory in store.
958 (substitute* "daemon/lua/sandbox.lua.in"
959 (("^trust_anchors\\.add_file.*") ""))
961 (add-after 'build 'build-doc
963 (invoke "ninja" "doc")))
964 (add-after 'install 'move-doc
965 (lambda* (#:key outputs #:allow-other-keys)
966 ;; Move the manual and the example configuration files to the
968 (let ((out (assoc-ref outputs "out"))
969 (doc (assoc-ref outputs "doc")))
970 (mkdir-p (string-append doc "/share/doc/knot-resolver"))
973 (rename-file (string-append out "/share/" dir)
974 (string-append doc "/share/" dir)))
975 '("doc/knot-resolver/examples"
976 "doc/knot-resolver/html"
978 (add-after 'install 'wrap-binary
979 (lambda* (#:key inputs outputs #:allow-other-keys)
980 (let* ((out (assoc-ref outputs "out"))
981 (lua-* (map cdr (filter
983 (string-prefix? "lua-" (car input)))
985 (lua-path (lambda (p)
986 (string-append p "/share/lua/5.1/?.lua")))
987 (lua-cpath (lambda (p)
988 (string-append p "/lib/lua/5.1/?.so"))))
989 (wrap-program (string-append out "/sbin/kresd")
990 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
991 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
994 `(("cmocka" ,cmocka) ; for unit tests
996 ("protobuf-c" ,protobuf-c)
997 ("pkg-config" ,pkg-config)
998 ("python-breathe" ,python-breathe)
999 ("python-sphinx" ,python-sphinx)
1000 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
1001 ("texinfo" ,texinfo)))
1005 ("knot:lib" ,knot "lib")
1009 ;; TODO: Add optional lua modules: basexx and psl.
1010 ("lua-bitop" ,lua5.1-bitop)
1011 ("nghttp2" ,nghttp2 "lib")))
1012 (home-page "https://www.knot-resolver.cz/")
1013 (synopsis "Caching validating DNS resolver")
1015 "Knot Resolver is a caching full resolver implementation written in C and
1016 LuaJIT, both a resolver library and a daemon.")
1017 (license (list license:gpl3+
1018 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
1023 (define-public ddclient
1031 (url "https://github.com/ddclient/ddclient")
1032 (commit (string-append "v" version))))
1033 (file-name (git-file-name name version))
1035 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
1036 (build-system trivial-build-system) ; no Makefile.PL
1041 `(("inetutils" ,inetutils) ; logger
1042 ("net-tools" ,net-tools)
1043 ("perl-data-validate-ip" ,perl-data-validate-ip)
1044 ("perl-digest-sha1" ,perl-digest-sha1)
1045 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
1047 `(#:modules ((guix build utils)
1052 (use-modules (guix build utils)
1055 (setenv "PATH" (string-append
1056 (assoc-ref %build-inputs "bash") "/bin" ":"
1057 (assoc-ref %build-inputs "perl") "/bin"))
1059 ;; Copy the (read-only) source into the (writable) build directory.
1060 (copy-recursively (assoc-ref %build-inputs "source") ".")
1063 (let* ((out (assoc-ref %outputs "out"))
1064 (bin (string-append out "/bin")))
1065 (let ((file "ddclient"))
1067 (("/usr/bin/perl") (which "perl"))
1068 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1069 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1070 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1071 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1072 (("\\$cachedir\\$program\\.cache")
1073 "/var/cache/ddclient/ddclient.cache"))
1074 (install-file file bin)
1075 (wrap-program (string-append bin "/" file)
1078 ,@(map (lambda (input)
1081 (string-append store "/bin"))))
1087 (((? (cut string-prefix? "perl-" <>) name) . dir)
1088 (string-append dir "/lib/perl5/site_perl"))
1091 (for-each (cut install-file <> (string-append out
1093 (find-files "." "sample.*$"))))))
1094 (home-page "https://ddclient.net/")
1095 (synopsis "Address updating utility for dynamic DNS services")
1096 (description "This package provides a client to update dynamic IP
1097 addresses with several dynamic DNS service providers, such as
1098 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1100 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1101 access a machine with a dynamic IP address.
1103 The client supports both dynamic and (near) static services, as well as MX
1104 record and alternative name management. It caches the address, and only
1105 attempts the update when it has changed.")
1106 (license license:gpl2+)))
1109 ;; There have been no releases yet, hence this commit.
1110 (let ((revision "0")
1111 (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
1114 (version (git-version "0.0" revision commit))
1118 (url "https://github.com/handshake-org/hnsd")
1122 "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
1123 (file-name (git-file-name name version))
1124 (modules '((guix build utils)))
1127 ;; Delete the bundled copy of libuv.
1128 (delete-file-recursively "uv")
1129 (substitute* "configure.ac"
1130 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1131 (substitute* "Makefile.am"
1132 (("SUBDIRS = uv") "\n")
1133 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1135 ;; Make sure the 'hnsd' binary is installed and
1136 ;; dynamically-linked.
1137 (("noinst_PROGRAMS") "bin_PROGRAMS")
1138 (("hnsd_LDFLAGS = -static") ""))
1140 ;; This script tries to chdir to "uv" and doesn't do more
1141 ;; than "autoreconf" so remove it.
1142 (delete-file "autogen.sh")
1144 (build-system gnu-build-system)
1146 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1148 `(("autoconf" ,autoconf)
1149 ("automake" ,automake)
1150 ("libtool" ,libtool)))
1152 `(("unbound" ,unbound)
1154 (home-page "https://www.handshake.org/")
1155 (synopsis "Resolver daemon for the Handshake naming protocol")
1157 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1158 System (HNS) peer-to-peer network.")
1159 (license license:expat))))
1161 (define-public libmicrodns
1163 (name "libmicrodns")
1167 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1168 "releases/download/" version "/microdns-"
1172 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1173 (build-system meson-build-system)
1174 (home-page "https://github.com/videolabs/libmicrodns")
1175 (synopsis "Minimal mDNS resolver library")
1176 (description "@code{libmicrodns} provides a minimal implementation of a
1177 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1178 a zero-config service that allows one to resolve host names to IP addresses in
1180 (license license:lgpl2.1)))
1182 (define-public public-suffix-list
1183 ;; Mozilla releases the official list here:
1185 ;; https://publicsuffix.org/list/public_suffix_list.dat
1187 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1188 ;; so its contents will change over time. If you update this commit, please
1189 ;; make sure that the new commit refers to a list which is identical to the
1190 ;; officially published list available from the URL above.
1191 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1193 (name "public-suffix-list")
1194 (version (git-version "0" "1" commit))
1198 (url "https://github.com/publicsuffix/list")
1200 (file-name (git-file-name name version))
1203 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1204 (build-system trivial-build-system)
1206 `(#:modules ((guix build utils))
1209 (use-modules (guix build utils))
1210 (let* ((out (assoc-ref %outputs "out"))
1211 ;; Install to /share because that is where "read-only
1212 ;; architecture-independent data files" should go (see:
1213 ;; (standards) Directory Variables). Include the version in
1214 ;; the directory name so that if multiple versions are ever
1215 ;; installed in the same profile, they will not conflict.
1216 (destination (string-append
1217 out "/share/public-suffix-list-" ,version))
1218 (source (assoc-ref %build-inputs "source")))
1219 (with-directory-excursion source
1220 (install-file "public_suffix_list.dat" destination)
1221 (install-file "LICENSE" destination))
1223 (home-page "https://publicsuffix.org/")
1224 (synopsis "Database of current and historical DNS suffixes")
1225 (description "This is the Public Suffix List maintained by Mozilla. A
1226 \"public suffix\" is one under which Internet users can (or historically
1227 could) directly register names in the Domain Name System (DNS). Some examples
1228 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1229 known public suffixes.")
1230 (license license:mpl2.0))))
1232 (define-public maradns
1235 (version "3.5.0007")
1239 (uri (string-append "https://maradns.samiam.org/download/"
1240 (version-major+minor version) "/"
1241 version "/maradns-" version ".tar.xz"))
1243 (base32 "0bc19xylg4whww9qaj5i4izwxcrh0c0ja7l1pfcn2la02hlvg1a6"))))
1244 (build-system gnu-build-system)
1246 `(#:tests? #f ; need to be root to run tests
1249 ,(string-append "CC=" (cc-for-target))
1250 (string-append "PREFIX=" %output)
1251 (string-append "RPM_BUILD_ROOT=" %output))
1253 (modify-phases %standard-phases
1255 (lambda* (#:key native-inputs target #:allow-other-keys)
1256 ;; make_32bit_tables generates a header file that is used during
1257 ;; compilation. Hence, during cross compilation, it should be
1258 ;; built for the host system.
1260 (substitute* "rng/Makefile"
1261 (("\\$\\(CC\\) -o make_32bit_tables")
1262 (string-append (assoc-ref native-inputs "gcc")
1263 "/bin/gcc -o make_32bit_tables"))))
1264 (invoke "./configure")))
1265 (add-before 'install 'create-install-directories
1266 (lambda* (#:key outputs #:allow-other-keys)
1267 (let ((out (assoc-ref outputs "out")))
1268 (for-each (lambda (dir)
1269 (mkdir-p (string-append out dir)))
1270 (list "/bin" "/sbin" "/etc"
1275 (home-page "https://maradns.samiam.org")
1276 (synopsis "Small lightweight DNS server")
1277 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1278 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1279 and TCP-capable recursive DNS server for finding domains on the internet.")
1280 (license license:bsd-2)))
1282 (define-public openresolv
1288 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1289 "openresolv-" version ".tar.xz"))
1292 "01ms6c087la4hk0f0w6n2vpsb7dg4kklah2rqyhz88p0vr9bqy20"))
1294 (search-patches "openresolv-restartcmd-guix.patch"))))
1295 (build-system gnu-build-system)
1297 `(#:tests? #f ; No test suite
1299 (list (string-append "--sysconfdir=/etc"))
1301 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
1302 (home-page "https://roy.marples.name/projects/openresolv/")
1303 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1304 (description "openresolv is an implementation of @command{resolvconf}, the
1305 middleman between the network configuration services and
1306 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1307 stores, removes and lists a full @file{resolv.conf} generated for the
1308 interface. It then calls all the helper scripts it knows about so it can
1309 configure the real @file{/etc/resolv.conf} and optionally any local
1310 nameservers other than libc.")
1311 (license license:bsd-2)))