Re: relocate dnsmasq --conf-dir location?



Hi,

Another option is also possible. You can add
conf-dir=/modifiable/dnsmasq.d,*.conf into
/etc/NetworkManager/dnsmasq.d/modify.conf

That would be fixed part, which would stay read-only. And any
configuration generated on-fly would be in modifiable directory. dnsmasq
should support multiple directories read for configuration. It allows
additional directory instead of moving existing directory.

Cheers,
Petr

On 10/29/21 11:14, Thomas Haller via networkmanager-list wrote:
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

_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

-- 
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik redhat com
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB



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