Summary: SELinux is preventing /usr/sbin/dnsmasq "setattr" access on /var/log/dnsmasq. Detailed Description: [SELinux is in permissive mode. This access was not denied.] SELinux denied access requested by dnsmasq. It is not expected that this access is required by dnsmasq and this access may signal an intrusion attempt. It is also possible that the specific version or configuration of the application is causing it to require additional access. Allowing Access: You can generate a local policy module to allow this access - see FAQ (http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug report. Additional Information: Source Context unconfined_u:system_r:dnsmasq_t:s0 Target Context system_u:object_r:var_log_t:s0 Target Objects /var/log/dnsmasq [ file ] Source dnsmasq Source Path /usr/sbin/dnsmasq Port <Unknown> Host (removed) Source RPM Packages dnsmasq-2.51-1.fc12 Target RPM Packages Policy RPM selinux-policy-3.6.32-84.fc12 Selinux Enabled True Policy Type targeted Enforcing Mode Permissive Plugin Name catchall Host Name (removed) Platform Linux (removed) 2.6.31.12-174.2.3.fc12.x86_64 #1 SMP Mon Jan 18 19:52:07 UTC 2010 x86_64 x86_64 Alert Count 8 First Seen Mon 08 Feb 2010 11:57:08 PM CET Last Seen Fri 12 Feb 2010 09:18:50 AM CET Local ID 6441645b-7dea-44db-9e8d-af03b6f65654 Line Numbers Raw Audit Messages node=(removed) type=AVC msg=audit(1265962730.699:64070): avc: denied { setattr } for pid=4184 comm="dnsmasq" name="dnsmasq" dev=dm-1 ino=1443 scontext=unconfined_u:system_r:dnsmasq_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file node=(removed) type=AVC msg=audit(1265962730.699:64070): avc: denied { chown } for pid=4184 comm="dnsmasq" capability=0 scontext=unconfined_u:system_r:dnsmasq_t:s0 tcontext=unconfined_u:system_r:dnsmasq_t:s0 tclass=capability node=(removed) type=SYSCALL msg=audit(1265962730.699:64070): arch=c000003e syscall=93 success=yes exit=0 a0=a a1=63 a2=ffffffff a3=418 items=0 ppid=4183 pid=4184 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm="dnsmasq" exe="/usr/sbin/dnsmasq" subj=unconfined_u:system_r:dnsmasq_t:s0 key=(null) Hash String generated from catchall,dnsmasq,dnsmasq_t,var_log_t,file,setattr audit2allow suggests: #============= dnsmasq_t ============== allow dnsmasq_t self:capability chown; allow dnsmasq_t var_log_t:file setattr;
I get this together with bug 564276 whenever I (re)start dnsmasq. # /sbin/service dnsmasq restart I use dnsmasq as a local name server and have it reload its configuration triggered by NetworkManager changing the network connection.
Did you setup special logging in dnsmasq? It looks like it wants to create a log file named /var/log/dnsmasq?
Miroslav add type dnsmasq_var_log_t; logging_log_file(dnsmasq_var_log_t) manage_files_pattern(dnsmasq_t, dnsmasq_var_log_t, dnsmasq_var_log_t) logging_log_filetrans(dnsmasq_t, dnsmasq_var_log_t, file) /var/log/dnsmasq\.log gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
We might need to add the following also. #============= dnsmasq_t ============== allow dnsmasq_t self:capability dac_override; #============= dnsmasq_t ============== allow dnsmasq_t self:capability chown;
Fixed in selinux-policy-3.6.32-90.fc12
(In reply to comment #2) I have log-facility=/var/log/dnsmasq in /etc/dnsmasq.conf. I believe I set this up when I was debugging the setup. According to the man page, dnsmasq, by default, sends its log messages to the DAEMON facility of syslog. If I remember correctly, I created the log file my self. # ls -lZ /var/log/dnsmasq -rw-r-----. nobody root system_u:object_r:var_log_t:s0 /var/log/dnsmasq
Well it is probably best if you turn it off.
selinux-policy-3.6.32-92.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/selinux-policy-3.6.32-92.fc12
selinux-policy-3.6.32-92.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update selinux-policy'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-2953
selinux-policy-3.6.32-92.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.
Looks like this had been fixed previously. I usually do 'sudo service dnsmasq restart' and get this AVC. This a clean install of F14 and I already tried autorelabel to no avail.
Sandro, you mean you are seeing the same AVC messages which are mentioned in the comment #1 ? # rpm -q selinux-policy My the latest F14 policy has # sesearch -A -s dnsmasq_t -t dnsmasq_t -c capability Found 2 semantic av rules: allow dnsmasq_t dnsmasq_t : capability { chown dac_override setgid setuid net_bind_service net_admin net_raw } ; allow dnsmasq_t dnsmasq_t : capability net_bind_service ; # rpm -q selinux-policy selinux-policy-3.9.7-14.fc14.noarch # matchpathcon /var/log/dnsmasq.log /var/log/dnsmasq.log system_u:object_r:dnsmasq_var_log_t:s0
I used the SELinux Security Alert "Report this Bug..." button and it happened to attach my report to this bug. The exact message is: Summary: SELinux is preventing /usr/sbin/dnsmasq "setattr" access on /var/log/dnsmasq. Detailed Description: SELinux denied access requested by dnsmasq. It is not expected that this access is required by dnsmasq and this access may signal an intrusion attempt. It is also possible that the specific version or configuration of the application is causing it to require additional access. Allowing Access: You can generate a local policy module to allow this access - see FAQ (http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug report. Additional Information: Source Context system_u:system_r:dnsmasq_t:s0 Target Context system_u:object_r:var_log_t:s0 Target Objects /var/log/dnsmasq [ file ] Source dnsmasq Source Path /usr/sbin/dnsmasq Port <Unknown> Host gethen.penguinpee.nl Source RPM Packages dnsmasq-2.52-1.fc13 Target RPM Packages Policy RPM selinux-policy-3.9.7-12.fc14 Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Plugin Name catchall Host Name gethen.penguinpee.nl Platform Linux gethen.penguinpee.nl 2.6.35.6-48.fc14.x86_64 #1 SMP Fri Oct 22 15:36:08 UTC 2010 x86_64 x86_64 Alert Count 3 First Seen Tue 23 Nov 2010 01:51:33 PM CET Last Seen Tue 30 Nov 2010 08:03:45 PM CET Local ID 1e66dccc-0078-47e7-9ce3-613a2248a628 Line Numbers Raw Audit Messages node=gethen.penguinpee.nl type=AVC msg=audit(1291143825.520:10): avc: denied { setattr } for pid=1854 comm="dnsmasq" name="dnsmasq" dev=dm-2 ino=524812 scontext=system_u:system_r:dnsmasq_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file node=gethen.penguinpee.nl type=SYSCALL msg=audit(1291143825.520:10): arch=c000003e syscall=93 success=no exit=-13 a0=a a1=63 a2=ffffffff a3=418 items=0 ppid=1 pid=1854 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="dnsmasq" exe="/usr/sbin/dnsmasq" subj=system_u:system_r:dnsmasq_t:s0 key=(null)
Ok, then the situation is the same as in the comment #6, #7. # restorecon -R -v /var/log/dnsmasq or you turn it off.
restorecon doesn't change the context of the log file (system_u:object_r:var_log_t:s0). Since logging to a file is a configurable option in dnsmasq, I presume it should be able to take what ever action is necessary to be able to do so. How do other applications handle this situation? I know, for one, that vsftpd allows you to choose logging to a file or to syslog.
Ok, the problem is you created the log file by hand and it got "var_log_t" label. We define the label for "/var/log/dnsmasq.log" file in policy. This is why restorecon does not work. So you can change the label for now using # chcon -t dnsmasq_var_log_t /var/log/dnsmasq or rename the log to dnsmasq.log and run restorecon. If you create a new log file with the different name by hand, you will need to setup the label for it. The situation would be easier if the default directory existed for customized log files.
I have fixed the labeling which will cover /var/log/dnsmasq* log files in selinux-policy-3.9.7-15.fc14.
Thanks for putting this in selinux-policy. How coud I have found out about the rule for /var/log/dnsmasq.log myself? About having a default place for dnsmasq to put its logfile: I believe this could very easily be achieved by the package maintainer providing a dnsmasq directory in /var/log and patching the configuration.
selinux-policy-3.9.7-16.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-16.fc14
selinux-policy-3.9.7-16.fc14 has been pushed to the Fedora 14 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update selinux-policy'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-16.fc14
selinux-policy-3.9.7-16.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.