All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Walters <walters@verbum.org>
To: jsingh@ensim.com
Cc: SELinux@tycho.nsa.gov
Subject: Re: writing rules to disallow a domain to read particular files
Date: Sun, 17 Oct 2004 12:35:22 -0400	[thread overview]
Message-ID: <1098030922.15741.20.camel@x-infinity.verbum.private> (raw)
In-Reply-To: <1098017660.2740.33.camel@jsingh.india.ensim.com>

[-- Attachment #1: Type: text/plain, Size: 3377 bytes --]

On Sun, 2004-10-17 at 18:24 +0530, Jaspreet Singh wrote:

> The higher goal is to support (site) virtualization e.g.
> 
> apart from /home/users I want to have /home/virtual/siteNum/home/users
> 
> and now based on the access writes of users of a particular site I want
> them to access services like apache. so that apache cant access
> /home/virtual/siteNum/home/users/public_html/files.html

I think I see.  Ok.  There are two broad approaches.  First is to go
with full_user_role for each user.  Let's say that you have three users:
jaspreet, bob, and manoj.  You have three sites: foocom, barcom, bazcom.
You want jaspreet to have control over foocom and barcom, bob to control
barcom, and manoj to control foocom and bazcom.

macros/program/apache_macros.te:
define(`httpd_virtual_subdomain',`
type httpd_$1_content_t, file_type, sysadmfile;
r_dir_file(httpd_t, httpd_$1_content_t)
# Also may want to define types for CGI scripts, etc here
')

define(`user_virtual_access',`
rw_dir_create_file($1, httpd_$2_content_t)
allow $1_t httpd_$2_content_t:{ file lnk_file } { relablelfrom relabelto };
')

domains/misc/local.te:
full_user_role(jaspreet)
full_user_role(bob)
full_user_role(manoj)
httpd_virtual_subdomain(foocom)
httpd_virtual_subdomain(barcom)
httpd_virtual_subdomain(bazcom)
user_virtual_access(jaspreet_t, foocom)
user_virtual_access(jaspreet_t, barcom)
user_virtual_access(bob_t, barcom)
user_virtual_access(manoj_t, foocom)
user_virtual_access(manoj_t, bazcom)

users.te:

user jaspreet roles { jaspreet_t };
user bob roles { bob_t };
user manoj roles { manoj_t };

That should do the trick.

> But, this would be computationally more complex to something like a role
> based approach.

Right, so the second approach would be:

domains/misc/local.te:
full_user_role(foocom_webmaster)
full_user_role(barcom_webmaster)
full_user_role(bazcom_webmaster)

users.te:

user jaspreet roles { foocom_webmaster_t barcom_webmaster_t };
user bob roles { barcom_webmaster_t };
user manoj roles { foocom_webmaster_t bazcom_webmaster_t };

This is a lot simpler from the policy side, but your users will have to
be aware of newrole.

> Now, I know only login method can assign roles , so what about the
> non-login sessions ???

You can use newrole to change between allowed roles, for example:
$ id
uid=500(jaspreet) gid=500(jaspreet) groups=500(jaspreet) context=jaspreet_u:foocom_webmaster_r:foocom_webmaster_t
$ $EDITOR /home/virtual/foocom/jaspreet/hi.html
$ newrole -r barcom_webmaster_t
Password for jaspreet: xxxxx
$ id
uid=500(jaspreet) gid=500(jaspreet) groups=500(jaspreet) context=jaspreet_u:barcom_webmaster_r:foocom_webmaster_t
$ $EDITOR /home/virtual/barcom/jaspreet/hi.html

> and one more thing which came to my mind was (may be irrelevent to the
> context) ... What if I "mount  --bind" contents of a directory to
> multiple places and give different file tags to the different mount
> points .. will the selinux system work properly in this scenario ( coz
> it wont in case of LIDS which rely upon ACLs)

During initial file labeling, SELinux ignores bind mounts.  Because it
labels the actual inodes instead of attempting to use runtime pathname-
based access, it doesn't matter if a program traverses to an inode via a
bind mount, it still has the same label.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-10-17 16:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-16 15:21 writing rules to disallow a domain to read particular files Jaspreet Singh
2004-10-16 17:40 ` Colin Walters
2004-10-17 12:54   ` Jaspreet Singh
2004-10-17 14:14     ` Luke Kenneth Casson Leighton
2004-10-17 14:31       ` Jaspreet Singh
2004-10-17 15:01         ` Luke Kenneth Casson Leighton
2004-10-17 17:16           ` Chris Kuethe
2004-10-17 16:35     ` Colin Walters [this message]
2004-10-18  7:58       ` Jaspreet Singh
2004-10-18 13:18         ` Colin Walters
2004-10-18 15:38           ` Karl MacMillan
2004-10-18  9:41       ` Jaspreet Singh
2004-10-18 13:22         ` Stephen Smalley
2004-10-16 19:39 ` Luke Kenneth Casson Leighton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1098030922.15741.20.camel@x-infinity.verbum.private \
    --to=walters@verbum.org \
    --cc=SELinux@tycho.nsa.gov \
    --cc=jsingh@ensim.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.