Stork not consider bind chroot path in all cases
name: Feature request
about: Suggest an idea for this project
Some initial questions
- Are you sure what you would like to do is not possible using some other mechanisms?
Maybe, changing all Bind setup, stork will find the conf files.
- Stork is in very early stages of development. If your request is not simple, it may be a while until anyone does anything with your request. Are you ok with that?
OK.
Is your feature request related to a problem? Please describe.
Yes. My Bind setup, and a wich a great number of Binds running, are on chroot environment. All Bind configuration is relactive to chroot path and in some them (my case) the configuration files are inside chroot.
Sample:
stork agent version: 1.9.0.230131111245
OS: Ubuntu 18.04.6 LTS - amd_64
chroot path: /var/lib/named
diretory absolute path: /var/lib/named/databases
bind command line: /var/lib/named/sbin/named -f -u bind -t /var/lib/named
Starting stork, in log it shows:
Feb 7 15:33:10 teste-compilando-bind-UB18 stork-agent[9802]: time="2023-02-07 15:33:10" level="warning" msg="cannot parse BIND 9 config file /etc/named.conf: exit status 1; /etc/named.conf.options:5: change directory to '/databases' failed: file not found\n\n/etc/named.conf.options:5: parsing failed: file not found\n" file=" bind9.go:405 "
Examining backend/agent/bind9.go (commit 639fbb70 (HEAD -> master, tag: v1.9.0, origin/master, origin/HEAD))
403 out, err := executor.Output(namedCheckconfPath, "-p", bind9ConfPath)
If I understand the code (sorry, programing is not my best :-) ) this function result on:
named-checkconf -p /etc/named.conf
/etc/named.conf.options:5: change directory to '/databases' failed: file not found
/etc/named.conf.options:5: parsing failed: file not found
Line 5 of /etc/named.conf.options is:
2 options {
3
4
5 directory "/databases";
This directory is relative to chroot path, but chroot path is not indicated to named-checonf -t option.
My Bind is compiled, so i think this is some part of the trouble.
If i use Bind from distro ( apt-get install bind9 ), this error not occours, see:
stork agent version: 1.9.0.230131111245
OS: Ubuntu 18.04.6 LTS - amd_64
chroot path: /var/bind9/chroot
diretory absolute path: /var/cache/bind
bind command line: /usr/sbin/named -f -u bind -t /var/bind9/chroot
/etc/bind/named.conf.options
1 options {
2
3 directory "/var/cache/bind";
This directory exists outside chroot directory, this way named-checkconf -p works whitout -t, of course, and all conf files are in /etc/bind.
I would like stork consider the chroot directory, automatically or by configuration the file agent.env, and if possible, configurations parameters to indicate bind named.conf.
Describe alternatives you've considered
To indicate Bind conf files a link was created from chroot/etc to /etc/bind. But no solution to use chroot unless change all Bind setup on all my servers.
Thanks.