gnu: Add knot-resolver.
[jackhill/guix/guix.git] / gnu / packages / dns.scm
CommitLineData
dd2efd3d
TUBK
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
d912db5b 3;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
b2844d8f 4;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
76dd04be 5;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
be86b7ad 6;;; Copyright © 2016 John Darrington <jmd@gnu.org>
47956fa0 7;;; Copyright © 2016 ng0 <ng0@n0.is>
fe99b7f7 8;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
afe62a8b 9;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
ecc7aa89 10;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
7e61a16c 11;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
0bc2d3e4 12;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
498911d3 13;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
41553c90 14;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
7e5eda0c 15;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
dd2efd3d
TUBK
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
36fb36b5 32(define-module (gnu packages dns)
f9cdf1c1 33 #:use-module (gnu packages admin)
71f048c6 34 #:use-module (gnu packages autotools)
6cf626e8 35 #:use-module (gnu packages base)
0bc2d3e4 36 #:use-module (gnu packages bash)
a35e16c0 37 #:use-module (gnu packages check)
1e744399 38 #:use-module (gnu packages databases)
a35e16c0 39 #:use-module (gnu packages documentation)
0bc2d3e4 40 #:use-module (gnu packages compression)
afe62a8b 41 #:use-module (gnu packages crypto)
f9cdf1c1 42 #:use-module (gnu packages datastructures)
7e61a16c 43 #:use-module (gnu packages flex)
cb6d322a 44 #:use-module (gnu packages glib)
71f048c6 45 #:use-module (gnu packages groff)
f9cdf1c1
TGR
46 #:use-module (gnu packages groff)
47 #:use-module (gnu packages libedit)
afe62a8b 48 #:use-module (gnu packages libevent)
f9cdf1c1 49 #:use-module (gnu packages libidn)
1e744399 50 #:use-module (gnu packages linux)
a35e16c0 51 #:use-module (gnu packages lua)
f9cdf1c1
TGR
52 #:use-module (gnu packages ncurses)
53 #:use-module (gnu packages nettle)
e12df2c6 54 #:use-module (gnu packages networking)
1e744399 55 #:use-module (gnu packages perl)
71f048c6 56 #:use-module (gnu packages pkg-config)
7e61a16c
GG
57 #:use-module (gnu packages protobuf)
58 #:use-module (gnu packages python)
0406434b 59 #:use-module (gnu packages python-xyz)
a35e16c0 60 #:use-module (gnu packages sphinx)
7e61a16c 61 #:use-module (gnu packages swig)
a7fd7b68 62 #:use-module (gnu packages tls)
f9cdf1c1 63 #:use-module (gnu packages web)
1e744399 64 #:use-module (gnu packages xml)
12e530ba 65 #:use-module (gnu packages)
1e744399 66 #:use-module ((guix licenses) #:prefix license:)
dd2efd3d
TUBK
67 #:use-module (guix packages)
68 #:use-module (guix download)
91a4863d 69 #:use-module (guix git-download)
7e61a16c 70 #:use-module (guix utils)
0bc2d3e4 71 #:use-module (guix build-system gnu)
a35e16c0 72 #:use-module (guix build-system meson)
0bc2d3e4 73 #:use-module (guix build-system trivial))
dd2efd3d
TUBK
74
75(define-public dnsmasq
76 (package
77 (name "dnsmasq")
0e8e2908 78 (version "2.80")
dd2efd3d
TUBK
79 (source (origin
80 (method url-fetch)
81 (uri (string-append
82 "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
83 version ".tar.xz"))
84 (sha256
85 (base32
0e8e2908 86 "1fv3g8vikj3sn37x1j6qsywn09w1jipvlv34j3q5qrljbrwa5ayd"))))
dd2efd3d 87 (build-system gnu-build-system)
cb6d322a
CB
88 (native-inputs
89 `(("pkg-config" ,pkg-config)))
90 (inputs
91 `(("dbus" ,dbus)))
dd2efd3d
TUBK
92 (arguments
93 `(#:phases
dc1d3cde 94 (modify-phases %standard-phases (delete 'configure))
dd2efd3d 95 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
cb6d322a
CB
96 "CC=gcc"
97 "COPTS=\"-DHAVE_DBUS\"")
4e6c51d4 98 #:tests? #f)) ; no ‘check’ target
dd2efd3d
TUBK
99 (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
100 (synopsis "Small caching DNS proxy and DHCP/TFTP server")
101 (description
c657716e
TGR
102 "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
103to provide DNS and, optionally, DHCP to a small network. It can serve the
dd2efd3d
TUBK
104names of local machines which are not in the global DNS. The DHCP server
105integrates with the DNS server and allows machines with DHCP-allocated
c657716e 106addresses to appear in the DNS with names configured either on each host or in
dd2efd3d
TUBK
107a central configuration file. Dnsmasq supports static and dynamic DHCP leases
108and BOOTP/TFTP for network booting of diskless machines.")
109 ;; Source files only say GPL2 and GPL3 are allowed.
1e744399
110 (license (list license:gpl2 license:gpl3))))
111
a0683006
LC
112;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
113;; different name here.
114(define-public isc-bind
1e744399 115 (package
be86b7ad 116 (name "bind")
8fc3116e 117 (version "9.14.7")
1e744399
118 (source (origin
119 (method url-fetch)
be86b7ad 120 (uri (string-append
54fd7c02
TGR
121 "https://ftp.isc.org/isc/bind9/" version
122 "/bind-" version ".tar.gz"))
1e744399
123 (sha256
124 (base32
8fc3116e 125 "07998nx0yv3xy8c62b1ira9qygsgvpljwcgb47ypzxq8b57gb86f"))))
1e744399 126 (build-system gnu-build-system)
be86b7ad 127 (outputs `("out" "utils"))
1e744399 128 (inputs
fc0dd636 129 ;; It would be nice to add GeoIP and gssapi once there are packages.
1e744399
130 `(("libcap" ,libcap)
131 ("libxml2" ,libxml2)
1e744399 132 ("openssl" ,openssl)
0406434b
TGR
133 ("p11-kit" ,p11-kit)
134 ("python" ,python)
135 ("python-ply" ,python-ply)))
be86b7ad
JD
136 (native-inputs `(("perl" ,perl)
137 ("net-tools" ,net-tools)))
1e744399 138 (arguments
be86b7ad 139 `(#:configure-flags
1e744399
140 (list (string-append "--with-openssl="
141 (assoc-ref %build-inputs "openssl"))
1e744399
142 (string-append "--with-pkcs11="
143 (assoc-ref %build-inputs "p11-kit")))
144 #:phases
be86b7ad
JD
145 (modify-phases %standard-phases
146 (add-after 'strip 'move-to-utils
147 (lambda _
148 (for-each
149 (lambda (file)
150 (let ((target (string-append (assoc-ref %outputs "utils") file))
151 (src (string-append (assoc-ref %outputs "out") file)))
152 (mkdir-p (dirname target))
153 (link src target)
154 (delete-file src)))
155 '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
156 "/share/man/man1/dig.1"
157 "/share/man/man1/host.1"
158 "/share/man/man1/nslookup.1"
6023ecab
TGR
159 "/share/man/man1/nsupdate.1"))
160 #t))
be86b7ad
JD
161 ;; When and if guix provides user namespaces for the build process,
162 ;; then the following can be uncommented and the subsequent "force-test"
163 ;; will not be necessary.
164 ;;
165 ;; (add-before 'check 'set-up-loopback
166 ;; (lambda _
167 ;; (system "bin/tests/system/ifconfig.sh up")))
168 (replace 'check
169 (lambda _
c72c1005
TGR
170 ;; XXX Even ‘make force-test’ tries to create network interfaces
171 ;; and fails. The only working target is the (trivial) fuzz test.
172 (with-directory-excursion "fuzz"
173 (invoke "make" "check"))
174 #t)))))
be86b7ad 175 (synopsis "An implementation of the Domain Name System")
366efcb2
TGR
176 (description "BIND is an implementation of the @dfn{Domain Name System}
177(DNS) protocols for the Internet. It is a reference implementation of those
be86b7ad
JD
178protocols, but it is also production-grade software, suitable for use in
179high-volume and high-reliability applications. The name BIND stands for
180\"Berkeley Internet Name Domain\", because the software originated in the early
1811980s at the University of California at Berkeley.")
182 (home-page "https://www.isc.org/downloads/bind")
ecc7aa89 183 (license (list license:mpl2.0))))
be86b7ad 184
d24727c0
MB
185(define-public dnscrypt-proxy
186 (package
187 (name "dnscrypt-proxy")
83a89531 188 (version "1.9.5")
d24727c0
MB
189 (source (origin
190 (method url-fetch)
191 (uri (string-append
192 "https://download.dnscrypt.org/dnscrypt-proxy/"
193 "dnscrypt-proxy-" version ".tar.bz2"))
194 (sha256
195 (base32
83a89531 196 "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
d24727c0
MB
197 (modules '((guix build utils)))
198 (snippet
199 ;; Delete bundled libltdl. XXX: This package also bundles
200 ;; a modified libevent that cannot currently be removed.
6cbee49d
MW
201 '(begin
202 (delete-file-recursively "libltdl")
203 #t))))
d24727c0
MB
204 (build-system gnu-build-system)
205 (arguments
206 `(#:phases
207 (modify-phases %standard-phases
d10092b8 208 (add-after 'unpack 'autoreconf
d24727c0
MB
209 (lambda _
210 ;; Re-generate build files due to unbundling ltdl.
211 ;; TODO: Prevent generating new libltdl and building it.
212 ;; The system version is still favored and referenced.
997a4e18 213 (invoke "autoreconf" "-vif"))))))
d24727c0
MB
214 (native-inputs
215 `(("pkg-config" ,pkg-config)
216 ("automake" ,automake)
217 ("autoconf" ,autoconf)
218 ("libtool" ,libtool)))
219 (inputs
220 `(("libltdl" ,libltdl)
221 ("libsodium" ,libsodium)))
222 (home-page "https://www.dnscrypt.org/")
223 (synopsis "Securely send DNS requests to a remote server")
224 (description
225 "@command{dnscrypt-proxy} is a tool for securing communications
226between a client and a DNS resolver. It verifies that responses you get
227from a DNS provider was actually sent by that provider, and haven't been
228tampered with. For optimal performance it is recommended to use this as
229a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
230can also be used as a normal DNS \"server\". A list of public dnscrypt
231servers is included, and an up-to-date version is available at
232@url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
233 (license (list license:isc
234 ;; Libevent and src/ext/queue.h is 3-clause BSD.
235 license:bsd-3))))
236
afe62a8b
MB
237(define-public dnscrypt-wrapper
238 (package
239 (name "dnscrypt-wrapper")
240 (version "0.2.2")
241 (source (origin
242 (method url-fetch)
243 (uri (string-append
244 "https://github.com/cofyc/dnscrypt-wrapper/releases"
245 "/download/v" version "/" name "-v" version ".tar.bz2"))
246 (sha256
247 (base32
248 "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
249 (build-system gnu-build-system)
250 (arguments
251 `(#:make-flags '("CC=gcc")
252 ;; TODO: Tests require ruby-cucumber and ruby-aruba.
253 #:tests? #f
254 #:phases
255 (modify-phases %standard-phases
d10092b8 256 (add-after 'unpack 'create-configure
afe62a8b 257 (lambda _
b43cd106 258 (invoke "make" "configure"))))))
afe62a8b
MB
259 (native-inputs
260 `(("autoconf" ,autoconf)))
261 (inputs
262 `(("libevent" ,libevent)
263 ("libsodium" ,libsodium)))
264 (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
265 (synopsis "Server-side dnscrypt proxy")
266 (description
267 "@command{dnscrypt-wrapper} is a tool to expose a name server over
268the @code{dnscrypt} protocol. It can be used as an endpoint for the
269@command{dnscrypt-proxy} client to securely tunnel DNS requests between
270the two.")
271 (license (list license:isc
272 ;; Bundled argparse is MIT. TODO: package and unbundle.
273 license:expat
274 ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
275 license:gpl2
276 license:gpl3))))
277
71f048c6 278(define-public libasr
279 (package
280 (name "libasr")
0aa217e7 281 (version "1.0.3")
71f048c6 282 (source
283 (origin
284 (method url-fetch)
285 (uri (string-append "https://www.opensmtpd.org/archives/"
c34d0cd8 286 "libasr-" version ".tar.gz"))
71f048c6 287 (sha256
0aa217e7 288 (base32 "13fn4sr4vlcx1xijpl26nmnxawyls4lr5q3mi11jdm76f80qxn4w"))))
71f048c6 289 (build-system gnu-build-system)
0aa217e7
TGR
290 (arguments
291 `(#:phases
292 (modify-phases %standard-phases
293 (replace 'bootstrap
294 ;; ‘GNU build system bootstrapping not needed’, the default lies.
295 (lambda _
296 (invoke "sh" "./bootstrap")))
297 (add-after 'install 'install-documentation
298 (lambda* (#:key outputs #:allow-other-keys)
299 (let ((out (assoc-ref outputs "out")))
300 (install-file "src/asr_run.3"
301 (string-append out "/share/man/man3"))
302 #t))))))
71f048c6 303 (native-inputs
304 `(("autoconf" ,autoconf)
305 ("automake" ,automake)
0aa217e7
TGR
306 ("libtool" ,libtool)
307 ("pkg-config" ,pkg-config)))
71f048c6 308 (home-page "https://www.opensmtpd.org")
309 (synopsis "Asynchronous resolver library by the OpenBSD project")
310 (description
311 "libasr is a free, simple and portable asynchronous resolver library.
312It allows to run DNS queries and perform hostname resolutions in a fully
313asynchronous fashion.")
314 (license (list license:isc
315 license:bsd-2 ; last part of getrrsetbyname_async.c
316 license:bsd-3
317 (license:non-copyleft "file://LICENSE") ; includes.h
318 license:openssl))))
6cf626e8 319
7382ecd8
TGR
320(define-public nsd
321 (package
322 (name "nsd")
1f10e369 323 (version "4.2.2")
7382ecd8
TGR
324 (source
325 (origin
326 (method url-fetch)
327 (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
328 version ".tar.gz"))
329 (sha256
1f10e369 330 (base32 "1ys608jyp5scc957q4brm094c97sxlwymina7d2nvzi51aa37cw3"))))
7382ecd8
TGR
331 (build-system gnu-build-system)
332 (arguments
333 `(#:configure-flags
334 (list "--enable-pie" ; fully benefit from ASLR
335 "--enable-ratelimit"
336 "--enable-recvmmsg"
337 "--enable-relro-now" ; protect GOT and .dtor areas
338 "--disable-radix-tree"
339 (string-append "--with-libevent="
340 (assoc-ref %build-inputs "libevent"))
341 (string-append "--with-ssl="
342 (assoc-ref %build-inputs "openssl"))
343 "--with-configdir=/etc"
344 "--with-nsd_conf_file=/etc/nsd/nsd.conf"
345 "--with-logfile=/var/log/nsd.log"
346 "--with-pidfile=/var/db/nsd/nsd.pid"
347 "--with-dbfile=/var/db/nsd/nsd.db"
348 "--with-zonesdir=/etc/nsd"
349 "--with-xfrdfile=/var/db/nsd/xfrd.state"
350 "--with-zonelistfile=/var/db/nsd/zone.list")
351 #:phases
352 (modify-phases %standard-phases
353 (add-before 'configure 'patch-installation-paths
354 (lambda* (#:key outputs #:allow-other-keys)
355 (let* ((out (assoc-ref outputs "out"))
356 (doc (string-append out "/share/doc/" ,name "-" ,version)))
357 ;; The ‘make install’ target tries to create the parent
358 ;; directories of run-time things like ‘pidfile’ above, and
359 ;; useless empty directories like 'configdir'. Remove such
360 ;; '$(INSTALL)' lines and install the example configuration file
361 ;; in an appropriate location.
362 (substitute* "Makefile.in"
363 ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
364 (string-append "#" command))
365 (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
366 (string-append doc "/examples/" file-name)))
367 #t))))
368 #:tests? #f)) ; no tests
369 (inputs
370 `(("libevent" ,libevent)
371 ("openssl" ,openssl)))
372 (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
373 (synopsis "Authoritative DNS name server")
374 (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
375name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
376RFC-compliant nameserver.
377
378NSD uses zone information compiled via @command{zonec} into a binary database
379file (@file{nsd.db}). This allows fast startup of the name service daemon and
380allows syntax-structural errors in zone files to be flagged at compile time,
381before being made available to NSD service itself. However, most traditional
382BIND-style zone files can be directly imported into NSD without modification.
383
384The collection of programs and processes that make up NSD are designed so that
385the daemon itself runs as a non-privileged user and can be easily configured to
386run in a @code{chroot} jail, thus making any security flaws in NSD less likely
387to result in system-wide compromise.")
388 (license (list license:bsd-3))))
389
7e61a16c
GG
390(define-public unbound
391 (package
392 (name "unbound")
ca1f4b19 393 (version "1.9.4")
7e61a16c
GG
394 (source
395 (origin
396 (method url-fetch)
397 (uri (string-append "https://www.unbound.net/downloads/unbound-"
398 version ".tar.gz"))
399 (sha256
ca1f4b19 400 (base32 "1c2bjm13x8bkw0ds1mhn9ivd2gzmfrb0x5y76bkz09a04bxjagix"))))
7e61a16c
GG
401 (build-system gnu-build-system)
402 (outputs '("out" "python"))
403 (native-inputs
404 `(("flex" ,flex)
405 ("swig" ,swig)))
406 (inputs
407 `(("expat" ,expat)
408 ("libevent" ,libevent)
409 ("protobuf" ,protobuf)
410 ("python" ,python-3)
411 ("python-wrapper" ,python-wrapper)
412 ("openssl" ,openssl)))
413 (arguments
414 `(#:configure-flags
37040b85 415 (list "--disable-static" ; save space and non-determinism in libunbound.a
a431929d 416 (string-append
7e61a16c
GG
417 "--with-ssl=" (assoc-ref %build-inputs "openssl"))
418 (string-append
419 "--with-libevent=" (assoc-ref %build-inputs "libevent"))
420 (string-append
421 "--with-libexpat=" (assoc-ref %build-inputs "expat"))
422 "--with-pythonmodule" "--with-pyunbound")
423 #:phases
424 (modify-phases %standard-phases
425 (add-after 'configure 'fix-python-site-package-path
426 ;; Move python modules into their own output.
427 (lambda* (#:key outputs #:allow-other-keys)
428 (let ((pyout (assoc-ref outputs "python"))
429 (ver ,(version-major+minor (package-version python))))
430 (substitute* "Makefile"
431 (("^PYTHON_SITE_PKG=.*$")
432 (string-append
433 "PYTHON_SITE_PKG="
434 pyout "/lib/python-" ver "/site-packages\n"))))
435 #t))
436 (add-before 'check 'fix-missing-nss-for-tests
437 ;; Unfortunately, the package's unittests involve some checks
438 ;; looking up protocols and services which are not provided
439 ;; by the minimalistic build environment, in particular,
440 ;; /etc/protocols and /etc/services are missing.
441 ;; Also, after plain substitution of protocol and service names
442 ;; in the test data, the tests still fail because the
443 ;; corresponding Resource Records have been signed by
444 ;; RRSIG records.
445 ;; The following LD_PRELOAD library overwrites the glibc
446 ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
447 ;; ‘getservbyport’ providing the few records required for the
448 ;; unit tests to pass.
449 (lambda* (#:key inputs outputs #:allow-other-keys)
450 (let* ((source (assoc-ref %build-inputs "source"))
451 (gcc (assoc-ref %build-inputs "gcc")))
452 (call-with-output-file "/tmp/nss_preload.c"
453 (lambda (port)
454 (display "#include <stdlib.h>
455#include <string.h>
456#include <strings.h>
457
458#include <netdb.h>
459
460struct protoent *getprotobyname(const char *name) {
461 struct protoent *p = malloc(sizeof(struct protoent));
462 p->p_aliases = malloc(sizeof(char*));
463 if (strcasecmp(name, \"tcp\") == 0) {
464 p->p_name = \"tcp\";
465 p->p_proto = 6;
466 p->p_aliases[0] = \"TCP\";
467 } else if (strcasecmp(name, \"udp\") == 0) {
468 p->p_name = \"udp\";
469 p->p_proto = 17;
470 p->p_aliases[0] = \"UDP\";
471 } else
472 p = NULL;
473 return p;
474}
475
476struct protoent *getprotobynumber(int proto) {
477 struct protoent *p = malloc(sizeof(struct protoent));
478 p->p_aliases = malloc(sizeof(char*));
479 switch(proto) {
480 case 6:
481 p->p_name = \"tcp\";
482 p->p_proto = 6;
483 p->p_aliases[0] = \"TCP\";
484 break;
485 case 17:
486 p->p_name = \"udp\";
487 p->p_proto = 17;
488 p->p_aliases[0] = \"UDP\";
489 break;
490 default:
491 p = NULL;
492 break;
493 }
494 return p;
495}
496
497struct servent *getservbyname(const char *name, const char *proto) {
498 struct servent *s = malloc(sizeof(struct servent));
499 char* buf = malloc((strlen(proto)+1)*sizeof(char));
500 strcpy(buf, proto);
501 s->s_aliases = malloc(sizeof(char*));
502 s->s_aliases[0] = NULL;
503 if (strcasecmp(name, \"domain\") == 0) {
504 s->s_name = \"domain\";
505 s->s_port = htons(53);
506 s->s_proto = buf;
507 } else
508 s = NULL;
509 return s;
510}
511
512struct servent *getservbyport(int port, const char *proto) {
513 char buf[32];
514 struct servent *s = malloc(sizeof(struct servent));
515 strcpy(buf, proto);
516 s->s_aliases = malloc(sizeof(char*));
517 s->s_aliases[0] = NULL;
518 switch(port) {
519 case 53:
520 s->s_name = \"domain\";
521 s->s_port = 53;
522 s->s_proto = \"udp\";
523 break;
524 default:
525 s = NULL;
526 break;
527 }
528 return s;
529}" port)))
9a3a1565
TGR
530 (invoke (string-append gcc "/bin/gcc")
531 "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
532 "/tmp/nss_preload.c")
7e61a16c
GG
533 ;; The preload library only affects the unittests.
534 (substitute* "Makefile"
535 (("./unittest")
536 "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
537 #t)))))
538 (home-page "https://www.unbound.net")
539 (synopsis "Validating, recursive, and caching DNS resolver")
540 (description
541 "Unbound is a recursive-only caching DNS server which can perform DNSSEC
542validation of results. It implements only a minimal amount of authoritative
543service to prevent leakage to the root nameservers: forward lookups for
544localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
545served by AS112. Stub and forward zones are supported.")
546 (license license:bsd-4)))
547
6cf626e8
TGR
548(define-public yadifa
549 (package
550 (name "yadifa")
92a33362 551 (version "2.3.9")
6cf626e8 552 (source
92a33362 553 (let ((build "8497"))
8769d482
TGR
554 (origin
555 (method url-fetch)
556 (uri
557 (string-append "http://cdn.yadifa.eu/sites/default/files/releases/"
fe99b7f7 558 "yadifa-" version "-" build ".tar.gz"))
8769d482 559 (sha256
92a33362 560 (base32 "0xvyr91sfgzkpw6g3h893ldbwnki3w2472n56rr18w67qghs1sa5")))))
6cf626e8
TGR
561 (build-system gnu-build-system)
562 (native-inputs
563 `(("which" ,which)))
564 (inputs
565 `(("openssl" ,openssl)))
566 (arguments
57b05e4a
TGR
567 `(#:phases
568 (modify-phases %standard-phases
569 (add-before 'configure 'omit-example-configurations
570 (lambda _
571 (substitute* "Makefile.in"
572 ((" (etc|var)") ""))
573 #t)))
574 #:configure-flags
575 (list "--sysconfdir=/etc"
576 "--localstatedir=/var"
577 "--disable-build-timestamp" ; build reproducibly
578 "--enable-shared"
579 "--disable-static"
580 "--enable-acl"
581 "--enable-caching"
582 "--enable-ctrl" ; enable remote control
583 "--enable-nsec"
584 "--enable-nsec3"
585 "--enable-tsig")))
6cf626e8
TGR
586 (home-page "http://www.yadifa.eu/")
587 (synopsis "Authoritative DNS name server")
366efcb2
TGR
588 (description "YADIFA is an authoritative name server for the @dfn{Domain
589Name System} (DNS). It aims for both higher performance and a smaller memory
6cf626e8 590footprint than other implementations, while remaining fully RFC-compliant.
366efcb2
TGR
591YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
592Extensions} (DNSSEC).")
6cf626e8 593 (license license:bsd-3)))
f9cdf1c1
TGR
594
595(define-public knot
596 (package
597 (name "knot")
07bec45d 598 (version "2.9.0")
e41ddf76
TGR
599 (source
600 (origin
601 (method url-fetch)
602 (uri (string-append "https://secure.nic.cz/files/knot-dns/"
603 "knot-" version ".tar.xz"))
604 (sha256
07bec45d 605 (base32 "18i1kdyaqaskjyhmq888wml4d2p4ic1sbjynlb6ggfxsxzm38x6z"))
e41ddf76
TGR
606 (modules '((guix build utils)))
607 (snippet
608 '(begin
609 ;; Delete bundled libraries.
610 (with-directory-excursion "src/contrib"
611 (delete-file-recursively "lmdb"))
612 #t))))
f9cdf1c1
TGR
613 (build-system gnu-build-system)
614 (native-inputs
615 `(("pkg-config" ,pkg-config)))
616 (inputs
023ef013
TGR
617 `(("fstrm" ,fstrm)
618 ("gnutls" ,gnutls)
f9cdf1c1
TGR
619 ("jansson" ,jansson)
620 ("libcap-ng" ,libcap-ng)
621 ("libedit" ,libedit)
622 ("libidn" ,libidn)
623 ("liburcu" ,liburcu)
624 ("lmdb" ,lmdb)
625 ("ncurses" ,ncurses)
1b00e3bd 626 ("protobuf-c" ,protobuf-c)))
f9cdf1c1
TGR
627 (arguments
628 `(#:phases
629 (modify-phases %standard-phases
630 (add-before 'configure 'disable-directory-pre-creation
631 (lambda _
632 ;; Don't install empty directories like ‘/etc’ outside the store.
1b00e3bd 633 ;; This is needed even when using ‘make config_dir=... install’.
2d431b01
TGR
634 (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))
635 #t))
f9cdf1c1
TGR
636 (replace 'install
637 (lambda* (#:key outputs #:allow-other-keys)
638 (let* ((out (assoc-ref outputs "out"))
ee1362fc 639 (doc (string-append out "/share/doc/" ,name "-" ,version))
f9cdf1c1 640 (etc (string-append doc "/examples/etc")))
6b042495
TGR
641 (invoke "make"
642 (string-append "config_dir=" etc)
1b00e3bd 643 "install")))))
f9cdf1c1
TGR
644 #:configure-flags
645 (list "--sysconfdir=/etc"
646 "--localstatedir=/var"
1b00e3bd
TGR
647 "--enable-dnstap" ; let tools read/write capture files
648 "--with-module-dnstap=yes" ; detailed query capturing & logging
f9cdf1c1
TGR
649 (string-append "--with-bash-completions="
650 (assoc-ref %outputs "out")
651 "/etc/bash_completion.d"))))
652 (home-page "https://www.knot-dns.cz/")
653 (synopsis "Authoritative DNS name server")
d1e4ad1b 654 (description "Knot DNS is an authoritative name server for the @dfn{Domain
f9cdf1c1
TGR
655Name System} (DNS), designed to meet the needs of root and @dfn{top-level
656domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
657number of programming techniques to improve speed. For example, the responder
658is completely lock-free, resulting in a very high response rate. Other features
659include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
660synthesis, and on-the-fly re-configuration.")
0056f4cc
TGR
661 (license
662 (list
663 ;; src/contrib/{hat-trie,murmurhash3,openbsd},
664 ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
665 license:expat
666 license:lgpl2.0+ ; parts of scr/contrib/ucw
667 license:public-domain ; src/contrib/fnv and possibly murmurhash3
668 license:gpl3+)))) ; everything else
0bc2d3e4 669
a35e16c0
SB
670(define-public knot-resolver
671 (package
672 (name "knot-resolver")
673 (version "4.2.2")
674 (source (origin
675 (method url-fetch)
676 (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
677 "knot-resolver-" version ".tar.xz"))
678 (sha256
679 (base32
680 "0n0llpclhparq9wbcrymxkl5d03c4y4p3shcbdxfv6j22vzqvdh3"))))
681 (build-system meson-build-system)
682 (arguments
683 '(#:configure-flags
684 '("-Dmanaged_ta=disabled" ; We'll manage the DNS root data ourself.
685 "-Ddoc=enabled")
686 #:phases
687 (modify-phases %standard-phases
688 (add-after 'build 'build-doc
689 (lambda _
690 (invoke "ninja" "doc")))
691 (add-after 'install 'wrap-binary
692 (lambda* (#:key inputs outputs #:allow-other-keys)
693 (let* ((out (assoc-ref outputs "out"))
694 (lua-* (map cdr (filter
695 (lambda (input)
696 (string-prefix? "lua-" (car input)))
697 inputs)))
698 (lua-path (lambda (p)
699 (string-append p "/share/lua/5.1/?.lua")))
700 (lua-cpath (lambda (p)
701 (string-append p "/lib/lua/5.1/?.so"))))
702 (wrap-program (string-append out "/sbin/kresd")
703 `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
704 `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
705 #t))))))
706 (native-inputs
707 `(("cmocka" ,cmocka) ; for unit tests
708 ("doxygen" ,doxygen)
709 ("protobuf-c" ,protobuf-c)
710 ("pkg-config" ,pkg-config)
711 ("python-breathe" ,python-breathe)
712 ("python-sphinx" ,python-sphinx)
713 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
714 (inputs
715 `(("fstrm" ,fstrm)
716 ("gnutls" ,gnutls)
717 ("knot" ,knot)
718 ("libuv" ,libuv)
719 ("lmdb" ,lmdb)
720 ("luajit" ,luajit)
721 ;; TODO: Add optional lua modules: basexx, cqueues and psl.
722 ("lua-bitop" ,lua5.1-bitop)
723 ("lua-filesystem" ,lua5.1-filesystem)
724 ("lua-sec" ,lua5.1-sec)
725 ("lua-socket" ,lua5.1-socket)))
726 (home-page "https://www.knot-resolver.cz/")
727 (synopsis "Caching validating DNS resolver")
728 (description
729 "Knot Resolver is a caching full resolver implementation written in C and
730LuaJIT, both a resolver library and a daemon.")
731 (license (list license:gpl3+
732 ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
733 license:expat
734 license:cc0
735 license:lgpl2.0))))
736
0bc2d3e4
OP
737(define-public ddclient
738 (package
739 (name "ddclient")
e12df2c6 740 (version "3.9.0")
0bc2d3e4
OP
741 (source (origin
742 (method url-fetch)
743 (uri (string-append "mirror://sourceforge/ddclient/ddclient/ddclient-"
744 version "/ddclient-" version ".tar.gz"))
745 (sha256
746 (base32
e12df2c6 747 "0fwyhab8yga2yi1kdfkbqxa83wxhwpagmj1w1mwkg2iffh1fjjlw"))))
0bc2d3e4
OP
748 (build-system trivial-build-system) ; no Makefile.PL
749 (native-inputs
750 `(("bash" ,bash)
751 ("gzip" ,gzip)
752 ("perl" ,perl)
753 ("tar" ,tar)))
754 (inputs
e12df2c6
TGR
755 `(("inetutils" ,inetutils) ; logger
756 ("net-tools" ,net-tools)
757 ("perl-data-validate-ip" ,perl-data-validate-ip)
758 ("perl-digest-sha1" ,perl-digest-sha1)
759 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
0bc2d3e4
OP
760 (arguments
761 `(#:modules ((guix build utils)
762 (ice-9 match)
763 (srfi srfi-26))
764 #:builder
765 (begin
766 (use-modules (guix build utils)
767 (ice-9 match)
768 (srfi srfi-26))
769 ;; bootstrap
770 (setenv "PATH" (string-append
771 (assoc-ref %build-inputs "bash") "/bin" ":"
772 (assoc-ref %build-inputs "tar") "/bin" ":"
773 (assoc-ref %build-inputs "gzip") "/bin" ":"
774 (assoc-ref %build-inputs "perl") "/bin"))
775 ;; extract source
776 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
777 ;; package
778 (with-directory-excursion (string-append ,name "-" ,version)
779 (let* ((out (assoc-ref %outputs "out"))
780 (bin (string-append out "/bin")))
781 (let ((file "ddclient"))
782 (substitute* file
783 (("/usr/bin/perl") (which "perl"))
784 ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
785 (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
786 (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
787 ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
788 (("\\$cachedir\\$program\\.cache")
789 "/var/cache/ddclient/ddclient.cache"))
790 (install-file file bin)
791 (wrap-program (string-append bin "/" file)
792 `("PATH" ":" =
793 ("$PATH"
794 ,@(map (lambda (input)
795 (match input
796 ((name . store)
797 (string-append store "/bin"))))
798 %build-inputs)))
799 `("PERL5LIB" ":" =
800 ,(delete
801 ""
802 (map (match-lambda
803 (((? (cut string-prefix? "perl-" <>) name) . dir)
804 (string-append dir "/lib/perl5/site_perl"))
805 (_ ""))
806 %build-inputs)))))
807 (for-each (cut install-file <> (string-append out
808 "/share/ddclient"))
809 (find-files "." "sample.*$")))))))
810 (home-page "https://sourceforge.net/projects/ddclient/")
811 (synopsis "Address updating utility for dynamic DNS services")
812 (description "This package provides a client to update dynamic IP
813addresses with several dynamic DNS service providers, such as
814@uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
815
816This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
817access a machine with a dynamic IP address.
818
819The client supports both dynamic and (near) static services, as well as MX
820record and alternative name management. It caches the address, and only
821attempts the update when it has changed.")
822 (license license:gpl2+)))
91a4863d
LC
823
824(define-public hnsd
825 ;; There have been no releases yet, hence this commit.
826 (let ((revision "0")
827 (commit "895d89c25d316d18df9d374fe78aae3902bc89fb"))
828 (package
829 (name "hnsd")
830 (version (git-version "0.0" revision commit))
831 (source (origin
832 (method git-fetch)
833 (uri (git-reference
834 (url "https://github.com/handshake-org/hnsd")
835 (commit commit)))
836 (sha256
837 (base32
838 "0704y73sddn24jga9csw4gxyfb3pnrfnk0vdcph84n1h38490l16"))
839 (file-name (git-file-name name version))
840 (modules '((guix build utils)))
841 (snippet
842 '(begin
843 ;; Delete the bundled copy of libuv.
844 (delete-file-recursively "uv")
845 (substitute* "configure.ac"
846 (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
847 (substitute* "Makefile.am"
848 (("SUBDIRS = uv") "\n")
849 (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
850
851 ;; Make sure the 'hnsd' binary is installed and
852 ;; dynamically-linked.
853 (("noinst_PROGRAMS") "bin_PROGRAMS")
854 (("hnsd_LDFLAGS = -static") ""))
855
856 ;; This script tries to chdir to "uv" and doesn't do more
857 ;; than "autoreconf" so remove it.
858 (delete-file "autogen.sh")
859 #t))))
860 (build-system gnu-build-system)
861 (arguments
862 '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
863 (native-inputs
864 `(("autoconf" ,autoconf)
865 ("automake" ,automake)
866 ("libtool" ,libtool)))
867 (inputs
868 `(("unbound" ,unbound)
869 ("libuv" ,libuv)))
870 (home-page "https://www.handshake.org/")
871 (synopsis "Resolver daemon for the Handshake naming protocol")
872 (description
873 "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
874System (HNS) peer-to-peer network.")
875 (license license:expat))))
498911d3
MO
876
877(define-public libmicrodns
878 (package
879 (name "libmicrodns")
880 (version "0.0.10")
881 (source (origin
882 (method git-fetch)
883 (uri (git-reference
884 (url "https://github.com/videolabs/libmicrodns")
885 (commit version)))
886 (file-name (git-file-name name version))
887 (sha256
888 (base32
889 "1xvl9k49ng35wbsqmnjnyqvkyjf8dcq2ywsq3jp3wh0rgmxhq2fh"))))
890 (build-system gnu-build-system)
891 (native-inputs
892 `(("pkg-config" ,pkg-config)
893 ("autoconf" ,autoconf)
894 ("automake" ,automake)
895 ("libtool" ,libtool)))
896 (home-page "https://github.com/videolabs/libmicrodns")
897 (synopsis "Minimal mDNS resolver library")
898 (description "@code{libmicrodns} provides a minimal implementation of a
899mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
900a zero-config service that allows one to resolve host names to IP addresses in
901local networks.")
902 (license license:lgpl2.1)))
41553c90
CM
903
904(define-public public-suffix-list
905 ;; Mozilla releases the official list here:
906 ;;
907 ;; https://publicsuffix.org/list/public_suffix_list.dat
908 ;;
909 ;; However, Mozilla syncs that file from the GitHub repository periodically,
910 ;; so its contents will change over time. If you update this commit, please
911 ;; make sure that the new commit refers to a list which is identical to the
912 ;; officially published list available from the URL above.
913 (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
914 (package
915 (name "public-suffix-list")
916 (version (git-version "0" "1" commit))
917 (source (origin
918 (method git-fetch)
919 (uri (git-reference
920 (url "https://github.com/publicsuffix/list.git")
921 (commit commit)))
922 (file-name (git-file-name name version))
923 (sha256
924 (base32
925 "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
926 (build-system trivial-build-system)
927 (arguments
928 `(#:modules ((guix build utils))
929 #:builder
930 (begin
931 (use-modules (guix build utils))
932 (let* ((out (assoc-ref %outputs "out"))
933 ;; Install to /share because that is where "read-only
934 ;; architecture-independent data files" should go (see:
935 ;; (standards) Directory Variables). Include the version in
936 ;; the directory name so that if multiple versions are ever
937 ;; installed in the same profile, they will not conflict.
938 (destination (string-append
939 out "/share/public-suffix-list-" ,version))
940 (source (assoc-ref %build-inputs "source")))
941 (with-directory-excursion source
942 (install-file "public_suffix_list.dat" destination)
943 (install-file "LICENSE" destination))
944 #t))))
945 (home-page "https://publicsuffix.org/")
946 (synopsis "Database of current and historical DNS suffixes")
947 (description "This is the Public Suffix List maintained by Mozilla. A
948\"public suffix\" is one under which Internet users can (or historically
949could) directly register names in the Domain Name System (DNS). Some examples
950of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
951known public suffixes.")
952 (license license:mpl2.0))))