Bug 1003175 - SELinux is preventing /usr/bin/fetchmail from 'write, open' accesses on the file /run/fetchmail/fetchmail.pid
Summary: SELinux is preventing /usr/bin/fetchmail from 'write, open' accesses on the f...
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2013-08-31 13:53 UTC by Vladislav Grigoryev
Modified: 2013-09-08 00:36 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.12.1-74.1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-09-08 00:36:56 UTC
Type: Bug

Attachments (Terms of Use)

Description Vladislav Grigoryev 2013-08-31 13:53:44 UTC
SELinux is preventing /usr/bin/fetchmail from 'write, open' accesses on the file /run/fetchmail/fetchmail.pid.

*****  Plugin restorecon (99.5 confidence) suggests  *************************

If you want to fix the label. 
/run/fetchmail/fetchmail.pid default label should be fetchmail_var_run_t.
Then you can run restorecon.
# /sbin/restorecon -v /run/fetchmail/fetchmail.pid

*****  Plugin catchall (1.49 confidence) suggests  ***************************

If you believe that fetchmail should be allowed write open access on the fetchmail.pid file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
allow this access for now by executing:
# grep fetchmail /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:fetchmail_t:s0
Target Context                system_u:object_r:var_run_t:s0
Target Objects                /run/fetchmail/fetchmail.pid [ file ]
Source                        fetchmail
Source Path                   /usr/bin/fetchmail
Port                          <Unknown>
Host                          srv6.kola.fad.ru
Source RPM Packages           fetchmail-6.3.24-3.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-73.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     srv6.kola.fad.ru
Platform                      Linux srv6.kola.fad.ru 3.10.9-200.fc19.x86_64 #1
                              SMP Wed Aug 21 19:27:58 UTC 2013 x86_64 x86_64
Alert Count                   16
First Seen                    2013-07-29 18:46:56 MSK
Last Seen                     2013-08-31 17:28:58 MSK
Local ID                      caa66d82-fc47-4a55-ae28-0b4ad51f4986

Raw Audit Messages
type=AVC msg=audit(1377955738.521:187): avc:  denied  { write open } for  pid=2378 comm="fetchmail" path="/run/fetchmail/fetchmail.pid" dev="tmpfs" ino=47146 scontext=system_u:system_r:fetchmail_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file

type=SYSCALL msg=audit(1377955738.521:187): arch=x86_64 syscall=open success=no exit=EACCES a0=164acd0 a1=c1 a2=1b6 a3=8 items=0 ppid=1 pid=2378 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=fetchmail exe=/usr/bin/fetchmail subj=system_u:system_r:fetchmail_t:s0 key=(null)

Hash: fetchmail,fetchmail_t,var_run_t,file,write,open

Version-Release number of selected component (if applicable):

How reproducible:

Additional info:
# cat /etc/fetchmail/fetchmail.conf
set daemon 60
set pidfile /run/fetchmail/fetchmail.pid
poll "mail.example.com" with proto POP3 user "user@example.com" there with password "passwd" is "user@example.org" here

# cat /etc/tmpfiles.d/fetchmail.conf
D /var/run/fetchmail 0700 root root -

# man fetchmail_selinux
> Paths:
>     /var/lib/fetchmail(/.*)?, /var/mail/.fetchmail-UIDL-cache
> fetchmail_var_run_t
> - Set files with the fetchmail_var_run_t type, if you want to store the fetchmail files under the /run or /var/run directory.

So let's try to restore the context:
# restorecon /var/run/fetchmail/
# ls -ldZ /var/run/fetchmail/ 
drwx------. root root system_u:object_r:var_run_t:s0   /var/run/fetchmail/

restorecon doesn't change the context to "fetchmail_var_run_t", however setting the context manually resolves the issue

Comment 1 Miroslav Grepl 2013-09-03 12:17:26 UTC
You need to run

# restorecon -R  /var/run/fetchmail

Comment 2 Vladislav Grigoryev 2013-09-03 12:39:57 UTC
(In reply to Miroslav Grepl from comment #1)
> You need to run
> # restorecon -R  /var/run/fetchmail

As I've said before, restorecon changes the context to "var_run_t", but according to the manual fetchmail_selinux it should be "fetchmail_var_run_t".

Comment 3 Vladislav Grigoryev 2013-09-03 12:43:26 UTC
# restorecon -R -v  /var/run/fetchmail
restorecon reset /run/fetchmail context system_u:object_r:fetchmail_var_run_t:s0->system_u:object_r:var_run_t:s0

# rpm -q selinux-policy fetchmail

Comment 4 Miroslav Grepl 2013-09-03 13:17:40 UTC
Ok, I see a bug. Thank you for testing.


# chcon -R -t fetchmail_var_run_t /run/fetchmail*

Comment 5 Fedora Update System 2013-09-03 19:57:25 UTC
selinux-policy-3.12.1-74.1.fc19 has been submitted as an update for Fedora 19.

Comment 6 Fedora Update System 2013-09-05 01:38:55 UTC
Package selinux-policy-3.12.1-74.1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-74.1.fc19'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 7 Vladislav Grigoryev 2013-09-06 20:48:26 UTC
Update resolves the issue.

Comment 8 Fedora Update System 2013-09-08 00:36:56 UTC
selinux-policy-3.12.1-74.1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.