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 "0305a0c3snwqcv77sipyynr55xip1fp2843yn04pc4vk9g39acb0"))))
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.
320 ;; The BIND release notes are available here:
321 ;; https://www.isc.org/bind/
326 "https://ftp.isc.org/isc/bind9/" version
327 "/bind-" version ".tar.xz"))
330 "0zys8hk08zzrw57x0vmzv6zx0a7vjj6qk5qh8jmrqd7x269sy54r"))))
331 (build-system gnu-build-system)
332 (outputs `("out" "utils"))
334 ;; It would be nice to add GeoIP and gssapi once there are packages.
341 ("python-ply" ,python-ply)))
344 ("pkg-config" ,pkg-config)))
347 (list (string-append "--with-pkcs11="
348 (assoc-ref %build-inputs "p11-kit")))
350 (modify-phases %standard-phases
351 (add-after 'strip 'move-to-utils
355 (let ((target (string-append (assoc-ref %outputs "utils") file))
356 (src (string-append (assoc-ref %outputs "out") file)))
357 (mkdir-p (dirname target))
360 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
361 "/share/man/man1/dig.1"
362 "/share/man/man1/host.1"
363 "/share/man/man1/nslookup.1"
364 "/share/man/man1/nsupdate.1"))
366 ;; When and if guix provides user namespaces for the build process,
367 ;; then the following can be uncommented and the subsequent "force-test"
368 ;; will not be necessary.
370 ;; (add-before 'check 'set-up-loopback
372 ;; (system "bin/tests/system/ifconfig.sh up")))
375 ;; XXX Even ‘make force-test’ tries to create network interfaces
376 ;; and fails. The only working target is the (trivial) fuzz test.
377 (with-directory-excursion "fuzz"
378 (invoke "make" "check"))
380 (synopsis "@acronym{DNS, Domain Name System} implementation")
381 (description "BIND implements the @acronym{DNS, Domain Name System}
382 protocols for the Internet. It is both a reference implementation of those
383 protocols and production-grade software, suitable for use in high-volume and
384 high-reliability applications.
386 The name stands for \"Berkeley Internet Name Domain\" because the software
387 originated in the early 1980s at the University of California at Berkeley.
389 The @code{utils} output of this package contains the following command line
390 utilities related to DNS name servers:
394 DNS lookup and validation utility
400 Internet name servers interactive query utility
402 Dynamic DNS update utility
404 (home-page "https://www.isc.org/bind/")
405 (license (list license:mpl2.0))))
407 (define-public dnscrypt-proxy
409 (name "dnscrypt-proxy")
414 "https://download.dnscrypt.org/dnscrypt-proxy/"
415 "dnscrypt-proxy-" version ".tar.bz2"))
418 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
419 (modules '((guix build utils)))
421 ;; Delete bundled libltdl. XXX: This package also bundles
422 ;; a modified libevent that cannot currently be removed.
424 (delete-file-recursively "libltdl")
426 (build-system gnu-build-system)
429 (modify-phases %standard-phases
430 (add-after 'unpack 'autoreconf
432 ;; Re-generate build files due to unbundling ltdl.
433 ;; TODO: Prevent generating new libltdl and building it.
434 ;; The system version is still favored and referenced.
435 (invoke "autoreconf" "-vif"))))))
437 `(("pkg-config" ,pkg-config)
438 ("automake" ,automake)
439 ("autoconf" ,autoconf)
440 ("libtool" ,libtool)))
442 `(("libltdl" ,libltdl)
443 ("libsodium" ,libsodium)))
444 (home-page "https://www.dnscrypt.org/")
445 (synopsis "Securely send DNS requests to a remote server")
447 "@command{dnscrypt-proxy} is a tool for securing communications
448 between a client and a DNS resolver. It verifies that responses you get
449 from a DNS provider was actually sent by that provider, and haven't been
450 tampered with. For optimal performance it is recommended to use this as
451 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
452 can also be used as a normal DNS \"server\". A list of public dnscrypt
453 servers is included, and an up-to-date version is available at
454 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
455 (license (list license:isc
456 ;; Libevent and src/ext/queue.h is 3-clause BSD.
459 (define-public dnscrypt-wrapper
461 (name "dnscrypt-wrapper")
466 "https://github.com/cofyc/dnscrypt-wrapper/releases"
467 "/download/v" version "/" name "-v" version ".tar.bz2"))
470 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
471 (build-system gnu-build-system)
473 `(#:make-flags '("CC=gcc")
474 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
477 (modify-phases %standard-phases
478 (add-after 'unpack 'create-configure
480 (invoke "make" "configure"))))))
482 `(("autoconf" ,autoconf)))
484 `(("libevent" ,libevent)
485 ("libsodium" ,libsodium)))
486 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
487 (synopsis "Server-side dnscrypt proxy")
489 "@command{dnscrypt-wrapper} is a tool to expose a name server over
490 the @code{dnscrypt} protocol. It can be used as an endpoint for the
491 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
493 (license (list license:isc
494 ;; Bundled argparse is MIT. TODO: package and unbundle.
496 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
500 (define-public libasr
507 (uri (string-append "https://www.opensmtpd.org/archives/"
508 "libasr-" version ".tar.gz"))
510 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
511 (build-system gnu-build-system)
514 (modify-phases %standard-phases
515 (add-after 'install 'install-documentation
516 (lambda* (#:key outputs #:allow-other-keys)
517 (let ((out (assoc-ref outputs "out")))
518 (install-file "src/asr_run.3"
519 (string-append out "/share/man/man3"))
522 `(("autoconf" ,autoconf)
523 ("automake" ,automake)
525 ("pkg-config" ,pkg-config)))
526 (home-page "https://www.opensmtpd.org")
527 (synopsis "Asynchronous resolver library by the OpenBSD project")
529 "libasr is a free, simple and portable asynchronous resolver library.
530 It runs DNS queries and performs hostname resolution in a fully
531 asynchronous fashion.")
532 (license (list license:isc
533 license:bsd-2 ; last part of getrrsetbyname_async.c
535 (license:non-copyleft "file://LICENSE") ; includes.h
545 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
548 (base32 "0wj490rxqs86z8s4lxjwk06ry5pvkdqqyq1cf83z7mxk60zb98kx"))))
549 (build-system gnu-build-system)
552 (list "--enable-pie" ; fully benefit from ASLR
555 "--enable-relro-now" ; protect GOT and .dtor areas
556 "--disable-radix-tree"
557 (string-append "--with-libevent="
558 (assoc-ref %build-inputs "libevent"))
559 (string-append "--with-ssl="
560 (assoc-ref %build-inputs "openssl"))
561 "--with-configdir=/etc"
562 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
563 "--with-logfile=/var/log/nsd.log"
564 "--with-pidfile=/var/db/nsd/nsd.pid"
565 "--with-dbfile=/var/db/nsd/nsd.db"
566 "--with-zonesdir=/etc/nsd"
567 "--with-xfrdfile=/var/db/nsd/xfrd.state"
568 "--with-zonelistfile=/var/db/nsd/zone.list")
570 (modify-phases %standard-phases
571 (add-before 'configure 'patch-installation-paths
572 (lambda* (#:key outputs #:allow-other-keys)
573 (let* ((out (assoc-ref outputs "out"))
574 (doc (string-append out "/share/doc/" ,name "-" ,version)))
575 ;; The ‘make install’ target tries to create the parent
576 ;; directories of run-time things like ‘pidfile’ above, and
577 ;; useless empty directories like 'configdir'. Remove such
578 ;; '$(INSTALL)' lines and install the example configuration file
579 ;; in an appropriate location.
580 (substitute* "Makefile.in"
581 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
582 (string-append "#" command))
583 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
584 (string-append doc "/examples/" file-name)))
586 #:tests? #f)) ; no tests
588 `(("libevent" ,libevent)
589 ("openssl" ,openssl)))
590 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
591 (synopsis "Authoritative DNS name server")
592 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
593 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
594 RFC-compliant nameserver.
596 NSD uses zone information compiled via @command{zonec} into a binary database
597 file (@file{nsd.db}). This allows fast startup of the name service daemon and
598 allows syntax-structural errors in zone files to be flagged at compile time,
599 before being made available to NSD service itself. However, most traditional
600 BIND-style zone files can be directly imported into NSD without modification.
602 The collection of programs and processes that make up NSD are designed so that
603 the daemon itself runs as a non-privileged user and can be easily configured to
604 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
605 to result in system-wide compromise.")
606 (license (list license:bsd-3))))
608 (define-public unbound
615 (uri (string-append "https://www.unbound.net/downloads/unbound-"
618 (base32 "18dj7migq6379hps59793457l81s3z7dll3y0fj6qcmhjlx08m59"))))
619 (build-system gnu-build-system)
620 (outputs '("out" "python"))
626 ("libevent" ,libevent)
627 ("protobuf" ,protobuf)
628 ("python-wrapper" ,python-wrapper)
629 ("openssl" ,openssl)))
632 (list "--disable-static" ; save space and non-determinism in libunbound.a
634 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
636 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
638 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
639 "--with-pythonmodule" "--with-pyunbound")
641 (modify-phases %standard-phases
642 (add-after 'configure 'fix-python-site-package-path
643 ;; Move python modules into their own output.
644 (lambda* (#:key outputs #:allow-other-keys)
645 (let ((pyout (assoc-ref outputs "python"))
646 (ver ,(version-major+minor (package-version python))))
647 (substitute* "Makefile"
648 (("^PYTHON_SITE_PKG=.*$")
651 pyout "/lib/python-" ver "/site-packages\n"))))
653 (add-before 'check 'fix-missing-nss-for-tests
654 ;; Unfortunately, the package's unittests involve some checks
655 ;; looking up protocols and services which are not provided
656 ;; by the minimalistic build environment, in particular,
657 ;; /etc/protocols and /etc/services are missing.
658 ;; Also, after plain substitution of protocol and service names
659 ;; in the test data, the tests still fail because the
660 ;; corresponding Resource Records have been signed by
662 ;; The following LD_PRELOAD library overwrites the glibc
663 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
664 ;; ‘getservbyport’ providing the few records required for the
665 ;; unit tests to pass.
666 (lambda* (#:key inputs outputs #:allow-other-keys)
667 (let* ((source (assoc-ref %build-inputs "source"))
668 (gcc (assoc-ref %build-inputs "gcc")))
669 (call-with-output-file "/tmp/nss_preload.c"
671 (display "#include <stdlib.h>
677 struct protoent *getprotobyname(const char *name) {
678 struct protoent *p = malloc(sizeof(struct protoent));
679 p->p_aliases = malloc(sizeof(char*));
680 if (strcasecmp(name, \"tcp\") == 0) {
683 p->p_aliases[0] = \"TCP\";
684 } else if (strcasecmp(name, \"udp\") == 0) {
687 p->p_aliases[0] = \"UDP\";
693 struct protoent *getprotobynumber(int proto) {
694 struct protoent *p = malloc(sizeof(struct protoent));
695 p->p_aliases = malloc(sizeof(char*));
700 p->p_aliases[0] = \"TCP\";
705 p->p_aliases[0] = \"UDP\";
714 struct servent *getservbyname(const char *name, const char *proto) {
715 struct servent *s = malloc(sizeof(struct servent));
716 char* buf = malloc((strlen(proto)+1)*sizeof(char));
718 s->s_aliases = malloc(sizeof(char*));
719 s->s_aliases[0] = NULL;
720 if (strcasecmp(name, \"domain\") == 0) {
721 s->s_name = \"domain\";
722 s->s_port = htons(53);
729 struct servent *getservbyport(int port, const char *proto) {
731 struct servent *s = malloc(sizeof(struct servent));
733 s->s_aliases = malloc(sizeof(char*));
734 s->s_aliases[0] = NULL;
737 s->s_name = \"domain\";
739 s->s_proto = \"udp\";
747 (invoke (string-append gcc "/bin/gcc")
748 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
749 "/tmp/nss_preload.c")
750 ;; The preload library only affects the unittests.
751 (substitute* "Makefile"
753 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
755 (home-page "https://www.unbound.net")
756 (synopsis "Validating, recursive, and caching DNS resolver")
758 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
759 validation of results. It implements only a minimal amount of authoritative
760 service to prevent leakage to the root nameservers: forward lookups for
761 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
762 served by AS112. Stub and forward zones are supported.")
763 (license license:bsd-4)))
765 (define-public yadifa
770 (let ((build "9916"))
774 (string-append "https://www.yadifa.eu/sites/default/files/releases/"
775 "yadifa-" version "-" build ".tar.gz"))
777 (base32 "1m1j7q1f0682xig8qign5ms52igix8pd45fds7p5j285dvrfa4xd")))))
778 (build-system gnu-build-system)
782 `(("openssl" ,openssl)))
785 (modify-phases %standard-phases
786 (add-before 'configure 'omit-example-configurations
788 (substitute* "Makefile.in"
791 (add-after 'configure 'omit-spurious-references
793 ;; The many Makefile.in grep this(!) to #define BUILD_OPTIONS.
794 (substitute* "config.log"
795 (("(=/gnu/store/)[^-]*" _ match)
796 (string-append match "...")))
799 (list "--sysconfdir=/etc"
800 "--localstatedir=/var"
801 "--enable-shared" "--disable-static"
802 "--disable-build-timestamp"))) ; build reproducibly
803 (home-page "https://www.yadifa.eu/")
804 (synopsis "Authoritative DNS name server")
805 (description "YADIFA is an authoritative name server for the @dfn{Domain
806 Name System} (DNS). It aims for both higher performance and a smaller memory
807 footprint than other implementations, while remaining fully RFC-compliant.
808 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
809 Extensions} (DNSSEC).")
810 (license license:bsd-3)))
820 (url "https://gitlab.nic.cz/knot/knot-dns")
821 (commit (string-append "v" version))))
822 (file-name (git-file-name name version))
824 (base32 "1mbjl18zi8yxs7pa3395lqjwdw0agjbfpl32x42i6d9zb8fsblzs"))
825 (modules '((guix build utils)))
828 ;; Remove Ragel-generated C files. We'll recreate them below.
829 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
830 (delete-file "src/libknot/yparser/ypbody.c")
831 ;; Remove bundled library to ensure we always use the system's.
832 (delete-file-recursively "src/contrib/libbpf")
834 (build-system gnu-build-system)
835 (outputs (list "out" "doc" "lib" "tools"))
838 (list (string-append "--docdir=" (assoc-ref %outputs "doc")
839 "/share/" ,name "-" ,version)
840 (string-append "--infodir=" (assoc-ref %outputs "doc")
842 (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib")
844 "--localstatedir=/var"
845 "--enable-dnstap" ; let tools read/write capture files
846 "--enable-fastparser" ; disabled by default when .git/ exists
847 "--enable-xdp=auto" ; XXX [=yes] currently means =embedded
848 "--with-module-dnstap=yes") ; detailed query capturing & logging
850 (modify-phases %standard-phases
851 (add-after 'unpack 'link-missing-libbpf-dependency
852 ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
853 ;; zlib in its Requires.private (not Requires) field. Add it here.
855 (substitute* "configure.ac"
856 (("enable_xdp=yes" match)
857 (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))
859 (add-before 'bootstrap 'update-parser
861 (with-directory-excursion "src"
862 (invoke "sh" "../scripts/update-parser.sh"))))
863 (add-before 'configure 'disable-directory-pre-creation
865 ;; Don't install empty directories like ‘/etc’ outside the store.
866 ;; This is needed even when using ‘make config_dir=... install’.
867 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
869 (add-after 'build 'build-info
871 (invoke "make" "info")))
873 (lambda* (#:key outputs #:allow-other-keys)
874 (let* ((out (assoc-ref outputs "out"))
875 (doc (string-append out "/share/doc/" ,name "-" ,version))
876 (etc (string-append doc "/examples/etc")))
878 (string-append "config_dir=" etc)
880 (add-after 'install 'install-info
882 (invoke "make" "install-info")))
883 (add-after 'install 'break-circular-:lib->:out-reference
884 (lambda* (#:key outputs #:allow-other-keys)
885 (let ((lib (assoc-ref outputs "lib")))
886 (for-each (lambda (file)
888 (("(prefix=).*" _ assign)
889 (string-append assign lib "\n"))))
890 (find-files lib "\\.pc$"))
892 (add-after 'install 'split-:tools
893 (lambda* (#:key outputs #:allow-other-keys)
894 (let* ((out (assoc-ref outputs "out"))
895 (tools (assoc-ref outputs "tools")))
896 (mkdir-p (string-append tools "/share/man"))
897 (rename-file (string-append out "/bin")
898 (string-append tools "/bin"))
899 (rename-file (string-append out "/share/man/man1")
900 (string-append tools "/share/man/man1"))
903 `(("autoconf" ,autoconf)
904 ("automake" ,automake)
906 ("pkg-config" ,pkg-config)
907 ("python-sphinx" ,python-sphinx)
909 ("texinfo" ,texinfo)))
915 ("libcap-ng" ,libcap-ng)
919 ("libnghttp2" ,nghttp2 "lib")
923 ("protobuf-c" ,protobuf-c)))
924 (home-page "https://www.knot-dns.cz/")
925 (synopsis "Authoritative DNS name server")
926 (description "Knot DNS is an authoritative name server for the @dfn{Domain
927 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
928 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
929 number of programming techniques to improve speed. For example, the responder
930 is completely lock-free, resulting in a very high response rate. Other features
931 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
932 synthesis, and on-the-fly re-configuration.")
935 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
936 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
938 license:lgpl2.0+ ; parts of scr/contrib/ucw
939 license:public-domain ; src/contrib/fnv and possibly murmurhash3
940 license:gpl3+)))) ; everything else
942 (define-public knot-resolver
944 (name "knot-resolver")
948 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
949 "knot-resolver-" version ".tar.xz"))
952 "0gp3ivv3zccz4b6s1wxbsvvlrc837lw2g089l3cbvzsg7z0b4v7v"))))
953 (build-system meson-build-system)
954 (outputs '("out" "doc"))
956 '(#:configure-flags '("-Ddoc=enabled")
958 (modify-phases %standard-phases
959 (add-before 'configure 'disable-default-ta
961 ;; Disable the default managed root TA, since we don't have
962 ;; write access to the keyfile and its directory in store.
963 (substitute* "daemon/lua/sandbox.lua.in"
964 (("^trust_anchors\\.add_file.*") ""))
966 (add-after 'build 'build-doc
968 (invoke "ninja" "doc")))
969 (add-after 'install 'move-doc
970 (lambda* (#:key outputs #:allow-other-keys)
971 ;; Move the manual and the example configuration files to the
973 (let ((out (assoc-ref outputs "out"))
974 (doc (assoc-ref outputs "doc")))
975 (mkdir-p (string-append doc "/share/doc/knot-resolver"))
978 (rename-file (string-append out "/share/" dir)
979 (string-append doc "/share/" dir)))
980 '("doc/knot-resolver/examples"
981 "doc/knot-resolver/html"
983 (add-after 'install 'wrap-binary
984 (lambda* (#:key inputs outputs #:allow-other-keys)
985 (let* ((out (assoc-ref outputs "out"))
986 (lua-* (map cdr (filter
988 (string-prefix? "lua-" (car input)))
990 (lua-path (lambda (p)
991 (string-append p "/share/lua/5.1/?.lua")))
992 (lua-cpath (lambda (p)
993 (string-append p "/lib/lua/5.1/?.so"))))
994 (wrap-program (string-append out "/sbin/kresd")
995 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
996 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
999 `(("cmocka" ,cmocka) ; for unit tests
1000 ("doxygen" ,doxygen)
1001 ("protobuf-c" ,protobuf-c)
1002 ("pkg-config" ,pkg-config)
1003 ("python-breathe" ,python-breathe)
1004 ("python-sphinx" ,python-sphinx)
1005 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
1006 ("texinfo" ,texinfo)))
1010 ("knot:lib" ,knot "lib")
1014 ;; TODO: Add optional lua modules: basexx and psl.
1015 ("lua-bitop" ,lua5.1-bitop)
1016 ("nghttp2" ,nghttp2 "lib")))
1017 (home-page "https://www.knot-resolver.cz/")
1018 (synopsis "Caching validating DNS resolver")
1020 "Knot Resolver is a caching full resolver implementation written in C and
1021 LuaJIT, both a resolver library and a daemon.")
1022 (license (list license:gpl3+
1023 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
1028 (define-public ddclient
1036 (url "https://github.com/ddclient/ddclient")
1037 (commit (string-append "v" version))))
1038 (file-name (git-file-name name version))
1040 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
1041 (build-system trivial-build-system) ; no Makefile.PL
1046 `(("inetutils" ,inetutils) ; logger
1047 ("net-tools" ,net-tools)
1048 ("perl-data-validate-ip" ,perl-data-validate-ip)
1049 ("perl-digest-sha1" ,perl-digest-sha1)
1050 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
1052 `(#:modules ((guix build utils)
1057 (use-modules (guix build utils)
1060 (setenv "PATH" (string-append
1061 (assoc-ref %build-inputs "bash") "/bin" ":"
1062 (assoc-ref %build-inputs "perl") "/bin"))
1064 ;; Copy the (read-only) source into the (writable) build directory.
1065 (copy-recursively (assoc-ref %build-inputs "source") ".")
1068 (let* ((out (assoc-ref %outputs "out"))
1069 (bin (string-append out "/bin")))
1070 (let ((file "ddclient"))
1072 (("/usr/bin/perl") (which "perl"))
1073 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1074 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1075 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1076 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1077 (("\\$cachedir\\$program\\.cache")
1078 "/var/cache/ddclient/ddclient.cache"))
1079 (install-file file bin)
1080 (wrap-program (string-append bin "/" file)
1083 ,@(map (lambda (input)
1086 (string-append store "/bin"))))
1092 (((? (cut string-prefix? "perl-" <>) name) . dir)
1093 (string-append dir "/lib/perl5/site_perl"))
1096 (for-each (cut install-file <> (string-append out
1098 (find-files "." "sample.*$"))))))
1099 (home-page "https://ddclient.net/")
1100 (synopsis "Address updating utility for dynamic DNS services")
1101 (description "This package provides a client to update dynamic IP
1102 addresses with several dynamic DNS service providers, such as
1103 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1105 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1106 access a machine with a dynamic IP address.
1108 The client supports both dynamic and (near) static services, as well as MX
1109 record and alternative name management. It caches the address, and only
1110 attempts the update when it has changed.")
1111 (license license:gpl2+)))
1114 ;; There have been no releases yet, hence this commit.
1115 (let ((revision "0")
1116 (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
1119 (version (git-version "0.0" revision commit))
1123 (url "https://github.com/handshake-org/hnsd")
1127 "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
1128 (file-name (git-file-name name version))
1129 (modules '((guix build utils)))
1132 ;; Delete the bundled copy of libuv.
1133 (delete-file-recursively "uv")
1134 (substitute* "configure.ac"
1135 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1136 (substitute* "Makefile.am"
1137 (("SUBDIRS = uv") "\n")
1138 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1140 ;; Make sure the 'hnsd' binary is installed and
1141 ;; dynamically-linked.
1142 (("noinst_PROGRAMS") "bin_PROGRAMS")
1143 (("hnsd_LDFLAGS = -static") ""))
1145 ;; This script tries to chdir to "uv" and doesn't do more
1146 ;; than "autoreconf" so remove it.
1147 (delete-file "autogen.sh")
1149 (build-system gnu-build-system)
1151 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1153 `(("autoconf" ,autoconf)
1154 ("automake" ,automake)
1155 ("libtool" ,libtool)))
1157 `(("unbound" ,unbound)
1159 (home-page "https://www.handshake.org/")
1160 (synopsis "Resolver daemon for the Handshake naming protocol")
1162 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1163 System (HNS) peer-to-peer network.")
1164 (license license:expat))))
1166 (define-public libmicrodns
1168 (name "libmicrodns")
1172 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1173 "releases/download/" version "/microdns-"
1177 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1178 (build-system meson-build-system)
1179 (home-page "https://github.com/videolabs/libmicrodns")
1180 (synopsis "Minimal mDNS resolver library")
1181 (description "@code{libmicrodns} provides a minimal implementation of a
1182 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1183 a zero-config service that allows one to resolve host names to IP addresses in
1185 (license license:lgpl2.1)))
1187 (define-public public-suffix-list
1188 ;; Mozilla releases the official list here:
1190 ;; https://publicsuffix.org/list/public_suffix_list.dat
1192 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1193 ;; so its contents will change over time. If you update this commit, please
1194 ;; make sure that the new commit refers to a list which is identical to the
1195 ;; officially published list available from the URL above.
1196 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1198 (name "public-suffix-list")
1199 (version (git-version "0" "1" commit))
1203 (url "https://github.com/publicsuffix/list")
1205 (file-name (git-file-name name version))
1208 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1209 (build-system trivial-build-system)
1211 `(#:modules ((guix build utils))
1214 (use-modules (guix build utils))
1215 (let* ((out (assoc-ref %outputs "out"))
1216 ;; Install to /share because that is where "read-only
1217 ;; architecture-independent data files" should go (see:
1218 ;; (standards) Directory Variables). Include the version in
1219 ;; the directory name so that if multiple versions are ever
1220 ;; installed in the same profile, they will not conflict.
1221 (destination (string-append
1222 out "/share/public-suffix-list-" ,version))
1223 (source (assoc-ref %build-inputs "source")))
1224 (with-directory-excursion source
1225 (install-file "public_suffix_list.dat" destination)
1226 (install-file "LICENSE" destination))
1228 (home-page "https://publicsuffix.org/")
1229 (synopsis "Database of current and historical DNS suffixes")
1230 (description "This is the Public Suffix List maintained by Mozilla. A
1231 \"public suffix\" is one under which Internet users can (or historically
1232 could) directly register names in the Domain Name System (DNS). Some examples
1233 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1234 known public suffixes.")
1235 (license license:mpl2.0))))
1237 (define-public maradns
1240 (version "3.5.0007")
1244 (uri (string-append "https://maradns.samiam.org/download/"
1245 (version-major+minor version) "/"
1246 version "/maradns-" version ".tar.xz"))
1248 (base32 "0bc19xylg4whww9qaj5i4izwxcrh0c0ja7l1pfcn2la02hlvg1a6"))))
1249 (build-system gnu-build-system)
1251 `(#:tests? #f ; need to be root to run tests
1254 ,(string-append "CC=" (cc-for-target))
1255 (string-append "PREFIX=" %output)
1256 (string-append "RPM_BUILD_ROOT=" %output))
1258 (modify-phases %standard-phases
1260 (lambda* (#:key native-inputs target #:allow-other-keys)
1261 ;; make_32bit_tables generates a header file that is used during
1262 ;; compilation. Hence, during cross compilation, it should be
1263 ;; built for the host system.
1265 (substitute* "rng/Makefile"
1266 (("\\$\\(CC\\) -o make_32bit_tables")
1267 (string-append (assoc-ref native-inputs "gcc")
1268 "/bin/gcc -o make_32bit_tables"))))
1269 (invoke "./configure")))
1270 (add-before 'install 'create-install-directories
1271 (lambda* (#:key outputs #:allow-other-keys)
1272 (let ((out (assoc-ref outputs "out")))
1273 (for-each (lambda (dir)
1274 (mkdir-p (string-append out dir)))
1275 (list "/bin" "/sbin" "/etc"
1280 (home-page "https://maradns.samiam.org")
1281 (synopsis "Small lightweight DNS server")
1282 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1283 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1284 and TCP-capable recursive DNS server for finding domains on the internet.")
1285 (license license:bsd-2)))
1287 (define-public openresolv
1293 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1294 "openresolv-" version ".tar.xz"))
1297 "01ms6c087la4hk0f0w6n2vpsb7dg4kklah2rqyhz88p0vr9bqy20"))
1299 (search-patches "openresolv-restartcmd-guix.patch"))))
1300 (build-system gnu-build-system)
1302 `(#:tests? #f ; No test suite
1304 (list (string-append "--sysconfdir=/etc"))
1306 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
1307 (home-page "https://roy.marples.name/projects/openresolv/")
1308 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1309 (description "openresolv is an implementation of @command{resolvconf}, the
1310 middleman between the network configuration services and
1311 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1312 stores, removes and lists a full @file{resolv.conf} generated for the
1313 interface. It then calls all the helper scripts it knows about so it can
1314 configure the real @file{/etc/resolv.conf} and optionally any local
1315 nameservers other than libc.")
1316 (license license:bsd-2)))