From nobody Wed Mar 27 08:03:48 2024 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V4K1j52M8z5Gglv for ; Wed, 27 Mar 2024 08:03:53 +0000 (UTC) (envelope-from cryintothebluesky@gmail.com) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V4K1j3Kcdz48MC for ; Wed, 27 Mar 2024 08:03:53 +0000 (UTC) (envelope-from cryintothebluesky@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41494c040a1so1959565e9.2 for ; Wed, 27 Mar 2024 01:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711526630; x=1712131430; darn=freebsd.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=TyiQEFK3AeaamXLFHpU3WkR32HqwhMJQbFHEhGpCy0w=; b=CcHMqlnHkbOmF4vba96RARoyvySfMxfz0QAR168BgJyOtXMAm5H2WzuhbzXSqAD6la mIAXIjb70J2+Ru86fQx/PPOMJ04olp8dtsYBHEf/zkrHOg4rLScG/++dT5Q8gVLRXOCY 43kw9kz+XY04zQKlm2LBOsAhwqelZV7GiNlcJgLu2s3FmjwOefzAV1mR1BMv6fux2d67 H9994YBk75rdy7Vdj9WK90rCfAdRqmY2PWuiYH0+9hBHm55bnjdz+wfN9pPcdljId9xA Zz15zPum9lu3+yOqe6I1takHid7rWLEiXPHlPZGKEQoSOPkSb0iUt+2PPa+kx4w75pTA PGYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711526630; x=1712131430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TyiQEFK3AeaamXLFHpU3WkR32HqwhMJQbFHEhGpCy0w=; b=JFj/hgBkKYLmVgfncC76GZrxpb66RYBPzXhVMQqjwByfF7Qq+pFB8fzIam4Of5hyio 3MFTv51FSLuqReq4Tl7BnT1e3APqHd2JG5dFE0SQrDM+7Yg6V6jk5g1BwIBXz95RqqAF uydOW+n/jyv+t/fBuWQVY8ovUGyTOnmajjcnPVW0M6QCqx200DTT6SkVp57EfdfXOU58 Y/NmnjVCGrovyLPTwmosEwkx/uNVS4P7DxUgzIZiny8Q+kQ0JogDu+jrH2NReDg297Hb qe1m1BB017KONF51c389ApDdXnp3TmWN8OPsoCVlXFcJ1iLMA/kyLYPUqoyfucBjJDxn 3K4w== X-Gm-Message-State: AOJu0Yw0/5L3l5swzDpd1Fj224u/UIYE73PsjtF01y7ABGP6krBSAVp7 byuSF5somLdau/iomiiB6OdkNv8ipdV7Ky1GnyV0Y2hHH+uGkJry X-Google-Smtp-Source: AGHT+IE5sJZPRkNNcn+D453EV+rhbY00hEyfcbu9x+Ykaf2gNSowCvMczhg0G96JGNVh+T0413oanQ== X-Received: by 2002:a05:600c:5120:b0:414:9141:1462 with SMTP id o32-20020a05600c512000b0041491411462mr418325wms.28.1711526629402; Wed, 27 Mar 2024 01:03:49 -0700 (PDT) Received: from z600.home.lan (111.129.159.143.dyn.plus.net. [143.159.129.111]) by smtp.gmail.com with ESMTPSA id dx23-20020a05600c63d700b00414887d9329sm1314383wmb.46.2024.03.27.01.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 01:03:49 -0700 (PDT) Date: Wed, 27 Mar 2024 08:03:48 +0000 From: Sad Clouds To: "John R. Levine" Cc: freebsd-questions@freebsd.org Subject: Re: local-unbound vs. dns/unbound Message-Id: <20240327080348.4c7759fef2c361536b942116@gmail.com> In-Reply-To: References: <20240326182155.f49f1239901deabb0dafb84d@gmail.com> <20240326194028.516F58634567@ary.qy> <20240326204728.77de2d013a1cf546b8abe03d@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4V4K1j3Kcdz48MC On 26 Mar 2024 18:01:34 -0400 "John R. Levine" wrote: > >> > >> It's a copy of unbound with a setup script that configures it as > >> a cache to run on 127.0.0.1. It looks in /etc/resolv.conf to use > >> any DNS forwarding you've set up and some other places for > >> stuff that seems more exotic. > > > Thanks. I'm not too fussed about using the latest version, as long as > > functionality is mostly the same. I'll play around with local-unbound > > and see if I can make it work for my use cases. > > As far as I know, it's the same program with a different setup script. > > My main concern is that the setup script might overrwrite your changes > when you do a system upgrade. > > Regards, > John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies", > Please consider the environment before reading this e-mail. https://jl.ly Hello, I had a look at it and it appears people already thought of this: # ls -l /var/unbound/ total 24 drwxr-xr-x 2 unbound unbound 512 Nov 10 07:07 conf.d -rw-r--r-- 1 root unbound 193 Mar 27 07:25 control.conf -rw-r--r-- 1 root unbound 223 Mar 27 07:25 forward.conf -rw-r--r-- 1 root unbound 189 Mar 27 07:25 lan-zones.conf -rw-r--r-- 1 unbound unbound 758 Mar 27 07:25 root.key -rw-r--r-- 1 root unbound 411 Mar 27 07:25 unbound.conf In the conf.d directory I can put my customisations that get included via unbound.conf The only issue I found is that the logic in /etc/rc.d/local_unbound script is a bit buggy. With no config files in /var/unbound it generates correct config: # sysrc local_unbound_enable=YES # sysrc local_unbound_tls=YES # sysrc local_unbound_forwarders="1.0.0.1@853#one.one.one.one 1.1.1.1@853#one.one.one.one" # service local_unbound start Performing initial setup. destination: Extracting forwarders from /etc/resolv.conf. /var/unbound/forward.conf created /var/unbound/lan-zones.conf created /var/unbound/control.conf created /var/unbound/unbound.conf created /etc/resolvconf.conf created Original /etc/resolv.conf saved as /var/backups/resolv.conf. 20240327.070818 Starting local_unbound. However if I later decide for example, to disable TLS: # service local_unbound stop # sysrc local_unbound_tls=NO local_unbound_tls: YES -> NO # service local_unbound start Starting local_unbound. Waiting for nameserver to start... good No config files are updated and TLS is still enabled: # cat /var/unbound/forward.conf # This file was generated by local-unbound-setup. # Modifications will be overwritten. forward-zone: name: . forward-tls-upstream: yes forward-addr: 1.0.0.1@853#one.one.one.one forward-addr: 1.1.1.1@853#one.one.one.one This is due to this function in /etc/rc.d/local_unbound which runs setup only if unbound config file is missing. local_unbound_prestart() { # Create configuration file if [ ! -f ${local_unbound_config} ] ; then run_rc_command setup fi # Retrieve DNSSEC root key if [ ! -s ${local_unbound_anchor} ] ; then run_rc_command anchor fi } I guess the workaround is to "rm -f /var/unbound/*" after changes to rc.conf