Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 12 Jul 2024 21:39:43 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 12 17:39:43 2024 Received: from localhost ([127.0.0.1]:54857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sSNzS-0008GE-46 for submit <at> debbugs.gnu.org; Fri, 12 Jul 2024 17:39:42 -0400 Received: from lists.gnu.org ([209.51.188.17]:52956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <bounce+686de0.08547a-guix-patches=gnu.org@HIDDEN>) id 1sSNzP-0008G7-Ry for submit <at> debbugs.gnu.org; Fri, 12 Jul 2024 17:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <bounce+686de0.08547a-guix-patches=gnu.org@HIDDEN>) id 1sSNzP-0003hB-54 for guix-patches@HIDDEN; Fri, 12 Jul 2024 17:39:39 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <bounce+686de0.08547a-guix-patches=gnu.org@HIDDEN>) id 1sSNzI-00067j-44 for guix-patches@HIDDEN; Fri, 12 Jul 2024 17:39:38 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1720820371; x=1720827571; h=Content-Transfer-Encoding: Content-Type: MIME-Version: Message-Id: Subject: Subject: From: From: To: To: Date: Sender: Sender; bh=/HGgHebbOC401QJHWlC8FUtfdaUnyJdN8Opa6RHR340=; b=Fk+/U+KQWvaCExrs6JQuopTkJ/U6y/s4INFkCUKDYiTbETGCEKHvZWTtJhMj0v+/3rLC0ovGT1lxYY1d+UVVbHUc8b3NSCxFT5cpSEG9q6L/LZcatpOduNqNI0fNc3wcelEUkBjDLX5IerwOeLhe0MWMXGk/c4YcAHuJQBEDm2NoVmSIKMpXRW9tpqzUSjodN6fUySiCV1vw5Aas7BoIonuR30CtceyBIMNvepkm/TT4ZAI4m2i7xbx2IclmQSzAFOlswCXSrSCXnKfcDQgKdkgMDqppxMoSv3MlK3n9ZGpd4T+t0T2odQ7rspQ9qTguDyktCFznixGaM4xUQ09bog== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyI5MmEzMyIsImd1aXgtcGF0Y2hlc0BnbnUub3JnIiwiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by 45eea559954c with SMTP id 6691a29342584033c1afe04a (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Fri, 12 Jul 2024 21:39:31 GMT Received: from localhost (p1267142-ipngn3402fukuhanazo.fukushima.ocn.ne.jp [125.174.241.142]) by wilsonb.com (Postfix) with ESMTPSA id 9DA47A1C75 for <guix-patches@HIDDEN>; Fri, 12 Jul 2024 21:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1720820368; bh=/HGgHebbOC401QJHWlC8FUtfdaUnyJdN8Opa6RHR340=; h=Date:To:From:Subject:From; b=OpjbnYczFdBzdp82GuNTfg3Cpoa+Ul2t4uLTnDGyNjE8PJ6kbfxjNShaRCftsu9Wl e5dsi82zq6/ltDc1eYwAlqa1xo+TrzvstKDUVXvsQhE6pUuLJ5pJNC+FRqene6d17t /8ivVdTiYCrQUEeCjwld9Rut6ShlX53kRGEfMKXQjSKqaKy8CqwKDj2c31Sdjhn8nY +2T98KheVf4+fGj/UVGJzofJU+b/zmcALJ/UWVlDSIXc6w/i1yYS3VxLV+Ezv93rXG iNS+jBpB8/ADk9drysAkBUu8mWi7GM5qmD/BUGGZHBWG+QGj/Z65524VZskEHumowk 9HAkv0mrbPSSsgTvk41XwIqHEciswYFrFSvUqMcn6mZ/7bQwj5fiBuh0X/3C2tETUf 13IIvPIRDFiJrS9DhhJBkDZKpXfewnTdKp61ZAQUycgQ1R/6ZS5WnNTSM/sKgZyuo/ TvLgS055L/8IlwIUC9pnUqNfxduTx9T5Qpd32OHrDqCSTc7hUym25R4U/EOtB9p2rd 8/DzXZQqZ7sMsZvFVjjjbLxd6ZfP3ANdpnmG9YkuNu/9mpi4MovR6GXkF25xME/whn pyZVH3xFcK6T1cLxTTV6IzJ3oLJRo607ObLwYqRjqRUJtTqfRYek7ogYechEbmAFX1 XN6uKRKrCHX8TA6t7PZRWizM= Date: Sat, 13 Jul 2024 06:39:26 +0900 To: guix-patches@HIDDEN From: "B. Wilson" <elaexuotee@HIDDEN> Subject: j Message-Id: <3M6CCJ5R0LVT4.1Y8B0PXM4N6NN@HIDDEN> User-Agent: mblaze/1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=69.72.42.5; envelope-from=bounce+686de0.08547a-guix-patches=gnu.org@HIDDEN; helo=m42-5.mailgun.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) * gnu/services/admin.scm (resolvconf-service-type, resolvconf-configuration): New variables. * doc/guix.texi (DNS Services): Document resolvconf-service-type. --- doc/guix.texi | 138 +++++++++++++++++++++++++++++++ gnu/services/admin.scm | 179 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 317 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 5b77c84b4a..926c9e7bb9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33838,6 +33838,144 @@ command-line arguments to @command{dnsmasq} as a = list of strings. @end table @end deftp =20 +@subsubheading Resolvconf + +Resolvconf acts as a mediary between supplying and consuming programs of n= ame +server information, allowing the contents of @code{/etc/resolv.conf} to be= +multiplexed between supporting programs. + +A typical use case is running a local DNS server such as @code{dnsmasq} on= a +laptop. In this case, both the DNS server and the DHCP client content for= +control of @code{/etc/resolv.conf}. Resolvconf allows these programs to +cooperate together. + +In the parlance of resolvconf, programs which write resolver information a= re +clients and programs which read said information are subscribers. Resolvc= onf +has built-in support for auto-configuring a handful of subscribers, includ= ing +@code{dnsmasq}, @code{named}, @code{pdnsd}, and @code{unbound}. + +@defvar resolvconf-service-type + +The @code{resolvconf-service-type} can be configured via the +@code{resolvconf-configuration} record, documented below. +@end defvar + +@deftp {Data Type} resolvconf-configuration +Available @code{resolvconf-configuration} fields are: + +@table @asis +@item @code{display-number} (default: @code{0}) (type: number) +The display number used by Xvnc. You should set this to a number not +already used a Xorg server. + +@item @code{package} (default: @code{openresolv}) (type: file-like) +The implementing package. + +@item @code{resolvconf?} (default: @code{#t}) (type: boolean) +Wether to run subscribers or not. + +@item @code{allow-interfaces} (default: @code{'()}) (type: list) +Whitelist of configurable interfaces. + +@item @code{deny-interfaces} (default: @code{'()}) (type: list) +Blacklist of non-configurable interfaces. + +@item @code{interface-order} (default: @code{'()}) (type: list) +Interfaces to process first, in th prescribed order. When unset, the loop= back +interfaces are assumed. + +@item @code{dynamic-order} (default: @code{'()}) (type: list) +These interfaces are processed after those of @code{interface-order}, unle= ss +they possess a metric. + +@item @code{inclusive-interfaces} (default: @code{'()}) (type: list) +Ignore any exclusive marking on these interfaces. This can be useful when= +third-party client integrations force the exclusive option on interfaces. + +@item @code{local-nameservers} (default: @code{'()}) (type: list) +Explicitly configured nameservers for this machine. + +@item @code{search-domains} (default: @code{'()}) (type: list) +Search domains to prepend to the dynamically generated list. + +@item @code{search-domains-append} (default: @code{'()}) (type: list) +Search domains to append to the dynamically generated list. + +@item @code{domain-blacklist} (default: @code{'()}) (type: list) +Domains to completely ignore. Accepts wildcards, e.g. @code{foo.*} blackl= ists +a domain and @code{*.bar} subdomains. + +@item @code{name-servers} (default: @code{'()}) (type: list) +Nameservers to prepend to the dynamically generated list. This should be = set +to something like @code{'("::1" "127.0.0.1")} when running a local nameser= ver. + +@item @code{name-servers-append} (default: @code{'()}) (type: list) +Nameservers to append to the dynamically generated list. + +@item @code{name-server-blacklist} (default: @code{'()}) (type: list) +Nameservers to completely remove from consideration. Accepts wildcards. + +@item @code{private-interfaces} (default: @code{'()}) (type: list) +These name servers will only be queried for the domains listed in the +resolv.conf of their corresponding interface. This is useful for VPN devi= ces +and domains. + +@item @code{public-interfaces} (default: @code{'()}) (type: list) +Override the private designation. This is useful in cases where third-par= ty +client integrations force the private option. + +@item @code{replace} (default: @code{'()}) (type: list) +This is a space-separated list of replacement keywords. The syntax is +@code{<keyword>/<match>/<replacement>}, where @code{<match>} may contain +wildcards. + +@item @code{replace-sub} (default: @code{'()}) (type: list) +This functions the same as @code{replace}, except it operates over individ= ual +values instead of the entire field. + +@item @code{enabled-subscribers} (default: @code{'()}) (type: list) +The subscribers which should be configured. + +@item @code{resolv-conf} (default: @code{"/etc/resolv.conf"}) (type: strin= g) +Location of @code{resolv.conf}. + +@item @code{dnsmasq-conf} (default: @code{"/run/resolvconf/dnsmasq/dnsmasq= .conf"}) (type: string) +Location of configuration for @code{dnsmasq}'s domain-specific nameservers= =2E + +@item @code{dnsmasq-resolv} (default: @code{"/run/resolvconf/dnsmasq/resol= v.conf"}) (type: string) +Global nameserver configuration for @code{dnsmasq}. + +@item @code{dnsmasq-pid} (default: @code{"/run/dnsmasq.pid"}) (type: strin= g) +Location of @code{dnsmasq} process PID file. + +@item @code{named-options} (default: @code{"/run/resolvconf/named/options.= conf"}) (type: string) +Location of @code{named} configuration file for global lookups. + +@item @code{named-zones} (default: @code{"/run/resolvconf/named/zones.conf= "}) (type: string) +Location of @code{named} configuration file for domain-specific lookups. + +@item @code{pdnsd-conf} (default: @code{"/run/resolvconf/pdnsd/pdnsd.conf"= }) (type: string) +Location of @code{pdnsd} configuration for adding forward domanis. + +@item @code{pdnsd-resolv} (default: @code{"/run/resolvconf/pdnsd/resolv.co= nf"}) (type: string) +Location of @code{pdnsd} configuration for global name lookups. + +@item @code{pdnsd-zones} (default: @code{"/run/resolvconf/pdnsd/zones.conf= "}) (type: string) +Location of @code{pdnsd} configuration for specific and global name server= s. + +@item @code{unbound-conf} (default: @code{"/run/resolvconf/unbound/unbound= .conf"}) (type: string) +Location of @code{unbound} nameserver configuration. + +@item @code{unbound-pid} (default: @code{"/run/unbound.pid"}) (type: strin= g) +PID file location for @code{unbound}. + +@item @code{extra-options} (default: @code{'()}) (type: list) +Escape hatch for any other options. + +@end table +@end deftp + + @node VNC Services @subsection VNC Services @cindex VNC (virtual network computing) diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 0b325fddb1..b3db44ee02 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -24,6 +24,7 @@ (define-module (gnu services admin) #:use-module ((gnu packages base) #:select (canonical-package findutils coreutils sed)) #:use-module (gnu packages certs) + #:use-module (gnu packages dns) #:use-module (gnu packages package-management) #:use-module (gnu services) #:use-module (gnu services configuration) @@ -38,6 +39,7 @@ (define-module (gnu services admin) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 match) + #:use-module (ice-9 receive) #:use-module (ice-9 vlist) #:export (%default-rotations %rotated-files @@ -537,4 +539,181 @@ (define unattended-upgrade-service-type "Periodically upgrade the system from the current configuration.") (default-value (unattended-upgrade-configuration)))) =20 + +;;; +;;; Managing /etc/resolv.conf +;;; + +(define-record-type* <resolvconf-configuration> + resolvconf-configuration make-resolvconf-configuration + resolvconf-configuration? + (package resolvconf-configuration-package + (default openresolv)) + (resolvconf? resolvconf-configuration-resolvconf? + (default #t)) + (allow-interfaces resolvconf-configuration-allow-interfaces + (default '())) + (deny-interfaces resolvconf-configuration-deny-interfaces + (default '())) + (interface-order resolvconf-configuration-interface-order + (default '())) + (dynamic-order resolvconf-configuration-dynamic-order + (default '())) + (inclusive-interfaces resolvconf-configuration-inclusive-interfaces + (default '())) + (local-nameservers resolvconf-configuration-local-nameservers + (default '())) + (search-domains resolvconf-configuration-search-domains + (default '())) + (search-domains-append resolvconf-configuration-search-domains-append + (default '())) + (domain-blacklist resolvconf-configuration-domain-blacklist + (default '())) + (name-servers resolvconf-configuration-name-servers + (default '())) + (name-servers-append resolvconf-configuration-name-servers-append + (default '())) + (name-server-blacklist resolvconf-configuration-name-server-blacklist + (default '())) + (private-interfaces resolvconf-configuration-private-interfaces + (default '())) + (public-interfaces resolvconf-configuration-public-interfaces + (default '())) + (replace resolvconf-configuration-replace + (default '())) + (replace-sub resolvconf-configuration-replace-sub + (default '())) + (enabled-subscribers resolvconf-configuration-enabled-subscribers + (default '())) + (resolv-conf resolvconf-configuration-resolv-conf + (default "/etc/resolv.conf")) + (dnsmasq-conf resolvconf-configuration-dnsmasq-conf + (default "/run/resolvconf/dnsmasq/dnsmasq.conf"))= + (dnsmasq-resolv resolvconf-configuration-dnsmasq-resolv + (default "/run/resolvconf/dnsmasq/resolv.conf")) + (dnsmasq-pid resolvconf-configuration-dnsmasq-pid + (default "/run/dnsmasq.pid")) + (named-options resolvconf-configuration-named-options + (default "/run/resolvconf/named/options.conf")) + (named-zones resolvconf-configuration-named-zones + (default "/run/resolvconf/named/zones.conf")) + (pdnsd-conf resolvconf-configuration-pdnsd-conf + (default "/run/resolvconf/pdnsd/pdnsd.conf")) + (pdnsd-resolv resolvconf-configuration-pdnsd-resolv + (default "/run/resolvconf/pdnsd/resolv.conf")) + (pdnsd-zones resolvconf-configuration-pdnsd-zones + (default "/run/resolvconf/pdnsd/zones.conf")) + (unbound-conf resolvconf-configuration-unbound-conf + (default "/run/resolvconf/unbound/unbound.conf"))= + (unbound-pid resolvconf-configuration-unbound-pid + (default "/run/unbound.pid")) + (extra-options resolvconf-configuration-extra-options + (default '()))) + +(define (resolvconf-conf-service config) + (match-record config <resolvconf-configuration> + (package resolvconf? + allow-interfaces deny-interfaces + interface-order dynamic-order + inclusive-interfaces + local-nameservers search-domains search-domains-append + domain-blacklist + name-servers name-servers-append + name-server-blacklist + private-interfaces public-interfaces + replace replace-sub + enabled-subscribers + resolv-conf + dnsmasq-conf dnsmasq-resolv dnsmasq-pid + named-options named-zones + pdnsd-conf pdnsd-resolv pdnsd-zones + unbound-conf unbound-pid + extra-options) + `(("resolvconf.conf" + ,(plain-file "resolvconf.conf" + (string-join + (filter identity + (append + (list + (if resolvconf? #f "resolvconf=3DNO") + (format #f "resolv_conf=3D~s" resolv-conf)) + (if (memq 'dnsmasq enabled-subscribers) + (list + (format #f "dnsmasq_conf=3D~s" dnsmasq-conf) + (format #f "dnsmasq_resolv=3D~s" dnsmasq-resolv) + (format #f "dnsmasq_pid=3D~s" dnsmasq-pid)) + '()) + (if (memq 'named enabled-subscribers) + (list + (format #f "named_options=3D~s" named-options) + (format #f "named_zones=3D~s" named-zones)) + '()) + (if (memq 'pdnsd enabled-subscribers) + (list + (format #f "pdnsd_conf=3D~s" pdnsd-conf) + (format #f "pdnsd_resolv=3D~s" pdnsd-resolv) + (format #f "pdnsd_zones=3D~s" pdnsd-zones)) + '()) + (if (memq 'unbound enabled-subscribers) + (list + (format #f "unbound_conf=3D~s" unbound-conf) + (format #f "unbound_pid=3D~s" unbound-pid)) + '()) + (receive (vars vals) + (unzip2 + (list + `("allow_interfaces" ,allow-interfaces) + `("deny_interfaces" ,deny-interfaces) + `("interface_order" ,interface-order) + `("dynamic_order" ,dynamic-order) + `("inclusive_interfaces" ,inclusive-interfaces) + `("local_nameservers" ,local-nameservers) + `("search_domains" ,search-domains) + `("search_domains_append" ,search-domains-append) + `("domain_blacklist" ,domain-blacklist) + `("name_servers" ,name-servers) + `("name_servers_append" ,name-servers-append) + `("name_server_blacklist" ,name-server-blacklist) + `("private_interfaces" ,private-interfaces) + `("public_interfaces" ,public-interfaces) + `("replace" ,replace) + `("replace_sub" ,replace-sub))) + (map + (lambda (var val) + (if (nil? val) #f + (format #f "~a=3D~s" var (string-join val)))) + vars vals)) + extra-options)) + "\n" 'suffix)))))) + +(define (resolvconf-subscriber-setup package) + #~(lambda _ + (let ((resolvconf #$(file-append package "/sbin/resolvconf"))) + (case (status:exit-val (system* resolvconf "-u")) + ((0) #t) + (else #f))))) + +(define (resolvconf-subscriber-service conf) + (let ((package (resolvconf-configuration-package conf)) + (subscribers (resolvconf-configuration-enabled-subscribers conf)))= + (shepherd-service + (provision '(resolvconf)) + (documentation "Setup resolvconf subscribers.") + (start (resolvconf-subscriber-setup package)) + (stop #~(const #f)) + (respawn? #f)))) + +(define resolvconf-service-type + (service-type + (name 'resolvconf) + (extensions + (list (service-extension etc-service-type + resolvconf-conf-service) + (service-extension shepherd-root-service-type + (compose list resolvconf-subscriber-service= )))) + (default-value (resolvconf-configuration)) + (compose concatenate) + (description "Setup resolvconf."))) + + ;;; admin.scm ends here --=20 2.45.2
"B. Wilson" <elaexuotee@HIDDEN>
:guix-patches@HIDDEN
.
Full text available.guix-patches@HIDDEN
:bug#72083
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.