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–2022 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, 2022 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 check)
44 #:use-module (gnu packages curl)
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 serialization)
73 #:use-module (gnu packages shells)
74 #:use-module (gnu packages sphinx)
75 #:use-module (gnu packages swig)
76 #:use-module (gnu packages texinfo)
77 #:use-module (gnu packages tls)
78 #:use-module (gnu packages web)
79 #:use-module (gnu packages xml)
80 #:use-module (gnu packages)
81 #:use-module (guix gexp)
82 #:use-module ((guix licenses) #:prefix license:)
83 #:use-module (guix packages)
84 #:use-module (guix download)
85 #:use-module (guix git-download)
86 #:use-module (guix utils)
87 #:use-module (guix build-system copy)
88 #:use-module (guix build-system glib-or-gtk)
89 #:use-module (guix build-system gnu)
90 #:use-module (guix build-system meson)
91 #:use-module (guix build-system trivial))
93 (define-public cloudflare-cli
94 (let ((commit "2d986d3ec1b0e3158c4bd40e8918947cb74aa392")
97 (name "cloudflare-cli")
98 (version (git-version "0.0.0" revision commit))
103 (url "https://github.com/earlchew/cloudflare-cli")
105 (file-name (git-file-name name version))
108 "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
109 (build-system copy-build-system)
111 `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
113 (modify-phases %standard-phases
114 (add-after 'unpack 'find-jsonsh
115 (lambda* (#:key inputs #:allow-other-keys)
116 (substitute* "cloudflare-cli.sh"
117 (("\\$\\{0%/\\*\\}/jsonsh")
118 (string-append (assoc-ref inputs "json.sh") "/bin/JSON.sh")))
120 (add-after 'install 'wrap-program
121 (lambda* (#:key inputs outputs #:allow-other-keys)
122 (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
125 (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
130 (list bash-minimal curl grep json.sh))
132 "CLI to edit Cloudflare DNS records")
134 "This command line tool to update Cloudfare DNS records is useful for tasks
135 such as updating dynamic DNS records or updating DNS records for the ACME DNS-01
137 (home-page "https://github.com/earlchew/cloudflare-cli")
138 (license license:expat))))
148 (string-append "https://www.nlnetlabs.nl/downloads/"
149 "ldns/ldns-" version ".tar.gz"))
151 (base32 "0q3q1svyxpj2g5wdkfy1ndb14m9fzffwyskflpihfabb0g8jvxy3"))
154 ;; To create make-flag variables,
155 ;; for splitting installation of drill and examples.
156 "ldns-drill-examples.patch"))))
157 (build-system gnu-build-system)
158 (outputs '("out" "drill" "examples" "pyldns"))
161 #:tests? #f ; tests require <https://tpkg.github.io>
165 "--enable-gost-anyway"
166 "--enable-rrtype-ninfo"
167 "--enable-rrtype-rkey"
169 "--enable-rrtype-avc"
170 "--enable-rrtype-doa"
171 "--enable-rrtype-amtrelay"
175 ;; Perl module DNS::LDNS not available.
176 ;; https://github.com/erikoest/DNS-LDNS.git
177 ;; "--with-p5-dns-ldns"
178 (string-append "--with-ssl=" #$(this-package-input "openssl"))
179 (string-append "--with-ca-path=/etc/ssl/certs"))
182 (string-append "drillbindir=" #$output:drill "/bin")
183 (string-append "drillmandir=" #$output:drill "/share/man")
184 (string-append "examplesbindir=" #$output:examples "/bin")
185 (string-append "examplesmandir=" #$output:examples "/share/man")
186 (string-append "python_site=" #$output:pyldns "/lib/python"
187 #$(version-major+minor (package-version
192 (list doxygen perl perl-devel-checklib pkg-config swig))
194 (list libpcap openssl python-wrapper))
195 (synopsis "DNS library that facilitates DNS tool programming")
196 (description "LDNS aims to simplify DNS programming, it supports recent
197 RFCs like the DNSSEC documents, and allows developers to easily create
198 software conforming to current RFCs, and experimental software for current
199 Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
200 C it should be a lot faster than Perl.")
201 (home-page "https://nlnetlabs.nl/projects/ldns/about/")
202 (license license:bsd-3)))
204 (define-public dnssec-trigger
206 (name "dnssec-trigger")
212 (string-append "https://www.nlnetlabs.nl/downloads/"
213 name "/" name "-" version ".tar.gz"))
215 (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
216 (build-system glib-or-gtk-build-system)
217 (outputs '("out" "gui" "nm"))
219 (list #:test-target "test"
222 (string-append "--with-ssl=" #$(this-package-input "openssl"))
223 "--with-hooks=networkmanager"
224 (string-append "--with-networkmanager-dispatch="
226 "/etc/NetworkManager/dispatcher.d")
227 (string-append "--with-xdg-autostart="
229 "/etc/xdg/autostart")
230 (string-append "--with-uidir="
232 "/share/dnssec-trigger")
233 (string-append "--with-python="
234 #$(this-package-native-input "python-wrapper")
236 (string-append "--with-unbound-control="
237 #$(this-package-input "unbound")
238 "/sbin/unbound-control")
239 "--with-forward-zones-support")
241 #~(modify-phases %standard-phases
242 (add-after 'unpack 'patch-configure
244 (substitute* "configure"
245 (("appindicator-0.1")
246 "appindicator3-0.1"))))
247 (add-before 'configure 'patch-makefile
249 (substitute* "Makefile.in"
254 ((".*gtk-update-icon-cache.*")
256 (add-after 'install 'remove-systemd
258 (delete-file-recursively
259 (string-append #$output "/lib/systemd"))))
260 (add-after 'remove-systemd 'move-gui
262 (mkdir-p (string-append #$output:gui "/bin"))
263 (mkdir-p (string-append #$output:gui "/share"))
265 (string-append #$output "/bin")
266 (string-append #$output:gui "/bin"))
268 (string-append #$output "/share/icons")
269 (string-append #$output:gui "/share/icons"))))
270 (add-after 'move-gui 'move-nm
272 (mkdir-p (string-append #$output:nm "/libexec"))
274 (string-append #$output "/libexec")
275 (string-append #$output:nm "/libexec")))))))
277 (list cmocka pkg-config python-wrapper))
279 (list gtk+-2 ldns libappindicator openssl unbound))
280 (synopsis "DNSSEC protection for the DNS traffic")
281 (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
282 for the DNS traffic. It relies on the Unbound DNS resolver running locally on
283 your system, which performs DNSSEC validation. It reconfigures Unbound in such
284 a way that it will signal it to to use the DHCP obtained forwarders if possible,
285 fallback to doing its own AUTH queries if that fails, and if that fails it will
286 prompt the user with the option to go with insecure DNS only.")
287 (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
288 (license license:bsd-3)))
290 (define-public dnsmasq
297 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
301 "027b0ycw8h8yvvkq46vnr7dv8iqn5srm4kr7hm7sq110kvy2rm98"))))
302 (build-system gnu-build-system)
309 (modify-phases %standard-phases (delete 'configure))
310 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
311 (string-append "CC=" ,(cc-for-target))
312 (string-append "PKG_CONFIG=" ,(pkg-config-for-target))
313 "COPTS=\"-DHAVE_DBUS\"")
314 #:tests? #f)) ; no ‘check’ target
315 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
316 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
318 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
319 to provide DNS and, optionally, DHCP to a small network. It can serve the
320 names of local machines which are not in the global DNS. The DHCP server
321 integrates with the DNS server and allows machines with DHCP-allocated
322 addresses to appear in the DNS with names configured either on each host or in
323 a central configuration file. Dnsmasq supports static and dynamic DHCP leases
324 and BOOTP/TFTP for network booting of diskless machines.")
325 ;; Source files only say GPL2 and GPL3 are allowed.
326 (license (list license:gpl2 license:gpl3))))
328 ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
329 ;; different name here.
330 (define-public isc-bind
333 ;; When updating, check whether isc-dhcp's bundled copy should be as well.
334 ;; The BIND release notes are available here:
335 ;; https://www.isc.org/bind/
340 (uri (string-append "https://ftp.isc.org/isc/bind9/" version
341 "/bind-" version ".tar.xz"))
343 (base32 "05ig8y20qksam7s466h15v6j2zgidn5nkbrk1d5c29nmypy2wgai"))
345 (search-patches "bind-re-add-attr-constructor-priority.patch"))))
346 (build-system gnu-build-system)
347 (outputs `("out" "utils"))
349 ;; It would be nice to add GeoIP and gssapi once there are packages.
358 (list perl pkg-config))
361 (list (string-append "--with-pkcs11="
362 (assoc-ref %build-inputs "p11-kit")))
364 (modify-phases %standard-phases
365 (add-after 'strip 'move-to-utils
369 (let ((target (string-append (assoc-ref %outputs "utils") file))
370 (src (string-append (assoc-ref %outputs "out") file)))
371 (mkdir-p (dirname target))
374 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
375 "/share/man/man1/dig.1"
376 "/share/man/man1/host.1"
377 "/share/man/man1/nslookup.1"
378 "/share/man/man1/nsupdate.1"))
380 ;; When and if guix provides user namespaces for the build process,
381 ;; then the following can be uncommented and the subsequent "force-test"
382 ;; will not be necessary.
384 ;; (add-before 'check 'set-up-loopback
386 ;; (system "bin/tests/system/ifconfig.sh up")))
389 ;; XXX Even ‘make force-test’ tries to create network interfaces
390 ;; and fails. The only working target is the (trivial) fuzz test.
391 (with-directory-excursion "fuzz"
392 (invoke "make" "check"))
394 (synopsis "@acronym{DNS, Domain Name System} implementation")
395 (description "BIND implements the @acronym{DNS, Domain Name System}
396 protocols for the Internet. It is both a reference implementation of those
397 protocols and production-grade software, suitable for use in high-volume and
398 high-reliability applications.
400 The name stands for \"Berkeley Internet Name Domain\" because the software
401 originated in the early 1980s at the University of California at Berkeley.
403 The @code{utils} output of this package contains the following command line
404 utilities related to DNS name servers:
408 DNS lookup and validation utility
414 Internet name servers interactive query utility
416 Dynamic DNS update utility
418 (home-page "https://www.isc.org/bind/")
419 (license (list license:mpl2.0))))
421 (define-public dnscrypt-proxy
423 (name "dnscrypt-proxy")
428 "https://download.dnscrypt.org/dnscrypt-proxy/"
429 "dnscrypt-proxy-" version ".tar.bz2"))
432 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
433 (modules '((guix build utils)))
435 ;; Delete bundled libltdl. XXX: This package also bundles
436 ;; a modified libevent that cannot currently be removed.
438 (delete-file-recursively "libltdl")
440 (build-system gnu-build-system)
443 (modify-phases %standard-phases
444 (add-after 'unpack 'autoreconf
446 ;; Re-generate build files due to unbundling ltdl.
447 ;; TODO: Prevent generating new libltdl and building it.
448 ;; The system version is still favored and referenced.
449 (invoke "autoreconf" "-vif"))))))
451 (list pkg-config automake autoconf libtool))
453 (list libltdl libsodium))
454 (home-page "https://www.dnscrypt.org/")
455 (synopsis "Securely send DNS requests to a remote server")
457 "@command{dnscrypt-proxy} is a tool for securing communications
458 between a client and a DNS resolver. It verifies that responses you get
459 from a DNS provider was actually sent by that provider, and haven't been
460 tampered with. For optimal performance it is recommended to use this as
461 a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
462 can also be used as a normal DNS \"server\". A list of public dnscrypt
463 servers is included, and an up-to-date version is available at
464 @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
465 (license (list license:isc
466 ;; Libevent and src/ext/queue.h is 3-clause BSD.
469 (define-public dnscrypt-wrapper
471 (name "dnscrypt-wrapper")
476 "https://github.com/cofyc/dnscrypt-wrapper/releases"
477 "/download/v" version "/" name "-v" version ".tar.bz2"))
480 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
481 (build-system gnu-build-system)
483 `(#:make-flags '("CC=gcc")
484 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
487 (modify-phases %standard-phases
488 (add-after 'unpack 'create-configure
490 (invoke "make" "configure"))))))
494 (list libevent libsodium))
495 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
496 (synopsis "Server-side dnscrypt proxy")
498 "@command{dnscrypt-wrapper} is a tool to expose a name server over
499 the @code{dnscrypt} protocol. It can be used as an endpoint for the
500 @command{dnscrypt-proxy} client to securely tunnel DNS requests between
502 (license (list license:isc
503 ;; Bundled argparse is MIT. TODO: package and unbundle.
505 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
509 (define-public libasr
516 (uri (string-append "https://www.opensmtpd.org/archives/"
517 "libasr-" version ".tar.gz"))
519 (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
520 (build-system gnu-build-system)
523 (modify-phases %standard-phases
524 (add-after 'install 'install-documentation
525 (lambda* (#:key outputs #:allow-other-keys)
526 (let ((out (assoc-ref outputs "out")))
527 (install-file "src/asr_run.3"
528 (string-append out "/share/man/man3"))
531 (list autoconf automake libtool pkg-config))
532 (home-page "https://www.opensmtpd.org")
533 (synopsis "Asynchronous resolver library by the OpenBSD project")
535 "libasr is a free, simple and portable asynchronous resolver library.
536 It runs DNS queries and performs hostname resolution in a fully
537 asynchronous fashion.")
538 (license (list license:isc
539 license:bsd-2 ; last part of getrrsetbyname_async.c
541 (license:non-copyleft "file://LICENSE") ; includes.h
551 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
554 (base32 "0dl8iriy0mscppfa6ar5qcglgvxw87140abwxyksak1lk7fnzkfg"))))
555 (build-system gnu-build-system)
558 (list "--enable-pie" ; fully benefit from ASLR
561 "--enable-relro-now" ; protect GOT and .dtor areas
562 "--disable-radix-tree"
563 (string-append "--with-libevent="
564 (assoc-ref %build-inputs "libevent"))
565 (string-append "--with-ssl="
566 (assoc-ref %build-inputs "openssl"))
567 "--with-configdir=/etc"
568 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
569 "--with-logfile=/var/log/nsd.log"
570 "--with-pidfile=/var/db/nsd/nsd.pid"
571 "--with-dbfile=/var/db/nsd/nsd.db"
572 "--with-zonesdir=/etc/nsd"
573 "--with-xfrdfile=/var/db/nsd/xfrd.state"
574 "--with-zonelistfile=/var/db/nsd/zone.list")
576 (modify-phases %standard-phases
577 (add-before 'configure 'patch-installation-paths
578 (lambda* (#:key outputs #:allow-other-keys)
579 (let* ((out (assoc-ref outputs "out"))
580 (doc (string-append out "/share/doc/" ,name "-" ,version)))
581 ;; The ‘make install’ target tries to create the parent
582 ;; directories of run-time things like ‘pidfile’ above, and
583 ;; useless empty directories like 'configdir'. Remove such
584 ;; '$(INSTALL)' lines and install the example configuration file
585 ;; in an appropriate location.
586 (substitute* "Makefile.in"
587 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
588 (string-append "#" command))
589 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
590 (string-append doc "/examples/" file-name)))))))
591 #:tests? #f)) ; no tests
593 (list libevent openssl))
594 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
595 (synopsis "Authoritative DNS name server")
596 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
597 name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
598 RFC-compliant nameserver.
600 NSD uses zone information compiled via @command{zonec} into a binary database
601 file (@file{nsd.db}). This allows fast startup of the name service daemon and
602 allows syntax-structural errors in zone files to be flagged at compile time,
603 before being made available to NSD service itself. However, most traditional
604 BIND-style zone files can be directly imported into NSD without modification.
606 The collection of programs and processes that make up NSD are designed so that
607 the daemon itself runs as a non-privileged user and can be easily configured to
608 run in a @code{chroot} jail, thus making any security flaws in NSD less likely
609 to result in system-wide compromise.")
610 (license (list license:bsd-3))))
612 (define-public rbldnsd
620 (url "https://github.com/spamhaus/rbldnsd")
622 (file-name (git-file-name name version))
624 (base32 "0jj3kyir43qnjgd9rk0wz13iggf3p4p1779v0wgmx3ci0ypnglcr"))))
625 (build-system gnu-build-system)
628 (modify-phases %standard-phases
630 ;; The ./configure is hand-written and doesn't ignore unknown
631 ;; standard autotools options like CONFIG_SHELL.
633 (invoke "./configure")))
635 ;; There is no Makefile ‘install’ target. contrib/debian/rules has
636 ;; one but relies on Debian-specific helpers, so install manually.
637 (lambda* (#:key outputs #:allow-other-keys)
638 (let* ((out (assoc-ref outputs "out"))
639 (sbin (string-append out "/sbin"))
640 (man8 (string-append out "/share/man/man8")))
641 (install-file "rbldnsd" sbin)
642 (install-file "rbldnsd.8" man8)))))))
646 ;; For running the test suite. Python 3 is not yet supported by a release:
647 ;; see <https://github.com/spamhaus/rbldnsd/issues/16>.
648 `(("python" ,python-2)))
649 (home-page "https://rbldnsd.io/")
651 "Small nameserver to efficiently serve @acronym{DNSBL, DNS blocklists}")
653 "This package contains a small DNS daemon especially made to handle queries
654 of @acronym{DNSBL, DNS blocklists}, a simple way to publish IP addresses and/or
655 (domain) names which are somehow notable. Such lists are frequently used to
656 refuse e-mail service to clients known to send unwanted (spam) messages.
658 @command{rbldnsd} is not a general-purpose nameserver. It answers to a limited
659 variety of queries. This makes it extremely fast---greatly outperforming both
660 BIND and djbdns---whilst using relatively little memory.")
662 (list license:bsd-3 ; btrie.[ch]
663 license:lgpl2.1+ ; qsort.c
664 license:gpl2+)))) ; the rest
666 (define-public unbound
673 (uri (string-append "https://www.unbound.net/downloads/unbound-"
676 (base32 "10qs1q26lzw18ljggnbz0cc5f7lr9ksj615xbrmh4amryd3va4qa"))))
677 (build-system gnu-build-system)
678 (outputs '("out" "python"))
690 (list "--disable-static" ; save space and non-determinism in libunbound.a
692 "--with-libnghttp2=" (assoc-ref %build-inputs "nghttp2"))
694 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
696 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
698 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
699 "--with-pythonmodule" "--with-pyunbound")
701 (modify-phases %standard-phases
702 (add-after 'configure 'fix-python-site-package-path
703 ;; Move python modules into their own output.
704 (lambda* (#:key outputs #:allow-other-keys)
705 (let ((pyout (assoc-ref outputs "python"))
706 (ver ,(version-major+minor (package-version python))))
707 (substitute* "Makefile"
708 (("^PYTHON_SITE_PKG=.*$")
711 pyout "/lib/python-" ver "/site-packages\n"))))
713 (add-before 'check 'fix-missing-nss-for-tests
714 ;; Unfortunately, the package's unittests involve some checks
715 ;; looking up protocols and services which are not provided
716 ;; by the minimalistic build environment, in particular,
717 ;; /etc/protocols and /etc/services are missing.
718 ;; Also, after plain substitution of protocol and service names
719 ;; in the test data, the tests still fail because the
720 ;; corresponding Resource Records have been signed by
722 ;; The following LD_PRELOAD library overwrites the glibc
723 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
724 ;; ‘getservbyport’ providing the few records required for the
725 ;; unit tests to pass.
726 (lambda* (#:key inputs outputs #:allow-other-keys)
727 (let* ((source (assoc-ref %build-inputs "source"))
728 (gcc (assoc-ref %build-inputs "gcc")))
729 (call-with-output-file "/tmp/nss_preload.c"
731 (display "#include <stdlib.h>
737 struct protoent *getprotobyname(const char *name) {
738 struct protoent *p = malloc(sizeof(struct protoent));
739 p->p_aliases = malloc(sizeof(char*));
740 if (strcasecmp(name, \"tcp\") == 0) {
743 p->p_aliases[0] = \"TCP\";
744 } else if (strcasecmp(name, \"udp\") == 0) {
747 p->p_aliases[0] = \"UDP\";
753 struct protoent *getprotobynumber(int proto) {
754 struct protoent *p = malloc(sizeof(struct protoent));
755 p->p_aliases = malloc(sizeof(char*));
760 p->p_aliases[0] = \"TCP\";
765 p->p_aliases[0] = \"UDP\";
774 struct servent *getservbyname(const char *name, const char *proto) {
775 struct servent *s = malloc(sizeof(struct servent));
776 char* buf = malloc((strlen(proto)+1)*sizeof(char));
778 s->s_aliases = malloc(sizeof(char*));
779 s->s_aliases[0] = NULL;
780 if (strcasecmp(name, \"domain\") == 0) {
781 s->s_name = \"domain\";
782 s->s_port = htons(53);
789 struct servent *getservbyport(int port, const char *proto) {
791 struct servent *s = malloc(sizeof(struct servent));
793 s->s_aliases = malloc(sizeof(char*));
794 s->s_aliases[0] = NULL;
797 s->s_name = \"domain\";
799 s->s_proto = \"udp\";
807 (invoke (string-append gcc "/bin/gcc")
808 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
809 "/tmp/nss_preload.c")
810 ;; The preload library only affects the unittests.
811 (substitute* "Makefile"
813 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
815 (home-page "https://www.unbound.net")
816 (synopsis "Validating, recursive, and caching DNS resolver")
818 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
819 validation of results. It implements only a minimal amount of authoritative
820 service to prevent leakage to the root nameservers: forward lookups for
821 localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
822 served by AS112. Stub and forward zones are supported.")
823 (license license:bsd-4)))
825 (define-public yadifa
830 (let ((build "10333"))
834 (string-append "https://www.yadifa.eu/sites/default/files/releases/"
835 "yadifa-" version "-" build ".tar.gz"))
837 (base32 "1mwy6sfnlaslx26f3kpj9alh8i8y8bf1nbnsdd5j04hjsbavd07p")))))
838 (build-system gnu-build-system)
845 (modify-phases %standard-phases
846 (add-before 'configure 'omit-example-configurations
848 (substitute* "Makefile.in"
849 ((" (etc|var)") ""))))
850 (add-after 'configure 'omit-spurious-references
852 ;; The many Makefile.in grep this(!) to #define BUILD_OPTIONS.
853 (substitute* "config.log"
854 (("(=/gnu/store/)[^-]*" _ match)
855 (string-append match "..."))))))
857 (list "--sysconfdir=/etc"
858 "--localstatedir=/var"
859 "--enable-shared" "--disable-static"
860 "--disable-build-timestamp" ; build reproducibly
861 "--enable-tcp-manager")))
862 (home-page "https://www.yadifa.eu/")
863 (synopsis "Authoritative DNS name server")
864 (description "YADIFA is an authoritative name server for the @dfn{Domain
865 Name System} (DNS). It aims for both higher performance and a smaller memory
866 footprint than other implementations, while remaining fully RFC-compliant.
867 YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
868 Extensions} (DNSSEC).")
869 (license license:bsd-3)))
879 (url "https://gitlab.nic.cz/knot/knot-dns")
880 (commit (string-append "v" version))))
881 (file-name (git-file-name name version))
883 (base32 "0w3jyz9qgkb34gkv2lr71phk5ad3rycn86qyw7n88ryhdsk45j73"))
884 (modules '((guix build utils)))
887 ;; Remove Ragel-generated C files. We'll recreate them below.
888 (for-each delete-file (find-files "." "\\.c\\.[gt]."))
889 (delete-file "src/libknot/yparser/ypbody.c")
890 ;; Remove bundled library to ensure we always use the system's.
891 (delete-file-recursively "src/contrib/libbpf")))))
892 (build-system gnu-build-system)
893 (outputs (list "out" "doc" "lib" "tools"))
896 (list (string-append "--docdir=" (assoc-ref %outputs "doc")
897 "/share/" ,name "-" ,version)
898 (string-append "--infodir=" (assoc-ref %outputs "doc")
900 (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib")
902 "--localstatedir=/var"
903 "--disable-static" ; static libraries are built by default
904 "--enable-dnstap" ; let tools read/write capture files
905 "--enable-fastparser" ; disabled by default when .git/ exists
907 "--with-module-dnstap=yes") ; detailed query capturing & logging
909 (modify-phases %standard-phases
910 (add-after 'unpack 'link-missing-libbpf-dependency
911 ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
912 ;; zlib in its Requires.private (not Requires) field. Add it here.
914 (substitute* "configure.ac"
915 (("enable_xdp=yes" match)
916 (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))))
917 (add-before 'bootstrap 'update-parser
919 (with-directory-excursion "src"
920 (invoke "sh" "../scripts/update-parser.sh"))))
921 (add-before 'configure 'disable-directory-pre-creation
923 ;; Don't install empty directories like ‘/etc’ outside the store.
924 ;; This is needed even when using ‘make config_dir=... install’.
925 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))))
926 (add-after 'build 'build-info
927 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
928 (apply invoke "make" "info"
929 `(,@(if parallel-build?
930 `("-j" ,(number->string (parallel-job-count)))
934 (lambda* (#:key make-flags outputs parallel-build? #:allow-other-keys)
935 (let* ((out (assoc-ref outputs "out"))
936 (doc (string-append out "/share/doc/" ,name "-" ,version))
937 (etc (string-append doc "/examples/etc")))
938 (apply invoke "make" "install"
939 (string-append "config_dir=" etc)
940 `(,@(if parallel-build?
941 `("-j" ,(number->string (parallel-job-count)))
944 (add-after 'install 'install-info
945 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
946 (apply invoke "make" "install-info"
947 `(,@(if parallel-build?
948 `("-j" ,(number->string (parallel-job-count)))
951 (add-after 'install 'break-circular-:lib->:out-reference
952 (lambda* (#:key outputs #:allow-other-keys)
953 (let ((lib (assoc-ref outputs "lib")))
954 (for-each (lambda (file)
956 (("(prefix=).*" _ assign)
957 (string-append assign lib "\n"))))
958 (find-files lib "\\.pc$")))))
959 (add-after 'install 'split-:tools
960 (lambda* (#:key outputs #:allow-other-keys)
961 (let* ((out (assoc-ref outputs "out"))
962 (tools (assoc-ref outputs "tools")))
963 (mkdir-p (string-append tools "/share/man"))
964 (rename-file (string-append out "/bin")
965 (string-append tools "/bin"))
966 (rename-file (string-append out "/share/man/man1")
967 (string-append tools "/share/man/man1"))))))))
981 ("libcap-ng" ,libcap-ng)
986 ("libnghttp2" ,nghttp2 "lib")
990 ("protobuf-c" ,protobuf-c)))
991 (home-page "https://www.knot-dns.cz/")
992 (synopsis "Authoritative DNS name server")
993 (description "Knot DNS is an authoritative name server for the @dfn{Domain
994 Name System} (DNS), designed to meet the needs of root and @dfn{top-level
995 domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
996 number of programming techniques to improve speed. For example, the responder
997 is completely lock-free, resulting in a very high response rate. Other features
998 include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
999 synthesis, and on-the-fly re-configuration.")
1002 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
1003 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
1005 license:lgpl2.0+ ; parts of scr/contrib/ucw
1006 license:public-domain ; src/contrib/fnv and possibly murmurhash3
1007 license:gpl3+)))) ; everything else
1009 (define-public knot-resolver
1011 (name "knot-resolver")
1015 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
1016 "knot-resolver-" version ".tar.xz"))
1019 "1sic5ccbbqml4c01dbikkg6qx1gg81nqi76cj79pjdllkqqn92aq"))))
1020 (build-system meson-build-system)
1021 (outputs '("out" "doc"))
1023 '(#:configure-flags '("-Ddoc=enabled")
1025 (modify-phases %standard-phases
1026 (add-before 'configure 'disable-default-ta
1028 ;; Disable the default managed root TA, since we don't have
1029 ;; write access to the keyfile and its directory in store.
1030 (substitute* "daemon/lua/sandbox.lua.in"
1031 (("^trust_anchors\\.add_file.*") ""))))
1032 (add-after 'build 'build-doc
1034 (invoke "ninja" "doc")))
1035 (add-after 'install 'move-doc
1036 (lambda* (#:key outputs #:allow-other-keys)
1037 ;; Move the manual and the example configuration files to the
1039 (let ((out (assoc-ref outputs "out"))
1040 (doc (assoc-ref outputs "doc")))
1041 (mkdir-p (string-append doc "/share/doc/knot-resolver"))
1044 (rename-file (string-append out "/share/" dir)
1045 (string-append doc "/share/" dir)))
1046 '("doc/knot-resolver/examples"
1047 "doc/knot-resolver/html"
1049 (add-after 'install 'wrap-binary
1050 (lambda* (#:key inputs outputs #:allow-other-keys)
1051 (let* ((out (assoc-ref outputs "out"))
1052 (lua-* (map cdr (filter
1054 (string-prefix? "lua-" (car input)))
1056 (lua-path (lambda (p)
1057 (string-append p "/share/lua/5.1/?.lua")))
1058 (lua-cpath (lambda (p)
1059 (string-append p "/lib/lua/5.1/?.so"))))
1060 (wrap-program (string-append out "/sbin/kresd")
1061 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
1062 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))))))))
1064 (list cmocka ; for unit tests
1070 python-sphinx-rtd-theme
1075 ("knot:lib" ,knot "lib")
1079 ;; TODO: Add optional lua modules: basexx and psl.
1080 ("lua-bitop" ,lua5.1-bitop)
1081 ("nghttp2" ,nghttp2 "lib")
1082 ("python" ,python)))
1083 (home-page "https://www.knot-resolver.cz/")
1084 (synopsis "Caching validating DNS resolver")
1086 "Knot Resolver is a caching full resolver implementation written in C and
1087 LuaJIT, both a resolver library and a daemon.")
1088 (license (list license:gpl3+
1089 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
1094 (define-public ddclient
1102 (url "https://github.com/ddclient/ddclient")
1103 (commit (string-append "v" version))))
1104 (file-name (git-file-name name version))
1106 (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
1107 (build-system trivial-build-system) ; no Makefile.PL
1111 (list inetutils ; logger
1113 perl-data-validate-ip
1115 perl-io-socket-ssl))
1117 `(#:modules ((guix build utils))
1120 (use-modules (guix build utils)
1123 (setenv "PATH" (string-append
1124 (assoc-ref %build-inputs "bash") "/bin" ":"
1125 (assoc-ref %build-inputs "perl") "/bin"))
1127 ;; Copy the (read-only) source into the (writable) build directory.
1128 (copy-recursively (assoc-ref %build-inputs "source") ".")
1131 (let* ((out (assoc-ref %outputs "out"))
1132 (bin (string-append out "/bin")))
1133 (let ((file "ddclient"))
1135 (("/usr/bin/perl") (which "perl"))
1136 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
1137 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
1138 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
1139 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
1140 (("\\$cachedir\\$program\\.cache")
1141 "/var/cache/ddclient/ddclient.cache"))
1142 (install-file file bin)
1143 (wrap-program (string-append bin "/" file)
1146 ,@(map (lambda (input)
1149 (string-append store "/bin"))))
1155 (((? (cut string-prefix? "perl-" <>) name) . dir)
1156 (string-append dir "/lib/perl5/site_perl"))
1159 (for-each (cut install-file <> (string-append out
1161 (find-files "." "sample.*$"))))))
1162 (home-page "https://ddclient.net/")
1163 (synopsis "Address updating utility for dynamic DNS services")
1164 (description "This package provides a client to update dynamic IP
1165 addresses with several dynamic DNS service providers, such as
1166 @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
1168 This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
1169 access a machine with a dynamic IP address.
1171 The client supports both dynamic and (near) static services, as well as MX
1172 record and alternative name management. It caches the address, and only
1173 attempts the update when it has changed.")
1174 (license license:gpl2+)))
1183 (url "https://github.com/handshake-org/hnsd")
1184 (commit (string-append "v" version))))
1187 "1kdgff8rf8gmvwz2p758ilbjxpvz4xm6z41pa5353asg6xb853bb"))
1188 (file-name (git-file-name name version))
1189 (modules '((guix build utils)))
1192 ;; Delete the bundled copy of libuv.
1193 (delete-file-recursively "uv")
1194 (substitute* "configure.ac"
1195 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
1196 (substitute* "Makefile.am"
1197 (("SUBDIRS = uv") "\n")
1198 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
1200 ;; Make sure the 'hnsd' binary is installed and
1201 ;; dynamically-linked.
1202 (("noinst_PROGRAMS") "bin_PROGRAMS")
1203 (("hnsd_LDFLAGS = -static") ""))
1205 ;; This script tries to chdir to "uv" and doesn't do more
1206 ;; than "autoreconf" so remove it.
1207 (delete-file "autogen.sh")
1209 (build-system gnu-build-system)
1211 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
1213 (list autoconf automake libtool))
1215 (list unbound libuv))
1216 (home-page "https://www.handshake.org/")
1217 (synopsis "Resolver daemon for the Handshake naming protocol")
1219 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
1220 System (HNS) peer-to-peer network.")
1221 (license license:expat)))
1223 (define-public libmicrodns
1225 (name "libmicrodns")
1229 (uri (string-append "https://github.com/videolabs/libmicrodns/"
1230 "releases/download/" version "/microdns-"
1234 "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
1235 (build-system meson-build-system)
1236 (home-page "https://github.com/videolabs/libmicrodns")
1237 (synopsis "Minimal mDNS resolver library")
1238 (description "@code{libmicrodns} provides a minimal implementation of a
1239 mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
1240 a zero-config service that allows one to resolve host names to IP addresses in
1242 (license license:lgpl2.1)))
1244 (define-public public-suffix-list
1245 ;; Mozilla releases the official list here:
1247 ;; https://publicsuffix.org/list/public_suffix_list.dat
1249 ;; However, Mozilla syncs that file from the GitHub repository periodically,
1250 ;; so its contents will change over time. If you update this commit, please
1251 ;; make sure that the new commit refers to a list which is identical to the
1252 ;; officially published list available from the URL above.
1253 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
1255 (name "public-suffix-list")
1256 (version (git-version "0" "1" commit))
1260 (url "https://github.com/publicsuffix/list")
1262 (file-name (git-file-name name version))
1265 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
1266 (build-system trivial-build-system)
1268 `(#:modules ((guix build utils))
1271 (use-modules (guix build utils))
1272 (let* ((out (assoc-ref %outputs "out"))
1273 ;; Install to /share because that is where "read-only
1274 ;; architecture-independent data files" should go (see:
1275 ;; (standards) Directory Variables). Include the version in
1276 ;; the directory name so that if multiple versions are ever
1277 ;; installed in the same profile, they will not conflict.
1278 (destination (string-append
1279 out "/share/public-suffix-list-" ,version))
1280 (source (assoc-ref %build-inputs "source")))
1281 (with-directory-excursion source
1282 (install-file "public_suffix_list.dat" destination)
1283 (install-file "LICENSE" destination))
1285 (home-page "https://publicsuffix.org/")
1286 (synopsis "Database of current and historical DNS suffixes")
1287 (description "This is the Public Suffix List maintained by Mozilla. A
1288 \"public suffix\" is one under which Internet users can (or historically
1289 could) directly register names in the Domain Name System (DNS). Some examples
1290 of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
1291 known public suffixes.")
1292 (license license:mpl2.0))))
1294 (define-public maradns
1297 (version "3.5.0020")
1301 (uri (string-append "https://maradns.samiam.org/download/"
1302 (version-major+minor version) "/"
1303 version "/maradns-" version ".tar.xz"))
1305 (base32 "1qgabw6y2bwy6y88dikis62k789i0xh7iwxan8jmqpzvksqwjfgw"))))
1306 (build-system gnu-build-system)
1308 `(#:tests? #f ; need to be root to run tests
1311 ,(string-append "CC=" (cc-for-target))
1312 (string-append "PREFIX=" %output)
1313 (string-append "RPM_BUILD_ROOT=" %output))
1315 (modify-phases %standard-phases
1317 (lambda* (#:key native-inputs target #:allow-other-keys)
1318 ;; make_32bit_tables generates a header file that is used during
1319 ;; compilation. Hence, during cross compilation, it should be
1320 ;; built for the host system.
1322 (substitute* "rng/Makefile"
1323 (("\\$\\(CC\\) -o make_32bit_tables")
1324 (string-append (assoc-ref native-inputs "gcc")
1325 "/bin/gcc -o make_32bit_tables"))))
1326 (invoke "./configure")))
1327 (add-before 'install 'create-install-directories
1328 (lambda* (#:key outputs #:allow-other-keys)
1329 (let ((out (assoc-ref outputs "out")))
1330 (for-each (lambda (dir)
1331 (mkdir-p (string-append out dir)))
1332 (list "/bin" "/sbin" "/etc"
1337 (home-page "https://maradns.samiam.org")
1338 (synopsis "Small lightweight DNS server")
1339 (description "MaraDNS is a small and lightweight DNS server. MaraDNS
1340 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
1341 and TCP-capable recursive DNS server for finding domains on the internet.")
1342 (license license:bsd-2)))
1344 (define-public openresolv
1350 (uri (string-append "https://roy.marples.name/downloads/openresolv/"
1351 "openresolv-" version ".tar.xz"))
1354 "15qvp5va2yrqpz0ba54clvn8cbc66v4sl7k3bi9ji8jpx040bcs2"))
1356 (search-patches "openresolv-restartcmd-guix.patch"))))
1357 (build-system gnu-build-system)
1359 `(#:tests? #f ; No test suite
1361 (list (string-append "--sysconfdir=/etc"))
1363 (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))
1365 (modify-phases %standard-phases
1366 (add-after 'install 'wrap-program
1367 (lambda* (#:key inputs outputs #:allow-other-keys)
1368 (let ((out (assoc-ref outputs "out"))
1369 (coreutils (assoc-ref inputs "coreutils-minimal")))
1370 (substitute* (string-append out "/sbin/resolvconf")
1371 (("RESOLVCONF=\"\\$0\"")
1377 (list coreutils-minimal))
1378 (home-page "https://roy.marples.name/projects/openresolv/")
1379 (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
1380 (description "openresolv is an implementation of @command{resolvconf}, the
1381 middleman between the network configuration services and
1382 @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
1383 stores, removes and lists a full @file{resolv.conf} generated for the
1384 interface. It then calls all the helper scripts it knows about so it can
1385 configure the real @file{/etc/resolv.conf} and optionally any local
1386 nameservers other than libc.")
1387 (license license:bsd-2)))