Thanks all for replies.<br>I have modified the policy by using the template userdom_unpriv_user_template() and everything is ok.<br>Talking about different labels for each home directory i'm not sure but if all users domains have access to the default type user_home_dir_t<br>
access control on files under /home will be based on DAC mechanism.<br>My effort is focused on trying to evaluate if it is possible with SELinux to protect files using as criteria for access decision the combination user identity-application-identity.<br>
For example i want to protect the user's private key allowing the access only to the program "ssh" ran by the user "user1".<br>In my policy i created the domain "user1_t" which is set by the login program when "user1" logs in the system. Then i called the interface ssh_basic_client_template(user1, user1_t, user1_r) which creates the derived domain user1_ssh_t at the time user1 executes the "ssh" command. The file $home/.ssh/id_rsa could be labeled with a unique label and a specific rule can be added to allow only the user1_ssh_t domain to read the key.<br>
Denying to users the ability to set security contexts, does this policy create a separation between the ssh application and the others ran by the same user?<br><br><br><br><br><br><br><br><div class="gmail_quote">On Tue, Sep 15, 2009 at 5:40 PM, Daniel J Walsh <span dir="ltr"><<a href="mailto:dwalsh@redhat.com">dwalsh@redhat.com</a>></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 09/15/2009 09:57 AM, Roberto Sassu wrote:<br>
> Hello all<br>
><br>
> i'm new to SELinux. I'm trying to create per-user domains in a system running<br>
> Fedora 11 with the targeted policy enabled. The reason for that is that i need<br>
> to create transitions to different domains when users start the same<br>
> application.<br>
> I followed these steps:<br>
> - written my custom policy module(posted as attachment) in order to create new<br>
> roles user1_r, user2_r with the default domains user1_t and user2_t;<br>
> - added to the system new selinux users user1_u and user2_u;<br>
> - added to the system the new linux users user1 and user2;<br>
> - associated user1 with user1_u and user2 with user2_u;<br>
> - labeled home directories respectively with types user1_home_t and<br>
> user2_home_t<br>
> - created the two files user1_u and user2_u in<br>
> /etc/selinux/targeted/contexts/users;<br>
><br>
> Then i tried to connect in local to the ssh server from root to the user1 but<br>
> it rejected the connection with this log messages (but no AVC warnings):<br>
><br>
> Sep 15 15:39:19 seclab05 sshd[5014]: Accepted password for user1 from ::1 port<br>
> 53163 ssh2<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: pam_selinux(sshd:session): conversation<br>
> failed<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: pam_selinux(sshd:session): No response to<br>
> query: Would you like to enter a security context? [N]<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: pam_selinux(sshd:session): Unable to get<br>
> valid context for user1<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: pam_unix(sshd:session): session opened<br>
> for user user1 by (uid=0)<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: error: PAM: pam_open_session():<br>
> Authentication failure<br>
> Sep 15 15:39:19 seclab05 sshd[5014]: error: ssh_selinux_setup_pty:<br>
> security_compute_relabel: Invalid argument<br>
><br>
> If putting the system in permissive mode the connection was successful but the<br>
> security context after login was: system_u:system_r:unconfined_t:s0-s0:c0.c1023<br>
> Any suggestions? Thanks in advance.<br>
><br>
><br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
<div class="im">><br>
> --<br>
> fedora-selinux-list mailing list<br>
> <a href="mailto:fedora-selinux-list@redhat.com">fedora-selinux-list@redhat.com</a><br>
> <a href="https://www.redhat.com/mailman/listinfo/fedora-selinux-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-selinux-list</a><br>
<br>
</div>You probably need to create /etc/selinux/targeted/context/user1 and user2<br>
<br>
Base these off of xguest<br>
<br>
I am not crazy about having home content variable between users, I think this is a waste of time.  Others disagree.<br>
<div><div></div><div class="h5"><br>
--<br>
fedora-selinux-list mailing list<br>
<a href="mailto:fedora-selinux-list@redhat.com">fedora-selinux-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-selinux-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-selinux-list</a><br>
</div></div></blockquote></div><br>