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