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