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>
21 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages dns)
39 #:use-module (gnu packages admin)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages bash)
43 #:use-module (gnu packages certs)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages databases)
46 #:use-module (gnu packages documentation)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages crypto)
49 #:use-module (gnu packages datastructures)
50 #:use-module (gnu packages elf)
51 #:use-module (gnu packages flex)
52 #:use-module (gnu packages freedesktop)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages groff)
56 #:use-module (gnu packages groff)
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages libedit)
59 #:use-module (gnu packages libevent)
60 #:use-module (gnu packages libidn)
61 #:use-module (gnu packages linux)
62 #:use-module (gnu packages lua)
63 #:use-module (gnu packages ncurses)
64 #:use-module (gnu packages nettle)
65 #:use-module (gnu packages networking)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages protobuf)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages python-xyz)
71 #:use-module (gnu packages ragel)
72 #:use-module (gnu packages shells)
73 #:use-module (gnu packages sphinx)
74 #:use-module (gnu packages swig)
75 #:use-module (gnu packages texinfo)
76 #:use-module (gnu packages tls)
77 #:use-module (gnu packages web)
78 #:use-module (gnu packages xml)
79 #:use-module (gnu packages)
80 #:use-module ((guix licenses) #:prefix license:)
81 #:use-module (guix packages)
82 #:use-module (guix download)
83 #:use-module (guix git-download)
84 #:use-module (guix utils)
85 #:use-module (guix build-system glib-or-gtk)
86 #:use-module (guix build-system gnu)
87 #:use-module (guix build-system meson)
88 #:use-module (guix build-system trivial))
98 (string-append "https://www.nlnetlabs.nl/downloads/"
99 name "/" name "-" version ".tar.gz"))
101 (base32 "0ac242n7996fswq1a3nlh1bbbhrsdwsq4mx7xq8ffq6aplb4rj4a"))
104 ;; To create make-flag vairables,
105 ;; for splitting installation of drill and examples.
106 "ldns-drill-examples.patch"))))
107 (build-system gnu-build-system)
108 (outputs '("out" "drill" "examples" "pyldns"))
110 `( ;; Tests require Tpkg.
111 ;; https://tpkg.github.io/
116 "--enable-gost-anyway"
117 "--enable-rrtype-ninfo"
118 "--enable-rrtype-rkey"
120 "--enable-rrtype-avc"
121 "--enable-rrtype-doa"
122 "--enable-rrtype-amtrelay"
126 ;; Perl module DNS::LDNS not available.
127 ;; https://github.com/erikoest/DNS-LDNS.git
128 ;; "--with-p5-dns-ldns"
129 (string-append "--with-ssl="
130 (assoc-ref %build-inputs "openssl"))
131 (string-append "--with-ca-path="
132 (assoc-ref %build-inputs "nss-certs")
136 (string-append "drillbindir="
137 (assoc-ref %outputs "drill")
139 (string-append "drillmandir="
140 (assoc-ref %outputs "drill")
142 (string-append "examplesbindir="
143 (assoc-ref %outputs "examples")
145 (string-append "examplesmandir="
146 (assoc-ref %outputs "examples")
148 (string-append "python_site="
149 (assoc-ref %outputs "pyldns")
151 ,(version-major+minor
152 (package-version python))
155 `(("doxygen" ,doxygen)
158 ("perl-devel-checklib" ,perl-devel-checklib)
159 ("pkg-config" ,pkg-config)
160 ("python" ,python-wrapper)
163 `(("libpcap" ,libpcap)
164 ("nss-certs" ,nss-certs)
165 ("openssl" ,openssl)))
166 (synopsis "DNS library that facilitates DNS tool programming")
167 (description "LDNS aims to simplify DNS programming, it supports recent
168 RFCs like the DNSSEC documents, and allows developers to easily create
169 software conforming to current RFCs, and experimental software for current
170 Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
171 C it should be a lot faster than Perl.")
172 (home-page "https://nlnetlabs.nl/projects/ldns/about/")
173 (license license:bsd-3)))
175 (define-public dnssec-trigger
177 (name "dnssec-trigger")
183 (string-append "https://www.nlnetlabs.nl/downloads/"
184 name "/" name "-" version ".tar.gz"))
186 (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
187 (build-system glib-or-gtk-build-system)
188 (outputs '("out" "gui" "nm"))
190 `(#:test-target "test"
193 (string-append "--with-ssl="
194 (assoc-ref %build-inputs "openssl"))
195 "--with-hooks=networkmanager"
196 (string-append "--with-networkmanager-dispatch="
197 (assoc-ref %outputs "nm")
198 "/etc/NetworkManager/dispatcher.d")
199 (string-append "--with-xdg-autostart="
200 (assoc-ref %outputs "gui")
201 "/etc/xdg/autostart")
202 (string-append "--with-uidir="
203 (assoc-ref %outputs "gui")
204 "/share/dnssec-trigger")
205 (string-append "--with-python="
206 (assoc-ref %build-inputs "python")
208 (string-append "--with-unbound-control="
209 (assoc-ref %build-inputs "unbound")
210 "/sbin/unbound-control")
211 "--with-forward-zones-support")
213 (modify-phases %standard-phases
214 (add-after 'unpack 'patch-configure
216 (substitute* "configure"
217 (("appindicator-0.1")
218 "appindicator3-0.1"))
220 (add-before 'configure 'patch-makefile
222 (substitute* "Makefile.in"
227 ((".*gtk-update-icon-cache.*")
230 (add-after 'install 'remove-systemd
231 (lambda* (#:key outputs #:allow-other-keys)
232 (let* ((out (assoc-ref outputs "out")))
233 (delete-file-recursively
234 (string-append out "/lib/systemd"))
236 (add-after 'remove-systemd 'move-gui
237 (lambda* (#:key outputs #:allow-other-keys)
238 (let* ((out (assoc-ref outputs "out"))
239 (gui (assoc-ref outputs "gui")))
240 (mkdir-p (string-append gui "/bin"))
241 (mkdir-p (string-append gui "/share"))
243 (string-append out "/bin")
244 (string-append gui "/bin"))
246 (string-append out "/share/icons")
247 (string-append gui "/share/icons"))
249 (add-after 'move-gui 'move-nm
250 (lambda* (#:key outputs #:allow-other-keys)
251 (let* ((out (assoc-ref outputs "out"))
252 (nm (assoc-ref outputs "nm")))
253 (mkdir-p (string-append nm "/libexec"))
255 (string-append out "/libexec")
256 (string-append nm "/libexec"))
260 ("pkg-config" ,pkg-config)
261 ("python" ,python-wrapper)))
265 ("libappindicator" ,libappindicator)
267 ("unbound" ,unbound)))
268 (synopsis "DNSSEC protection for the DNS traffic")
269 (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
270 for the DNS traffic. It relies on the Unbound DNS resolver running locally on
271 your system, which performs DNSSEC validation. It reconfigures Unbound in such
272 a way that it will signal it to to use the DHCP obtained forwarders if possible,
273 fallback to doing its own AUTH queries if that fails, and if that fails it will
274 prompt the user with the option to go with insecure DNS only.")
275 (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
276 (license license:bsd-3)))
278 (define-public dnsmasq
285 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
289 "1yhjwgz8g5qrqvxh6bbmg3443zi8qqjks3q872wyb1zn7n0d765d"))))
290 (build-system gnu-build-system)
292 `(("pkg-config" ,pkg-config)))
297 (modify-phases %standard-phases (delete 'configure))
298 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
300 "COPTS=\"-DHAVE_DBUS\"")
301 #:tests? #f)) ; no ‘check’ target
302 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
303 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
305 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
306 to provide DNS and, optionally, DHCP to a small network. It can serve the
307 names of local machines which are not in the global DNS. The DHCP server
308 integrates with the DNS server and allows machines with DHCP-allocated
309 addresses to appear in the DNS with names configured either on each host or in
310 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
311 and BOOTP/TFTP for network booting of diskless machines.")
312 ;; Source files only say GPL2 and GPL3 are allowed.
313 (license (list license:gpl2 license:gpl3))))
315 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
316 ;; different name here.
317 (define-public isc-bind
320 ;; When updating, check whether isc-dhcp's bundled copy should be as well.
321 ;; The BIND release notes are available here:
322 ;; https://www.isc.org/bind/
327 "https://ftp.isc.org/isc/bind9/" version
328 "/bind-" version ".tar.xz"))
331 "026cliyj570wxvvij96mrzsxyf421xv9a80gc5gv6savza9wfk55"))))
332 (build-system gnu-build-system)
333 (outputs `("out" "utils"))
335 ;; It would be nice to add GeoIP and gssapi once there are packages.
342 ("python-ply" ,python-ply)))
345 ("pkg-config" ,pkg-config)))
348 (list (string-append "--with-pkcs11="
349 (assoc-ref %build-inputs "p11-kit")))
351 (modify-phases %standard-phases
352 (add-after 'strip 'move-to-utils
356 (let ((target (string-append (assoc-ref %outputs "utils") file))
357 (src (string-append (assoc-ref %outputs "out") file)))
358 (mkdir-p (dirname target))
361 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
362 "/share/man/man1/dig.1"
363 "/share/man/man1/host.1"
364 "/share/man/man1/nslookup.1"
365 "/share/man/man1/nsupdate.1"))
367 ;; When and if guix provides user namespaces for the build process,
368 ;; then the following can be uncommented and the subsequent "force-test"
369 ;; will not be necessary.
371 ;; (add-before 'check 'set-up-loopback
373 ;; (system "bin/tests/system/ifconfig.sh up")))
376 ;; XXX Even ‘make force-test’ tries to create network interfaces
377 ;; and fails. The only working target is the (trivial) fuzz test.
378 (with-directory-excursion "fuzz"
379 (invoke "make" "check"))
381 (synopsis "@acronym{DNS, Domain Name System} implementation")
382 (description "BIND implements the @acronym{DNS, Domain Name System}
383 protocols for the Internet. It is both a reference implementation of those
384 protocols and production-grade software, suitable for use in high-volume and
385 high-reliability applications.
387 The name stands for \"Berkeley Internet Name Domain\" because the software
388 originated in the early 1980s at the University of California at Berkeley.
390 The @code{utils} output of this package contains the following command line
391 utilities related to DNS name servers:
395 DNS lookup and validation utility
401 Internet name servers interactive query utility
403 Dynamic DNS update utility
405 (home-page "https://www.isc.org/bind/")
406 (license (list license:mpl2.0))))
408 (define-public dnscrypt-proxy
410 (name "dnscrypt-proxy")
415 "https://download.dnscrypt.org/dnscrypt-proxy/"
416 "dnscrypt-proxy-" version ".tar.bz2"))
419 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
420 (modules '((guix build utils)))
422 ;; Delete bundled libltdl. XXX: This package also bundles
423 ;; a modified libevent that cannot currently be removed.
425 (delete-file-recursively "libltdl")
427 (build-system gnu-build-system)
430 (modify-phases %standard-phases
431 (add-after 'unpack 'autoreconf
433 ;; Re-generate build files due to unbundling ltdl.
434 ;; TODO: Prevent generating new libltdl and building it.
435 ;; The system version is still favored and referenced.
436 (invoke "autoreconf" "-vif"))))))
438 `(("pkg-config" ,pkg-config)
439 ("automake" ,automake)
440 ("autoconf" ,autoconf)
441 ("libtool" ,libtool)))
443 `(("libltdl" ,libltdl)
444 ("libsodium" ,libsodium)))
445 (home-page "https://www.dnscrypt.org/")
446 (synopsis "Securely send DNS requests to a remote server")
448 "@command{dnscrypt-proxy} is a tool for securing communications
449 between a client and a DNS resolver. It verifies that responses you get
450 from a DNS provider was actually sent by that provider, and haven't been
451 tampered with. For optimal performance it is recommended to use this as
452 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
453 can also be used as a normal DNS \"server\". A list of public dnscrypt
454 servers is included, and an up-to-date version is available at
455 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
456 (license (list license:isc
457 ;; Libevent and src/ext/queue.h is 3-clause BSD.
460 (define-public dnscrypt-wrapper
462 (name "dnscrypt-wrapper")
467 "https://github.com/cofyc/dnscrypt-wrapper/releases"
468 "/download/v" version "/" name "-v" version ".tar.bz2"))
471 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
472 (build-system gnu-build-system)
474 `(#:make-flags '("CC=gcc")
475 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
478 (modify-phases %standard-phases
479 (add-after 'unpack 'create-configure
481 (invoke "make" "configure"))))))
483 `(("autoconf" ,autoconf)))
485 `(("libevent" ,libevent)
486 ("libsodium" ,libsodium)))
487 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
488 (synopsis "Server-side dnscrypt proxy")
490 "@command{dnscrypt-wrapper} is a tool to expose a name server over
491 the @code{dnscrypt} protocol. It can be used as an endpoint for the
492 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
494 (license (list license:isc
495 ;; Bundled argparse is MIT. TODO: package and unbundle.
497 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
501 (define-public libasr
508 (uri (string-append "https://www.opensmtpd.org/archives/"
509 "libasr-" version ".tar.gz"))
511 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
512 (build-system gnu-build-system)
515 (modify-phases %standard-phases
516 (add-after 'install 'install-documentation
517 (lambda* (#:key outputs #:allow-other-keys)
518 (let ((out (assoc-ref outputs "out")))
519 (install-file "src/asr_run.3"
520 (string-append out "/share/man/man3"))
523 `(("autoconf" ,autoconf)
524 ("automake" ,automake)
526 ("pkg-config" ,pkg-config)))
527 (home-page "https://www.opensmtpd.org")
528 (synopsis "Asynchronous resolver library by the OpenBSD project")
530 "libasr is a free, simple and portable asynchronous resolver library.
531 It runs DNS queries and performs hostname resolution in a fully
532 asynchronous fashion.")
533 (license (list license:isc
534 license:bsd-2 ; last part of getrrsetbyname_async.c
536 (license:non-copyleft "file://LICENSE") ; includes.h
546 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
549 (base32 "062zwx4k5rgpg2c0b4721ldj36aj8clrxv79mlfw9b15ap7w1rmy"))))
550 (build-system gnu-build-system)
553 (list "--enable-pie" ; fully benefit from ASLR
556 "--enable-relro-now" ; protect GOT and .dtor areas
557 "--disable-radix-tree"
558 (string-append "--with-libevent="
559 (assoc-ref %build-inputs "libevent"))
560 (string-append "--with-ssl="
561 (assoc-ref %build-inputs "openssl"))
562 "--with-configdir=/etc"
563 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
564 "--with-logfile=/var/log/nsd.log"
565 "--with-pidfile=/var/db/nsd/nsd.pid"
566 "--with-dbfile=/var/db/nsd/nsd.db"
567 "--with-zonesdir=/etc/nsd"
568 "--with-xfrdfile=/var/db/nsd/xfrd.state"
569 "--with-zonelistfile=/var/db/nsd/zone.list")
571 (modify-phases %standard-phases
572 (add-before 'configure 'patch-installation-paths
573 (lambda* (#:key outputs #:allow-other-keys)
574 (let* ((out (assoc-ref outputs "out"))
575 (doc (string-append out "/share/doc/" ,name "-" ,version)))
576 ;; The ‘make install’ target tries to create the parent
577 ;; directories of run-time things like ‘pidfile’ above, and
578 ;; useless empty directories like 'configdir'. Remove such
579 ;; '$(INSTALL)' lines and install the example configuration file
580 ;; in an appropriate location.
581 (substitute* "Makefile.in"
582 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
583 (string-append "#" command))
584 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
585 (string-append doc "/examples/" file-name)))
587 #:tests? #f)) ; no tests
589 `(("libevent" ,libevent)
590 ("openssl" ,openssl)))
591 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
592 (synopsis "Authoritative DNS name server")
593 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
594 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
595 RFC-compliant nameserver.
597 NSD uses zone information compiled via @command{zonec} into a binary database
598 file (@file{nsd.db}). This allows fast startup of the name service daemon and
599 allows syntax-structural errors in zone files to be flagged at compile time,
600 before being made available to NSD service itself. However, most traditional
601 BIND-style zone files can be directly imported into NSD without modification.
603 The collection of programs and processes that make up NSD are designed so that
604 the daemon itself runs as a non-privileged user and can be easily configured to
605 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
606 to result in system-wide compromise.")
607 (license (list license:bsd-3))))
609 (define-public unbound
616 (uri (string-append "https://www.unbound.net/downloads/unbound-"
619 (base32 "1f2hky62f4xxnjr0lncrzz4gipg01rp12pf98mrqkgf5ixxxj145"))))
620 (build-system gnu-build-system)
621 (outputs '("out" "python"))
627 ("libevent" ,libevent)
628 ("protobuf" ,protobuf)
629 ("python-wrapper" ,python-wrapper)
630 ("openssl" ,openssl)))
633 (list "--disable-static" ; save space and non-determinism in libunbound.a
635 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
637 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
639 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
640 "--with-pythonmodule" "--with-pyunbound")
642 (modify-phases %standard-phases
643 (add-after 'configure 'fix-python-site-package-path
644 ;; Move python modules into their own output.
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let ((pyout (assoc-ref outputs "python"))
647 (ver ,(version-major+minor (package-version python))))
648 (substitute* "Makefile"
649 (("^PYTHON_SITE_PKG=.*$")
652 pyout "/lib/python-" ver "/site-packages\n"))))
654 (add-before 'check 'fix-missing-nss-for-tests
655 ;; Unfortunately, the package's unittests involve some checks
656 ;; looking up protocols and services which are not provided
657 ;; by the minimalistic build environment, in particular,
658 ;; /etc/protocols and /etc/services are missing.
659 ;; Also, after plain substitution of protocol and service names
660 ;; in the test data, the tests still fail because the
661 ;; corresponding Resource Records have been signed by
663 ;; The following LD_PRELOAD library overwrites the glibc
664 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
665 ;; ‘getservbyport’ providing the few records required for the
666 ;; unit tests to pass.
667 (lambda* (#:key inputs outputs #:allow-other-keys)
668 (let* ((source (assoc-ref %build-inputs "source"))
669 (gcc (assoc-ref %build-inputs "gcc")))
670 (call-with-output-file "/tmp/nss_preload.c"
672 (display "#include <stdlib.h>
678 struct protoent *getprotobyname(const char *name) {
679 struct protoent *p = malloc(sizeof(struct protoent));
680 p->p_aliases = malloc(sizeof(char*));
681 if (strcasecmp(name, \"tcp\") == 0) {
684 p->p_aliases[0] = \"TCP\";
685 } else if (strcasecmp(name, \"udp\") == 0) {
688 p->p_aliases[0] = \"UDP\";
694 struct protoent *getprotobynumber(int proto) {
695 struct protoent *p = malloc(sizeof(struct protoent));
696 p->p_aliases = malloc(sizeof(char*));
701 p->p_aliases[0] = \"TCP\";
706 p->p_aliases[0] = \"UDP\";
715 struct servent *getservbyname(const char *name, const char *proto) {
716 struct servent *s = malloc(sizeof(struct servent));
717 char* buf = malloc((strlen(proto)+1)*sizeof(char));
719 s->s_aliases = malloc(sizeof(char*));
720 s->s_aliases[0] = NULL;
721 if (strcasecmp(name, \"domain\") == 0) {
722 s->s_name = \"domain\";
723 s->s_port = htons(53);
730 struct servent *getservbyport(int port, const char *proto) {
732 struct servent *s = malloc(sizeof(struct servent));
734 s->s_aliases = malloc(sizeof(char*));
735 s->s_aliases[0] = NULL;
738 s->s_name = \"domain\";
740 s->s_proto = \"udp\";
748 (invoke (string-append gcc "/bin/gcc")
749 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
750 "/tmp/nss_preload.c")
751 ;; The preload library only affects the unittests.
752 (substitute* "Makefile"
754 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
756 (home-page "https://www.unbound.net")
757 (synopsis "Validating, recursive, and caching DNS resolver")
759 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
760 validation of results. It implements only a minimal amount of authoritative
761 service to prevent leakage to the root nameservers: forward lookups for
762 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
763 served by AS112. Stub and forward zones are supported.")
764 (license license:bsd-4)))
766 (define-public yadifa
771 (let ((build "9997"))
775 (string-append "https://www.yadifa.eu/sites/default/files/releases/"
776 "yadifa-" version "-" build ".tar.gz"))
778 (base32 "0f1by2c7l39qpsar5nh98f3xypmn2ikv7wr557wmva6m0lwbl3q0")))))
779 (build-system gnu-build-system)
783 `(("openssl" ,openssl)))
786 (modify-phases %standard-phases
787 (add-before 'configure 'omit-example-configurations
789 (substitute* "Makefile.in"
792 (add-after 'configure 'omit-spurious-references
794 ;; The many Makefile.in grep this(!) to #define BUILD_OPTIONS.
795 (substitute* "config.log"
796 (("(=/gnu/store/)[^-]*" _ match)
797 (string-append match "...")))
800 (list "--sysconfdir=/etc"
801 "--localstatedir=/var"
802 "--enable-shared" "--disable-static"
803 "--disable-build-timestamp"))) ; build reproducibly
804 (home-page "https://www.yadifa.eu/")
805 (synopsis "Authoritative DNS name server")
806 (description "YADIFA is an authoritative name server for the @dfn{Domain
807 Name System} (DNS). It aims for both higher performance and a smaller memory
808 footprint than other implementations, while remaining fully RFC-compliant.
809 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
810 Extensions} (DNSSEC).")
811 (license license:bsd-3)))
821 (url "https://gitlab.nic.cz/knot/knot-dns")
822 (commit (string-append "v" version))))
823 (file-name (git-file-name name version))
825 (base32 "16rgcmgj21w2niyz45d3zjlci9i22gxcvfzqw7g5zwsjdy9610nx"))
826 (modules '((guix build utils)))
829 ;; Remove Ragel-generated C files. We'll recreate them below.
830 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
831 (delete-file "src/libknot/yparser/ypbody.c")
832 ;; Remove bundled library to ensure we always use the system's.
833 (delete-file-recursively "src/contrib/libbpf")
835 (build-system gnu-build-system)
836 (outputs (list "out" "doc" "lib" "tools"))
839 (list (string-append "--docdir=" (assoc-ref %outputs "doc")
840 "/share/" ,name "-" ,version)
841 (string-append "--infodir=" (assoc-ref %outputs "doc")
843 (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib")
845 "--localstatedir=/var"
846 "--enable-dnstap" ; let tools read/write capture files
847 "--enable-fastparser" ; disabled by default when .git/ exists
848 "--enable-xdp=auto" ; XXX [=yes] currently means =embedded
849 "--with-module-dnstap=yes") ; detailed query capturing & logging
851 (modify-phases %standard-phases
852 (add-after 'unpack 'link-missing-libbpf-dependency
853 ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
854 ;; zlib in its Requires.private (not Requires) field. Add it here.
856 (substitute* "configure.ac"
857 (("enable_xdp=yes" match)
858 (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))
860 (add-before 'bootstrap 'update-parser
862 (with-directory-excursion "src"
863 (invoke "sh" "../scripts/update-parser.sh"))))
864 (add-before 'configure 'disable-directory-pre-creation
866 ;; Don't install empty directories like ‘/etc’ outside the store.
867 ;; This is needed even when using ‘make config_dir=... install’.
868 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
870 (add-after 'build 'build-info
872 (invoke "make" "info")))
874 (lambda* (#:key outputs #:allow-other-keys)
875 (let* ((out (assoc-ref outputs "out"))
876 (doc (string-append out "/share/doc/" ,name "-" ,version))
877 (etc (string-append doc "/examples/etc")))
879 (string-append "config_dir=" etc)
881 (add-after 'install 'install-info
883 (invoke "make" "install-info")))
884 (add-after 'install 'break-circular-:lib->:out-reference
885 (lambda* (#:key outputs #:allow-other-keys)
886 (let ((lib (assoc-ref outputs "lib")))
887 (for-each (lambda (file)
889 (("(prefix=).*" _ assign)
890 (string-append assign lib "\n"))))
891 (find-files lib "\\.pc$"))
893 (add-after 'install 'split-:tools
894 (lambda* (#:key outputs #:allow-other-keys)
895 (let* ((out (assoc-ref outputs "out"))
896 (tools (assoc-ref outputs "tools")))
897 (mkdir-p (string-append tools "/share/man"))
898 (rename-file (string-append out "/bin")
899 (string-append tools "/bin"))
900 (rename-file (string-append out "/share/man/man1")
901 (string-append tools "/share/man/man1"))
904 `(("autoconf" ,autoconf)
905 ("automake" ,automake)
907 ("pkg-config" ,pkg-config)
908 ("python-sphinx" ,python-sphinx)
910 ("texinfo" ,texinfo)))
916 ("libcap-ng" ,libcap-ng)
920 ("libnghttp2" ,nghttp2 "lib")
924 ("protobuf-c" ,protobuf-c)))
925 (home-page "https://www.knot-dns.cz/")
926 (synopsis "Authoritative DNS name server")
927 (description "Knot DNS is an authoritative name server for the @dfn{Domain
928 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
929 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
930 number of programming techniques to improve speed. For example, the responder
931 is completely lock-free, resulting in a very high response rate. Other features
932 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
933 synthesis, and on-the-fly re-configuration.")
936 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
937 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
939 license:lgpl2.0+ ; parts of scr/contrib/ucw
940 license:public-domain ; src/contrib/fnv and possibly murmurhash3
941 license:gpl3+)))) ; everything else
943 (define-public knot-resolver
945 (name "knot-resolver")
949 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
950 "knot-resolver-" version ".tar.xz"))
953 "1j99sz6r1hdvvd8rffx1917r9cyb7z46ivp5934sq57irmxnnkcx"))))
954 (build-system meson-build-system)
955 (outputs '("out" "doc"))
957 '(#:configure-flags '("-Ddoc=enabled")
959 (modify-phases %standard-phases
960 (add-before 'configure 'disable-default-ta
962 ;; Disable the default managed root TA, since we don't have
963 ;; write access to the keyfile and its directory in store.
964 (substitute* "daemon/lua/sandbox.lua.in"
965 (("^trust_anchors\\.add_file.*") ""))
967 (add-after 'build 'build-doc
969 (invoke "ninja" "doc")))
970 (add-after 'install 'move-doc
971 (lambda* (#:key outputs #:allow-other-keys)
972 ;; Move the manual and the example configuration files to the
974 (let ((out (assoc-ref outputs "out"))
975 (doc (assoc-ref outputs "doc")))
976 (mkdir-p (string-append doc "/share/doc/knot-resolver"))
979 (rename-file (string-append out "/share/" dir)
980 (string-append doc "/share/" dir)))
981 '("doc/knot-resolver/examples"
982 "doc/knot-resolver/html"
984 (add-after 'install 'wrap-binary
985 (lambda* (#:key inputs outputs #:allow-other-keys)
986 (let* ((out (assoc-ref outputs "out"))
987 (lua-* (map cdr (filter
989 (string-prefix? "lua-" (car input)))
991 (lua-path (lambda (p)
992 (string-append p "/share/lua/5.1/?.lua")))
993 (lua-cpath (lambda (p)
994 (string-append p "/lib/lua/5.1/?.so"))))
995 (wrap-program (string-append out "/sbin/kresd")
996 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
997 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
1000 `(("cmocka" ,cmocka) ; for unit tests
1001 ("doxygen" ,doxygen)
1002 ("protobuf-c" ,protobuf-c)
1003 ("pkg-config" ,pkg-config)
1004 ("python-breathe" ,python-breathe)
1005 ("python-sphinx" ,python-sphinx)
1006 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
1007 ("texinfo" ,texinfo)))
1011 ("knot:lib" ,knot "lib")
1015 ;; TODO: Add optional lua modules: basexx and psl.
1016 ("lua-bitop" ,lua5.1-bitop)
1017 ("nghttp2" ,nghttp2 "lib")))
1018 (home-page "https://www.knot-resolver.cz/")
1019 (synopsis "Caching validating DNS resolver")
1021 "Knot Resolver is a caching full resolver implementation written in C and
1022 LuaJIT, both a resolver library and a daemon.")
1023 (license (list license:gpl3+
1024 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
1029 (define-public ddclient
1037 (url "https://github.com/ddclient/ddclient")
1038 (commit (string-append "v" version))))
1039 (file-name (git-file-name name version))
1041 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
1042 (build-system trivial-build-system) ; no Makefile.PL
1047 `(("inetutils" ,inetutils) ; logger
1048 ("net-tools" ,net-tools)
1049 ("perl-data-validate-ip" ,perl-data-validate-ip)
1050 ("perl-digest-sha1" ,perl-digest-sha1)
1051 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
1053 `(#:modules ((guix build utils))
1056 (use-modules (guix build utils)
1059 (setenv "PATH" (string-append
1060 (assoc-ref %build-inputs "bash") "/bin" ":"
1061 (assoc-ref %build-inputs "perl") "/bin"))
1063 ;; Copy the (read-only) source into the (writable) build directory.
1064 (copy-recursively (assoc-ref %build-inputs "source") ".")
1067 (let* ((out (assoc-ref %outputs "out"))
1068 (bin (string-append out "/bin")))
1069 (let ((file "ddclient"))
1071 (("/usr/bin/perl") (which "perl"))
1072 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1073 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1074 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1075 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1076 (("\\$cachedir\\$program\\.cache")
1077 "/var/cache/ddclient/ddclient.cache"))
1078 (install-file file bin)
1079 (wrap-program (string-append bin "/" file)
1082 ,@(map (lambda (input)
1085 (string-append store "/bin"))))
1091 (((? (cut string-prefix? "perl-" <>) name) . dir)
1092 (string-append dir "/lib/perl5/site_perl"))
1095 (for-each (cut install-file <> (string-append out
1097 (find-files "." "sample.*$"))))))
1098 (home-page "https://ddclient.net/")
1099 (synopsis "Address updating utility for dynamic DNS services")
1100 (description "This package provides a client to update dynamic IP
1101 addresses with several dynamic DNS service providers, such as
1102 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1104 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1105 access a machine with a dynamic IP address.
1107 The client supports both dynamic and (near) static services, as well as MX
1108 record and alternative name management. It caches the address, and only
1109 attempts the update when it has changed.")
1110 (license license:gpl2+)))
1119 (url "https://github.com/handshake-org/hnsd")
1120 (commit (string-append "v" version))))
1123 "1kdgff8rf8gmvwz2p758ilbjxpvz4xm6z41pa5353asg6xb853bb"))
1124 (file-name (git-file-name name version))
1125 (modules '((guix build utils)))
1128 ;; Delete the bundled copy of libuv.
1129 (delete-file-recursively "uv")
1130 (substitute* "configure.ac"
1131 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1132 (substitute* "Makefile.am"
1133 (("SUBDIRS = uv") "\n")
1134 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1136 ;; Make sure the 'hnsd' binary is installed and
1137 ;; dynamically-linked.
1138 (("noinst_PROGRAMS") "bin_PROGRAMS")
1139 (("hnsd_LDFLAGS = -static") ""))
1141 ;; This script tries to chdir to "uv" and doesn't do more
1142 ;; than "autoreconf" so remove it.
1143 (delete-file "autogen.sh")
1145 (build-system gnu-build-system)
1147 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1149 `(("autoconf" ,autoconf)
1150 ("automake" ,automake)
1151 ("libtool" ,libtool)))
1153 `(("unbound" ,unbound)
1155 (home-page "https://www.handshake.org/")
1156 (synopsis "Resolver daemon for the Handshake naming protocol")
1158 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1159 System (HNS) peer-to-peer network.")
1160 (license license:expat)))
1162 (define-public libmicrodns
1164 (name "libmicrodns")
1168 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1169 "releases/download/" version "/microdns-"
1173 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1174 (build-system meson-build-system)
1175 (home-page "https://github.com/videolabs/libmicrodns")
1176 (synopsis "Minimal mDNS resolver library")
1177 (description "@code{libmicrodns} provides a minimal implementation of a
1178 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1179 a zero-config service that allows one to resolve host names to IP addresses in
1181 (license license:lgpl2.1)))
1183 (define-public public-suffix-list
1184 ;; Mozilla releases the official list here:
1186 ;; https://publicsuffix.org/list/public_suffix_list.dat
1188 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1189 ;; so its contents will change over time. If you update this commit, please
1190 ;; make sure that the new commit refers to a list which is identical to the
1191 ;; officially published list available from the URL above.
1192 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1194 (name "public-suffix-list")
1195 (version (git-version "0" "1" commit))
1199 (url "https://github.com/publicsuffix/list")
1201 (file-name (git-file-name name version))
1204 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1205 (build-system trivial-build-system)
1207 `(#:modules ((guix build utils))
1210 (use-modules (guix build utils))
1211 (let* ((out (assoc-ref %outputs "out"))
1212 ;; Install to /share because that is where "read-only
1213 ;; architecture-independent data files" should go (see:
1214 ;; (standards) Directory Variables). Include the version in
1215 ;; the directory name so that if multiple versions are ever
1216 ;; installed in the same profile, they will not conflict.
1217 (destination (string-append
1218 out "/share/public-suffix-list-" ,version))
1219 (source (assoc-ref %build-inputs "source")))
1220 (with-directory-excursion source
1221 (install-file "public_suffix_list.dat" destination)
1222 (install-file "LICENSE" destination))
1224 (home-page "https://publicsuffix.org/")
1225 (synopsis "Database of current and historical DNS suffixes")
1226 (description "This is the Public Suffix List maintained by Mozilla. A
1227 \"public suffix\" is one under which Internet users can (or historically
1228 could) directly register names in the Domain Name System (DNS). Some examples
1229 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1230 known public suffixes.")
1231 (license license:mpl2.0))))
1233 (define-public maradns
1236 (version "3.5.0007")
1240 (uri (string-append "https://maradns.samiam.org/download/"
1241 (version-major+minor version) "/"
1242 version "/maradns-" version ".tar.xz"))
1244 (base32 "0bc19xylg4whww9qaj5i4izwxcrh0c0ja7l1pfcn2la02hlvg1a6"))))
1245 (build-system gnu-build-system)
1247 `(#:tests? #f ; need to be root to run tests
1250 ,(string-append "CC=" (cc-for-target))
1251 (string-append "PREFIX=" %output)
1252 (string-append "RPM_BUILD_ROOT=" %output))
1254 (modify-phases %standard-phases
1256 (lambda* (#:key native-inputs target #:allow-other-keys)
1257 ;; make_32bit_tables generates a header file that is used during
1258 ;; compilation. Hence, during cross compilation, it should be
1259 ;; built for the host system.
1261 (substitute* "rng/Makefile"
1262 (("\\$\\(CC\\) -o make_32bit_tables")
1263 (string-append (assoc-ref native-inputs "gcc")
1264 "/bin/gcc -o make_32bit_tables"))))
1265 (invoke "./configure")))
1266 (add-before 'install 'create-install-directories
1267 (lambda* (#:key outputs #:allow-other-keys)
1268 (let ((out (assoc-ref outputs "out")))
1269 (for-each (lambda (dir)
1270 (mkdir-p (string-append out dir)))
1271 (list "/bin" "/sbin" "/etc"
1276 (home-page "https://maradns.samiam.org")
1277 (synopsis "Small lightweight DNS server")
1278 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1279 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1280 and TCP-capable recursive DNS server for finding domains on the internet.")
1281 (license license:bsd-2)))
1283 (define-public openresolv
1289 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1290 "openresolv-" version ".tar.xz"))
1293 "15qvp5va2yrqpz0ba54clvn8cbc66v4sl7k3bi9ji8jpx040bcs2"))
1295 (search-patches "openresolv-restartcmd-guix.patch"))))
1296 (build-system gnu-build-system)
1298 `(#:tests? #f ; No test suite
1300 (list (string-append "--sysconfdir=/etc"))
1302 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
1303 (home-page "https://roy.marples.name/projects/openresolv/")
1304 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1305 (description "openresolv is an implementation of @command{resolvconf}, the
1306 middleman between the network configuration services and
1307 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1308 stores, removes and lists a full @file{resolv.conf} generated for the
1309 interface. It then calls all the helper scripts it knows about so it can
1310 configure the real @file{/etc/resolv.conf} and optionally any local
1311 nameservers other than libc.")
1312 (license license:bsd-2)))