<br><br><div class="gmail_quote">On Thu, Jan 28, 2010 at 5:32 PM, Daniel J Walsh <span dir="ltr">&lt;<a href="mailto:dwalsh@redhat.com">dwalsh@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On 01/28/2010 09:53 AM, Leif Thuresson wrote:<br>
&gt; Hi,<br>
&gt; I have been experimenting with confined users in centos54 to create my own<br>
&gt; staff and admin roles.<br>
&gt; I have only been meddling with policies for services before so creating user<br>
&gt; domains is<br>
&gt; new territory for me.<br>
&gt; For the test I used userdom_unpriv_user_template() and<br>
&gt; userdom_admin_user_template()<br>
&gt; interfaces to create the an unprivileged login role and an admin role.<br>
&gt; The first test policy module looked like the one below but without the call<br>
&gt; auth_run_chk_passwd()<br>
&gt; interface.<br>
&gt;<br>
&gt; In permissive mode I could login and verify with id -Z that I had the<br>
&gt; correct login role and type.<br>
&gt; I could use newrole to switch to the admin role and again verify that I<br>
&gt; received the correct<br>
&gt; role and type. I did not get any AVC denials when doing this.<br>
&gt;<br>
&gt; Now when I switched to enforcing mode I could login to the login role as<br>
&gt; before<br>
&gt; but when I ran newrole to switch to the admin role, newrole said<br>
&gt; &#39;incorrect password&#39; and failed&#39;<br>
&gt; but still no AVC denials.<br>
&gt; I traced newrole with strace and I could see that it failed trying to open<br>
&gt; /etc/shadow<br>
&gt;<br>
</div></div>newrole is not allowed to read /etc/shadow (dontaudited), It expects the use the pam_unix module in Fedora/RHEL which execs a helper app to read the shadow file.<br></blockquote><div>Hmm... strange that this did not work in my test environment, What is the name of the helper app? <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
&gt; When comparing centos54 interface for newrole in selinuxutil.if with<br>
&gt; corresponding<br>
&gt; interface in fedora12 (where I got a similar test working) I saw that the<br>
&gt; newrole interface in<br>
&gt; fedora12 called interfaces in authlogin.if  so I added similar calls in my<br>
&gt; module<br>
&gt; and then I got it working in enforcing mode too !<br>
&gt; Although I think the newrole interface in centos54 is kind of useless when<br>
&gt; it does not<br>
&gt; handle the authentication permissions internally :-(<br>
&gt;<br>
&gt; Now before I proceed with this project I would like to clear up my<br>
&gt; understanding of<br>
&gt; user domains so if anyone of you can answer these questions it would be much<br>
&gt; appreciated.<br>
&gt; The ultimate target environment for my project is a RedHat5 based server<br>
&gt; farm.<br>
&gt;<br>
</div>If you want to use confined users in RHEL5 you need to install the strict policy.   Targeted policy does not support confined users in RHEL5.  It does support them in RHEL6.<br>
<div class="im">&gt; - First of all is this the right way to do this kind of thing or am I<br>
&gt; completely on the wrong track?<br>
&gt;   Is the user domain support mature enough in redhat5 to be used in a<br>
&gt; production environment?<br>
</div>Depends on what you are trying to do.  If this is a server machine it will probably work ok,  if you want to have confined desktops, you will probably run into problems.<br></blockquote><div> </div>What I want to do is to create admin roles with permissions to administer only a sub-system or service<br>
without the full power of root.<br>
I do realize that the natural way to do this would be to start with the strict policy, but it is my understanding that the strict policy is not fully supported by RedHat and that disqualifies it from<br>being used in my target environment.<br>

My intension was to see if I could do something to gain a little bit of
the confined user security improvements even with the targeted policy while waiting for the release of RedHat 6.<br>
The sub-system administrators can have a login role that is unconfined, but when executing admin commands via sudo or similar they will transfer into an admin role within a confined domain while the command is executing under uid=0<br>

So I must have my own unconfined login domain for sub-administrators so that I can separate them from default unconfined domain.<br>
Does this make sense? I realize that RedHat support for this
environment might be questionable, but ideally I would only have to support my own additional policy modules myself instead of taking on the support for the full strict policy.<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
&gt;   If not I guess I have to wait for redhat6.<br>
&gt;<br>
</div>redhat6 should work well better with confined users.<br>
<div class="im">&gt; - Does anyone know how the feature transfer from Fedora to RedHat work?<br>
&gt;   How much of the selinux functionality existing in Fedora12 can we expect<br>
&gt; to appear in<br>
&gt;   RedHat 6 when it arrives?<br>
&gt;<br>
</div>All of it.<br></blockquote><div>Great! my problems will be solved then :-) <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">&gt; - A assume that the reason my first test failed in enforcing mode without<br>
&gt; any AVC denials was<br>
&gt;   because of some hidden don&#39;t audit rules in the interfaces I called.<br>
&gt;   Is there some way to turn off don&#39;t audit rules globally to trace these<br>
&gt; problems ?<br>
&gt;   (I tried semodule -DB although it is not listed as a valid option on<br>
&gt; centos54 semodule man<br>
&gt;    page, but the only effect it had was that it got the setroubleshootd<br>
&gt; constantly crashing)<br>
&gt;<br>
</div>semodule -DB does not exist in RHEL5.<br>
<div><div></div><div class="h5">&gt; Thanks,<br>
&gt; /leif<br>
&gt;<br>
&gt;<br>
&gt; Policy used in test below:<br>
&gt;<br>
&gt; policy_module(myadm, 1.0.0)<br>
&gt;<br>
&gt; require {<br>
&gt;         type unconfined_t;<br>
&gt;         type newrole_t;<br>
&gt;         type user_home_t;<br>
&gt;         type devpts_t;<br>
&gt;         type system_chkpwd_t;<br>
&gt; }<br>
&gt;<br>
&gt; # Create mystaff_r and mystaff_t<br>
&gt; userdom_unpriv_user_template(mystaff)<br>
&gt; allow mystaff_t user_home_t: file read;<br>
&gt; allow mystaff_t devpts_t:chr_file { read write ioctl };<br>
&gt;<br>
&gt; # Allow login daemon (sshd) to transition to mystaff_t<br>
&gt; allow unconfined_t mystaff_t:process transition;<br>
&gt;<br>
&gt; # Add &quot;mystaff_r:mystaff_t&quot; to /etc/selinux/targeted/<br>
&gt; contexts/default_type<br>
&gt;<br>
&gt; seutil_run_newrole(mystaff_t, mystaff_r, devpts_t)<br>
&gt;<br>
&gt; # There is a typo in the auth_run_chk_passwd() interface so we can&#39;t use it.<br>
&gt; # Lets do the work inline instead<br>
&gt; # Implement auth_run_chk_passwd(newrole_t, mystaff_r, devpts_t) inline:<br>
&gt; auth_domtrans_chk_passwd(newrole_t)<br>
&gt; role mystaff_r types system_chkpwd_t;<br>
&gt; allow system_chkpwd_t devpts_t:chr_file rw_file_perms;<br>
&gt; auth_run_upd_passwd(newrole_t, mystaff_r, devpts_t)<br>
&gt;<br>
&gt; # Create myadm_r and myadm_t<br>
&gt; userdom_admin_user_template(myadm)<br>
&gt;<br>
&gt; # Add &quot;myadm_r:myadm_t&quot; to /etc/selinux/targeted/contexts/default_type<br>
&gt;<br>
&gt; domain_transition_pattern(newrole_t, shell_exec_t, myadm_t)<br>
&gt; userdom_role_change_template(mystaff, myadm)<br>
&gt;<br>
&gt; # Create mystaff_u<br>
&gt; gen_user(mystaff_u, mystaff, mystaff_r myadm_r, s0, s0 - mls_systemhigh,<br>
&gt; mcs_allcats)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; --<br>
&gt; selinux mailing list<br>
&gt; <a href="mailto:selinux@lists.fedoraproject.org">selinux@lists.fedoraproject.org</a><br>
&gt; <a href="https://admin.fedoraproject.org/mailman/listinfo/selinux" target="_blank">https://admin.fedoraproject.org/mailman/listinfo/selinux</a><br>
<br>
</blockquote></div><br>