1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
3 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
7 ;;; Copyright © 2016 Nikita <nikita@n0.is>
8 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
11 ;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
12 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
13 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
14 ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
15 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
16 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
17 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
18 ;;; Copyright © 2020 Leo Famulari <leo@famulari.name>
19 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
21 ;;; This file is part of GNU Guix.
23 ;;; GNU Guix is free software; you can redistribute it and/or modify it
24 ;;; under the terms of the GNU General Public License as published by
25 ;;; the Free Software Foundation; either version 3 of the License, or (at
26 ;;; your option) any later version.
28 ;;; GNU Guix is distributed in the hope that it will be useful, but
29 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 ;;; GNU General Public License for more details.
33 ;;; You should have received a copy of the GNU General Public License
34 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
36 (define-module (gnu packages dns)
37 #:use-module (gnu packages admin)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages bash)
41 #:use-module (gnu packages certs)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages documentation)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages crypto)
47 #:use-module (gnu packages datastructures)
48 #:use-module (gnu packages flex)
49 #:use-module (gnu packages freedesktop)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages groff)
53 #:use-module (gnu packages groff)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages libedit)
56 #:use-module (gnu packages libevent)
57 #:use-module (gnu packages libidn)
58 #:use-module (gnu packages linux)
59 #:use-module (gnu packages lua)
60 #:use-module (gnu packages ncurses)
61 #:use-module (gnu packages nettle)
62 #:use-module (gnu packages networking)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages protobuf)
66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-xyz)
68 #:use-module (gnu packages ragel)
69 #:use-module (gnu packages shells)
70 #:use-module (gnu packages sphinx)
71 #:use-module (gnu packages swig)
72 #:use-module (gnu packages tls)
73 #:use-module (gnu packages web)
74 #:use-module (gnu packages xml)
75 #:use-module (gnu packages)
76 #:use-module ((guix licenses) #:prefix license:)
77 #:use-module (guix packages)
78 #:use-module (guix download)
79 #:use-module (guix git-download)
80 #:use-module (guix utils)
81 #:use-module (guix build-system glib-or-gtk)
82 #:use-module (guix build-system gnu)
83 #:use-module (guix build-system meson)
84 #:use-module (guix build-system trivial))
94 (string-append "https://www.nlnetlabs.nl/downloads/"
95 name "/" name "-" version ".tar.gz"))
97 (base32 "0ac242n7996fswq1a3nlh1bbbhrsdwsq4mx7xq8ffq6aplb4rj4a"))
100 ;; To create make-flag vairables,
101 ;; for splitting installation of drill and examples.
102 "ldns-drill-examples.patch"))))
103 (build-system gnu-build-system)
104 (outputs '("out" "drill" "examples" "pyldns"))
106 `( ;; Tests require Tpkg.
107 ;; https://tpkg.github.io/
112 "--enable-gost-anyway"
113 "--enable-rrtype-ninfo"
114 "--enable-rrtype-rkey"
116 "--enable-rrtype-avc"
117 "--enable-rrtype-doa"
118 "--enable-rrtype-amtrelay"
122 ;; Perl module DNS::LDNS not available.
123 ;; https://github.com/erikoest/DNS-LDNS.git
124 ;; "--with-p5-dns-ldns"
125 (string-append "--with-ssl="
126 (assoc-ref %build-inputs "openssl"))
127 (string-append "--with-ca-path="
128 (assoc-ref %build-inputs "nss-certs")
132 (string-append "drillbindir="
133 (assoc-ref %outputs "drill")
135 (string-append "drillmandir="
136 (assoc-ref %outputs "drill")
138 (string-append "examplesbindir="
139 (assoc-ref %outputs "examples")
141 (string-append "examplesmandir="
142 (assoc-ref %outputs "examples")
144 (string-append "python_site="
145 (assoc-ref %outputs "pyldns")
147 ,(version-major+minor
148 (package-version python))
151 `(("doxygen" ,doxygen)
154 ("perl-devel-checklib" ,perl-devel-checklib)
155 ("pkg-config" ,pkg-config)
156 ("python" ,python-wrapper)
159 `(("libpcap" ,libpcap)
160 ("nss-certs" ,nss-certs)
161 ("openssl" ,openssl)))
162 (synopsis "DNS library that facilitates DNS tool programming")
163 (description "LDNS aims to simplify DNS programming, it supports recent
164 RFCs like the DNSSEC documents, and allows developers to easily create
165 software conforming to current RFCs, and experimental software for current
166 Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
167 C it should be a lot faster than Perl.")
168 (home-page "https://nlnetlabs.nl/projects/ldns/about/")
169 (license license:bsd-3)))
171 (define-public dnssec-trigger
173 (name "dnssec-trigger")
179 (string-append "https://www.nlnetlabs.nl/downloads/"
180 name "/" name "-" version ".tar.gz"))
182 (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
183 (build-system glib-or-gtk-build-system)
184 (outputs '("out" "gui" "nm"))
186 `(#:test-target "test"
189 (string-append "--with-ssl="
190 (assoc-ref %build-inputs "openssl"))
191 "--with-hooks=networkmanager"
192 (string-append "--with-networkmanager-dispatch="
193 (assoc-ref %outputs "nm")
194 "/etc/NetworkManager/dispatcher.d")
195 (string-append "--with-xdg-autostart="
196 (assoc-ref %outputs "gui")
197 "/etc/xdg/autostart")
198 (string-append "--with-uidir="
199 (assoc-ref %outputs "gui")
200 "/share/dnssec-trigger")
201 (string-append "--with-python="
202 (assoc-ref %build-inputs "python")
204 (string-append "--with-unbound-control="
205 (assoc-ref %build-inputs "unbound")
206 "/sbin/unbound-control")
207 "--with-forward-zones-support")
209 (modify-phases %standard-phases
210 (add-after 'unpack 'patch-configure
212 (substitute* "configure"
213 (("appindicator-0.1")
214 "appindicator3-0.1"))
216 (add-before 'configure 'patch-makefile
218 (substitute* "Makefile.in"
223 ((".*gtk-update-icon-cache.*")
226 (add-after 'install 'remove-systemd
227 (lambda* (#:key outputs #:allow-other-keys)
228 (let* ((out (assoc-ref outputs "out")))
229 (delete-file-recursively
230 (string-append out "/lib/systemd"))
232 (add-after 'remove-systemd 'move-gui
233 (lambda* (#:key outputs #:allow-other-keys)
234 (let* ((out (assoc-ref outputs "out"))
235 (gui (assoc-ref outputs "gui")))
236 (mkdir-p (string-append gui "/bin"))
237 (mkdir-p (string-append gui "/share"))
239 (string-append out "/bin")
240 (string-append gui "/bin"))
242 (string-append out "/share/icons")
243 (string-append gui "/share/icons"))
245 (add-after 'move-gui 'move-nm
246 (lambda* (#:key outputs #:allow-other-keys)
247 (let* ((out (assoc-ref outputs "out"))
248 (nm (assoc-ref outputs "nm")))
249 (mkdir-p (string-append nm "/libexec"))
251 (string-append out "/libexec")
252 (string-append nm "/libexec"))
256 ("pkg-config" ,pkg-config)
257 ("python" ,python-wrapper)))
261 ("libappindicator" ,libappindicator)
263 ("unbound" ,unbound)))
264 (synopsis "DNSSEC protection for the DNS traffic")
265 (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
266 for the DNS traffic. It relies on the Unbound DNS resolver running locally on
267 your system, which performs DNSSEC validation. It reconfigures Unbound in such
268 a way that it will signal it to to use the DHCP obtained forwarders if possible,
269 fallback to doing its own AUTH queries if that fails, and if that fails it will
270 prompt the user with the option to go with insecure DNS only.")
271 (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
272 (license license:bsd-3)))
274 (define-public dnsmasq
281 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
285 "0cn1xd1s6xs78jmrmwjnh9m6w3q38pk6dyqy2phvasqiyd33cll4"))))
286 (build-system gnu-build-system)
288 `(("pkg-config" ,pkg-config)))
293 (modify-phases %standard-phases (delete 'configure))
294 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
296 "COPTS=\"-DHAVE_DBUS\"")
297 #:tests? #f)) ; no ‘check’ target
298 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
299 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
301 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
302 to provide DNS and, optionally, DHCP to a small network. It can serve the
303 names of local machines which are not in the global DNS. The DHCP server
304 integrates with the DNS server and allows machines with DHCP-allocated
305 addresses to appear in the DNS with names configured either on each host or in
306 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
307 and BOOTP/TFTP for network booting of diskless machines.")
308 ;; Source files only say GPL2 and GPL3 are allowed.
309 (license (list license:gpl2 license:gpl3))))
311 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
312 ;; different name here.
313 (define-public isc-bind
316 ;; When updating, check whether isc-dhcp's bundled copy should be as well.
321 "https://ftp.isc.org/isc/bind9/" version
322 "/bind-" version ".tar.xz"))
325 "1l8lhgnkj3fnl1101bs3pzj5gv2x5m9ahvrbyscsc9mxxc91hzcz"))))
326 (build-system gnu-build-system)
327 (outputs `("out" "utils"))
329 ;; It would be nice to add GeoIP and gssapi once there are packages.
336 ("python-ply" ,python-ply)))
339 ("pkg-config" ,pkg-config)))
342 (list (string-append "--with-pkcs11="
343 (assoc-ref %build-inputs "p11-kit")))
345 (modify-phases %standard-phases
346 (add-after 'strip 'move-to-utils
350 (let ((target (string-append (assoc-ref %outputs "utils") file))
351 (src (string-append (assoc-ref %outputs "out") file)))
352 (mkdir-p (dirname target))
355 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
356 "/share/man/man1/dig.1"
357 "/share/man/man1/host.1"
358 "/share/man/man1/nslookup.1"
359 "/share/man/man1/nsupdate.1"))
361 ;; When and if guix provides user namespaces for the build process,
362 ;; then the following can be uncommented and the subsequent "force-test"
363 ;; will not be necessary.
365 ;; (add-before 'check 'set-up-loopback
367 ;; (system "bin/tests/system/ifconfig.sh up")))
370 ;; XXX Even ‘make force-test’ tries to create network interfaces
371 ;; and fails. The only working target is the (trivial) fuzz test.
372 (with-directory-excursion "fuzz"
373 (invoke "make" "check"))
375 (synopsis "Domain Name System (DNS) implementation")
376 (description "BIND is an implementation of the @dfn{Domain Name System}
377 (DNS) protocols for the Internet. It is a reference implementation of those
378 protocols, but it is also production-grade software, suitable for use in
379 high-volume and high-reliability applications. The name BIND stands for
380 \"Berkeley Internet Name Domain\", because the software originated in the
381 early 1980s at the University of California at Berkeley. The @code{utils}
382 output of this package contains the following DNS name servers related command
386 DNS lookup and validation utility
392 Internet name servers interactive query utility
394 Dynamic DNS update utility
396 (home-page "https://www.isc.org/bind/")
397 (license (list license:mpl2.0))))
399 (define-public dnscrypt-proxy
401 (name "dnscrypt-proxy")
406 "https://download.dnscrypt.org/dnscrypt-proxy/"
407 "dnscrypt-proxy-" version ".tar.bz2"))
410 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
411 (modules '((guix build utils)))
413 ;; Delete bundled libltdl. XXX: This package also bundles
414 ;; a modified libevent that cannot currently be removed.
416 (delete-file-recursively "libltdl")
418 (build-system gnu-build-system)
421 (modify-phases %standard-phases
422 (add-after 'unpack 'autoreconf
424 ;; Re-generate build files due to unbundling ltdl.
425 ;; TODO: Prevent generating new libltdl and building it.
426 ;; The system version is still favored and referenced.
427 (invoke "autoreconf" "-vif"))))))
429 `(("pkg-config" ,pkg-config)
430 ("automake" ,automake)
431 ("autoconf" ,autoconf)
432 ("libtool" ,libtool)))
434 `(("libltdl" ,libltdl)
435 ("libsodium" ,libsodium)))
436 (home-page "https://www.dnscrypt.org/")
437 (synopsis "Securely send DNS requests to a remote server")
439 "@command{dnscrypt-proxy} is a tool for securing communications
440 between a client and a DNS resolver. It verifies that responses you get
441 from a DNS provider was actually sent by that provider, and haven't been
442 tampered with. For optimal performance it is recommended to use this as
443 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
444 can also be used as a normal DNS \"server\". A list of public dnscrypt
445 servers is included, and an up-to-date version is available at
446 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
447 (license (list license:isc
448 ;; Libevent and src/ext/queue.h is 3-clause BSD.
451 (define-public dnscrypt-wrapper
453 (name "dnscrypt-wrapper")
458 "https://github.com/cofyc/dnscrypt-wrapper/releases"
459 "/download/v" version "/" name "-v" version ".tar.bz2"))
462 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
463 (build-system gnu-build-system)
465 `(#:make-flags '("CC=gcc")
466 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
469 (modify-phases %standard-phases
470 (add-after 'unpack 'create-configure
472 (invoke "make" "configure"))))))
474 `(("autoconf" ,autoconf)))
476 `(("libevent" ,libevent)
477 ("libsodium" ,libsodium)))
478 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
479 (synopsis "Server-side dnscrypt proxy")
481 "@command{dnscrypt-wrapper} is a tool to expose a name server over
482 the @code{dnscrypt} protocol. It can be used as an endpoint for the
483 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
485 (license (list license:isc
486 ;; Bundled argparse is MIT. TODO: package and unbundle.
488 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
492 (define-public libasr
499 (uri (string-append "https://www.opensmtpd.org/archives/"
500 "libasr-" version ".tar.gz"))
502 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
503 (build-system gnu-build-system)
506 (modify-phases %standard-phases
507 (add-after 'install 'install-documentation
508 (lambda* (#:key outputs #:allow-other-keys)
509 (let ((out (assoc-ref outputs "out")))
510 (install-file "src/asr_run.3"
511 (string-append out "/share/man/man3"))
514 `(("autoconf" ,autoconf)
515 ("automake" ,automake)
517 ("pkg-config" ,pkg-config)))
518 (home-page "https://www.opensmtpd.org")
519 (synopsis "Asynchronous resolver library by the OpenBSD project")
521 "libasr is a free, simple and portable asynchronous resolver library.
522 It runs DNS queries and performs hostname resolution in a fully
523 asynchronous fashion.")
524 (license (list license:isc
525 license:bsd-2 ; last part of getrrsetbyname_async.c
527 (license:non-copyleft "file://LICENSE") ; includes.h
537 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
540 (base32 "0ac3mbn5z4nc18782m9aswdpi2m9f4665vidw0ciyigdh0pywp2v"))))
541 (build-system gnu-build-system)
544 (list "--enable-pie" ; fully benefit from ASLR
547 "--enable-relro-now" ; protect GOT and .dtor areas
548 "--disable-radix-tree"
549 (string-append "--with-libevent="
550 (assoc-ref %build-inputs "libevent"))
551 (string-append "--with-ssl="
552 (assoc-ref %build-inputs "openssl"))
553 "--with-configdir=/etc"
554 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
555 "--with-logfile=/var/log/nsd.log"
556 "--with-pidfile=/var/db/nsd/nsd.pid"
557 "--with-dbfile=/var/db/nsd/nsd.db"
558 "--with-zonesdir=/etc/nsd"
559 "--with-xfrdfile=/var/db/nsd/xfrd.state"
560 "--with-zonelistfile=/var/db/nsd/zone.list")
562 (modify-phases %standard-phases
563 (add-before 'configure 'patch-installation-paths
564 (lambda* (#:key outputs #:allow-other-keys)
565 (let* ((out (assoc-ref outputs "out"))
566 (doc (string-append out "/share/doc/" ,name "-" ,version)))
567 ;; The ‘make install’ target tries to create the parent
568 ;; directories of run-time things like ‘pidfile’ above, and
569 ;; useless empty directories like 'configdir'. Remove such
570 ;; '$(INSTALL)' lines and install the example configuration file
571 ;; in an appropriate location.
572 (substitute* "Makefile.in"
573 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
574 (string-append "#" command))
575 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
576 (string-append doc "/examples/" file-name)))
578 #:tests? #f)) ; no tests
580 `(("libevent" ,libevent)
581 ("openssl" ,openssl)))
582 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
583 (synopsis "Authoritative DNS name server")
584 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
585 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
586 RFC-compliant nameserver.
588 NSD uses zone information compiled via @command{zonec} into a binary database
589 file (@file{nsd.db}). This allows fast startup of the name service daemon and
590 allows syntax-structural errors in zone files to be flagged at compile time,
591 before being made available to NSD service itself. However, most traditional
592 BIND-style zone files can be directly imported into NSD without modification.
594 The collection of programs and processes that make up NSD are designed so that
595 the daemon itself runs as a non-privileged user and can be easily configured to
596 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
597 to result in system-wide compromise.")
598 (license (list license:bsd-3))))
600 (define-public unbound
607 (uri (string-append "https://www.unbound.net/downloads/unbound-"
610 (base32 "0dnmh9jjh2v274f0hl31bgv40pl77mmfgky8bkqr5kvi3b17fdmp"))))
611 (build-system gnu-build-system)
612 (outputs '("out" "python"))
618 ("libevent" ,libevent)
619 ("protobuf" ,protobuf)
620 ("python-wrapper" ,python-wrapper)
621 ("openssl" ,openssl)))
624 (list "--disable-static" ; save space and non-determinism in libunbound.a
626 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
628 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
630 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
631 "--with-pythonmodule" "--with-pyunbound")
633 (modify-phases %standard-phases
634 (add-after 'configure 'fix-python-site-package-path
635 ;; Move python modules into their own output.
636 (lambda* (#:key outputs #:allow-other-keys)
637 (let ((pyout (assoc-ref outputs "python"))
638 (ver ,(version-major+minor (package-version python))))
639 (substitute* "Makefile"
640 (("^PYTHON_SITE_PKG=.*$")
643 pyout "/lib/python-" ver "/site-packages\n"))))
645 (add-before 'check 'fix-missing-nss-for-tests
646 ;; Unfortunately, the package's unittests involve some checks
647 ;; looking up protocols and services which are not provided
648 ;; by the minimalistic build environment, in particular,
649 ;; /etc/protocols and /etc/services are missing.
650 ;; Also, after plain substitution of protocol and service names
651 ;; in the test data, the tests still fail because the
652 ;; corresponding Resource Records have been signed by
654 ;; The following LD_PRELOAD library overwrites the glibc
655 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
656 ;; ‘getservbyport’ providing the few records required for the
657 ;; unit tests to pass.
658 (lambda* (#:key inputs outputs #:allow-other-keys)
659 (let* ((source (assoc-ref %build-inputs "source"))
660 (gcc (assoc-ref %build-inputs "gcc")))
661 (call-with-output-file "/tmp/nss_preload.c"
663 (display "#include <stdlib.h>
669 struct protoent *getprotobyname(const char *name) {
670 struct protoent *p = malloc(sizeof(struct protoent));
671 p->p_aliases = malloc(sizeof(char*));
672 if (strcasecmp(name, \"tcp\") == 0) {
675 p->p_aliases[0] = \"TCP\";
676 } else if (strcasecmp(name, \"udp\") == 0) {
679 p->p_aliases[0] = \"UDP\";
685 struct protoent *getprotobynumber(int proto) {
686 struct protoent *p = malloc(sizeof(struct protoent));
687 p->p_aliases = malloc(sizeof(char*));
692 p->p_aliases[0] = \"TCP\";
697 p->p_aliases[0] = \"UDP\";
706 struct servent *getservbyname(const char *name, const char *proto) {
707 struct servent *s = malloc(sizeof(struct servent));
708 char* buf = malloc((strlen(proto)+1)*sizeof(char));
710 s->s_aliases = malloc(sizeof(char*));
711 s->s_aliases[0] = NULL;
712 if (strcasecmp(name, \"domain\") == 0) {
713 s->s_name = \"domain\";
714 s->s_port = htons(53);
721 struct servent *getservbyport(int port, const char *proto) {
723 struct servent *s = malloc(sizeof(struct servent));
725 s->s_aliases = malloc(sizeof(char*));
726 s->s_aliases[0] = NULL;
729 s->s_name = \"domain\";
731 s->s_proto = \"udp\";
739 (invoke (string-append gcc "/bin/gcc")
740 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
741 "/tmp/nss_preload.c")
742 ;; The preload library only affects the unittests.
743 (substitute* "Makefile"
745 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
747 (home-page "https://www.unbound.net")
748 (synopsis "Validating, recursive, and caching DNS resolver")
750 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
751 validation of results. It implements only a minimal amount of authoritative
752 service to prevent leakage to the root nameservers: forward lookups for
753 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
754 served by AS112. Stub and forward zones are supported.")
755 (license license:bsd-4)))
757 (define-public yadifa
762 (let ((build "9729"))
766 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
767 "yadifa-" version "-" build ".tar.gz"))
769 (base32 "0azaignqmylfdzr4x02s8y3pkn4f0xkpz3d1pkiiz8mwk92zgybn")))))
770 (build-system gnu-build-system)
774 `(("openssl" ,openssl)))
777 (modify-phases %standard-phases
778 (add-before 'configure 'omit-example-configurations
780 (substitute* "Makefile.in"
784 (list "--sysconfdir=/etc"
785 "--localstatedir=/var"
786 "--disable-build-timestamp" ; build reproducibly
791 "--enable-ctrl" ; enable remote control
795 (home-page "https://www.yadifa.eu/")
796 (synopsis "Authoritative DNS name server")
797 (description "YADIFA is an authoritative name server for the @dfn{Domain
798 Name System} (DNS). It aims for both higher performance and a smaller memory
799 footprint than other implementations, while remaining fully RFC-compliant.
800 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
801 Extensions} (DNSSEC).")
802 (license license:bsd-3)))
812 (url "https://gitlab.nic.cz/knot/knot-dns")
813 (commit (string-append "v" version))))
814 (file-name (git-file-name name version))
816 (base32 "0fkvip7n5ihjfwnnivdc3jf44y8p85ifglvq7b0anxvj9cg1m78f"))
817 (modules '((guix build utils)))
820 ;; Remove Ragel-generated C files. We'll recreate them below.
821 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
822 (delete-file "src/libknot/yparser/ypbody.c")
824 (build-system gnu-build-system)
827 (list "--sysconfdir=/etc"
828 "--localstatedir=/var"
829 "--enable-dnstap" ; let tools read/write capture files
830 "--enable-fast-parser" ; disabled by default when .git/ exists
831 "--with-module-dnstap=yes" ; detailed query capturing & logging
832 (string-append "--with-bash-completions="
833 (assoc-ref %outputs "out")
834 "/etc/bash_completion.d"))
836 (modify-phases %standard-phases
837 (add-before 'bootstrap 'update-parser
839 (with-directory-excursion "src"
840 (invoke "sh" "../scripts/update-parser.sh"))))
841 (add-before 'configure 'disable-directory-pre-creation
843 ;; Don't install empty directories like ‘/etc’ outside the store.
844 ;; This is needed even when using ‘make config_dir=... install’.
845 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
848 (lambda* (#:key outputs #:allow-other-keys)
849 (let* ((out (assoc-ref outputs "out"))
850 (doc (string-append out "/share/doc/" ,name "-" ,version))
851 (etc (string-append doc "/examples/etc")))
853 (string-append "config_dir=" etc)
856 `(("autoconf" ,autoconf)
857 ("automake" ,automake)
859 ("pkg-config" ,pkg-config)
865 ("libcap-ng" ,libcap-ng)
871 ("protobuf-c" ,protobuf-c)))
872 (home-page "https://www.knot-dns.cz/")
873 (synopsis "Authoritative DNS name server")
874 (description "Knot DNS is an authoritative name server for the @dfn{Domain
875 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
876 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
877 number of programming techniques to improve speed. For example, the responder
878 is completely lock-free, resulting in a very high response rate. Other features
879 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
880 synthesis, and on-the-fly re-configuration.")
883 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
884 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
886 license:lgpl2.0+ ; parts of scr/contrib/ucw
887 license:public-domain ; src/contrib/fnv and possibly murmurhash3
888 license:gpl3+)))) ; everything else
890 (define-public knot-resolver
892 (name "knot-resolver")
896 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
897 "knot-resolver-" version ".tar.xz"))
900 "12s5070nqqf599s1mb6rjas2as481rjf751qk5yrz6p34y885k90"))))
901 (build-system meson-build-system)
903 '(#:configure-flags '("-Ddoc=enabled")
905 (modify-phases %standard-phases
906 (add-before 'configure 'disable-default-ta
908 ;; Disable the default managed root TA, since we don't have
909 ;; write access to the keyfile and its directory in store.
910 (substitute* "daemon/lua/sandbox.lua.in"
911 (("^trust_anchors\\.add_file.*") ""))
913 (add-after 'build 'build-doc
915 (invoke "ninja" "doc")))
916 (add-after 'install 'wrap-binary
917 (lambda* (#:key inputs outputs #:allow-other-keys)
918 (let* ((out (assoc-ref outputs "out"))
919 (lua-* (map cdr (filter
921 (string-prefix? "lua-" (car input)))
923 (lua-path (lambda (p)
924 (string-append p "/share/lua/5.1/?.lua")))
925 (lua-cpath (lambda (p)
926 (string-append p "/lib/lua/5.1/?.so"))))
927 (wrap-program (string-append out "/sbin/kresd")
928 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
929 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
932 `(("cmocka" ,cmocka) ; for unit tests
934 ("protobuf-c" ,protobuf-c)
935 ("pkg-config" ,pkg-config)
936 ("python-breathe" ,python-breathe)
937 ("python-sphinx" ,python-sphinx)
938 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
946 ;; TODO: Add optional lua modules: basexx and psl.
947 ("lua-bitop" ,lua5.1-bitop)))
948 (home-page "https://www.knot-resolver.cz/")
949 (synopsis "Caching validating DNS resolver")
951 "Knot Resolver is a caching full resolver implementation written in C and
952 LuaJIT, both a resolver library and a daemon.")
953 (license (list license:gpl3+
954 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
959 (define-public ddclient
967 (url "https://github.com/ddclient/ddclient")
968 (commit (string-append "v" version))))
969 (file-name (git-file-name name version))
971 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
972 (build-system trivial-build-system) ; no Makefile.PL
977 `(("inetutils" ,inetutils) ; logger
978 ("net-tools" ,net-tools)
979 ("perl-data-validate-ip" ,perl-data-validate-ip)
980 ("perl-digest-sha1" ,perl-digest-sha1)
981 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
983 `(#:modules ((guix build utils)
988 (use-modules (guix build utils)
991 (setenv "PATH" (string-append
992 (assoc-ref %build-inputs "bash") "/bin" ":"
993 (assoc-ref %build-inputs "perl") "/bin"))
995 ;; Copy the (read-only) source into the (writable) build directory.
996 (copy-recursively (assoc-ref %build-inputs "source") ".")
999 (let* ((out (assoc-ref %outputs "out"))
1000 (bin (string-append out "/bin")))
1001 (let ((file "ddclient"))
1003 (("/usr/bin/perl") (which "perl"))
1004 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1005 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1006 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1007 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1008 (("\\$cachedir\\$program\\.cache")
1009 "/var/cache/ddclient/ddclient.cache"))
1010 (install-file file bin)
1011 (wrap-program (string-append bin "/" file)
1014 ,@(map (lambda (input)
1017 (string-append store "/bin"))))
1023 (((? (cut string-prefix? "perl-" <>) name) . dir)
1024 (string-append dir "/lib/perl5/site_perl"))
1027 (for-each (cut install-file <> (string-append out
1029 (find-files "." "sample.*$"))))))
1030 (home-page "https://ddclient.net/")
1031 (synopsis "Address updating utility for dynamic DNS services")
1032 (description "This package provides a client to update dynamic IP
1033 addresses with several dynamic DNS service providers, such as
1034 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1036 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1037 access a machine with a dynamic IP address.
1039 The client supports both dynamic and (near) static services, as well as MX
1040 record and alternative name management. It caches the address, and only
1041 attempts the update when it has changed.")
1042 (license license:gpl2+)))
1045 ;; There have been no releases yet, hence this commit.
1046 (let ((revision "0")
1047 (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
1050 (version (git-version "0.0" revision commit))
1054 (url "https://github.com/handshake-org/hnsd")
1058 "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
1059 (file-name (git-file-name name version))
1060 (modules '((guix build utils)))
1063 ;; Delete the bundled copy of libuv.
1064 (delete-file-recursively "uv")
1065 (substitute* "configure.ac"
1066 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1067 (substitute* "Makefile.am"
1068 (("SUBDIRS = uv") "\n")
1069 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1071 ;; Make sure the 'hnsd' binary is installed and
1072 ;; dynamically-linked.
1073 (("noinst_PROGRAMS") "bin_PROGRAMS")
1074 (("hnsd_LDFLAGS = -static") ""))
1076 ;; This script tries to chdir to "uv" and doesn't do more
1077 ;; than "autoreconf" so remove it.
1078 (delete-file "autogen.sh")
1080 (build-system gnu-build-system)
1082 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1084 `(("autoconf" ,autoconf)
1085 ("automake" ,automake)
1086 ("libtool" ,libtool)))
1088 `(("unbound" ,unbound)
1090 (home-page "https://www.handshake.org/")
1091 (synopsis "Resolver daemon for the Handshake naming protocol")
1093 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1094 System (HNS) peer-to-peer network.")
1095 (license license:expat))))
1097 (define-public libmicrodns
1099 (name "libmicrodns")
1103 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1104 "releases/download/" version "/microdns-"
1108 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1109 (build-system meson-build-system)
1110 (home-page "https://github.com/videolabs/libmicrodns")
1111 (synopsis "Minimal mDNS resolver library")
1112 (description "@code{libmicrodns} provides a minimal implementation of a
1113 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1114 a zero-config service that allows one to resolve host names to IP addresses in
1116 (license license:lgpl2.1)))
1118 (define-public public-suffix-list
1119 ;; Mozilla releases the official list here:
1121 ;; https://publicsuffix.org/list/public_suffix_list.dat
1123 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1124 ;; so its contents will change over time. If you update this commit, please
1125 ;; make sure that the new commit refers to a list which is identical to the
1126 ;; officially published list available from the URL above.
1127 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1129 (name "public-suffix-list")
1130 (version (git-version "0" "1" commit))
1134 (url "https://github.com/publicsuffix/list")
1136 (file-name (git-file-name name version))
1139 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1140 (build-system trivial-build-system)
1142 `(#:modules ((guix build utils))
1145 (use-modules (guix build utils))
1146 (let* ((out (assoc-ref %outputs "out"))
1147 ;; Install to /share because that is where "read-only
1148 ;; architecture-independent data files" should go (see:
1149 ;; (standards) Directory Variables). Include the version in
1150 ;; the directory name so that if multiple versions are ever
1151 ;; installed in the same profile, they will not conflict.
1152 (destination (string-append
1153 out "/share/public-suffix-list-" ,version))
1154 (source (assoc-ref %build-inputs "source")))
1155 (with-directory-excursion source
1156 (install-file "public_suffix_list.dat" destination)
1157 (install-file "LICENSE" destination))
1159 (home-page "https://publicsuffix.org/")
1160 (synopsis "Database of current and historical DNS suffixes")
1161 (description "This is the Public Suffix List maintained by Mozilla. A
1162 \"public suffix\" is one under which Internet users can (or historically
1163 could) directly register names in the Domain Name System (DNS). Some examples
1164 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1165 known public suffixes.")
1166 (license license:mpl2.0))))
1168 (define-public maradns
1171 (version "3.5.0007")
1175 (uri (string-append "https://maradns.samiam.org/download/"
1176 (version-major+minor version) "/"
1177 version "/maradns-" version ".tar.xz"))
1179 (base32 "0bc19xylg4whww9qaj5i4izwxcrh0c0ja7l1pfcn2la02hlvg1a6"))))
1180 (build-system gnu-build-system)
1182 `(#:tests? #f ; need to be root to run tests
1185 ,(string-append "CC=" (cc-for-target))
1186 (string-append "PREFIX=" %output)
1187 (string-append "RPM_BUILD_ROOT=" %output))
1189 (modify-phases %standard-phases
1191 (lambda* (#:key native-inputs target #:allow-other-keys)
1192 ;; make_32bit_tables generates a header file that is used during
1193 ;; compilation. Hence, during cross compilation, it should be
1194 ;; built for the host system.
1196 (substitute* "rng/Makefile"
1197 (("\\$\\(CC\\) -o make_32bit_tables")
1198 (string-append (assoc-ref native-inputs "gcc")
1199 "/bin/gcc -o make_32bit_tables"))))
1200 (invoke "./configure")))
1201 (add-before 'install 'create-install-directories
1202 (lambda* (#:key outputs #:allow-other-keys)
1203 (let ((out (assoc-ref outputs "out")))
1204 (for-each (lambda (dir)
1205 (mkdir-p (string-append out dir)))
1206 (list "/bin" "/sbin" "/etc"
1211 (home-page "https://maradns.samiam.org")
1212 (synopsis "Small lightweight DNS server")
1213 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1214 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1215 and TCP-capable recursive DNS server for finding domains on the internet.")
1216 (license license:bsd-2)))
1218 (define-public openresolv
1224 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1225 "openresolv-" version ".tar.xz"))
1228 "01ms6c087la4hk0f0w6n2vpsb7dg4kklah2rqyhz88p0vr9bqy20"))
1230 (search-patches "openresolv-restartcmd-guix.patch"))))
1231 (build-system gnu-build-system)
1233 `(#:tests? #f ; No test suite
1235 (list (string-append "--sysconfdir=/etc"))
1237 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
1238 (home-page "https://roy.marples.name/projects/openresolv/")
1239 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1240 (description "openresolv is an implementation of @command{resolvconf}, the
1241 middleman between the network configuration services and
1242 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1243 stores, removes and lists a full @file{resolv.conf} generated for the
1244 interface. It then calls all the helper scripts it knows about so it can
1245 configure the real @file{/etc/resolv.conf} and optionally any local
1246 nameservers other than libc.")
1247 (license license:bsd-2)))