Description of problem: SElinux prevents dnsmasq from running Version-Release number of selected component (if applicable): Dnsmasq version 2.79 Copyright (c) 2000-2018 Simon Kelley Compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth DNSSEC loop-detect inotify This software comes with ABSOLUTELY NO WARRANTY. Dnsmasq is free software, and you are welcome to redistribute it under the terms of the GNU General Public License, version 2 or 3. How reproducible: If a "log-facility=/var/log/dnsmasq.log" has been defined in /etc/dnsmasq.conf, the issue is always present. If the log-facility is commented out, dnsmasq runs correct. Steps to Reproduce: 1. Install a minimum Fedora 29 server 2. Install dnsmasq 3. Create/adjust /etc/dnsmasq.conf to include "log-facility=/var/log/dnsmasq.log" 4. Run: systemctl enable dnsmasq 5. Run: systemctl start dnsmasq 6. Run: systemctl status dnsmasq Actual results: 1. -------------- "systemctl status dnsmasq" shows: ● dnsmasq.service - DNS caching server. Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2019-01-06 16:58:45 CET; 2s ago Process: 3776 ExecStart=/usr/sbin/dnsmasq -k (code=exited, status=3) Main PID: 3776 (code=exited, status=3) Jan 06 16:58:44 ns2.edgar-matzinger.nl systemd[1]: Started DNS caching server.. Jan 06 16:58:45 ns2.edgar-matzinger.nl dnsmasq[3776]: dnsmasq: cannot open log /var/log/dnsmasq.log: Permission denied Jan 06 16:58:45 ns2.edgar-matzinger.nl dnsmasq[3776]: cannot open log /var/log/dnsmasq.log: Permission denied Jan 06 16:58:45 ns2.edgar-matzinger.nl dnsmasq[3776]: FAILED to start up Jan 06 16:58:45 ns2.edgar-matzinger.nl systemd[1]: dnsmasq.service: Main process exited, code=exited, status=3/NOTIMPLE> Jan 06 16:58:45 ns2.edgar-matzinger.nl systemd[1]: dnsmasq.service: Failed with result 'exit-code'. 2. -------------- audit2why shows: type=AVC msg=audit(1546789506.693:901): avc: denied { dac_override } for pid=3751 comm="dnsmasq" capability=1 scontext=system_u:system_r:dnsmasq_t:s0 tcontext=system_u:system_r:dnsmasq_t:s0 tclass=capability permissive=0 Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access. 3. -------------- SELinux contexts: [root@ns2 audit]# ls -ldZ /etc/dnsmasq.conf /etc/dnsmasq.d /etc/dnsmasq.d/dnsmasq.dhcp.conf /var/log/dnsmasq.log -rw-r--r--. 1 root dnsmasq system_u:object_r:dnsmasq_etc_t:s0 26924 Jan 6 17:00 /etc/dnsmasq.conf drwxr-xr-x. 2 root dnsmasq system_u:object_r:dnsmasq_etc_t:s0 31 Jan 6 16:19 /etc/dnsmasq.d -rw-r--r--. 1 root root unconfined_u:object_r:dnsmasq_etc_t:s0 543 Jan 6 16:19 /etc/dnsmasq.d/dnsmasq.dhcp.conf -rw-r-----. 1 dnsmasq dnsmasq system_u:object_r:dnsmasq_var_log_t:s0 9322 Jan 6 16:43 /var/log/dnsmasq.log Expected results: Running dnsmasq configuration with logging to /var/log/dnsmasq.log Additional info: Switching SELinux to permissive, allows dnsmasq to start correctly using systemctl.
Dnsmasq is denied right to override unix permissions in /var/log directory. It can work, just /var/log/dnsmasq.log has to be created first with right to write to it. Daemon running network services runs under dnsmasq user, which has no right to write into /var/log. If you first create file writeable by that user, dnsmasq should be able to write there. Can you try (as root): touch /var/log/dnsmasq.log chgrp dnsmasq /var/log/dnsmasq.log chmod g+w /var/log/dnsmasq.log systemctl restart dnsmasq This should work also with selinux set to enforcing.
This message is a reminder that Fedora 29 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '29'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 29 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.