[HELP NEEDED] Unable to figure out directory permissions
cross-posted from: infosec.pub/post/15386345
Hi everyone,
This is my
CONTAINERFILE
for Bind9:<span style="color:#323232;">FROM debian </span><span style="color:#323232;"> </span><span style="color:#323232;">ENV LC_ALL C.UTF-8 </span><span style="color:#323232;"> </span><span style="color:#323232;"># Update and upgrade system </span><span style="color:#323232;">RUN apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y </span><span style="color:#323232;"> </span><span style="color:#323232;"># Install BIND 9 and sudo (for debugging if needed) </span><span style="color:#323232;">RUN apt-get install -y bind9 bind9-dnsutils bind9-libs bind9-utils sudo </span><span style="color:#323232;"> </span><span style="color:#323232;"># Configure permissions for BIND directories </span><span style="color:#323232;">RUN mkdir -p /var/cache/bind /var/lib/bind /var/log/bind </span><span style="color:#323232;">RUN chown -R bind:bind /var/cache/bind /var/lib/bind /var/log/bind </span><span style="color:#323232;">RUN chmod 664 /var/cache/bind /var/lib/bind /var/log/bind </span><span style="color:#323232;">RUN chmod -R 664 /var/cache/bind /var/lib/bind /var/log/bind </span><span style="color:#323232;"> </span><span style="color:#323232;"># Create and configure log files </span><span style="color:#323232;">RUN touch /var/log/bind/default.log /var/log/bind/update_debug.log /var/log/bind/security_info.log /var/log/bind/bind.log </span><span style="color:#323232;">RUN chown -R bind:bind /var/log/bind </span><span style="color:#323232;">RUN chmod 644 /var/log/bind/*.log </span><span style="color:#323232;"> </span><span style="color:#323232;"># Define volumes </span><span style="color:#323232;">VOLUME ["/etc/bind", "/var/cache/bind", "/var/lib/bind", "/var/log/bind"] </span><span style="color:#323232;"> </span><span style="color:#323232;"># Set the entrypoint to the named executable </span><span style="color:#323232;">ENTRYPOINT ["/usr/sbin/named"] </span><span style="color:#323232;"> </span><span style="color:#323232;"># Set the default command arguments for the named executable </span><span style="color:#323232;">CMD ["-g"] </span>
I keep getting this error when I run it with podman:
<span style="color:#323232;">26-Jul-2024 03:18:21.328 loading configuration from '/etc/bind/named.conf' </span><span style="color:#323232;">26-Jul-2024 03:18:21.328 directory '/var/cache/bind' is not writable </span><span style="color:#323232;">26-Jul-2024 03:18:21.332 /etc/bind/named.conf.options:2: parsing failed: permission denied </span>
As you can see from the
CONTAINERFILE
, thebind
user should be able to read and write to/var/cache/bind
but for some reason it doesn’t.I have been at this for a while and I’m at my wits end. Your help is appreciated!