Re: relocate dnsmasq --conf-dir location?



On Thu, 2021-10-28 at 07:21 -0700, mailinglist bentleyemail net wrote:
Our embedded device has a readonly partition for configuration and
such.  /etc/ is on this readonly partition.

We currently use keyfile path=/writable partition in order to get
system-connections off the readonly partition.  Is there a way to get
the dnsmasq --conf-dir parameter to point to a different location as
well?

Currently I see:
# ps | grep dns
 340 nobody /usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-
in-foreground --bind-interfaces --except-interface=lo --clear-on-reload
--strict-order --listen-address=172.16.54.100 --dhcp-
range=172.16.54.109,172.16.54.254,60m --dhcp-lease-max=50 --dhcp-
leasefile=/var/lib/NetworkManager/dnsmasq-br0.leases --pid-
file=/var/run/nm-dnsmasq-br0.pid --conf-
dir=/etc/NetworkManager/dnsmasq-shared.d
 345 nobody /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-
hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid
--listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-
file=/dev/null --proxy-dnssec --enable-
dbus=org.freedesktop.NetworkManager.dnsmasq --conf-
dir=/etc/NetworkManager/dnsmasq.d

I have not seen where I can influence this location.  Can you advise? 
I'd like to be able to have something like:

/usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-in-foreground
--bind-interfaces --except-interface=lo --clear-on-reload --strict-
order --listen-address=172.16.54.100 --dhcp-
range=172.16.54.109,172.16.54.254,60m --dhcp-lease-max=50 --dhcp-
leasefile=/var/lib/NetworkManager/dnsmasq-br0.leases --pid-
file=/var/run/nm-dnsmasq-br0.pid --conf-
dir=/modifiable/NetworkManager/dnsmasq-shared.d
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-
interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-
address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-
file=/dev/null --proxy-dnssec --enable-
dbus=org.freedesktop.NetworkManager.dnsmasq --conf-
dir=/modifiable/NetworkManager/dnsmasq.d

Thanks,


Hi,


no, that's not currently possible.

You could:

1) bind-mount the directory "/modifiable/NetworkManager/dnsmasq*.d" to
"/etc/NetworkManager/dnsmasq*.d"

2) you could replace /usr/sbin/dnsmasq with a wrapper script that hacks
the configuration option. 

3) the code does

  if (g_file_test(CONFDIR, G_FILE_TEST_IS_DIR))
        argv[argv_idx++] = "--conf-dir=" CONFDIR;

You could patch the code (welcome upstream) to also accept SYMLINKS,
then you could symlink the /modifiable dir from /etc.


4) maybe this could be made configurable in NetworkManager.conf (patch
maybe welcome upstream). But with 1) and 3) you would have alternatives
for that. Beside, dropping files to --conf-dir entirely bypasses
NetworkManager and it would be better to natively support the features
that are hacked this way.

5) any other patch that works for you.


1) seems best. 3) is best otherwise, if you invest the work and can
wait for a new version of NetworkManager.



best,
Thoma



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]