Re: git: 1d577bedbae8 - main - unbound: Fix config file path

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Wed, 18 Jan 2023 17:07:32 UTC
In message <202301181702.30IH2toO010890@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > In message <202301181645.30IGj4Ra010783@gndrsh.dnsmgr.net>, "Rodney W. 
> > Grimes"
> > writes:
> > > > > In message <202301181551.30IFpbRu010474@gndrsh.dnsmgr.net>, "Rodney W
> . 
> > > > > Grimes"
> > > > > writes:
> > > > > > [ Charset UTF-8 unsupported, converting... ]
> > > > > > > 
> > > > > > > 
> > > > > > > > On 18 Jan 2023, at 16:34, Rodney W. Grimes <freebsd@gndrsh.dnsm
> gr.n
> > > et> wr
> > > > > > ote:
> > > > > > > > 
> > > > > > > > No, otis fixed it thus:
> > > > > > > > -#define CONFIGFILE "/usr/local/etc/unbound/unbound.conf"
> > > > > > > > +#define CONFIGFILE "/var/unbound/unbound.conf"
> > > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > > I am suggesting that it should be
> > > > > > > > #define CONFIGFILE "/etc/unbound/unbound.conf"
> > > > > > > > 
> > > > > > > > ALL base system configuration files *should* be relative to /et
> c, n
> > > ot /va
> > > > > > r.
> > > > > > > > 
> > > > > > > 
> > > > > > > Would this need any mtree changes or similar?
> > > > > >
> > > > > > No, /etc/unbound is a symbolic link already installed by the build 
> syst
> > > em,
> > > > > > and /var/unbound is already a directory, again, installed by the bu
> ild 
> > > system
> > > > > > .
> > > > > >
> > > > > > This is a one line change that actually makes the /etc/unbound link
>  wor
> > > k
> > > > > > correctly, without this change the binary has a hard coded path tha
> t ig
> > > nores 
> > > > > > the
> > > > > > /etc/unbound symbolic link and requires a recompile if I want to mo
> ve
> > > > > > things around, or maintanance of 2 symbolic links.
> > > > > >
> > > > > > Personally I dont see *why* unbound has a /var/unbound directory, c
> an
> > > > > > someone tell me why that was done?  Is this some attempt and mainta
> inin
> > > g
> > > > > > read only root?  Does unbound scribble in the config directory, or
> > > > > > is this simply mirroring some of the stuff that bind did?
> > > > > 
> > > > > I see why it does this. Looking at usr.sbin/unbound/setup/local-unbou
> nd-s
> > > etu
> > > > > p.sh, it installs its config files in $workdir. Looking at git log 
> > > > > 49cede74eecf4 (SVN r255809), the last paragraph in the commit log ent
> ry 
> > > > > says:
> > > > > 
> > > > >     Note that these scripts place the unbound configuration files in
> > > > >     /var/unbound rather than /etc/unbound.  This is necessary so that
> > > > >     unbound can reload its configuration while chrooted.  We should
> > > > >     probably provide symlinks in /etc.
> > >
> > > Hang on a second... where is unbound chrooted to?  If it is chrooted
> > > to /var/unbound would it not then look for /var/unbound/var/unbound/unbou
> nd.c
> > > onf?
> > >
> > > I got a feeling something is not well thought out here... 
> > 
> > Probably and it needs someone to investigate and possibly fix. I can put 
> > this on my todo list.
>
> I've read a few of the linux how to's on running unbound chrooted and
> it leads me to belive that /etc/unbound/unbound.conf is the correct
> value of the path to the config file.
>
> I'll also spend some ENOTIME idle cycles looking closer at what has
> happened here.  My gut says that if unbound is running chroot to
> /var/unbound then the config file should live in
> /var/unbound/etc/unbound/unbound.conf

If you have more ENOTIME than I do, the help would be appreciated. 
Otherwise I'll just add it to my multitasking list.

>
> This would mimic what I am seeing done with /var/lib/unbound on
> linux systems.  

This also mimics how one would run named chrooted.

>
> Then the symlink at /etc would need to be updated to point to
> /etc/unbound -> ../var/unbound/etc/unbound


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0