Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 454221 - mcs does not work
Summary: mcs does not work
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2008-07-06 21:54 UTC by Dominick Grift
Modified: 2009-07-14 16:01 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-07-14 16:01:58 UTC

Attachments (Terms of Use)

Description Dominick Grift 2008-07-06 21:54:15 UTC
Description of problem:
cannot get mcs to work:

with chat:
sh-3.2# chcat -L | grep User
s0-s0:c4                       SystemLow,UserGroup1
s0:c4                          UserGroup1

sh-3.2# chcat -l -- UserGroup1 joe
sh: semanage: command not found

with semanage:
sh-3.2# /usr/sbin/semanage user -a -L s0 -r "s0-s0:c4" -R guest_r -P user test_u
sh-3.2# /usr/sbin/semanage login -m -s test_u -r "s0-s0:c4" joe

sh-3.2# /usr/sbin/semanage translation -l | grep User
s0-s0:c4                  SystemLow,UserGroup1
s0:c4                     UserGroup1

Jul  6 23:28:47 sulphur sshd[7894]: Accepted password for joe from
port 41489 ssh2
Jul  6 23:28:47 sulphur sshd[7894]: pam_unix(sshd:session): session opened for
user joe by (uid=0)
Jul  6 23:28:47 sulphur sshd[7894]: pam_selinux(sshd:session): Security context
test_u:guest_r:oddjob_mkhomedir_t:SystemLow,UserGroup1 is not allowed for
Jul  6 23:28:47 sulphur sshd[7894]: pam_selinux(sshd:session): Unable to get
valid context for joe
Jul  6 23:28:47 sulphur sshd[7894]: pam_namespace(sshd:session): Error getting
exec context, Success
Jul  6 23:28:47 sulphur sshd[7894]: pam_namespace(sshd:session): Error getting
instance name
Jul  6 23:28:47 sulphur sshd[7894]: error: PAM: pam_open_session():
Authentication failure
Jul  6 23:28:47 sulphur sshd[7894]: error: ssh_selinux_setup_pty:
security_compute_relabel: Invalid argument

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

Additional info:
chcat on files does seem to work

Comment 1 Dominick Grift 2008-07-06 22:18:00 UTC
I figured the above snippet from /var/log/secure is due to the missing user
context file fo i copied /etc/selinux/targeted/contexts/users/guest_u to test_u

after that i received denials in audit.log:
#============= setfiles_t ==============

#============= sshd_t ==============
allow sshd_t tmp_t:dir relabelto;

with this allowed it works:
uid=501(joe) gid=503(joe) groups=501(realusers),502(sshusers),503(joe)

Comment 2 Dominick Grift 2008-07-06 22:27:04 UTC
And even then it does not work after all:

[joe@sulphur public]$ touch test
[joe@sulphur public]$ ls -alZ
ls: cannot access domg472: Permission denied
drwxrwsr-t  root realusers system_u:object_r:user_home_t:s0 .
drwxr-xr-x  root root system_u:object_r:root_t:s0      ..
?---------  ? ?                                  domg472
-rw-rw-r--  joe realusers guest_u:object_r:user_home_t:s0  test
[joe@sulphur public]$ chcat -- +UserGroup1 test
/usr/bin/chcat: Requires a mls enabled system

Comment 3 Dominick Grift 2008-07-07 08:48:20 UTC
With this, it works

#============= guest_t ==============
allow guest_t self:netlink_audit_socket create;

Comment 4 Dominick Grift 2008-07-07 08:54:40 UTC
never mind still does not work... works in permissive though and works for staff_t

Comment 5 Dominick Grift 2008-07-07 09:15:49 UTC
mcs does not work for guest_t. it works for user_t with the above modifications.
managing mcs for users works only via semanage and not with chcat.

Comment 6 Dominick Grift 2008-07-07 10:34:22 UTC
another thing i just noticed is that restorecon does not restore some file
objects properly:

/sbin/restorecon reset
context system_u:object_r:user_mozilla_home_t:s0->system_u:object_r:user_home_t:s0

Comment 7 Daniel Walsh 2008-07-07 15:56:42 UTC
Why do you restorecon did not work properly?  The system default for this
directory is system_u:object_r:user_home_t:s0

allow guest_t self:netlink_audit_socket create;
Is probably not what you want.  Since this would potentially allow an untrusted
guest to send audit messages.  Probably caused by a pam module.   Maybe in xlock?

What AVC did you see on the 

Comment 8 Dominick Grift 2008-07-07 16:40:34 UTC
guest goesnt work with mcs not even with this rule:allow guest_t
self:netlink_audit_socket create; this is probably due to dontaudit rules in
guest_t policy.

my main report is about:

cannot use chcat to manage user categories  (chcat -l --)

mcs doesnt work with poly instantation ( sshd_t cannot relabel instantiated dirs)
setfiles need to write ssh tcp_socket

#============= setfiles_t ==============

#============= sshd_t ==============
allow sshd_t tmp_t:dir relabelto;

ofcourse also there is the issue where one cannot add a new seuser mapping (it
needs /etc/selinux/targeted/contexts/users/'seuser_u'

Comment 9 Dominick Grift 2008-07-07 17:02:55 UTC
the issue with: allow sshd_t tmp_t:dir relabelto; is that i have a fcotext entry:
/tmp-inst(/.*)?                                    all files         
/var/tmp-inst(/.*)?                                all files         

ssh wants to relabel the instantiated dir:

type=AVC msg=audit(1215381843.199:328): avc:  denied  { relabelto } for 
pid=9935 comm="sshd" name="system_u:object_r:tmp_t:s0-s0:c4_joe" dev=dm-1
ino=7315459 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023
tcontext=system_u:object_r:tmp_t:s0-s0:c4 tclass=dir

type=AVC msg=audit(1215382196.711:361): avc:  denied  { read write } for 
pid=10300 comm="restorecon" path="socket:[1298819]" dev=sockfs ino=1298819
tcontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tclass=tcp_socket

type=AVC msg=audit(1215382428.555:396): avc:  denied  { relabelto } for 
pid=10563 comm="sshd" name="system_u:object_r:user_home_dir_t:s0-s0:c4_joe"
dev=dm-1 ino=7290896 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023
tcontext=system_u:object_r:user_home_dir_t:s0-s0:c4 tclass=dir

Comment 10 Daniel Walsh 2008-07-07 17:50:03 UTC
Are you using somekind of pam_namespace?

Comment 11 Dominick Grift 2008-07-07 18:13:59 UTC
yes i am using pam_namespace poly instantiation

Comment 12 Bug Zapper 2009-06-10 01:57:17 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  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 WONTFIX if it remains open with a Fedora 
'version' of '9'.

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 prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 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 please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

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:

Comment 13 Bug Zapper 2009-07-14 16:01:58 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 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.

Thank you for reporting this bug and we are sorry it could not be fixed.

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