All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Joshua Brindle <jbrindle@tresys.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: Re: rawhide targeted vs. refpolicy rpm
Date: Mon, 14 Nov 2005 13:27:05 -0500	[thread overview]
Message-ID: <4378D6F9.5070301@redhat.com> (raw)
In-Reply-To: <4378C285.3080005@tresys.com>

Joshua Brindle wrote:
> Daniel J Walsh wrote:
>> policycoreutils patch to genhomedircon to use libsemanage to read 
>> seusers file.
>>
>>
> <snip>
>>  
>>  class selinuxConfig:
>>      def __init__(self, selinuxdir="/etc/selinux", type="targeted", 
>> usepwd=1):
>> +        self.semanageHandle=semanage_handle_create()
>> +        self.semanaged=semanage_is_managed(self.semanageHandle)
>> +        if self.semanaged:
>> +            semanage_connect(self.semanageHandle)
>> +            (status, self.ulist, self.usize) = 
>> semanage_user_list(self.semanageHandle)
>>          self.type=type
>>          self.selinuxdir=selinuxdir +"/"
>>          self.contextdir="/contexts"
>> @@ -313,47 +142,72 @@
>>              errorExit(string.join("sed error ", rc[1]))
>>  
>>      def getUsersFile(self):
>> -        return self.selinuxdir+self.type+"/users/local.users"
>> +        if self.semanaged:
>> +            return self.selinuxdir+self.type+"module/active/seusers"
> Why should this return a path at all in the managed case? 
> genhomedircon (or any semanage user) can't make an assumption that a 
> particular path is used, accessible or even on the same computer.
Ok I guess we could throw an exception.
>
>> +        else:
>> +            return self.selinuxdir+self.type+"/seusers"
>>  
>> -    def getSystemUsersFile(self):
>> -        return self.selinuxdir+self.type+"/users/system.users"
>> -       
>>      def heading(self):
>>          ret = "\n#\n#\n# User-specific file contexts, generated via 
>> %s\n" % sys.argv[0]
>>          ret += "# edit %s to change file_context\n#\n#\n" % 
>> self.getUsersFile()
>>          return ret
>>  
>> +
>> +    def defaultrole(self, name):
>> +        for idx in range(self.usize):
>> +            user = semanage_user_by_idx(self.ulist, idx)
>> +            if semanage_user_get_name(user) == name:
>> +                role=semanage_user_get_defrole(user)
>> +                if role=="system_r":
>> +                    # targeted policy
>> +                    return "user_r"
> I don't understand this case. Why wouldn't user_get_defrole return 
> user_r in the targeted case?
>
user_r is not defined in targeted policy.  Everything runs in one role 
system_r.  Problem is we don't use system_home_t.
>> +                else:
>> +                    return  role
>> +        return name
>> +    def adduser(self, udict, user, seuser, role):
>> +        try:
>> +            if seuser == "user_u" or user == "__default__":
>> +                return
>> +            # !!! chooses first role in the list to use in the file 
>> context !!!
> or what semanage considers the default role, right?
>
>> +            if role[-2:] == "_r" or role[-2:] == "_u":
>> +                role = role[:-2]
>> +            home = pwd.getpwnam(user)[5]
>> +            if home == "/":
>> +                return
>> +            prefs = {}
>> +            prefs["role"] = role
>> +            prefs["home"] = home
>> +            udict[seuser] = prefs
>> +        except KeyError:
>> +            sys.stderr.write("The user \"%s\" is not present in the 
>> passwd file, skipping...\n" % user)
>> +
> <snip>
>


-- 



--
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.

  reply	other threads:[~2005-11-14 18:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BF9A263D.7FFA%csellers@tresys.com>
     [not found] ` <4374BDEC.4050600@redhat.com>
     [not found]   ` <200511111717.16542.csellers@tresys.com>
     [not found]     ` <200511141041.49643.csellers@tresys.com>
     [not found]       ` <1131983537.5415.137.camel@moss-spartans.epoch.ncsc.mil>
2005-11-14 16:17         ` rawhide targeted vs. refpolicy rpm Daniel J Walsh
2005-11-14 16:51           ` Stephen Smalley
2005-11-14 18:23             ` Daniel J Walsh
2005-11-14 19:32               ` Stephen Smalley
2005-11-15 13:23                 ` Stephen Smalley
2005-11-14 16:59           ` Joshua Brindle
2005-11-14 18:27             ` Daniel J Walsh [this message]
2005-11-14 19:37               ` Stephen Smalley
2005-11-15 11:17                 ` Stephen Smalley
2005-11-15 13:40                   ` Stephen Smalley
2005-11-15 14:44                     ` Daniel J Walsh
2005-11-15 14:57                       ` Stephen Smalley
2005-11-15 15:10                         ` Stephen Smalley
2005-11-15 15:18                           ` Stephen Smalley
2005-11-15 19:03                             ` Stephen Smalley
2005-11-15 19:28                               ` Joshua Brindle
2005-11-16 13:12                                 ` Stephen Smalley
2005-11-15 19:50                               ` Ivan Gyurdiev
2005-11-16 13:11                                 ` Stephen Smalley
2005-11-16 13:42                                   ` Ivan Gyurdiev
2005-11-16 13:42                                     ` Stephen Smalley
2005-11-16 14:08                                       ` Ivan Gyurdiev
2005-11-16 14:14                                         ` Stephen Smalley
2005-11-16 14:27                                           ` Ivan Gyurdiev
2005-11-16 14:26                                             ` Stephen Smalley
2005-11-16 14:47                                               ` Ivan Gyurdiev
2005-11-16 14:53                                                 ` Ivan Gyurdiev
2005-11-14 17:28           ` Ivan Gyurdiev
2005-11-14 18:09         ` I have modified Joshua's libsemanage-swigify patch to work better in my spec file Daniel J Walsh
2005-11-15 13:21           ` Stephen Smalley

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=4378D6F9.5070301@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=jbrindle@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.