dns.scm 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
  3. ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
  7. ;;; Copyright © 2016 Nikita <nikita@n0.is>
  8. ;;; Copyright © 2016–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
  10. ;;; Copyright © 2017 Vasile Dumitrascu <va511e@yahoo.com>
  11. ;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
  12. ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
  13. ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  14. ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
  15. ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
  16. ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
  17. ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
  18. ;;; Copyright © 2020 Leo Famulari <leo@famulari.name>
  19. ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
  20. ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
  21. ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
  22. ;;;
  23. ;;; This file is part of GNU Guix.
  24. ;;;
  25. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  26. ;;; under the terms of the GNU General Public License as published by
  27. ;;; the Free Software Foundation; either version 3 of the License, or (at
  28. ;;; your option) any later version.
  29. ;;;
  30. ;;; GNU Guix is distributed in the hope that it will be useful, but
  31. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  32. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  33. ;;; GNU General Public License for more details.
  34. ;;;
  35. ;;; You should have received a copy of the GNU General Public License
  36. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  37. (define-module (gnu packages dns)
  38. #:use-module (gnu packages admin)
  39. #:use-module (gnu packages autotools)
  40. #:use-module (gnu packages base)
  41. #:use-module (gnu packages bash)
  42. #:use-module (gnu packages certs)
  43. #:use-module (gnu packages check)
  44. #:use-module (gnu packages curl)
  45. #:use-module (gnu packages databases)
  46. #:use-module (gnu packages documentation)
  47. #:use-module (gnu packages compression)
  48. #:use-module (gnu packages crypto)
  49. #:use-module (gnu packages datastructures)
  50. #:use-module (gnu packages elf)
  51. #:use-module (gnu packages flex)
  52. #:use-module (gnu packages freedesktop)
  53. #:use-module (gnu packages gcc)
  54. #:use-module (gnu packages glib)
  55. #:use-module (gnu packages groff)
  56. #:use-module (gnu packages groff)
  57. #:use-module (gnu packages gtk)
  58. #:use-module (gnu packages libedit)
  59. #:use-module (gnu packages libevent)
  60. #:use-module (gnu packages libidn)
  61. #:use-module (gnu packages linux)
  62. #:use-module (gnu packages lua)
  63. #:use-module (gnu packages ncurses)
  64. #:use-module (gnu packages nettle)
  65. #:use-module (gnu packages networking)
  66. #:use-module (gnu packages perl)
  67. #:use-module (gnu packages pkg-config)
  68. #:use-module (gnu packages protobuf)
  69. #:use-module (gnu packages python)
  70. #:use-module (gnu packages python-xyz)
  71. #:use-module (gnu packages ragel)
  72. #:use-module (gnu packages serialization)
  73. #:use-module (gnu packages shells)
  74. #:use-module (gnu packages sphinx)
  75. #:use-module (gnu packages swig)
  76. #:use-module (gnu packages texinfo)
  77. #:use-module (gnu packages tls)
  78. #:use-module (gnu packages web)
  79. #:use-module (gnu packages xml)
  80. #:use-module (gnu packages)
  81. #:use-module ((guix licenses) #:prefix license:)
  82. #:use-module (guix packages)
  83. #:use-module (guix download)
  84. #:use-module (guix git-download)
  85. #:use-module (guix utils)
  86. #:use-module (guix build-system copy)
  87. #:use-module (guix build-system glib-or-gtk)
  88. #:use-module (guix build-system gnu)
  89. #:use-module (guix build-system meson)
  90. #:use-module (guix build-system trivial))
  91. (define-public cloudflare-cli
  92. (let ((commit "2d986d3ec1b0e3158c4bd40e8918947cb74aa392")
  93. (revision "1"))
  94. (package
  95. (name "cloudflare-cli")
  96. (version (git-version "0.0.0" revision commit))
  97. (source
  98. (origin
  99. (method git-fetch)
  100. (uri (git-reference
  101. (url "https://github.com/earlchew/cloudflare-cli")
  102. (commit commit)))
  103. (file-name (git-file-name name version))
  104. (sha256
  105. (base32
  106. "0f86g6n86kwykl3jnhqjrdfy8ybkp03ghr3dlr70q2552qw4axw2"))))
  107. (build-system copy-build-system)
  108. (arguments
  109. `(#:install-plan '(("cloudflare-cli" "bin/") ("cloudflare-cli.sh" "bin/"))
  110. #:phases
  111. (modify-phases %standard-phases
  112. (add-after 'unpack 'find-jsonsh
  113. (lambda* (#:key inputs #:allow-other-keys)
  114. (substitute* "cloudflare-cli.sh"
  115. (("\\$\\{0%/\\*\\}/jsonsh")
  116. (string-append (assoc-ref inputs "json.sh") "/bin/JSON.sh")))
  117. #t))
  118. (add-after 'install 'wrap-program
  119. (lambda* (#:key inputs outputs #:allow-other-keys)
  120. (wrap-program (string-append (assoc-ref outputs "out") "/bin/cloudflare-cli")
  121. `("PATH" ":" prefix
  122. (,(string-join
  123. (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
  124. '("grep" "curl"))
  125. ":"))))
  126. #t)))))
  127. (inputs
  128. `(("bash-minimal" ,bash-minimal)
  129. ("curl" ,curl)
  130. ("grep" ,grep)
  131. ("json.sh" ,json.sh)))
  132. (synopsis
  133. "CLI to edit Cloudflare DNS records")
  134. (description
  135. "This command line tool to update Cloudfare DNS records is useful for tasks
  136. such as updating dynamic DNS records or updating DNS records for the ACME DNS-01
  137. protocol.")
  138. (home-page "https://github.com/earlchew/cloudflare-cli")
  139. (license license:expat))))
  140. (define-public ldns
  141. (package
  142. (name "ldns")
  143. (version "1.7.1")
  144. (source
  145. (origin
  146. (method url-fetch)
  147. (uri
  148. (string-append "https://www.nlnetlabs.nl/downloads/"
  149. name "/" name "-" version ".tar.gz"))
  150. (sha256
  151. (base32 "0ac242n7996fswq1a3nlh1bbbhrsdwsq4mx7xq8ffq6aplb4rj4a"))
  152. (patches
  153. (search-patches
  154. ;; To create make-flag variables,
  155. ;; for splitting installation of drill and examples.
  156. "ldns-drill-examples.patch"))))
  157. (build-system gnu-build-system)
  158. (outputs '("out" "drill" "examples" "pyldns"))
  159. (arguments
  160. `( ;; Tests require Tpkg.
  161. ;; https://tpkg.github.io/
  162. #:tests? #f
  163. #:configure-flags
  164. (list
  165. "--disable-static"
  166. "--enable-gost-anyway"
  167. "--enable-rrtype-ninfo"
  168. "--enable-rrtype-rkey"
  169. "--enable-rrtype-ta"
  170. "--enable-rrtype-avc"
  171. "--enable-rrtype-doa"
  172. "--enable-rrtype-amtrelay"
  173. "--with-drill"
  174. "--with-examples"
  175. "--with-pyldns"
  176. ;; Perl module DNS::LDNS not available.
  177. ;; https://github.com/erikoest/DNS-LDNS.git
  178. ;; "--with-p5-dns-ldns"
  179. (string-append "--with-ssl="
  180. (assoc-ref %build-inputs "openssl"))
  181. (string-append "--with-ca-path="
  182. (assoc-ref %build-inputs "nss-certs")
  183. "/etc/ssl/certs"))
  184. #:make-flags
  185. (list
  186. (string-append "drillbindir="
  187. (assoc-ref %outputs "drill")
  188. "/bin")
  189. (string-append "drillmandir="
  190. (assoc-ref %outputs "drill")
  191. "/share/man")
  192. (string-append "examplesbindir="
  193. (assoc-ref %outputs "examples")
  194. "/bin")
  195. (string-append "examplesmandir="
  196. (assoc-ref %outputs "examples")
  197. "/share/man")
  198. (string-append "python_site="
  199. (assoc-ref %outputs "pyldns")
  200. "/lib/python"
  201. ,(version-major+minor
  202. (package-version python))
  203. "/site-packages"))))
  204. (native-inputs
  205. `(("doxygen" ,doxygen)
  206. ("ksh" ,oksh)
  207. ("perl" ,perl)
  208. ("perl-devel-checklib" ,perl-devel-checklib)
  209. ("pkg-config" ,pkg-config)
  210. ("python" ,python-wrapper)
  211. ("swig" ,swig)))
  212. (inputs
  213. `(("libpcap" ,libpcap)
  214. ("nss-certs" ,nss-certs)
  215. ("openssl" ,openssl)))
  216. (synopsis "DNS library that facilitates DNS tool programming")
  217. (description "LDNS aims to simplify DNS programming, it supports recent
  218. RFCs like the DNSSEC documents, and allows developers to easily create
  219. software conforming to current RFCs, and experimental software for current
  220. Internet Drafts. A secondary benefit of using ldns is speed; ldns is written in
  221. C it should be a lot faster than Perl.")
  222. (home-page "https://nlnetlabs.nl/projects/ldns/about/")
  223. (license license:bsd-3)))
  224. (define-public dnssec-trigger
  225. (package
  226. (name "dnssec-trigger")
  227. (version "0.17")
  228. (source
  229. (origin
  230. (method url-fetch)
  231. (uri
  232. (string-append "https://www.nlnetlabs.nl/downloads/"
  233. name "/" name "-" version ".tar.gz"))
  234. (sha256
  235. (base32 "10928q406x9r66a090xl5kznzgyxpja88w4srwcv454hd351j9f0"))))
  236. (build-system glib-or-gtk-build-system)
  237. (outputs '("out" "gui" "nm"))
  238. (arguments
  239. `(#:test-target "test"
  240. #:configure-flags
  241. (list
  242. (string-append "--with-ssl="
  243. (assoc-ref %build-inputs "openssl"))
  244. "--with-hooks=networkmanager"
  245. (string-append "--with-networkmanager-dispatch="
  246. (assoc-ref %outputs "nm")
  247. "/etc/NetworkManager/dispatcher.d")
  248. (string-append "--with-xdg-autostart="
  249. (assoc-ref %outputs "gui")
  250. "/etc/xdg/autostart")
  251. (string-append "--with-uidir="
  252. (assoc-ref %outputs "gui")
  253. "/share/dnssec-trigger")
  254. (string-append "--with-python="
  255. (assoc-ref %build-inputs "python")
  256. "/bin/python")
  257. (string-append "--with-unbound-control="
  258. (assoc-ref %build-inputs "unbound")
  259. "/sbin/unbound-control")
  260. "--with-forward-zones-support")
  261. #:phases
  262. (modify-phases %standard-phases
  263. (add-after 'unpack 'patch-configure
  264. (lambda _
  265. (substitute* "configure"
  266. (("appindicator-0.1")
  267. "appindicator3-0.1"))
  268. #t))
  269. (add-before 'configure 'patch-makefile
  270. (lambda _
  271. (substitute* "Makefile.in"
  272. (("/usr")
  273. "$(prefix)")
  274. (("/etc")
  275. "$(prefix)/etc")
  276. ((".*gtk-update-icon-cache.*")
  277. ""))
  278. #t))
  279. (add-after 'install 'remove-systemd
  280. (lambda* (#:key outputs #:allow-other-keys)
  281. (let* ((out (assoc-ref outputs "out")))
  282. (delete-file-recursively
  283. (string-append out "/lib/systemd"))
  284. #t)))
  285. (add-after 'remove-systemd 'move-gui
  286. (lambda* (#:key outputs #:allow-other-keys)
  287. (let* ((out (assoc-ref outputs "out"))
  288. (gui (assoc-ref outputs "gui")))
  289. (mkdir-p (string-append gui "/bin"))
  290. (mkdir-p (string-append gui "/share"))
  291. (rename-file
  292. (string-append out "/bin")
  293. (string-append gui "/bin"))
  294. (rename-file
  295. (string-append out "/share/icons")
  296. (string-append gui "/share/icons"))
  297. #t)))
  298. (add-after 'move-gui 'move-nm
  299. (lambda* (#:key outputs #:allow-other-keys)
  300. (let* ((out (assoc-ref outputs "out"))
  301. (nm (assoc-ref outputs "nm")))
  302. (mkdir-p (string-append nm "/libexec"))
  303. (rename-file
  304. (string-append out "/libexec")
  305. (string-append nm "/libexec"))
  306. #t))))))
  307. (native-inputs
  308. `(("cmocka" ,cmocka)
  309. ("pkg-config" ,pkg-config)
  310. ("python" ,python-wrapper)))
  311. (inputs
  312. `(("gtk+-2" ,gtk+-2)
  313. ("ldns" ,ldns)
  314. ("libappindicator" ,libappindicator)
  315. ("openssl" ,openssl)
  316. ("unbound" ,unbound)))
  317. (synopsis "DNSSEC protection for the DNS traffic")
  318. (description "DNSSEC-Trigger enables your computer to use DNSSEC protection
  319. for the DNS traffic. It relies on the Unbound DNS resolver running locally on
  320. your system, which performs DNSSEC validation. It reconfigures Unbound in such
  321. a way that it will signal it to to use the DHCP obtained forwarders if possible,
  322. fallback to doing its own AUTH queries if that fails, and if that fails it will
  323. prompt the user with the option to go with insecure DNS only.")
  324. (home-page "https://www.nlnetlabs.nl/projects/dnssec-trigger/about/")
  325. (license license:bsd-3)))
  326. (define-public dnsmasq
  327. (package
  328. (name "dnsmasq")
  329. (version "2.86")
  330. (source (origin
  331. (method url-fetch)
  332. (uri (string-append
  333. "http://www.thekelleys.org.uk/dnsmasq/dnsmasq-"
  334. version ".tar.xz"))
  335. (sha256
  336. (base32
  337. "027b0ycw8h8yvvkq46vnr7dv8iqn5srm4kr7hm7sq110kvy2rm98"))))
  338. (build-system gnu-build-system)
  339. (native-inputs
  340. `(("pkg-config" ,pkg-config)))
  341. (inputs
  342. `(("dbus" ,dbus)))
  343. (arguments
  344. `(#:phases
  345. (modify-phases %standard-phases (delete 'configure))
  346. #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  347. (string-append "CC=" ,(cc-for-target))
  348. "COPTS=\"-DHAVE_DBUS\"")
  349. #:tests? #f)) ; no ‘check’ target
  350. (home-page "http://www.thekelleys.org.uk/dnsmasq/doc.html")
  351. (synopsis "Small caching DNS proxy and DHCP/TFTP server")
  352. (description
  353. "Dnsmasq is a light-weight DNS forwarder and DHCP server. It is designed
  354. to provide DNS and, optionally, DHCP to a small network. It can serve the
  355. names of local machines which are not in the global DNS. The DHCP server
  356. integrates with the DNS server and allows machines with DHCP-allocated
  357. addresses to appear in the DNS with names configured either on each host or in
  358. a central configuration file. Dnsmasq supports static and dynamic DHCP leases
  359. and BOOTP/TFTP for network booting of diskless machines.")
  360. ;; Source files only say GPL2 and GPL3 are allowed.
  361. (license (list license:gpl2 license:gpl3))))
  362. ;; 'bind' is the name of a built-in Guile procedure, which is why we choose a
  363. ;; different name here.
  364. (define-public isc-bind
  365. (package
  366. (name "bind")
  367. ;; When updating, check whether isc-dhcp's bundled copy should be as well.
  368. ;; The BIND release notes are available here:
  369. ;; https://www.isc.org/bind/
  370. (version "9.16.16")
  371. (source (origin
  372. (method url-fetch)
  373. (uri (string-append
  374. "https://ftp.isc.org/isc/bind9/" version
  375. "/bind-" version ".tar.xz"))
  376. (sha256
  377. (base32
  378. "0yqxfq7qc26x7qhk0nkp8h7x9jggzaafm712bvfffy7qml13k4bc"))))
  379. (build-system gnu-build-system)
  380. (outputs `("out" "utils"))
  381. (inputs
  382. ;; It would be nice to add GeoIP and gssapi once there are packages.
  383. `(("libcap" ,libcap)
  384. ("libuv" ,libuv)
  385. ("libxml2" ,libxml2)
  386. ("openssl" ,openssl)
  387. ("p11-kit" ,p11-kit)
  388. ("python" ,python)
  389. ("python-ply" ,python-ply)))
  390. (native-inputs
  391. `(("perl" ,perl)
  392. ("pkg-config" ,pkg-config)))
  393. (arguments
  394. `(#:configure-flags
  395. (list (string-append "--with-pkcs11="
  396. (assoc-ref %build-inputs "p11-kit")))
  397. #:phases
  398. (modify-phases %standard-phases
  399. (add-after 'strip 'move-to-utils
  400. (lambda _
  401. (for-each
  402. (lambda (file)
  403. (let ((target (string-append (assoc-ref %outputs "utils") file))
  404. (src (string-append (assoc-ref %outputs "out") file)))
  405. (mkdir-p (dirname target))
  406. (link src target)
  407. (delete-file src)))
  408. '("/bin/dig" "/bin/delv" "/bin/nslookup" "/bin/host" "/bin/nsupdate"
  409. "/share/man/man1/dig.1"
  410. "/share/man/man1/host.1"
  411. "/share/man/man1/nslookup.1"
  412. "/share/man/man1/nsupdate.1"))
  413. #t))
  414. ;; When and if guix provides user namespaces for the build process,
  415. ;; then the following can be uncommented and the subsequent "force-test"
  416. ;; will not be necessary.
  417. ;;
  418. ;; (add-before 'check 'set-up-loopback
  419. ;; (lambda _
  420. ;; (system "bin/tests/system/ifconfig.sh up")))
  421. (replace 'check
  422. (lambda _
  423. ;; XXX Even ‘make force-test’ tries to create network interfaces
  424. ;; and fails. The only working target is the (trivial) fuzz test.
  425. (with-directory-excursion "fuzz"
  426. (invoke "make" "check"))
  427. #t)))))
  428. (synopsis "@acronym{DNS, Domain Name System} implementation")
  429. (description "BIND implements the @acronym{DNS, Domain Name System}
  430. protocols for the Internet. It is both a reference implementation of those
  431. protocols and production-grade software, suitable for use in high-volume and
  432. high-reliability applications.
  433. The name stands for \"Berkeley Internet Name Domain\" because the software
  434. originated in the early 1980s at the University of California at Berkeley.
  435. The @code{utils} output of this package contains the following command line
  436. utilities related to DNS name servers:
  437. @table @code
  438. @item delv
  439. DNS lookup and validation utility
  440. @item dig
  441. DNS lookup utility
  442. @item host
  443. DNS lookup utility
  444. @item nslookup
  445. Internet name servers interactive query utility
  446. @item nsupdate
  447. Dynamic DNS update utility
  448. @end table")
  449. (home-page "https://www.isc.org/bind/")
  450. (license (list license:mpl2.0))))
  451. (define-public dnscrypt-proxy
  452. (package
  453. (name "dnscrypt-proxy")
  454. (version "1.9.5")
  455. (source (origin
  456. (method url-fetch)
  457. (uri (string-append
  458. "https://download.dnscrypt.org/dnscrypt-proxy/"
  459. "dnscrypt-proxy-" version ".tar.bz2"))
  460. (sha256
  461. (base32
  462. "1dhvklr4dg2vlw108n11xbamacaryyg3dbrg629b76lp7685p7z8"))
  463. (modules '((guix build utils)))
  464. (snippet
  465. ;; Delete bundled libltdl. XXX: This package also bundles
  466. ;; a modified libevent that cannot currently be removed.
  467. '(begin
  468. (delete-file-recursively "libltdl")
  469. #t))))
  470. (build-system gnu-build-system)
  471. (arguments
  472. `(#:phases
  473. (modify-phases %standard-phases
  474. (add-after 'unpack 'autoreconf
  475. (lambda _
  476. ;; Re-generate build files due to unbundling ltdl.
  477. ;; TODO: Prevent generating new libltdl and building it.
  478. ;; The system version is still favored and referenced.
  479. (invoke "autoreconf" "-vif"))))))
  480. (native-inputs
  481. `(("pkg-config" ,pkg-config)
  482. ("automake" ,automake)
  483. ("autoconf" ,autoconf)
  484. ("libtool" ,libtool)))
  485. (inputs
  486. `(("libltdl" ,libltdl)
  487. ("libsodium" ,libsodium)))
  488. (home-page "https://www.dnscrypt.org/")
  489. (synopsis "Securely send DNS requests to a remote server")
  490. (description
  491. "@command{dnscrypt-proxy} is a tool for securing communications
  492. between a client and a DNS resolver. It verifies that responses you get
  493. from a DNS provider was actually sent by that provider, and haven't been
  494. tampered with. For optimal performance it is recommended to use this as
  495. a forwarder for a caching DNS resolver such as @command{dnsmasq}, but it
  496. can also be used as a normal DNS \"server\". A list of public dnscrypt
  497. servers is included, and an up-to-date version is available at
  498. @url{https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv}.")
  499. (license (list license:isc
  500. ;; Libevent and src/ext/queue.h is 3-clause BSD.
  501. license:bsd-3))))
  502. (define-public dnscrypt-wrapper
  503. (package
  504. (name "dnscrypt-wrapper")
  505. (version "0.2.2")
  506. (source (origin
  507. (method url-fetch)
  508. (uri (string-append
  509. "https://github.com/cofyc/dnscrypt-wrapper/releases"
  510. "/download/v" version "/" name "-v" version ".tar.bz2"))
  511. (sha256
  512. (base32
  513. "1vhg4g0r687f51wcdn7z9w1hxapazx6vyh5rsr8wa48sljzd583g"))))
  514. (build-system gnu-build-system)
  515. (arguments
  516. `(#:make-flags '("CC=gcc")
  517. ;; TODO: Tests require ruby-cucumber and ruby-aruba.
  518. #:tests? #f
  519. #:phases
  520. (modify-phases %standard-phases
  521. (add-after 'unpack 'create-configure
  522. (lambda _
  523. (invoke "make" "configure"))))))
  524. (native-inputs
  525. `(("autoconf" ,autoconf)))
  526. (inputs
  527. `(("libevent" ,libevent)
  528. ("libsodium" ,libsodium)))
  529. (home-page "https://github.com/Cofyc/dnscrypt-wrapper")
  530. (synopsis "Server-side dnscrypt proxy")
  531. (description
  532. "@command{dnscrypt-wrapper} is a tool to expose a name server over
  533. the @code{dnscrypt} protocol. It can be used as an endpoint for the
  534. @command{dnscrypt-proxy} client to securely tunnel DNS requests between
  535. the two.")
  536. (license (list license:isc
  537. ;; Bundled argparse is MIT. TODO: package and unbundle.
  538. license:expat
  539. ;; dns-protocol.h and rfc1035.{c,h} is gpl2 or gpl3 (either).
  540. license:gpl2
  541. license:gpl3))))
  542. (define-public libasr
  543. (package
  544. (name "libasr")
  545. (version "1.0.4")
  546. (source
  547. (origin
  548. (method url-fetch)
  549. (uri (string-append "https://www.opensmtpd.org/archives/"
  550. "libasr-" version ".tar.gz"))
  551. (sha256
  552. (base32 "1d6s8njqhvayx2gp47409sp1fn8m608ws26hr1srfp6i23nnpyqr"))))
  553. (build-system gnu-build-system)
  554. (arguments
  555. `(#:phases
  556. (modify-phases %standard-phases
  557. (add-after 'install 'install-documentation
  558. (lambda* (#:key outputs #:allow-other-keys)
  559. (let ((out (assoc-ref outputs "out")))
  560. (install-file "src/asr_run.3"
  561. (string-append out "/share/man/man3"))
  562. #t))))))
  563. (native-inputs
  564. `(("autoconf" ,autoconf)
  565. ("automake" ,automake)
  566. ("libtool" ,libtool)
  567. ("pkg-config" ,pkg-config)))
  568. (home-page "https://www.opensmtpd.org")
  569. (synopsis "Asynchronous resolver library by the OpenBSD project")
  570. (description
  571. "libasr is a free, simple and portable asynchronous resolver library.
  572. It runs DNS queries and performs hostname resolution in a fully
  573. asynchronous fashion.")
  574. (license (list license:isc
  575. license:bsd-2 ; last part of getrrsetbyname_async.c
  576. license:bsd-3
  577. (license:non-copyleft "file://LICENSE") ; includes.h
  578. license:openssl))))
  579. (define-public nsd
  580. (package
  581. (name "nsd")
  582. (version "4.3.7")
  583. (source
  584. (origin
  585. (method url-fetch)
  586. (uri (string-append "https://www.nlnetlabs.nl/downloads/nsd/nsd-"
  587. version ".tar.gz"))
  588. (sha256
  589. (base32 "1bg87g0i66hw16fm7gbqmzyi2rcn1hadzz0bg9b8s5mx7g2rwfzx"))))
  590. (build-system gnu-build-system)
  591. (arguments
  592. `(#:configure-flags
  593. (list "--enable-pie" ; fully benefit from ASLR
  594. "--enable-ratelimit"
  595. "--enable-recvmmsg"
  596. "--enable-relro-now" ; protect GOT and .dtor areas
  597. "--disable-radix-tree"
  598. (string-append "--with-libevent="
  599. (assoc-ref %build-inputs "libevent"))
  600. (string-append "--with-ssl="
  601. (assoc-ref %build-inputs "openssl"))
  602. "--with-configdir=/etc"
  603. "--with-nsd_conf_file=/etc/nsd/nsd.conf"
  604. "--with-logfile=/var/log/nsd.log"
  605. "--with-pidfile=/var/db/nsd/nsd.pid"
  606. "--with-dbfile=/var/db/nsd/nsd.db"
  607. "--with-zonesdir=/etc/nsd"
  608. "--with-xfrdfile=/var/db/nsd/xfrd.state"
  609. "--with-zonelistfile=/var/db/nsd/zone.list")
  610. #:phases
  611. (modify-phases %standard-phases
  612. (add-before 'configure 'patch-installation-paths
  613. (lambda* (#:key outputs #:allow-other-keys)
  614. (let* ((out (assoc-ref outputs "out"))
  615. (doc (string-append out "/share/doc/" ,name "-" ,version)))
  616. ;; The ‘make install’ target tries to create the parent
  617. ;; directories of run-time things like ‘pidfile’ above, and
  618. ;; useless empty directories like 'configdir'. Remove such
  619. ;; '$(INSTALL)' lines and install the example configuration file
  620. ;; in an appropriate location.
  621. (substitute* "Makefile.in"
  622. ((".*INSTALL.*\\$\\((config|pid|xfr|db)dir" command)
  623. (string-append "#" command))
  624. (("\\$\\(nsdconfigfile\\)\\.sample" file-name)
  625. (string-append doc "/examples/" file-name)))
  626. #t))))
  627. #:tests? #f)) ; no tests
  628. (inputs
  629. `(("libevent" ,libevent)
  630. ("openssl" ,openssl)))
  631. (home-page "https://www.nlnetlabs.nl/projects/nsd/about/")
  632. (synopsis "Authoritative DNS name server")
  633. (description "@dfn{NSD}, short for Name Server Daemon, is an authoritative
  634. name server for the Domain Name System (@dfn{DNS}). It aims to be a fast and
  635. RFC-compliant nameserver.
  636. NSD uses zone information compiled via @command{zonec} into a binary database
  637. file (@file{nsd.db}). This allows fast startup of the name service daemon and
  638. allows syntax-structural errors in zone files to be flagged at compile time,
  639. before being made available to NSD service itself. However, most traditional
  640. BIND-style zone files can be directly imported into NSD without modification.
  641. The collection of programs and processes that make up NSD are designed so that
  642. the daemon itself runs as a non-privileged user and can be easily configured to
  643. run in a @code{chroot} jail, thus making any security flaws in NSD less likely
  644. to result in system-wide compromise.")
  645. (license (list license:bsd-3))))
  646. (define-public rbldnsd
  647. (package
  648. (name "rbldnsd")
  649. (version "0.998b")
  650. (source
  651. (origin
  652. (method git-fetch)
  653. (uri (git-reference
  654. (url "https://github.com/spamhaus/rbldnsd")
  655. (commit version)))
  656. (file-name (git-file-name name version))
  657. (sha256
  658. (base32 "0jj3kyir43qnjgd9rk0wz13iggf3p4p1779v0wgmx3ci0ypnglcr"))))
  659. (build-system gnu-build-system)
  660. (arguments
  661. `(#:phases
  662. (modify-phases %standard-phases
  663. (replace 'configure
  664. ;; The ./configure is hand-written and doesn't ignore unknown
  665. ;; standard autotools options like CONFIG_SHELL.
  666. (lambda _
  667. (invoke "./configure")))
  668. (replace 'install
  669. ;; There is no Makefile ‘install’ target. contrib/debian/rules has
  670. ;; one but relies on Debian-specific helpers, so install manually.
  671. (lambda* (#:key outputs #:allow-other-keys)
  672. (let* ((out (assoc-ref outputs "out"))
  673. (sbin (string-append out "/sbin"))
  674. (man8 (string-append out "/share/man/man8")))
  675. (install-file "rbldnsd" sbin)
  676. (install-file "rbldnsd.8" man8)))))))
  677. (inputs
  678. `(("zlib" ,zlib)))
  679. (native-inputs
  680. ;; For running the test suite. Python 3 is not yet supported by a release:
  681. ;; see <https://github.com/spamhaus/rbldnsd/issues/16>.
  682. `(("python" ,python-2)))
  683. (home-page "https://rbldnsd.io/")
  684. (synopsis
  685. "Small nameserver to efficiently serve @acronym{DNSBL, DNS blocklists}")
  686. (description
  687. "This package contains a small DNS daemon especially made to handle queries
  688. of @acronym{DNSBL, DNS blocklists}, a simple way to publish IP addresses and/or
  689. (domain) names which are somehow notable. Such lists are frequently used to
  690. refuse e-mail service to clients known to send unwanted (spam) messages.
  691. @command{rbldnsd} is not a general-purpose nameserver. It answers to a limited
  692. variety of queries. This makes it extremely fast---greatly outperforming both
  693. BIND and djbdns---whilst using relatively little memory.")
  694. (license
  695. (list license:bsd-3 ; btrie.[ch]
  696. license:lgpl2.1+ ; qsort.c
  697. license:gpl2+)))) ; the rest
  698. (define-public unbound
  699. (package
  700. (name "unbound")
  701. (version "1.13.2")
  702. (source
  703. (origin
  704. (method url-fetch)
  705. (uri (string-append "https://www.unbound.net/downloads/unbound-"
  706. version ".tar.gz"))
  707. (sha256
  708. (base32 "10qs1q26lzw18ljggnbz0cc5f7lr9ksj615xbrmh4amryd3va4qa"))))
  709. (build-system gnu-build-system)
  710. (outputs '("out" "python"))
  711. (native-inputs
  712. `(("flex" ,flex)
  713. ("swig" ,swig)))
  714. (inputs
  715. `(("expat" ,expat)
  716. ("libevent" ,libevent)
  717. ("nghttp2" ,nghttp2 "lib")
  718. ("protobuf" ,protobuf)
  719. ("python-wrapper" ,python-wrapper)
  720. ("openssl" ,openssl)))
  721. (arguments
  722. `(#:configure-flags
  723. (list "--disable-static" ; save space and non-determinism in libunbound.a
  724. (string-append
  725. "--with-libnghttp2=" (assoc-ref %build-inputs "nghttp2"))
  726. (string-append
  727. "--with-ssl=" (assoc-ref %build-inputs "openssl"))
  728. (string-append
  729. "--with-libevent=" (assoc-ref %build-inputs "libevent"))
  730. (string-append
  731. "--with-libexpat=" (assoc-ref %build-inputs "expat"))
  732. "--with-pythonmodule" "--with-pyunbound")
  733. #:phases
  734. (modify-phases %standard-phases
  735. (add-after 'configure 'fix-python-site-package-path
  736. ;; Move python modules into their own output.
  737. (lambda* (#:key outputs #:allow-other-keys)
  738. (let ((pyout (assoc-ref outputs "python"))
  739. (ver ,(version-major+minor (package-version python))))
  740. (substitute* "Makefile"
  741. (("^PYTHON_SITE_PKG=.*$")
  742. (string-append
  743. "PYTHON_SITE_PKG="
  744. pyout "/lib/python-" ver "/site-packages\n"))))
  745. #t))
  746. (add-before 'check 'fix-missing-nss-for-tests
  747. ;; Unfortunately, the package's unittests involve some checks
  748. ;; looking up protocols and services which are not provided
  749. ;; by the minimalistic build environment, in particular,
  750. ;; /etc/protocols and /etc/services are missing.
  751. ;; Also, after plain substitution of protocol and service names
  752. ;; in the test data, the tests still fail because the
  753. ;; corresponding Resource Records have been signed by
  754. ;; RRSIG records.
  755. ;; The following LD_PRELOAD library overwrites the glibc
  756. ;; functions ‘get{proto,serv}byname’, ‘getprotobynumber’ and
  757. ;; ‘getservbyport’ providing the few records required for the
  758. ;; unit tests to pass.
  759. (lambda* (#:key inputs outputs #:allow-other-keys)
  760. (let* ((source (assoc-ref %build-inputs "source"))
  761. (gcc (assoc-ref %build-inputs "gcc")))
  762. (call-with-output-file "/tmp/nss_preload.c"
  763. (lambda (port)
  764. (display "#include <stdlib.h>
  765. #include <string.h>
  766. #include <strings.h>
  767. #include <netdb.h>
  768. struct protoent *getprotobyname(const char *name) {
  769. struct protoent *p = malloc(sizeof(struct protoent));
  770. p->p_aliases = malloc(sizeof(char*));
  771. if (strcasecmp(name, \"tcp\") == 0) {
  772. p->p_name = \"tcp\";
  773. p->p_proto = 6;
  774. p->p_aliases[0] = \"TCP\";
  775. } else if (strcasecmp(name, \"udp\") == 0) {
  776. p->p_name = \"udp\";
  777. p->p_proto = 17;
  778. p->p_aliases[0] = \"UDP\";
  779. } else
  780. p = NULL;
  781. return p;
  782. }
  783. struct protoent *getprotobynumber(int proto) {
  784. struct protoent *p = malloc(sizeof(struct protoent));
  785. p->p_aliases = malloc(sizeof(char*));
  786. switch(proto) {
  787. case 6:
  788. p->p_name = \"tcp\";
  789. p->p_proto = 6;
  790. p->p_aliases[0] = \"TCP\";
  791. break;
  792. case 17:
  793. p->p_name = \"udp\";
  794. p->p_proto = 17;
  795. p->p_aliases[0] = \"UDP\";
  796. break;
  797. default:
  798. p = NULL;
  799. break;
  800. }
  801. return p;
  802. }
  803. struct servent *getservbyname(const char *name, const char *proto) {
  804. struct servent *s = malloc(sizeof(struct servent));
  805. char* buf = malloc((strlen(proto)+1)*sizeof(char));
  806. strcpy(buf, proto);
  807. s->s_aliases = malloc(sizeof(char*));
  808. s->s_aliases[0] = NULL;
  809. if (strcasecmp(name, \"domain\") == 0) {
  810. s->s_name = \"domain\";
  811. s->s_port = htons(53);
  812. s->s_proto = buf;
  813. } else
  814. s = NULL;
  815. return s;
  816. }
  817. struct servent *getservbyport(int port, const char *proto) {
  818. char buf[32];
  819. struct servent *s = malloc(sizeof(struct servent));
  820. strcpy(buf, proto);
  821. s->s_aliases = malloc(sizeof(char*));
  822. s->s_aliases[0] = NULL;
  823. switch(port) {
  824. case 53:
  825. s->s_name = \"domain\";
  826. s->s_port = 53;
  827. s->s_proto = \"udp\";
  828. break;
  829. default:
  830. s = NULL;
  831. break;
  832. }
  833. return s;
  834. }" port)))
  835. (invoke (string-append gcc "/bin/gcc")
  836. "-shared" "-fPIC" "-o" "/tmp/nss_preload.so"
  837. "/tmp/nss_preload.c")
  838. ;; The preload library only affects the unittests.
  839. (substitute* "Makefile"
  840. (("./unittest")
  841. "LD_PRELOAD=/tmp/nss_preload.so ./unittest")))
  842. #t)))))
  843. (home-page "https://www.unbound.net")
  844. (synopsis "Validating, recursive, and caching DNS resolver")
  845. (description
  846. "Unbound is a recursive-only caching DNS server which can perform DNSSEC
  847. validation of results. It implements only a minimal amount of authoritative
  848. service to prevent leakage to the root nameservers: forward lookups for
  849. localhost, reverse for @code{127.0.0.1} and @code{::1}, and NXDOMAIN for zones
  850. served by AS112. Stub and forward zones are supported.")
  851. (license license:bsd-4)))
  852. (define-public yadifa
  853. (package
  854. (name "yadifa")
  855. (version "2.5.1")
  856. (source
  857. (let ((build "10306"))
  858. (origin
  859. (method url-fetch)
  860. (uri
  861. (string-append "https://www.yadifa.eu/sites/default/files/releases/"
  862. "yadifa-" version "-" build ".tar.gz"))
  863. (sha256
  864. (base32 "051h4pmh9llwj0w6h0v8fl2f146fb26cv3w5an9dmfh845sv6hzr")))))
  865. (build-system gnu-build-system)
  866. (native-inputs
  867. `(("which" ,which)))
  868. (inputs
  869. `(("openssl" ,openssl)))
  870. (arguments
  871. `(#:phases
  872. (modify-phases %standard-phases
  873. (add-before 'configure 'omit-example-configurations
  874. (lambda _
  875. (substitute* "Makefile.in"
  876. ((" (etc|var)") ""))
  877. #t))
  878. (add-after 'configure 'omit-spurious-references
  879. (lambda _
  880. ;; The many Makefile.in grep this(!) to #define BUILD_OPTIONS.
  881. (substitute* "config.log"
  882. (("(=/gnu/store/)[^-]*" _ match)
  883. (string-append match "...")))
  884. #t)))
  885. #:configure-flags
  886. (list "--sysconfdir=/etc"
  887. "--localstatedir=/var"
  888. "--enable-shared" "--disable-static"
  889. "--disable-build-timestamp" ; build reproducibly
  890. "--enable-tcp-manager")))
  891. (home-page "https://www.yadifa.eu/")
  892. (synopsis "Authoritative DNS name server")
  893. (description "YADIFA is an authoritative name server for the @dfn{Domain
  894. Name System} (DNS). It aims for both higher performance and a smaller memory
  895. footprint than other implementations, while remaining fully RFC-compliant.
  896. YADIFA supports dynamic record updates and the @dfn{Domain Name System Security
  897. Extensions} (DNSSEC).")
  898. (license license:bsd-3)))
  899. (define-public knot
  900. (package
  901. (name "knot")
  902. (version "3.1.2")
  903. (source
  904. (origin
  905. (method git-fetch)
  906. (uri (git-reference
  907. (url "https://gitlab.nic.cz/knot/knot-dns")
  908. (commit (string-append "v" version))))
  909. (file-name (git-file-name name version))
  910. (sha256
  911. (base32 "1kyjf6d1jx8q0zjzwy06f4d3ar5cbbqxka8cc7ckwmbpf1n6cij5"))
  912. (modules '((guix build utils)))
  913. (snippet
  914. '(begin
  915. ;; Remove Ragel-generated C files. We'll recreate them below.
  916. (for-each delete-file (find-files "." "\\.c\\.[gt]."))
  917. (delete-file "src/libknot/yparser/ypbody.c")
  918. ;; Remove bundled library to ensure we always use the system's.
  919. (delete-file-recursively "src/contrib/libbpf")))))
  920. (build-system gnu-build-system)
  921. (outputs (list "out" "doc" "lib" "tools"))
  922. (arguments
  923. `(#:configure-flags
  924. (list (string-append "--docdir=" (assoc-ref %outputs "doc")
  925. "/share/" ,name "-" ,version)
  926. (string-append "--infodir=" (assoc-ref %outputs "doc")
  927. "/share/info")
  928. (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib")
  929. "--sysconfdir=/etc"
  930. "--localstatedir=/var"
  931. "--disable-static" ; static libraries are built by default
  932. "--enable-dnstap" ; let tools read/write capture files
  933. "--enable-fastparser" ; disabled by default when .git/ exists
  934. "--enable-xdp=yes"
  935. "--with-module-dnstap=yes") ; detailed query capturing & logging
  936. #:phases
  937. (modify-phases %standard-phases
  938. (add-after 'unpack 'link-missing-libbpf-dependency
  939. ;; Linking against -lbpf later would fail to find -lz: libbpf.pc has
  940. ;; zlib in its Requires.private (not Requires) field. Add it here.
  941. (lambda _
  942. (substitute* "configure.ac"
  943. (("enable_xdp=yes" match)
  944. (string-append match "\nlibbpf_LIBS=\"$libbpf_LIBS -lz\"")))))
  945. (add-before 'bootstrap 'update-parser
  946. (lambda _
  947. (with-directory-excursion "src"
  948. (invoke "sh" "../scripts/update-parser.sh"))))
  949. (add-before 'configure 'disable-directory-pre-creation
  950. (lambda _
  951. ;; Don't install empty directories like ‘/etc’ outside the store.
  952. ;; This is needed even when using ‘make config_dir=... install’.
  953. (substitute* "src/Makefile.in" (("\\$\\(INSTALL\\) -d") "true"))))
  954. (add-after 'build 'build-info
  955. (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
  956. (apply invoke "make" "info"
  957. `(,@(if parallel-build?
  958. `("-j" ,(number->string (parallel-job-count)))
  959. '())
  960. ,@make-flags))))
  961. (replace 'install
  962. (lambda* (#:key make-flags outputs parallel-build? #:allow-other-keys)
  963. (let* ((out (assoc-ref outputs "out"))
  964. (doc (string-append out "/share/doc/" ,name "-" ,version))
  965. (etc (string-append doc "/examples/etc")))
  966. (apply invoke "make" "install"
  967. (string-append "config_dir=" etc)
  968. `(,@(if parallel-build?
  969. `("-j" ,(number->string (parallel-job-count)))
  970. '())
  971. ,@make-flags)))))
  972. (add-after 'install 'install-info
  973. (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
  974. (apply invoke "make" "install-info"
  975. `(,@(if parallel-build?
  976. `("-j" ,(number->string (parallel-job-count)))
  977. '())
  978. ,@make-flags))))
  979. (add-after 'install 'break-circular-:lib->:out-reference
  980. (lambda* (#:key outputs #:allow-other-keys)
  981. (let ((lib (assoc-ref outputs "lib")))
  982. (for-each (lambda (file)
  983. (substitute* file
  984. (("(prefix=).*" _ assign)
  985. (string-append assign lib "\n"))))
  986. (find-files lib "\\.pc$")))))
  987. (add-after 'install 'split-:tools
  988. (lambda* (#:key outputs #:allow-other-keys)
  989. (let* ((out (assoc-ref outputs "out"))
  990. (tools (assoc-ref outputs "tools")))
  991. (mkdir-p (string-append tools "/share/man"))
  992. (rename-file (string-append out "/bin")
  993. (string-append tools "/bin"))
  994. (rename-file (string-append out "/share/man/man1")
  995. (string-append tools "/share/man/man1"))))))))
  996. (native-inputs
  997. `(("autoconf" ,autoconf)
  998. ("automake" ,automake)
  999. ("libtool" ,libtool)
  1000. ("pkg-config" ,pkg-config)
  1001. ("python-sphinx" ,python-sphinx)
  1002. ("ragel" ,ragel)
  1003. ("texinfo" ,texinfo)))
  1004. (inputs
  1005. `(("fstrm" ,fstrm)
  1006. ("gnutls" ,gnutls)
  1007. ("jansson" ,jansson)
  1008. ("libbpf" ,libbpf)
  1009. ("libcap-ng" ,libcap-ng)
  1010. ("libedit" ,libedit)
  1011. ("libelf" ,libelf)
  1012. ("libidn" ,libidn)
  1013. ("libmnl" ,libmnl)
  1014. ("libnghttp2" ,nghttp2 "lib")
  1015. ("liburcu" ,liburcu)
  1016. ("lmdb" ,lmdb)
  1017. ("ncurses" ,ncurses)
  1018. ("protobuf-c" ,protobuf-c)))
  1019. (home-page "https://www.knot-dns.cz/")
  1020. (synopsis "Authoritative DNS name server")
  1021. (description "Knot DNS is an authoritative name server for the @dfn{Domain
  1022. Name System} (DNS), designed to meet the needs of root and @dfn{top-level
  1023. domain} (TLD) name servers. It is implemented as a threaded daemon and uses a
  1024. number of programming techniques to improve speed. For example, the responder
  1025. is completely lock-free, resulting in a very high response rate. Other features
  1026. include automatic @dfn{DNS Security Extensions} (DNSSEC) signing, dynamic record
  1027. synthesis, and on-the-fly re-configuration.")
  1028. (license
  1029. (list
  1030. ;; src/contrib/{hat-trie,murmurhash3,openbsd},
  1031. ;; src/dnssec/contrib/vpool.[ch], and parts of libtap/ are ‘MIT’ (expat).
  1032. license:expat
  1033. license:lgpl2.0+ ; parts of scr/contrib/ucw
  1034. license:public-domain ; src/contrib/fnv and possibly murmurhash3
  1035. license:gpl3+)))) ; everything else
  1036. (define-public knot-resolver
  1037. (package
  1038. (name "knot-resolver")
  1039. (version "5.4.1")
  1040. (source (origin
  1041. (method url-fetch)
  1042. (uri (string-append "https://secure.nic.cz/files/knot-resolver/"
  1043. "knot-resolver-" version ".tar.xz"))
  1044. (sha256
  1045. (base32
  1046. "0rixiqfj53rfabrz8qpnq4whx8y29d2m5w64a4jlwx7gv4nrd2zv"))))
  1047. (build-system meson-build-system)
  1048. (outputs '("out" "doc"))
  1049. (arguments
  1050. '(#:configure-flags '("-Ddoc=enabled")
  1051. #:phases
  1052. (modify-phases %standard-phases
  1053. (add-before 'configure 'disable-default-ta
  1054. (lambda _
  1055. ;; Disable the default managed root TA, since we don't have
  1056. ;; write access to the keyfile and its directory in store.
  1057. (substitute* "daemon/lua/sandbox.lua.in"
  1058. (("^trust_anchors\\.add_file.*") ""))
  1059. #t))
  1060. (add-after 'build 'build-doc
  1061. (lambda _
  1062. (invoke "ninja" "doc")))
  1063. (add-after 'install 'move-doc
  1064. (lambda* (#:key outputs #:allow-other-keys)
  1065. ;; Move the manual and the example configuration files to the
  1066. ;; "doc" output.
  1067. (let ((out (assoc-ref outputs "out"))
  1068. (doc (assoc-ref outputs "doc")))
  1069. (mkdir-p (string-append doc "/share/doc/knot-resolver"))
  1070. (for-each
  1071. (lambda (dir)
  1072. (rename-file (string-append out "/share/" dir)
  1073. (string-append doc "/share/" dir)))
  1074. '("doc/knot-resolver/examples"
  1075. "doc/knot-resolver/html"
  1076. "info")))))
  1077. (add-after 'install 'wrap-binary
  1078. (lambda* (#:key inputs outputs #:allow-other-keys)
  1079. (let* ((out (assoc-ref outputs "out"))
  1080. (lua-* (map cdr (filter
  1081. (lambda (input)
  1082. (string-prefix? "lua-" (car input)))
  1083. inputs)))
  1084. (lua-path (lambda (p)
  1085. (string-append p "/share/lua/5.1/?.lua")))
  1086. (lua-cpath (lambda (p)
  1087. (string-append p "/lib/lua/5.1/?.so"))))
  1088. (wrap-program (string-append out "/sbin/kresd")
  1089. `("LUA_PATH" ";" prefix ,(map lua-path lua-*))
  1090. `("LUA_CPATH" ";" prefix ,(map lua-cpath lua-*)))
  1091. #t))))))
  1092. (native-inputs
  1093. `(("cmocka" ,cmocka) ; for unit tests
  1094. ("doxygen" ,doxygen)
  1095. ("protobuf-c" ,protobuf-c)
  1096. ("pkg-config" ,pkg-config)
  1097. ("python-breathe" ,python-breathe)
  1098. ("python-sphinx" ,python-sphinx)
  1099. ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
  1100. ("texinfo" ,texinfo)))
  1101. (inputs
  1102. `(("fstrm" ,fstrm)
  1103. ("gnutls" ,gnutls)
  1104. ("knot:lib" ,knot "lib")
  1105. ("libuv" ,libuv)
  1106. ("lmdb" ,lmdb)
  1107. ("luajit" ,luajit)
  1108. ;; TODO: Add optional lua modules: basexx and psl.
  1109. ("lua-bitop" ,lua5.1-bitop)
  1110. ("nghttp2" ,nghttp2 "lib")))
  1111. (home-page "https://www.knot-resolver.cz/")
  1112. (synopsis "Caching validating DNS resolver")
  1113. (description
  1114. "Knot Resolver is a caching full resolver implementation written in C and
  1115. LuaJIT, both a resolver library and a daemon.")
  1116. (license (list license:gpl3+
  1117. ;; Some 'contrib' files are under MIT, CC0 and LGPL2.
  1118. license:expat
  1119. license:cc0
  1120. license:lgpl2.0))))
  1121. (define-public ddclient
  1122. (package
  1123. (name "ddclient")
  1124. (version "3.9.1")
  1125. (source
  1126. (origin
  1127. (method git-fetch)
  1128. (uri (git-reference
  1129. (url "https://github.com/ddclient/ddclient")
  1130. (commit (string-append "v" version))))
  1131. (file-name (git-file-name name version))
  1132. (sha256
  1133. (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
  1134. (build-system trivial-build-system) ; no Makefile.PL
  1135. (native-inputs
  1136. `(("bash" ,bash)
  1137. ("perl" ,perl)))
  1138. (inputs
  1139. `(("inetutils" ,inetutils) ; logger
  1140. ("net-tools" ,net-tools)
  1141. ("perl-data-validate-ip" ,perl-data-validate-ip)
  1142. ("perl-digest-sha1" ,perl-digest-sha1)
  1143. ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
  1144. (arguments
  1145. `(#:modules ((guix build utils))
  1146. #:builder
  1147. (begin
  1148. (use-modules (guix build utils)
  1149. (ice-9 match)
  1150. (srfi srfi-26))
  1151. (setenv "PATH" (string-append
  1152. (assoc-ref %build-inputs "bash") "/bin" ":"
  1153. (assoc-ref %build-inputs "perl") "/bin"))
  1154. ;; Copy the (read-only) source into the (writable) build directory.
  1155. (copy-recursively (assoc-ref %build-inputs "source") ".")
  1156. ;; Install.
  1157. (let* ((out (assoc-ref %outputs "out"))
  1158. (bin (string-append out "/bin")))
  1159. (let ((file "ddclient"))
  1160. (substitute* file
  1161. (("/usr/bin/perl") (which "perl"))
  1162. ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
  1163. (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
  1164. (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
  1165. ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
  1166. (("\\$cachedir\\$program\\.cache")
  1167. "/var/cache/ddclient/ddclient.cache"))
  1168. (install-file file bin)
  1169. (wrap-program (string-append bin "/" file)
  1170. `("PATH" ":" =
  1171. ("$PATH"
  1172. ,@(map (lambda (input)
  1173. (match input
  1174. ((name . store)
  1175. (string-append store "/bin"))))
  1176. %build-inputs)))
  1177. `("PERL5LIB" ":" =
  1178. ,(delete
  1179. ""
  1180. (map (match-lambda
  1181. (((? (cut string-prefix? "perl-" <>) name) . dir)
  1182. (string-append dir "/lib/perl5/site_perl"))
  1183. (_ ""))
  1184. %build-inputs)))))
  1185. (for-each (cut install-file <> (string-append out
  1186. "/share/ddclient"))
  1187. (find-files "." "sample.*$"))))))
  1188. (home-page "https://ddclient.net/")
  1189. (synopsis "Address updating utility for dynamic DNS services")
  1190. (description "This package provides a client to update dynamic IP
  1191. addresses with several dynamic DNS service providers, such as
  1192. @uref{https://www.dyndns.com/account/login.html,DynDNS.com}.
  1193. This makes it possible to use a fixed hostname (such as myhost.dyndns.org) to
  1194. access a machine with a dynamic IP address.
  1195. The client supports both dynamic and (near) static services, as well as MX
  1196. record and alternative name management. It caches the address, and only
  1197. attempts the update when it has changed.")
  1198. (license license:gpl2+)))
  1199. (define-public hnsd
  1200. (package
  1201. (name "hnsd")
  1202. (version "1.0.0")
  1203. (source (origin
  1204. (method git-fetch)
  1205. (uri (git-reference
  1206. (url "https://github.com/handshake-org/hnsd")
  1207. (commit (string-append "v" version))))
  1208. (sha256
  1209. (base32
  1210. "1kdgff8rf8gmvwz2p758ilbjxpvz4xm6z41pa5353asg6xb853bb"))
  1211. (file-name (git-file-name name version))
  1212. (modules '((guix build utils)))
  1213. (snippet
  1214. '(begin
  1215. ;; Delete the bundled copy of libuv.
  1216. (delete-file-recursively "uv")
  1217. (substitute* "configure.ac"
  1218. (("AC_CONFIG_SUBDIRS\\(\\[uv\\]\\)") ""))
  1219. (substitute* "Makefile.am"
  1220. (("SUBDIRS = uv") "\n")
  1221. (("\\$\\(top_builddir\\)/uv/libuv.la") "-luv")
  1222. ;; Make sure the 'hnsd' binary is installed and
  1223. ;; dynamically-linked.
  1224. (("noinst_PROGRAMS") "bin_PROGRAMS")
  1225. (("hnsd_LDFLAGS = -static") ""))
  1226. ;; This script tries to chdir to "uv" and doesn't do more
  1227. ;; than "autoreconf" so remove it.
  1228. (delete-file "autogen.sh")
  1229. #t))))
  1230. (build-system gnu-build-system)
  1231. (arguments
  1232. '(#:configure-flags '("--disable-static"))) ;no need for libhsk.a
  1233. (native-inputs
  1234. `(("autoconf" ,autoconf)
  1235. ("automake" ,automake)
  1236. ("libtool" ,libtool)))
  1237. (inputs
  1238. `(("unbound" ,unbound)
  1239. ("libuv" ,libuv)))
  1240. (home-page "https://www.handshake.org/")
  1241. (synopsis "Resolver daemon for the Handshake naming protocol")
  1242. (description
  1243. "@command{hnsd} is a @dfn{host name resolver} for the Handshake Naming
  1244. System (HNS) peer-to-peer network.")
  1245. (license license:expat)))
  1246. (define-public libmicrodns
  1247. (package
  1248. (name "libmicrodns")
  1249. (version "0.1.2")
  1250. (source (origin
  1251. (method url-fetch)
  1252. (uri (string-append "https://github.com/videolabs/libmicrodns/"
  1253. "releases/download/" version "/microdns-"
  1254. version ".tar.xz"))
  1255. (sha256
  1256. (base32
  1257. "0p4va18zxgmzcdwhlbg2mmjwswlbgqy4ay5vaxrw7cxmhsflnv36"))))
  1258. (build-system meson-build-system)
  1259. (home-page "https://github.com/videolabs/libmicrodns")
  1260. (synopsis "Minimal mDNS resolver library")
  1261. (description "@code{libmicrodns} provides a minimal implementation of a
  1262. mDNS resolver as well as an announcer. mDNS (Multicast Domain Name System) is
  1263. a zero-config service that allows one to resolve host names to IP addresses in
  1264. local networks.")
  1265. (license license:lgpl2.1)))
  1266. (define-public public-suffix-list
  1267. ;; Mozilla releases the official list here:
  1268. ;;
  1269. ;; https://publicsuffix.org/list/public_suffix_list.dat
  1270. ;;
  1271. ;; However, Mozilla syncs that file from the GitHub repository periodically,
  1272. ;; so its contents will change over time. If you update this commit, please
  1273. ;; make sure that the new commit refers to a list which is identical to the
  1274. ;; officially published list available from the URL above.
  1275. (let ((commit "9375b697baddb0827a5995c81bd3c75877a0b35d"))
  1276. (package
  1277. (name "public-suffix-list")
  1278. (version (git-version "0" "1" commit))
  1279. (source (origin
  1280. (method git-fetch)
  1281. (uri (git-reference
  1282. (url "https://github.com/publicsuffix/list")
  1283. (commit commit)))
  1284. (file-name (git-file-name name version))
  1285. (sha256
  1286. (base32
  1287. "1sm7pni01rnl4ldzi8z8nc4cbgq8nxda9gwc68v0s3ij7jd1jmik"))))
  1288. (build-system trivial-build-system)
  1289. (arguments
  1290. `(#:modules ((guix build utils))
  1291. #:builder
  1292. (begin
  1293. (use-modules (guix build utils))
  1294. (let* ((out (assoc-ref %outputs "out"))
  1295. ;; Install to /share because that is where "read-only
  1296. ;; architecture-independent data files" should go (see:
  1297. ;; (standards) Directory Variables). Include the version in
  1298. ;; the directory name so that if multiple versions are ever
  1299. ;; installed in the same profile, they will not conflict.
  1300. (destination (string-append
  1301. out "/share/public-suffix-list-" ,version))
  1302. (source (assoc-ref %build-inputs "source")))
  1303. (with-directory-excursion source
  1304. (install-file "public_suffix_list.dat" destination)
  1305. (install-file "LICENSE" destination))
  1306. #t))))
  1307. (home-page "https://publicsuffix.org/")
  1308. (synopsis "Database of current and historical DNS suffixes")
  1309. (description "This is the Public Suffix List maintained by Mozilla. A
  1310. \"public suffix\" is one under which Internet users can (or historically
  1311. could) directly register names in the Domain Name System (DNS). Some examples
  1312. of public suffixes are .com, .co.uk and pvt.k12.ma.us. This is a list of all
  1313. known public suffixes.")
  1314. (license license:mpl2.0))))
  1315. (define-public maradns
  1316. (package
  1317. (name "maradns")
  1318. (version "3.5.0020")
  1319. (source
  1320. (origin
  1321. (method url-fetch)
  1322. (uri (string-append "https://maradns.samiam.org/download/"
  1323. (version-major+minor version) "/"
  1324. version "/maradns-" version ".tar.xz"))
  1325. (sha256
  1326. (base32 "1qgabw6y2bwy6y88dikis62k789i0xh7iwxan8jmqpzvksqwjfgw"))))
  1327. (build-system gnu-build-system)
  1328. (arguments
  1329. `(#:tests? #f ; need to be root to run tests
  1330. #:make-flags
  1331. (list
  1332. ,(string-append "CC=" (cc-for-target))
  1333. (string-append "PREFIX=" %output)
  1334. (string-append "RPM_BUILD_ROOT=" %output))
  1335. #:phases
  1336. (modify-phases %standard-phases
  1337. (replace 'configure
  1338. (lambda* (#:key native-inputs target #:allow-other-keys)
  1339. ;; make_32bit_tables generates a header file that is used during
  1340. ;; compilation. Hence, during cross compilation, it should be
  1341. ;; built for the host system.
  1342. (when target
  1343. (substitute* "rng/Makefile"
  1344. (("\\$\\(CC\\) -o make_32bit_tables")
  1345. (string-append (assoc-ref native-inputs "gcc")
  1346. "/bin/gcc -o make_32bit_tables"))))
  1347. (invoke "./configure")))
  1348. (add-before 'install 'create-install-directories
  1349. (lambda* (#:key outputs #:allow-other-keys)
  1350. (let ((out (assoc-ref outputs "out")))
  1351. (for-each (lambda (dir)
  1352. (mkdir-p (string-append out dir)))
  1353. (list "/bin" "/sbin" "/etc"
  1354. "/share/man/man1"
  1355. "/share/man/man5"
  1356. "/share/man/man8"))
  1357. #t))))))
  1358. (home-page "https://maradns.samiam.org")
  1359. (synopsis "Small lightweight DNS server")
  1360. (description "MaraDNS is a small and lightweight DNS server. MaraDNS
  1361. consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
  1362. and TCP-capable recursive DNS server for finding domains on the internet.")
  1363. (license license:bsd-2)))
  1364. (define-public openresolv
  1365. (package
  1366. (name "openresolv")
  1367. (version "3.12.0")
  1368. (source (origin
  1369. (method url-fetch)
  1370. (uri (string-append "https://roy.marples.name/downloads/openresolv/"
  1371. "openresolv-" version ".tar.xz"))
  1372. (sha256
  1373. (base32
  1374. "15qvp5va2yrqpz0ba54clvn8cbc66v4sl7k3bi9ji8jpx040bcs2"))
  1375. (patches
  1376. (search-patches "openresolv-restartcmd-guix.patch"))))
  1377. (build-system gnu-build-system)
  1378. (arguments
  1379. `(#:tests? #f ; No test suite
  1380. #:configure-flags
  1381. (list (string-append "--sysconfdir=/etc"))
  1382. #:make-flags
  1383. (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
  1384. (home-page "https://roy.marples.name/projects/openresolv/")
  1385. (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
  1386. (description "openresolv is an implementation of @command{resolvconf}, the
  1387. middleman between the network configuration services and
  1388. @file{/etc/resolv.conf}. @command{resolvconf} itself is just a script that
  1389. stores, removes and lists a full @file{resolv.conf} generated for the
  1390. interface. It then calls all the helper scripts it knows about so it can
  1391. configure the real @file{/etc/resolv.conf} and optionally any local
  1392. nameservers other than libc.")
  1393. (license license:bsd-2)))