SELinux is preventing dnsmasq from using the dac_override capability.
While trying to set log-facility=/var/log/dnsmasq.log
in dnsmasq.conf
resulted in an SELinux splat:
SELinux is preventing dnsmasq from using the dac_override capability. [...] Raw Audit Messages type=AVC msg=audit(1583125188.633:22508): avc: denied { dac_override } for pid=1501431 comm="dnsmasq" capability=1 scontext=system_u:system_r:dnsmasq_t:s0 tcontext=system_u:system_r:dnsmasq_t:s0 tclass=capability permissive=0 Hash: dnsmasq,dnsmasq_t,dnsmasq_t,capability,dac_overrideThis had been reported before (in 2018), but for
/var/lib/dnsmasq/dnsmasq.leases
, this time it was about /var/log/dnsmasq.log
and we had everything in place:
$ ls -lZ /var/log/dnsmasq.log -rw-r-----. 1 dnsmasq root system_u:object_r:dnsmasq_var_log_t:s0 79783 \ Mar 1 20:59 /var/log/dnsmasq.logBefore granting dac_override to dnsmasq, we found this all explained in another blog post:
[...] The simple thing to do from an SELinux point of view would be to add the allow rule allow dovecot_t self:capability dac_override; But from a security proint of view, this is lousy. The much better solution would be to 'relax' the permissions on the socket by adding group read/write.And indeed, this helped as expected:
$ chmod -c g+w /var/log/dnsmasq.log mode of '/var/log/dnsmasq.log' changed from 0640 (rw-r-----) to 0660 (rw-rw----)Now
dnsmasq
would start and is able to log to /var/log/dnsmasq.log
.