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