Bug 802566 - selinux prevents mailman from running
Summary: selinux prevents mailman from running
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 15
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-12 21:43 UTC by H. Peter Anvin
Modified: 2012-08-07 19:59 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-07 19:59:11 UTC
Type: ---


Attachments (Terms of Use)

Description H. Peter Anvin 2012-03-12 21:43:57 UTC
Description of problem:
Almost all Mailman operations fail with various error messages, generating AVCs.

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.9.16-51.fc15.noarch
mailman-2.1.14-6.fc15.x86_64

Sample AVC:
type=AVC msg=audit(1331587694.525:759756): avc:  denied  { write } for  pid=19841 comm="python" name="mailman" dev=tmpfs ino=13342 scontext=system_u:system_r:mailman_cgi_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=dir

This appears to be related to the labelling on the mailman directories in /run:

drwxrwsr-x. root mailman system_u:object_r:var_run_t:s0   /run/lock/mailman/
drwxrwsr-x. root mailman system_u:object_r:mailman_lock_t:s0 /run/mailman/

... which both seem incorrect, but especially /run/lock/mailman (I would have expected mailman_lock_t to have belonged to the /run/mailman directory.)

Comment 1 H. Peter Anvin 2012-03-12 21:49:51 UTC
Note: file_contexts contains:

/var/run/mailman(/.*)?  system_u:object_r:mailman_lock_t:s0
/var/lock/mailman(/.*)? system_u:object_r:mailman_lock_t:s0

... and file_context.subs contains:

/run/lock /var/lock
/run /var/run
/var/run/lock /var/lock

Comment 2 H. Peter Anvin 2012-03-12 21:53:54 UTC
FWIW, an explicit:

chcon -R system_u:object_r:mailman_lock_t:s0 /run/lock/mailman

... worked, at least transiently; however, restorecon -n -v -R /run indicates it would like to override the label:

restorecon reset /run/lock/mailman context system_u:object_r:mailman_lock_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/mailman/master-qrunner.terminus.zytor.com.24941 context system_u:object_r:mailman_lock_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/mailman/master-qrunner context system_u:object_r:mailman_lock_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/mailman context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0

Comment 3 Daniel Walsh 2012-03-13 10:49:36 UTC
semanage fcontext -a -t mailman_lock_t '/var/lock/mailmain(/.*)?'

Will fix this.

This is the labeling we have in F16 and F17.

Comment 4 Miroslav Grepl 2012-03-13 10:54:27 UTC
I see we have

/var/lock/mailman(/.*)?         gen_context(system_u:object_r:mailman_lock_t,s0)

in F15.

Comment 5 H. Peter Anvin 2012-03-13 21:43:36 UTC
Yes, this is the confusing bit... it *looks* like it should be correct based on the file_context/file_context.subs files, but it doesn't actually work as expected.

I'm wondering if the problem is with rules conflicting with the wrong priority?

Comment 6 Miroslav Grepl 2012-03-14 10:01:34 UTC
If you execute

$ yum reinstall selinux-policy-targeted

does it complain on reinstall?

Comment 7 H. Peter Anvin 2012-03-14 23:28:48 UTC
No, but the problem is still there.

Comment 8 H. Peter Anvin 2012-05-03 18:36:08 UTC
My system just updated to selinux-policy-targeted-3.9.16-52.fc15.noarch, and the problem reappeared (presumably due to relabel), so this problem is still present.

Comment 9 Daniel Walsh 2012-05-04 13:17:31 UTC
What does 

matchpathcon /var/lock/mailman

say?

ls -lZ /var/lock/mailman

Comment 10 H. Peter Anvin 2012-05-04 22:03:22 UTC
[root@terminus ~]# restorecon -v -R /run
restorecon reset /run/lock/mailman context system_u:object_r:mailman_lock_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/spamd context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/mysqld context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/auditd context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/mdmonitor context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0
restorecon reset /run/lock/subsys/sshd context system_u:object_r:initrc_var_run_t:s0->system_u:object_r:var_run_t:s0
[root@terminus ~]# matchpathcon /var/lock/mailman
/var/lock/mailman       system_u:object_r:mailman_lock_t:s0
[root@terminus ~]# ls -alZ /var/lock/mailman
drwxrwsr-x. root mailman system_u:object_r:var_run_t:s0   .
drwxr-xr-x. root root    system_u:object_r:var_run_t:s0   ..
[root@terminus ~]# chcon -R system_u:object_r:mailman_lock_t:s0 /run/lock/mailman
[root@terminus ~]# matchpathcon /var/lock/mailman
/var/lock/mailman       system_u:object_r:mailman_lock_t:s0
[root@terminus ~]# ls -alZ /var/lock/mailman
drwxrwsr-x. root mailman system_u:object_r:mailman_lock_t:s0 .
drwxr-xr-x. root root    system_u:object_r:var_run_t:s0   ..
[root@terminus ~]# service mailman start
Starting mailman (via systemctl):                          [  OK  ]
[root@terminus ~]# ls -alZ /var/lock/mailman
drwxrwsr-x. root    mailman system_u:object_r:mailman_lock_t:s0 .
drwxr-xr-x. root    root    system_u:object_r:var_run_t:s0   ..
-rw-rw-r--. mailman mailman system_u:object_r:mailman_lock_t:s0 master-qrunner
-rw-rw-r--. mailman mailman system_u:object_r:mailman_lock_t:s0 master-qrunner.terminus.zytor.com.3148
[root@terminus ~]#

Comment 11 H. Peter Anvin 2012-05-04 22:05:28 UTC
On the other hand...

[root@terminus ~]# matchpathcon /run/lock/mailman
/run/lock/mailman       system_u:object_r:var_run_t:s0   

Keep in mind that:

[root@terminus ~]# ls -l /var/lock
lrwxrwxrwx. 1 root root 11 Sep 10  2011 /var/lock -> ../run/lock

... but the file_context.subs should handle that, no?

Comment 12 H. Peter Anvin 2012-05-04 22:08:28 UTC
Ah...

Reversing the order of the top two patters in file_context.subs solved the problem:

[root@terminus files]# cat file_contexts.subs
/run /var/run
/run/lock /var/lock
/pub/git /srv/git
/home/ftp/pub/git /srv/git
/var/run/lock /var/lock
/home/www /srv/www
[root@terminus files]# matchpathcon /run/lock/mailman
/run/lock/mailman       system_u:object_r:mailman_lock_t:s0

I don't know if this is local to my system or part of the file_context.subs that was shipped with the system... I thought it was the latter, but since I have added patterns to it it might have ignored updates.

Comment 13 Fedora End Of Life 2012-08-07 19:59:14 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached 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 to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

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.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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