From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zombie2.ncsc.mil (zombie2.ncsc.mil [144.51.88.133]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5FXPlX007519 for ; Wed, 5 Nov 2008 10:33:25 -0500 Received: from house.lunarmania.com (jazzdrum.ncsc.mil [144.51.5.7]) by zombie2.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5FVk1q020588 for ; Wed, 5 Nov 2008 15:31:46 GMT Received: from 78-3-234-122.adsl.net.t-com.hr ([78.3.234.122] helo=[192.168.1.22]) by house.lunarmania.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KxkNh-00036n-7X for selinux@tycho.nsa.gov; Wed, 05 Nov 2008 07:33:18 -0800 Message-ID: <4911BCB9.1060407@rubix.com> Date: Wed, 05 Nov 2008 16:33:13 +0100 From: Andy Warner MIME-Version: 1.0 To: selinux@tycho.nsa.gov Subject: using roles with mls policy Content-Type: multipart/alternative; boundary="------------000804000303020401040503" Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov This is a multi-part message in MIME format. --------------000804000303020401040503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I am using Fedora 9 with the MLS policy. I have been using it in permissive mode for a while (integrating SELinux with a DBMS and its objects) and now must do some work/testing in enforcing mode. As soon as I switch to enforcing mode I seem unable to perform any action which requires privilege. What is the anticipated method to shutdown/reboot the system and to toggle the enforcing mode while in MLS/Enforcing? What I assumed was to transition to an appropriate role (sysadm_r and secadm_r respectively) and then issue the corresponding command (shutdown and setenforce). This fails and I believe my difficulty is that in both cases I need to also be the linux root user. There does not seem to be an obvious way to execute a command as the lunux root user as neither su nor sudo seem available while in the sysadm_r and secadm_r roles. Executing something like seaudit while in the auditadm_r role fails to allow me to authenticate as root. Despite being the correct password it continuously loops asking for the password. As a related but less important question, in general, is it intended that a user initially have the staff_r role upon login and then transition to a more trusted role (i.e., secadm_r) using the newrole command? (as opposed to having the secadm_r upon login. Thanks for any help, Andy --------------000804000303020401040503 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I am using Fedora 9 with the MLS policy. I have been using it in permissive mode for a while (integrating SELinux with a DBMS and its objects) and now must do some work/testing in enforcing mode. As soon as I switch to enforcing mode I seem unable to perform any action which requires privilege.

What is the anticipated method to shutdown/reboot the system and to toggle the enforcing mode while in MLS/Enforcing? What I assumed was to transition to an appropriate role (sysadm_r and secadm_r respectively) and then issue the corresponding command (shutdown and setenforce). This fails and I believe my difficulty is that in both cases I need to also be the linux root user. There does not seem to be an obvious way to execute a command as the lunux root user as neither su nor sudo seem available while in the sysadm_r and secadm_r roles. Executing something like seaudit while in the auditadm_r role fails to allow me to authenticate as root. Despite being the correct password it continuously loops asking for the password.

As a related but less important question, in general, is it intended that a user initially have the staff_r role upon login and then transition to a more trusted role (i.e., secadm_r) using the newrole command? (as opposed to having the secadm_r upon login.

Thanks for any help,

Andy


--------------000804000303020401040503-- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mummy.ncsc.mil (mummy.ncsc.mil [144.51.88.129]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5GIwE4018362 for ; Wed, 5 Nov 2008 11:18:58 -0500 Received: from nf-out-0910.google.com (jazzhorn.ncsc.mil [144.51.5.9]) by mummy.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5GIreQ002581 for ; Wed, 5 Nov 2008 16:18:58 GMT Received: by nf-out-0910.google.com with SMTP id b21so39943nfd.4 for ; Wed, 05 Nov 2008 08:18:52 -0800 (PST) Message-ID: Date: Wed, 5 Nov 2008 08:18:52 -0800 From: "Justin Mattock" To: "Andy Warner" Subject: Re: using roles with mls policy Cc: selinux@tycho.nsa.gov In-Reply-To: <4911BCB9.1060407@rubix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 References: <4911BCB9.1060407@rubix.com> Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner wrote: > I am using Fedora 9 with the MLS policy. I have been using it in permissive > mode for a while (integrating SELinux with a DBMS and its objects) and now > must do some work/testing in enforcing mode. As soon as I switch to > enforcing mode I seem unable to perform any action which requires privilege. > > What is the anticipated method to shutdown/reboot the system and to toggle > the enforcing mode while in MLS/Enforcing? What I assumed was to transition > to an appropriate role (sysadm_r and secadm_r respectively) and then issue > the corresponding command (shutdown and setenforce). This fails and I > believe my difficulty is that in both cases I need to also be the linux root > user. There does not seem to be an obvious way to execute a command as the > lunux root user as neither su nor sudo seem available while in the sysadm_r > and secadm_r roles. Executing something like seaudit while in the auditadm_r > role fails to allow me to authenticate as root. Despite being the correct > password it continuously loops asking for the password. > > As a related but less important question, in general, is it intended that a > user initially have the staff_r role upon login and then transition to a > more trusted role (i.e., secadm_r) using the newrole command? (as opposed to > having the secadm_r upon login. > > Thanks for any help, > > Andy > > > Not sure how red hat works, but for me using ubuntu having to change roles I first needed to collect all of the allow rules, i.g. allow newrole_t staff_t:process etc... then after after a reboot into enforce mode using newrole -r works fine.(just haven't defined secadm_r yet). As for toggling from enforce to permissive using setenforce 0 or 1 or echo 0/1 > /selinux/enforce. -- Justin P. Mattock -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mummy.ncsc.mil (mummy.ncsc.mil [144.51.88.129]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5HqS4G005737 for ; Wed, 5 Nov 2008 12:52:28 -0500 Received: from house.lunarmania.com (jazzhorn.ncsc.mil [144.51.5.9]) by mummy.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5HqSeQ027218 for ; Wed, 5 Nov 2008 17:52:28 GMT Received: from 78-3-234-122.adsl.net.t-com.hr ([78.3.234.122] helo=[192.168.1.22]) by house.lunarmania.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KxmYF-0007tz-BH for selinux@tycho.nsa.gov; Wed, 05 Nov 2008 09:52:21 -0800 Message-ID: <4911DD4F.9050304@rubix.com> Date: Wed, 05 Nov 2008 18:52:15 +0100 From: Andy Warner MIME-Version: 1.0 To: SE-Linux Subject: Re: using roles with mls policy References: <4911BCB9.1060407@rubix.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------070109050904000603010703" Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov This is a multi-part message in MIME format. --------------070109050904000603010703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Justin Mattock wrote: > On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner wrote: > >> I am using Fedora 9 with the MLS policy. I have been using it in permissive >> mode for a while (integrating SELinux with a DBMS and its objects) and now >> must do some work/testing in enforcing mode. As soon as I switch to >> enforcing mode I seem unable to perform any action which requires privilege. >> >> What is the anticipated method to shutdown/reboot the system and to toggle >> the enforcing mode while in MLS/Enforcing? What I assumed was to transition >> to an appropriate role (sysadm_r and secadm_r respectively) and then issue >> the corresponding command (shutdown and setenforce). This fails and I >> believe my difficulty is that in both cases I need to also be the linux root >> user. There does not seem to be an obvious way to execute a command as the >> lunux root user as neither su nor sudo seem available while in the sysadm_r >> and secadm_r roles. Executing something like seaudit while in the auditadm_r >> role fails to allow me to authenticate as root. Despite being the correct >> password it continuously loops asking for the password. >> >> As a related but less important question, in general, is it intended that a >> user initially have the staff_r role upon login and then transition to a >> more trusted role (i.e., secadm_r) using the newrole command? (as opposed to >> having the secadm_r upon login. >> >> Thanks for any help, >> >> Andy >> >> >> >> > > Not sure how red hat works, > but for me using ubuntu having to change roles > I first needed to collect all of the allow rules, i.g. > allow newrole_t staff_t:process etc... > then after after a reboot into enforce mode > using newrole -r works fine.(just haven't defined secadm_r yet). > As for toggling from enforce to permissive > using setenforce 0 or 1 > or echo 0/1 > /selinux/enforce. > > > I have no problem changing to a role while in enforcing mode, the problem is in performing the command. Here is what is happening (the following was executed while in enforcing mode): [staff@oak ~]$ id -Z staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh [staff@oak ~]$ newrole -r secadm_r Password: [staff@oak ~]$ id -Z staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh [staff@oak ~]$ ls -l /selinux/enforce -rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce [staff@oak ~]$ /usr/sbin/setenforce 1 /usr/sbin/setenforce: setenforce() failed [staff@oak ~]$ sudo /usr/sbin/setenforce 1 sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted [staff@oak ~]$ id uid=503(staff) gid=500(user) groups=500(user) context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh [staff@oak ~]$ As can be seen I can transition to the secadm_r without an issue. And, from the DAC modes of /selinux/enforce I would guess it requires linux root to be written. Also, I thought I read elsewhere that the secadm_r was configured so that it could not perform an su/sudo. Likewise, if I try to execute system-config-selinux as the secadm_r role, I am not permitted to authenticate as linux root user so I am not able to do anything. If selinux is in permissive mode everything works, as long as I su/sudo to root first. I have similar issues with the auditadm_r role. As for my previously mentioned issue with using sysadm_r to issue a shutdown command while in enforcing mode, I was mistaken and this is possible using sudo (not sure what I was thinking). It seems no MLS roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r and secadm_r cannot use either and seem powerless without it. I am also unable to directly log in as root when in enforcing mode. Note that I am using the roles as they are configured in the MLS policy. If it is required to change or configure the roles to make them able do what it seems like they should be able to do, thats ok, but first I need to make sure I'm not just being boneheaded and using them in the wrong way or have bad expectations of what they should be able to do. --------------070109050904000603010703 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

Justin Mattock wrote:
On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner <warner@rubix.com> wrote:
  
I am using Fedora 9 with the MLS policy. I have been using it in permissive
mode for a while (integrating SELinux with a DBMS and its objects) and now
must do some work/testing in enforcing mode. As soon as I switch to
enforcing mode I seem unable to perform any action which requires privilege.

What is the anticipated method to shutdown/reboot the system and to toggle
the enforcing mode while in MLS/Enforcing? What I assumed was to transition
to an appropriate role (sysadm_r and secadm_r respectively) and then issue
the corresponding command (shutdown and setenforce). This fails and I
believe my difficulty is that in both cases I need to also be the linux root
user. There does not seem to be an obvious way to execute a command as the
lunux root user as neither su nor sudo seem available while in the sysadm_r
and secadm_r roles. Executing something like seaudit while in the auditadm_r
role fails to allow me to authenticate as root. Despite being the correct
password it continuously loops asking for the password.

As a related but less important question, in general, is it intended that a
user initially have the staff_r role upon login and then transition to a
more trusted role (i.e., secadm_r) using the newrole command? (as opposed to
having the secadm_r upon login.

Thanks for any help,

Andy



    

Not sure how red hat works,
but for me using ubuntu having to change roles
I first needed to collect all of the allow rules, i.g.
allow newrole_t staff_t:process  etc...
then after after a reboot into enforce mode
using newrole -r works fine.(just haven't defined secadm_r yet).
As for toggling from enforce to permissive
using setenforce 0 or 1
or echo 0/1 > /selinux/enforce.


  
I have no problem changing to a role while in enforcing mode, the problem is in performing the command. Here is what is happening (the following was executed while in enforcing mode):

[staff@oak ~]$ id -Z
staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ newrole -r secadm_r
Password:
[staff@oak ~]$ id -Z
staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ ls -l /selinux/enforce
-rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce
[staff@oak ~]$ /usr/sbin/setenforce 1
/usr/sbin/setenforce:  setenforce() failed
[staff@oak ~]$ sudo /usr/sbin/setenforce 1
sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted
[staff@oak ~]$ id
uid=503(staff) gid=500(user) groups=500(user)
context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$

As can be seen I can transition to the secadm_r without an issue. And, from the DAC modes of /selinux/enforce I would guess it requires linux root to be written. Also, I thought I read elsewhere that the secadm_r was configured so that it could not perform an su/sudo. Likewise, if I try to execute system-config-selinux as the secadm_r role, I am not permitted to authenticate as linux root user so I am not able to do anything. If selinux is in permissive mode everything works, as long as I su/sudo to root first. I have similar issues with the auditadm_r role.

As for my previously mentioned issue with using sysadm_r to issue a shutdown command while in enforcing mode, I was mistaken and this is possible using sudo (not sure what I was thinking). It seems no MLS roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r and secadm_r cannot use either and seem powerless without it. I am also unable to directly log in as root when in enforcing mode.

Note that I am using the roles as they are configured in the MLS policy. If it is required to change or configure the roles to make them able do what it seems like they should be able to do, thats ok, but first I need to make sure I'm not just being boneheaded and using them in the wrong way or have bad expectations of what they should be able to do.
--------------070109050904000603010703-- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mummy.ncsc.mil (mummy.ncsc.mil [144.51.88.129]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5IMYI0011956 for ; Wed, 5 Nov 2008 13:22:34 -0500 Received: from house.lunarmania.com (jazzhorn.ncsc.mil [144.51.5.9]) by mummy.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5IMYeQ005030 for ; Wed, 5 Nov 2008 18:22:34 GMT Received: from 78-3-234-122.adsl.net.t-com.hr ([78.3.234.122] helo=[192.168.1.22]) by house.lunarmania.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Kxn1M-0002mI-Np for selinux@tycho.nsa.gov; Wed, 05 Nov 2008 10:22:27 -0800 Message-ID: <4911E45C.4020904@rubix.com> Date: Wed, 05 Nov 2008 19:22:20 +0100 From: Andy Warner MIME-Version: 1.0 To: SE-Linux Subject: Re: using roles with mls policy References: <4911BCB9.1060407@rubix.com> <4911DD4F.9050304@rubix.com> In-Reply-To: <4911DD4F.9050304@rubix.com> Content-Type: multipart/alternative; boundary="------------030408050305040602070409" Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov This is a multi-part message in MIME format. --------------030408050305040602070409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andy Warner wrote: > > > Justin Mattock wrote: >> On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner wrote: >> >>> I am using Fedora 9 with the MLS policy. I have been using it in permissive >>> mode for a while (integrating SELinux with a DBMS and its objects) and now >>> must do some work/testing in enforcing mode. As soon as I switch to >>> enforcing mode I seem unable to perform any action which requires privilege. >>> >>> What is the anticipated method to shutdown/reboot the system and to toggle >>> the enforcing mode while in MLS/Enforcing? What I assumed was to transition >>> to an appropriate role (sysadm_r and secadm_r respectively) and then issue >>> the corresponding command (shutdown and setenforce). This fails and I >>> believe my difficulty is that in both cases I need to also be the linux root >>> user. There does not seem to be an obvious way to execute a command as the >>> lunux root user as neither su nor sudo seem available while in the sysadm_r >>> and secadm_r roles. Executing something like seaudit while in the auditadm_r >>> role fails to allow me to authenticate as root. Despite being the correct >>> password it continuously loops asking for the password. >>> >>> As a related but less important question, in general, is it intended that a >>> user initially have the staff_r role upon login and then transition to a >>> more trusted role (i.e., secadm_r) using the newrole command? (as opposed to >>> having the secadm_r upon login. >>> >>> Thanks for any help, >>> >>> Andy >>> >>> >>> >>> >> >> Not sure how red hat works, >> but for me using ubuntu having to change roles >> I first needed to collect all of the allow rules, i.g. >> allow newrole_t staff_t:process etc... >> then after after a reboot into enforce mode >> using newrole -r works fine.(just haven't defined secadm_r yet). >> As for toggling from enforce to permissive >> using setenforce 0 or 1 >> or echo 0/1 > /selinux/enforce. >> >> >> > I have no problem changing to a role while in enforcing mode, the > problem is in performing the command. Here is what is happening (the > following was executed while in enforcing mode): > > [staff@oak ~]$ id -Z > staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh > [staff@oak ~]$ newrole -r secadm_r > Password: > [staff@oak ~]$ id -Z > staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh > [staff@oak ~]$ ls -l /selinux/enforce > -rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce > [staff@oak ~]$ /usr/sbin/setenforce 1 > /usr/sbin/setenforce: setenforce() failed > [staff@oak ~]$ sudo /usr/sbin/setenforce 1 > sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted > [staff@oak ~]$ id > uid=503(staff) gid=500(user) groups=500(user) > context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh > [staff@oak ~]$ > > As can be seen I can transition to the secadm_r without an issue. And, > from the DAC modes of /selinux/enforce I would guess it requires linux > root to be written. Also, I thought I read elsewhere that the secadm_r > was configured so that it could not perform an su/sudo. Likewise, if I > try to execute system-config-selinux as the secadm_r role, I am not > permitted to authenticate as linux root user so I am not able to do > anything. If selinux is in permissive mode everything works, as long > as I su/sudo to root first. I have similar issues with the auditadm_r > role. > > As for my previously mentioned issue with using sysadm_r to issue a > shutdown command while in enforcing mode, I was mistaken and this is > possible using sudo (not sure what I was thinking). It seems no MLS > roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r > and secadm_r cannot use either and seem powerless without it. I am > also unable to directly log in as root when in enforcing mode. > > Note that I am using the roles as they are configured in the MLS > policy. If it is required to change or configure the roles to make > them able do what it seems like they should be able to do, thats ok, > but first I need to make sure I'm not just being boneheaded and using > them in the wrong way or have bad expectations of what they should be > able to do. Sorry to answer my own email, but just to button this up. I could not log into my root account because of a conflict between the staff_t (login process type) and the admin_home_t (root's home dir file type). Any attempt to start a session for root during enforcing mode would die as it could not access root's home directory. I am not exactly sure why policy is this way, if I did something or the mls policy is that way by default. So, I had to find another way to have linux root and secadm_r/auditadm_r at the same time. The su and sudo commands are not available from those roles. So, from the staff_r I had to start a shell using sudo as: sudo -s -r secadm_r This gave me a shell with the linux root user and the secadm_r role and I was able to run things like system-config-selinux and setenforce during enforcing mode. Same applies to auditadm_r. role. --------------030408050305040602070409 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

Andy Warner wrote:


Justin Mattock wrote:
On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner <warner@rubix.com> wrote:
  
I am using Fedora 9 with the MLS policy. I have been using it in permissive
mode for a while (integrating SELinux with a DBMS and its objects) and now
must do some work/testing in enforcing mode. As soon as I switch to
enforcing mode I seem unable to perform any action which requires privilege.

What is the anticipated method to shutdown/reboot the system and to toggle
the enforcing mode while in MLS/Enforcing? What I assumed was to transition
to an appropriate role (sysadm_r and secadm_r respectively) and then issue
the corresponding command (shutdown and setenforce). This fails and I
believe my difficulty is that in both cases I need to also be the linux root
user. There does not seem to be an obvious way to execute a command as the
lunux root user as neither su nor sudo seem available while in the sysadm_r
and secadm_r roles. Executing something like seaudit while in the auditadm_r
role fails to allow me to authenticate as root. Despite being the correct
password it continuously loops asking for the password.

As a related but less important question, in general, is it intended that a
user initially have the staff_r role upon login and then transition to a
more trusted role (i.e., secadm_r) using the newrole command? (as opposed to
having the secadm_r upon login.

Thanks for any help,

Andy



    

Not sure how red hat works,
but for me using ubuntu having to change roles
I first needed to collect all of the allow rules, i.g.
allow newrole_t staff_t:process  etc...
then after after a reboot into enforce mode
using newrole -r works fine.(just haven't defined secadm_r yet).
As for toggling from enforce to permissive
using setenforce 0 or 1
or echo 0/1 > /selinux/enforce.


  
I have no problem changing to a role while in enforcing mode, the problem is in performing the command. Here is what is happening (the following was executed while in enforcing mode):

[staff@oak ~]$ id -Z
staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ newrole -r secadm_r
Password:
[staff@oak ~]$ id -Z
staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ ls -l /selinux/enforce
-rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce
[staff@oak ~]$ /usr/sbin/setenforce 1
/usr/sbin/setenforce:  setenforce() failed
[staff@oak ~]$ sudo /usr/sbin/setenforce 1
sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted
[staff@oak ~]$ id
uid=503(staff) gid=500(user) groups=500(user)
context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$

As can be seen I can transition to the secadm_r without an issue. And, from the DAC modes of /selinux/enforce I would guess it requires linux root to be written. Also, I thought I read elsewhere that the secadm_r was configured so that it could not perform an su/sudo. Likewise, if I try to execute system-config-selinux as the secadm_r role, I am not permitted to authenticate as linux root user so I am not able to do anything. If selinux is in permissive mode everything works, as long as I su/sudo to root first. I have similar issues with the auditadm_r role.

As for my previously mentioned issue with using sysadm_r to issue a shutdown command while in enforcing mode, I was mistaken and this is possible using sudo (not sure what I was thinking). It seems no MLS roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r and secadm_r cannot use either and seem powerless without it. I am also unable to directly log in as root when in enforcing mode.

Note that I am using the roles as they are configured in the MLS policy. If it is required to change or configure the roles to make them able do what it seems like they should be able to do, thats ok, but first I need to make sure I'm not just being boneheaded and using them in the wrong way or have bad expectations of what they should be able to do.

Sorry to answer my own email, but just to button this up. I could not log into my root account because of a conflict between the staff_t (login process type) and the admin_home_t (root's home dir file type). Any attempt to start a session for root during enforcing mode would die as it could not access root's home directory. I am not exactly sure why policy is this way, if I did something or the mls policy is that way by default. So, I had to find another way to have linux root and secadm_r/auditadm_r at the same time. The su and sudo commands are not available from those roles. So, from the staff_r I had to start a shell using sudo as:
sudo -s -r secadm_r

This gave me a shell with the linux root user and the secadm_r role and I was able to run things like system-config-selinux and setenforce during enforcing mode. Same applies to auditadm_r. role.
--------------030408050305040602070409-- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zombie2.ncsc.mil (zombie2.ncsc.mil [144.51.88.133]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5JSugu023520 for ; Wed, 5 Nov 2008 14:28:56 -0500 Received: from rv-out-0708.google.com (jazzdrum.ncsc.mil [144.51.5.7]) by zombie2.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5JRGsN012331 for ; Wed, 5 Nov 2008 19:27:17 GMT Received: by rv-out-0708.google.com with SMTP id f25so162696rvb.54 for ; Wed, 05 Nov 2008 11:28:54 -0800 (PST) References: <4911BCB9.1060407@rubix.com> <4911DD4F.9050304@rubix.com> <4911E45C.4020904@rubix.com> Message-Id: <7B277800-3AF7-40AC-B906-D7CCD1728C9D@gmail.com> From: "Justin P. Mattock" To: Andy Warner In-Reply-To: <4911E45C.4020904@rubix.com> Content-Type: multipart/alternative; boundary=Apple-Mail-1-645502047 Mime-Version: 1.0 (iPhone Mail 5F136) Subject: Re: using roles with mls policy Date: Wed, 5 Nov 2008 11:28:40 -0800 Cc: SE-Linux Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov --Apple-Mail-1-645502047 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Not sure about auditadm_r and Secadm_r, from what I remember To access those roles you need to Be sysadm_r(but could be wrong); As for setting you initial context as User_r and then making the transition to syadm_r, don't think you can(or at least I haven't been able to do so); You would have to use a boot param To use permissive justin P. Mattock On Nov 5, 2008, at 10:22 AM, Andy Warner wrote: > > > Andy Warner wrote: >> >> >> >> Justin Mattock wrote: >>> >>> On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner >>> wrote: >>> >>>> I am using Fedora 9 with the MLS policy. I have been using it in >>>> permissive >>>> mode for a while (integrating SELinux with a DBMS and its >>>> objects) and now >>>> must do some work/testing in enforcing mode. As soon as I switch to >>>> enforcing mode I seem unable to perform any action which requires >>>> privilege. >>>> >>>> What is the anticipated method to shutdown/reboot the system and >>>> to toggle >>>> the enforcing mode while in MLS/Enforcing? What I assumed was to >>>> transition >>>> to an appropriate role (sysadm_r and secadm_r respectively) and >>>> then issue >>>> the corresponding command (shutdown and setenforce). This fails >>>> and I >>>> believe my difficulty is that in both cases I need to also be the >>>> linux root >>>> user. There does not seem to be an obvious way to execute a >>>> command as the >>>> lunux root user as neither su nor sudo seem available while in >>>> the sysadm_r >>>> and secadm_r roles. Executing something like seaudit while in the >>>> auditadm_r >>>> role fails to allow me to authenticate as root. Despite being the >>>> correct >>>> password it continuously loops asking for the password. >>>> >>>> As a related but less important question, in general, is it >>>> intended that a >>>> user initially have the staff_r role upon login and then >>>> transition to a >>>> more trusted role (i.e., secadm_r) using the newrole command? (as >>>> opposed to >>>> having the secadm_r upon login. >>>> >>>> Thanks for any help, >>>> >>>> Andy >>>> >>>> >>>> >>>> >>> Not sure how red hat works, >>> but for me using ubuntu having to change roles >>> I first needed to collect all of the allow rules, i.g. >>> allow newrole_t staff_t:process etc... >>> then after after a reboot into enforce mode >>> using newrole -r works fine.(just haven't defined secadm_r yet). >>> As for toggling from enforce to permissive >>> using setenforce 0 or 1 >>> or echo 0/1 > /selinux/enforce. >>> >>> >>> >> I have no problem changing to a role while in enforcing mode, the >> problem is in performing the command. Here is what is happening >> (the following was executed while in enforcing mode): >> >> [staff@oak ~]$ id -Z >> staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ newrole -r secadm_r >> Password: >> [staff@oak ~]$ id -Z >> staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ ls -l /selinux/enforce >> -rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce >> [staff@oak ~]$ /usr/sbin/setenforce 1 >> /usr/sbin/setenforce: setenforce() failed >> [staff@oak ~]$ sudo /usr/sbin/setenforce 1 >> sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted >> [staff@oak ~]$ id >> uid=503(staff) gid=500(user) groups=500(user) >> context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ >> >> As can be seen I can transition to the secadm_r without an issue. >> And, from the DAC modes of /selinux/enforce I would guess it >> requires linux root to be written. Also, I thought I read elsewhere >> that the secadm_r was configured so that it could not perform an su/ >> sudo. Likewise, if I try to execute system-config-selinux as the >> secadm_r role, I am not permitted to authenticate as linux root >> user so I am not able to do anything. If selinux is in permissive >> mode everything works, as long as I su/sudo to root first. I have >> similar issues with the auditadm_r role. >> >> As for my previously mentioned issue with using sysadm_r to issue a >> shutdown command while in enforcing mode, I was mistaken and this >> is possible using sudo (not sure what I was thinking). It seems no >> MLS roles can use su, only staff_r and sysadm_r may use sudo. >> auditadm_r and secadm_r cannot use either and seem powerless >> without it. I am also unable to directly log in as root when in >> enforcing mode. >> >> Note that I am using the roles as they are configured in the MLS >> policy. If it is required to change or configure the roles to make >> them able do what it seems like they should be able to do, thats >> ok, but first I need to make sure I'm not just being boneheaded and >> using them in the wrong way or have bad expectations of what they >> should be able to do. > > Sorry to answer my own email, but just to button this up. I could > not log into my root account because of a conflict between the > staff_t (login process type) and the admin_home_t (root's home dir > file type). Any attempt to start a session for root during enforcing > mode would die as it could not access root's home directory. I am > not exactly sure why policy is this way, if I did something or the > mls policy is that way by default. So, I had to find another way to > have linux root and secadm_r/auditadm_r at the same time. The su and > sudo commands are not available from those roles. So, from the > staff_r I had to start a shell using sudo as: > sudo -s -r secadm_r > > This gave me a shell with the linux root user and the secadm_r role > and I was able to run things like system-config-selinux and > setenforce during enforcing mode. Same applies to auditadm_r. role. --Apple-Mail-1-645502047 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
Not sure about auditadm_r and
Secadm_r, from what I remember
To access those roles you need to
Be sysadm_r(but could be wrong);
As for setting you initial context as
User_r and then making the transition to syadm_r, don't think you can(or at least I haven't been able to do so);
You would have to use a boot param
To use permissive

justin P. Mattock



On Nov 5, 2008, at 10:22 AM, Andy Warner <warner@rubix.com> wrote:



Andy Warner wrote:


Justin Mattock wrote:
On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner <warner@rubix.com> wrote:
  
I am using Fedora 9 with the MLS policy. I have been using it in permissive
mode for a while (integrating SELinux with a DBMS and its objects) and now
must do some work/testing in enforcing mode. As soon as I switch to
enforcing mode I seem unable to perform any action which requires privilege.

What is the anticipated method to shutdown/reboot the system and to toggle
the enforcing mode while in MLS/Enforcing? What I assumed was to transition
to an appropriate role (sysadm_r and secadm_r respectively) and then issue
the corresponding command (shutdown and setenforce). This fails and I
believe my difficulty is that in both cases I need to also be the linux root
user. There does not seem to be an obvious way to execute a command as the
lunux root user as neither su nor sudo seem available while in the sysadm_r
and secadm_r roles. Executing something like seaudit while in the auditadm_r
role fails to allow me to authenticate as root. Despite being the correct
password it continuously loops asking for the password.

As a related but less important question, in general, is it intended that a
user initially have the staff_r role upon login and then transition to a
more trusted role (i.e., secadm_r) using the newrole command? (as opposed to
having the secadm_r upon login.

Thanks for any help,

Andy



    
Not sure how red hat works,
but for me using ubuntu having to change roles
I first needed to collect all of the allow rules, i.g.
allow newrole_t staff_t:process  etc...
then after after a reboot into enforce mode
using newrole -r works fine.(just haven't defined secadm_r yet).
As for toggling from enforce to permissive
using setenforce 0 or 1
or echo 0/1 > /selinux/enforce.


  
I have no problem changing to a role while in enforcing mode, the problem is in performing the command. Here is what is happening (the following was executed while in enforcing mode):

[staff@oak ~]$ id -Z
staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ newrole -r secadm_r
Password:
[staff@oak ~]$ id -Z
staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$ ls -l /selinux/enforce
-rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce
[staff@oak ~]$ /usr/sbin/setenforce 1
/usr/sbin/setenforce:  setenforce() failed
[staff@oak ~]$ sudo /usr/sbin/setenforce 1
sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted
[staff@oak ~]$ id
uid=503(staff) gid=500(user) groups=500(user)
context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh
[staff@oak ~]$

As can be seen I can transition to the secadm_r without an issue. And, from the DAC modes of /selinux/enforce I would guess it requires linux root to be written. Also, I thought I read elsewhere that the secadm_r was configured so that it could not perform an su/sudo. Likewise, if I try to execute system-config-selinux as the secadm_r role, I am not permitted to authenticate as linux root user so I am not able to do anything. If selinux is in permissive mode everything works, as long as I su/sudo to root first. I have similar issues with the auditadm_r role.

As for my previously mentioned issue with using sysadm_r to issue a shutdown command while in enforcing mode, I was mistaken and this is possible using sudo (not sure what I was thinking). It seems no MLS roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r and secadm_r cannot use either and seem powerless without it. I am also unable to directly log in as root when in enforcing mode.

Note that I am using the roles as they are configured in the MLS policy. If it is required to change or configure the roles to make them able do what it seems like they should be able to do, thats ok, but first I need to make sure I'm not just being boneheaded and using them in the wrong way or have bad expectations of what they should be able to do.

Sorry to answer my own email, but just to button this up. I could not log into my root account because of a conflict between the staff_t (login process type) and the admin_home_t (root's home dir file type). Any attempt to start a session for root during enforcing mode would die as it could not access root's home directory. I am not exactly sure why policy is this way, if I did something or the mls policy is that way by default. So, I had to find another way to have linux root and secadm_r/auditadm_r at the same time. The su and sudo commands are not available from those roles. So, from the staff_r I had to start a shell using sudo as:
sudo -s -r secadm_r

This gave me a shell with the linux root user and the secadm_r role and I was able to run things like system-config-selinux and setenforce during enforcing mode. Same applies to auditadm_r. role.
--Apple-Mail-1-645502047-- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zombie2.ncsc.mil (zombie2.ncsc.mil [144.51.88.133]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5KBT8I032693 for ; Wed, 5 Nov 2008 15:11:29 -0500 Received: from mx2.redhat.com (jazzdrum.ncsc.mil [144.51.5.7]) by zombie2.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5K9osN020106 for ; Wed, 5 Nov 2008 20:09:50 GMT Message-ID: <4911FDEC.2080108@redhat.com> Date: Wed, 05 Nov 2008 15:11:24 -0500 From: Daniel J Walsh MIME-Version: 1.0 To: Andy Warner CC: SE-Linux Subject: Re: using roles with mls policy References: <4911BCB9.1060407@rubix.com> <4911DD4F.9050304@rubix.com> <4911E45C.4020904@rubix.com> In-Reply-To: <4911E45C.4020904@rubix.com> Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andy Warner wrote: > > > Andy Warner wrote: >> >> >> Justin Mattock wrote: >>> On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner wrote: >>> >>>> I am using Fedora 9 with the MLS policy. I have been using it in >>>> permissive >>>> mode for a while (integrating SELinux with a DBMS and its objects) >>>> and now >>>> must do some work/testing in enforcing mode. As soon as I switch to >>>> enforcing mode I seem unable to perform any action which requires >>>> privilege. >>>> >>>> What is the anticipated method to shutdown/reboot the system and to >>>> toggle >>>> the enforcing mode while in MLS/Enforcing? What I assumed was to >>>> transition >>>> to an appropriate role (sysadm_r and secadm_r respectively) and then >>>> issue >>>> the corresponding command (shutdown and setenforce). This fails and I >>>> believe my difficulty is that in both cases I need to also be the >>>> linux root >>>> user. There does not seem to be an obvious way to execute a command >>>> as the >>>> lunux root user as neither su nor sudo seem available while in the >>>> sysadm_r >>>> and secadm_r roles. Executing something like seaudit while in the >>>> auditadm_r >>>> role fails to allow me to authenticate as root. Despite being the >>>> correct >>>> password it continuously loops asking for the password. >>>> >>>> As a related but less important question, in general, is it intended >>>> that a >>>> user initially have the staff_r role upon login and then transition >>>> to a >>>> more trusted role (i.e., secadm_r) using the newrole command? (as >>>> opposed to >>>> having the secadm_r upon login. >>>> >>>> Thanks for any help, >>>> >>>> Andy >>>> >>>> >>>> >>>> >>> >>> Not sure how red hat works, >>> but for me using ubuntu having to change roles >>> I first needed to collect all of the allow rules, i.g. >>> allow newrole_t staff_t:process etc... >>> then after after a reboot into enforce mode >>> using newrole -r works fine.(just haven't defined secadm_r yet). >>> As for toggling from enforce to permissive >>> using setenforce 0 or 1 >>> or echo 0/1 > /selinux/enforce. >>> >>> >>> >> I have no problem changing to a role while in enforcing mode, the >> problem is in performing the command. Here is what is happening (the >> following was executed while in enforcing mode): >> >> [staff@oak ~]$ id -Z >> staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ newrole -r secadm_r >> Password: >> [staff@oak ~]$ id -Z >> staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ ls -l /selinux/enforce >> -rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce >> [staff@oak ~]$ /usr/sbin/setenforce 1 >> /usr/sbin/setenforce: setenforce() failed >> [staff@oak ~]$ sudo /usr/sbin/setenforce 1 >> sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted >> [staff@oak ~]$ id >> uid=503(staff) gid=500(user) groups=500(user) >> context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >> [staff@oak ~]$ >> >> As can be seen I can transition to the secadm_r without an issue. And, >> from the DAC modes of /selinux/enforce I would guess it requires linux >> root to be written. Also, I thought I read elsewhere that the secadm_r >> was configured so that it could not perform an su/sudo. Likewise, if I >> try to execute system-config-selinux as the secadm_r role, I am not >> permitted to authenticate as linux root user so I am not able to do >> anything. If selinux is in permissive mode everything works, as long >> as I su/sudo to root first. I have similar issues with the auditadm_r >> role. >> >> As for my previously mentioned issue with using sysadm_r to issue a >> shutdown command while in enforcing mode, I was mistaken and this is >> possible using sudo (not sure what I was thinking). It seems no MLS >> roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r >> and secadm_r cannot use either and seem powerless without it. I am >> also unable to directly log in as root when in enforcing mode. >> >> Note that I am using the roles as they are configured in the MLS >> policy. If it is required to change or configure the roles to make >> them able do what it seems like they should be able to do, thats ok, >> but first I need to make sure I'm not just being boneheaded and using >> them in the wrong way or have bad expectations of what they should be >> able to do. > > Sorry to answer my own email, but just to button this up. I could not > log into my root account because of a conflict between the staff_t > (login process type) and the admin_home_t (root's home dir file type). > Any attempt to start a session for root during enforcing mode would die > as it could not access root's home directory. I am not exactly sure why > policy is this way, if I did something or the mls policy is that way by > default. So, I had to find another way to have linux root and > secadm_r/auditadm_r at the same time. The su and sudo commands are not > available from those roles. So, from the staff_r I had to start a shell > using sudo as: > sudo -s -r secadm_r > > This gave me a shell with the linux root user and the secadm_r role and > I was able to run things like system-config-selinux and setenforce > during enforcing mode. Same applies to auditadm_r. role. > You need to run sudo first to become root and then run newrole. sudo also has the ability to transition directly to sysadm_r My sudoes has the following lines in it from targeted policy. dwalsh ALL=(ALL) ROLE=webadm_r TYPE=webadm_t ALL dwalsh ALL=(ALL) ROLE=unconfined_r TYPE=unconfined_t /bin/su I am logged in as staff_r:staff_t. I would not advise logging directly in as root on an MLS machine, but it probably should be setup to login as sysadm_r, (Although I would prefer unconfined_r). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkkR/esACgkQrlYvE4MpobN3agCgwKkY63w3+GN71srV7GuD9ciy 0PIAniCDIBsW7Dtp9H01OMH8hOk/MDRF =lixV -----END PGP SIGNATURE----- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zombie2.ncsc.mil (zombie2.ncsc.mil [144.51.88.133]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id mA5MsCbC021163 for ; Wed, 5 Nov 2008 17:54:12 -0500 Received: from ey-out-1920.google.com (jazzdrum.ncsc.mil [144.51.5.7]) by zombie2.ncsc.mil (8.12.10/8.12.10) with ESMTP id mA5Mq8C3012282 for ; Wed, 5 Nov 2008 22:52:08 GMT Received: by ey-out-1920.google.com with SMTP id 4so131741eyg.30 for ; Wed, 05 Nov 2008 14:53:46 -0800 (PST) Message-ID: Date: Wed, 5 Nov 2008 14:53:46 -0800 From: "Justin Mattock" To: "Daniel J Walsh" Subject: Re: using roles with mls policy Cc: "Andy Warner" , SE-Linux In-Reply-To: <4911FDEC.2080108@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 References: <4911BCB9.1060407@rubix.com> <4911DD4F.9050304@rubix.com> <4911E45C.4020904@rubix.com> <4911FDEC.2080108@redhat.com> Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov On Wed, Nov 5, 2008 at 12:11 PM, Daniel J Walsh wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Andy Warner wrote: >> >> >> Andy Warner wrote: >>> >>> >>> Justin Mattock wrote: >>>> On Wed, Nov 5, 2008 at 7:33 AM, Andy Warner wrote: >>>> >>>>> I am using Fedora 9 with the MLS policy. I have been using it in >>>>> permissive >>>>> mode for a while (integrating SELinux with a DBMS and its objects) >>>>> and now >>>>> must do some work/testing in enforcing mode. As soon as I switch to >>>>> enforcing mode I seem unable to perform any action which requires >>>>> privilege. >>>>> >>>>> What is the anticipated method to shutdown/reboot the system and to >>>>> toggle >>>>> the enforcing mode while in MLS/Enforcing? What I assumed was to >>>>> transition >>>>> to an appropriate role (sysadm_r and secadm_r respectively) and then >>>>> issue >>>>> the corresponding command (shutdown and setenforce). This fails and I >>>>> believe my difficulty is that in both cases I need to also be the >>>>> linux root >>>>> user. There does not seem to be an obvious way to execute a command >>>>> as the >>>>> lunux root user as neither su nor sudo seem available while in the >>>>> sysadm_r >>>>> and secadm_r roles. Executing something like seaudit while in the >>>>> auditadm_r >>>>> role fails to allow me to authenticate as root. Despite being the >>>>> correct >>>>> password it continuously loops asking for the password. >>>>> >>>>> As a related but less important question, in general, is it intended >>>>> that a >>>>> user initially have the staff_r role upon login and then transition >>>>> to a >>>>> more trusted role (i.e., secadm_r) using the newrole command? (as >>>>> opposed to >>>>> having the secadm_r upon login. >>>>> >>>>> Thanks for any help, >>>>> >>>>> Andy >>>>> >>>>> >>>>> >>>>> >>>> >>>> Not sure how red hat works, >>>> but for me using ubuntu having to change roles >>>> I first needed to collect all of the allow rules, i.g. >>>> allow newrole_t staff_t:process etc... >>>> then after after a reboot into enforce mode >>>> using newrole -r works fine.(just haven't defined secadm_r yet). >>>> As for toggling from enforce to permissive >>>> using setenforce 0 or 1 >>>> or echo 0/1 > /selinux/enforce. >>>> >>>> >>>> >>> I have no problem changing to a role while in enforcing mode, the >>> problem is in performing the command. Here is what is happening (the >>> following was executed while in enforcing mode): >>> >>> [staff@oak ~]$ id -Z >>> staff_u:staff_r:staff_t:SystemLow:SystemLow-SystemHigh >>> [staff@oak ~]$ newrole -r secadm_r >>> Password: >>> [staff@oak ~]$ id -Z >>> staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >>> [staff@oak ~]$ ls -l /selinux/enforce >>> -rw-r--r-- 1 root root 0 2008-11-05 17:08 /selinux/enforce >>> [staff@oak ~]$ /usr/sbin/setenforce 1 >>> /usr/sbin/setenforce: setenforce() failed >>> [staff@oak ~]$ sudo /usr/sbin/setenforce 1 >>> sudo: setresuid(ROOT_UID, 1, ROOT_UID): Operation not permitted >>> [staff@oak ~]$ id >>> uid=503(staff) gid=500(user) groups=500(user) >>> context=staff_u:secadm_r:secadm_t:SystemLow:SystemLow-SystemHigh >>> [staff@oak ~]$ >>> >>> As can be seen I can transition to the secadm_r without an issue. And, >>> from the DAC modes of /selinux/enforce I would guess it requires linux >>> root to be written. Also, I thought I read elsewhere that the secadm_r >>> was configured so that it could not perform an su/sudo. Likewise, if I >>> try to execute system-config-selinux as the secadm_r role, I am not >>> permitted to authenticate as linux root user so I am not able to do >>> anything. If selinux is in permissive mode everything works, as long >>> as I su/sudo to root first. I have similar issues with the auditadm_r >>> role. >>> >>> As for my previously mentioned issue with using sysadm_r to issue a >>> shutdown command while in enforcing mode, I was mistaken and this is >>> possible using sudo (not sure what I was thinking). It seems no MLS >>> roles can use su, only staff_r and sysadm_r may use sudo. auditadm_r >>> and secadm_r cannot use either and seem powerless without it. I am >>> also unable to directly log in as root when in enforcing mode. >>> >>> Note that I am using the roles as they are configured in the MLS >>> policy. If it is required to change or configure the roles to make >>> them able do what it seems like they should be able to do, thats ok, >>> but first I need to make sure I'm not just being boneheaded and using >>> them in the wrong way or have bad expectations of what they should be >>> able to do. >> >> Sorry to answer my own email, but just to button this up. I could not >> log into my root account because of a conflict between the staff_t >> (login process type) and the admin_home_t (root's home dir file type). >> Any attempt to start a session for root during enforcing mode would die >> as it could not access root's home directory. I am not exactly sure why >> policy is this way, if I did something or the mls policy is that way by >> default. So, I had to find another way to have linux root and >> secadm_r/auditadm_r at the same time. The su and sudo commands are not >> available from those roles. So, from the staff_r I had to start a shell >> using sudo as: >> sudo -s -r secadm_r >> >> This gave me a shell with the linux root user and the secadm_r role and >> I was able to run things like system-config-selinux and setenforce >> during enforcing mode. Same applies to auditadm_r. role. >> > You need to run sudo first to become root and then run newrole. > > sudo also has the ability to transition directly to sysadm_r > > My sudoes has the following lines in it from targeted policy. > > dwalsh ALL=(ALL) ROLE=webadm_r TYPE=webadm_t ALL > dwalsh ALL=(ALL) ROLE=unconfined_r TYPE=unconfined_t /bin/su > > I am logged in as staff_r:staff_t. > > I would not advise logging directly in as root on an MLS machine, but it > probably should be setup to login as sysadm_r, (Although I would prefer > unconfined_r). > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org > > iEYEARECAAYFAkkR/esACgkQrlYvE4MpobN3agCgwKkY63w3+GN71srV7GuD9ciy > 0PIAniCDIBsW7Dtp9H01OMH8hOk/MDRF > =lixV > -----END PGP SIGNATURE----- > > -- > This message was distributed to subscribers of the selinux mailing list. > If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with > the words "unsubscribe selinux" without quotes as the message. > My setup here is aterm -e sudo su (in the fluxbox menu); then newrole -r staff_r(for network manager) probably not as safe, but since being for personal use, probably O.K. -- Justin P. Mattock -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message.