lkml.org 
[lkml]   [2007]   [Dec]   [19]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 18 Dec 2007 21:39:33 -0800 (PST)
FromCasey Schaufler <>
SubjectRe: [PATCH 08/28] SECURITY: Allow kernel services to override LSM settings for task actions [try #2]

--- Crispin Cowan <crispin@crispincowan.com> wrote:
> Stephen Smalley wrote:
> >> It is if I have to maintain a special pieces of code for each possible
> LSM.
> >> One piece for SELinux, one piece for AppArmour, one piece for Smack, one
> piece
> >> for Casey's security system. That sounds like a pain.

It's probably less of a pain if you consider that Casey's
security scheme is Smack.

> > All your code has to do is invoke a function provided by libselinux. If
> > at some later time a liblsm is introduced that provides a common
> > front-end to a libselinux, libsmack, ..., then you can use that. But it
> > doesn't exist today. But it all just becomes a simple function call
> > regardless.
> >
> libapparmor exists. It only had one API, and now it has 2, but just 2
> versions on the same concept (change_hat and change_profile).
>
> This is the API for change_hat http://man-wiki.net/index.php/2:change_hat
>
> What does the corresponding API in SELinux look like?

The POSIX mac_set_proc(mac_t label) might work for this interface.
Sets the current process MAC attribute, if appropriate. The Smack
implementation would be pretty easy:

typedef char * mac_t;

int mac_set_proc(mac_t label)
{
int fd;
int rc;
rc = strlen(label);
if (rc > SMACK_MAX_LABEL_LEN)
return -1;
fd = open("/proc/self/attr/current", O_RDWR);
if (fd < 0)
return -1;
rc = write(fd, label, rc);
close(fd);
if (rc < 0)
return -1;
return 0;
}

Casey Schaufler
casey@schaufler-ca.com


\
 
 \ /
  Last update: 2007-12-19 06:43    [from the cache]
©2003-2009