Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2156789

Summary: dnsmasq: cannot open log /var/log/dnsmasq.log
Product: Red Hat Enterprise Linux 9 Reporter: Adam Ibrahim <adibrahi>
Component: dnsmasqAssignee: Petr Menšík <pemensik>
Status: CLOSED ERRATA QA Contact: Petr Sklenar <psklenar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: pemensik, psklenar
Target Milestone: rcKeywords: MigratedToJIRA, Reopened, TestCaseNeeded, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnsmasq-2.85-12.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:36:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2024166    
Bug Blocks:    

Description Adam Ibrahim 2022-12-28 19:23:10 UTC
This bug was initially created as a copy of Bug #2024166 & #1663692

I am copying this bug because: issue is reproducible in RHEL 9.1
Package version: dnsmasq-2.85-5.el9.x86_64


Description of problem:

DNSmasq failing to start when configured to use a separate log file via log-facility directive.
This occurs if the file does not have a write permission for group, while SELinux is running in enforcing mode

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 dnsmasq
3. Edit /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
7. Run: systemctl restart dnsmasq

Actual results:
dnsmasq fails to restart:
× dnsmasq.service - DNS caching server.
     Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Wed 2022-12-28 13:11:43 EST; 1min 50s ago
    Process: 1544 ExecStart=/usr/sbin/dnsmasq (code=exited, status=3)
        CPU: 6ms

Dec 28 13:11:43 rhel9-1.adamibrahim.net systemd[1]: Starting DNS caching server....
Dec 28 13:11:43 rhel9-1.adamibrahim.net dnsmasq[1544]: dnsmasq: cannot open log /var/log/dnsmasq.log: Permission denied
Dec 28 13:11:43 rhel9-1.adamibrahim.net dnsmasq[1544]: cannot open log /var/log/dnsmasq.log: Permission denied
Dec 28 13:11:43 rhel9-1.adamibrahim.net dnsmasq[1544]: FAILED to start up
Dec 28 13:11:43 rhel9-1.adamibrahim.net systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
Dec 28 13:11:43 rhel9-1.adamibrahim.net systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Dec 28 13:11:43 rhel9-1.adamibrahim.net systemd[1]: Failed to start DNS caching server..



Expected results:
dnsmasq should start.

Additional info: 
- Removing log-facility=/var/log/dnsmasq.log from the configuration makes dnsmasq start just fine.
- Switching SELinux to permissive, allows dnsmasq to start correctly using systemctl.

Per Bug #2024166:
===
Posted upstream, already accepted:

https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q1/016070.html

Accepted and merged:
http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=1f8f78a49b8fd6b2862a3882053b1c6e6e111e5c
===

Comment 1 Petr Menšík 2023-01-23 12:11:33 UTC
I think this issue was already fixed on Fedora bug #2024166, should be relative simple to backport.

Comment 2 Petr Menšík 2023-06-14 10:10:07 UTC
Should have a working test, checking it actually works.

Comment 25 errata-xmlrpc 2023-11-07 08:36:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: dnsmasq security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6524