From patchwork Sat Mar 12 15:48:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Remco van 't Veer X-Patchwork-Id: 37757 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DA0F127BBEA; Sat, 12 Mar 2022 15:49:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 51D3627BBE9 for ; Sat, 12 Mar 2022 15:49:10 +0000 (GMT) Received: from localhost ([::1]:36474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nT3zR-0006NV-F0 for patchwork@mira.cbaines.net; Sat, 12 Mar 2022 10:49:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT3zK-0006NN-Er for guix-patches@gnu.org; Sat, 12 Mar 2022 10:49:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nT3zK-0005BJ-6O for guix-patches@gnu.org; Sat, 12 Mar 2022 10:49:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nT3zK-00059e-0u for guix-patches@gnu.org; Sat, 12 Mar 2022 10:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54352] [PATCH] services: dnsmasq: Add more options. Resent-From: Remco van 't Veer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 12 Mar 2022 15:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54352 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54352@debbugs.gnu.org Cc: Remco van 't Veer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164710011619777 (code B ref -1); Sat, 12 Mar 2022 15:49:01 +0000 Received: (at submit) by debbugs.gnu.org; 12 Mar 2022 15:48:36 +0000 Received: from localhost ([127.0.0.1]:40652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nT3yu-00058v-E1 for submit@debbugs.gnu.org; Sat, 12 Mar 2022 10:48:36 -0500 Received: from lists.gnu.org ([209.51.188.17]:55168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nT3ys-00058m-JQ for submit@debbugs.gnu.org; Sat, 12 Mar 2022 10:48:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT3yr-0006N1-VG for guix-patches@gnu.org; Sat, 12 Mar 2022 10:48:34 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:43471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT3yp-0004fS-DA for guix-patches@gnu.org; Sat, 12 Mar 2022 10:48:33 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7DE6C3201DA2; Sat, 12 Mar 2022 10:48:28 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 12 Mar 2022 10:48:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=remworks.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm3; bh=/kXRW2Ioyy9eGbDbj+EfDDqJYqv+cmlIms5C+q M5SLE=; b=l5/UZ5PKMp/qH6s3D/5Drbz3J2wcNcT6+mD/DHhw36MeW4nLNfFFPe iod7DDDtUHqQvYFr3wX9URHYH+B/qGIO0U0R4botoVQNPNdLqNnIYH6oA5j5/UUb GgiWnauoEGcr19MaYGXmJdcPor7DsYxmD0a34XQthULCx8aa6fPNwl88EYYs7EF5 zfhup8M6QQK8KLEHMqqN+Tq9lVrBAw8fo2KAAn+9rCHESNihFDCPzhIxJsJLdaot Qejxjz9+9+QFBCi26A9lSKF/yOcaZRHxoRCQfjsJPm08zYnpfxHwLAWuVL30bIbm egRkhpo81DAaJxof6Ugwui3yIxSFU6qw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/kXRW2 Ioyy9eGbDbj+EfDDqJYqv+cmlIms5C+qM5SLE=; b=Wc6YgvhSe39j+OXRtIM7IF BXt/XW+BJ6y6pWHAW+Xiqi4WvQtSoR/PdHXhRvAjVgC0LutwnuG2BbCvQ5z+MIQj 8N0msLUz+LnnvDY09UT09gJHY7QsNeTbdY45yvG9Is2PVGcyCVqZBOUhL9x0DKg9 9DHJCVIIfr0FBH2QyDp1SIqB4roVW3CojiIGt+UjqsDnktq0AOSLF5MGHHoVbZDr pNVVYH3XIhXQBzO7BQsgjIGJxJSUGR8Iwe3m5hAC6waxUGcMx8hZJmu25DuigXgo AeFz8X7brhXN//CMhjYlswfNfsQF/hI4HeAuop/O2j5TvDfX4lY53mzmyZejABGw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddvgedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtkeertd ertdejnecuhfhrohhmpeftvghmtghouchvrghnucdkthcugggvvghruceorhgvmhgtohes rhgvmhifohhrkhhsrdhnvghtqeenucggtffrrghtthgvrhhnpeevfedugfefueelveeltd dtteehjefhvedvuefgueektdfhudefteekuedtgefhieenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrfihvsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Mar 2022 10:48:27 -0500 (EST) From: Remco van 't Veer Date: Sat, 12 Mar 2022 16:48:13 +0100 Message-Id: <20220312154813.5538-1-remco@remworks.net> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Received-SPF: pass client-ip=64.147.123.19; envelope-from=rwv@fastmail.com; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/dns.scm (): Add bogus-priv?, strict-order? and add-cpe-id options. (dnsmasq-shepherd-service): Pass bogus-priv, strict-order and add-cpe-id to the service. * doc/guix.texi (Guix Services): Document options added to dnsmasq. --- doc/guix.texi | 12 ++++++++++++ gnu/services/dns.scm | 20 +++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 4b71fb7010..136c199e58 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28945,6 +28945,14 @@ The file to read the IP address of the upstream nameservers from. @item @code{no-resolv?} (default: @code{#f}) When true, don't read @var{resolv-file}. +@item @code{bogus-priv?} (default: @code{#f}) +When true, all reverse lookups for private IP ranges are answered with +"no such domain" rather than being forwarded upstream. + +@item @code{strict-order?} (default: @code{#f}) +When true, forces dnsmasq to try each query with each server strictly in +the order they appear in @var{servers}. + @item @code{servers} (default: @code{'()}) Specify IP address of upstream servers directly. @@ -28974,6 +28982,10 @@ disables caching. @item @code{negative-cache?} (default: @code{#t}) When false, disable negative caching. +@item @code{add-cpe-id} (default: @code{#f}) +If set, add an arbitrary identifying string to DNS queries which are +forwarded upstream. + @item @code{tftp-enable?} (default: @code{#f}) Whether to enable the built-in TFTP server. diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 9b8603cc95..9f9b6c1a69 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018 Oleg Pykhalov ;;; Copyright © 2020 Pierre Langlois ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2022 Remco van 't Veer ;;; ;;; This file is part of GNU Guix. ;;; @@ -745,6 +746,10 @@ (define-record-type* (default "/etc/resolv.conf")) ;string (no-resolv? dnsmasq-configuration-no-resolv? (default #f)) ;boolean + (bogus-priv? dnsmasq-configuration-bogus-priv? + (default #f)) ;boolean + (strict-order? dnsmasq-configuration-strict-order? + (default #f)) ;boolean (servers dnsmasq-configuration-servers (default '())) ;list of string (addresses dnsmasq-configuration-addresses @@ -752,7 +757,9 @@ (define-record-type* (cache-size dnsmasq-configuration-cache-size (default 150)) ;integer (negative-cache? dnsmasq-configuration-negative-cache? - (default #t)) ;boolean + (default #t)) ;boolean + (add-cpe-id dnsmasq-configuration-add-cpe-id + (default #t)) ;string (tftp-enable? dnsmasq-configuration-tftp-enable? (default #f)) ;boolean (tftp-no-fail? dnsmasq-configuration-tftp-no-fail? @@ -781,8 +788,9 @@ (define dnsmasq-shepherd-service (($ package no-hosts? port local-service? listen-addresses - resolv-file no-resolv? servers - addresses cache-size negative-cache? + resolv-file no-resolv? bogus-priv? + strict-order? servers addresses cache-size + negative-cache? add-cpe-id tftp-enable? tftp-no-fail? tftp-single-port? tftp-secure? tftp-max tftp-mtu tftp-no-blocksize? @@ -809,6 +817,9 @@ (define dnsmasq-shepherd-service #$@(if no-resolv? '("--no-resolv") '()) + #$@(if bogus-priv? + '("--bogus-priv") + '()) #$@(map (cut format #f "--server=~a" <>) servers) #$@(map (cut format #f "--address=~a" <>) @@ -817,6 +828,9 @@ (define dnsmasq-shepherd-service #$@(if negative-cache? '() '("--no-negcache")) + #$@(if add-cpe-id + (list (format #f "--add-cpe-id=~a" add-cpe-id)) + '()) #$@(if tftp-enable? '("--enable-tftp") '())