On Sat, Sep 05, 2015 at 10:21:05PM +0100, Simon Kelley wrote:
> On 05/09/15 15:42, Guido Günther wrote:
> > Package: dnsmasq
> > Version: 2.72-3+deb8u1
> > Severity: wishlist
> > 
> > Hi,
> > it would be awesome if dnsmasq could use inotify in case of
> > 
> > --addn-hosts=/a/directory/
> > 
> > this would allow one to dump new files in there (and modify existing
> > ones) without reloading dnsmasq. The use case is creating hosts entries
> > for VMs popping up (and disappearing) on the network.
> > Cheers,
> >  -- Guido
> > 
> 
> The policy in the past has been to re-load /etc/resolv.conf and friends
> automatically when they change, as systems which re-write resolv.conf
> tend to assume that's all that needs to happen. For other configuration,
> (including addn-hosts) sending SIGHUP to the dnsmasq process causes a
> re-read. This is more conventional, and safer from race conditions, for
> instance reading a file before it has been completely written.

Yeah that is a valid point. I was thinking about how to detect "valid"
and fully written hosts file too.

> 
> 
> Is there a good reason not to use SIGHUP in this case?

The main reason is lack of privileges from the triggering process:

  $ kill -HUP 986
  bash: kill: (986) - Operation not permitted

I can simply prepare a sub directory in an init script with permissions
to put additional hosts file into but it's far more complex to have
another daemon running as another user configured to be able to send
sighup to dnsmasq without leaking additional privileges.

Cheers,
 -- Guido

Reply via email to