selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* MLS dominance check behavior on el7
@ 2018-09-10 17:13 Ted Toth
  2018-09-10 17:47 ` Stephen Smalley
  0 siblings, 1 reply; 27+ messages in thread
From: Ted Toth @ 2018-09-10 17:13 UTC (permalink / raw)
  To: SELinux

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

We currently have code running on el6 that does a MLS dominance check by
calling security_compute_av_raw with the security object class
SECCLASS_CONTEXT with permission CONTEXT__CONTAINS as you can see in the
python code below. When I run this code on el6 s1 dominates s0 however when
I run the same code on el7 s1 does not dominate s0. On both systems the
file read dominance check works as expected. Can anyone help me understand
why the context contains check does not work the same on both systems?

Ted

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

import selinux

SECCLASS_CONTEXT = selinux.string_to_security_class("context")
CONTEXT__CONTAINS = selinux.string_to_av_perm(SECCLASS_CONTEXT, "contains")
SECCLASS_FILE = selinux.string_to_security_class("file")
FILE__READ = selinux.string_to_av_perm(SECCLASS_FILE, "read")

raw_con1 = "user_u:user_r:user_t:s1"
raw_con2 = "user_u:user_r:user_t:s0"

avd = selinux.av_decision()
selinux.avc_reset()
try:
    rc = selinux.security_compute_av_raw(raw_con1, raw_con2,
SECCLASS_CONTEXT, CONTEXT__CONTAINS, avd)
    if rc < 0:
        print("selinux.security_compute_av_raw failed for %s %s" %
(raw_con1, raw_con2))
    if (avd.allowed & CONTEXT__CONTAINS) == CONTEXT__CONTAINS:
        print("%s dominates %s" % (raw_con1, raw_con2))
    else:
        print("%s does not dominate %s" % (raw_con1, raw_con2))
except OSError, ex:
    print "exception calling selinux.security_compute_av_raw", ex

avd = selinux.av_decision()
selinux.avc_reset()
try:
    rc = selinux.security_compute_av_raw(raw_con1, raw_con2, SECCLASS_FILE,
FILE__READ, avd)
    if rc < 0:
        print("selinux.security_compute_av_raw failed for %s %s" %
(raw_con1, raw_con2))
    if (avd.allowed & FILE__READ) == FILE__READ:
        print("%s dominates %s" % (raw_con1, raw_con2))
    else:
        print("%s does not dominate %s" % (raw_con1, raw_con2))

except OSError:
    print "exception calling selinux.security_compute_av_raw", ex

[-- Attachment #2: Type: text/html, Size: 2825 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2018-10-09  2:37 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 17:13 MLS dominance check behavior on el7 Ted Toth
2018-09-10 17:47 ` Stephen Smalley
2018-09-10 18:19   ` Ted Toth
2018-09-10 22:30     ` Ted Toth
2018-09-11 14:41       ` Stephen Smalley
2018-09-11 16:53         ` Joshua Brindle
2018-09-11 17:33           ` Stephen Smalley
2018-09-11 17:39             ` Joshua Brindle
2018-09-11 18:21               ` Stephen Smalley
2018-09-11 18:29         ` Stephen Smalley
2018-09-11 18:49           ` Ted Toth
2018-09-11 18:55             ` Yuli Khodorkovskiy
2018-09-11 19:29             ` Stephen Smalley
2018-09-11 19:43               ` Stephen Smalley
2018-09-11 20:59               ` Ted Toth
2018-09-12 13:05                 ` Stephen Smalley
2018-09-12 13:26                   ` Ted Toth
2018-09-12 13:57                     ` Stephen Smalley
2018-09-12 14:36                       ` Dominick Grift
2018-09-12 14:57                         ` Ted Toth
2018-09-14 21:18                           ` Ted Toth
2018-09-15  6:08                             ` Dominick Grift
2018-09-11 19:04           ` Joe Nall
2018-09-11 20:20             ` Stephen Smalley
2018-09-30 14:43               ` Chris PeBenito
     [not found]                 ` <6e21676a-249d-8b05-dd9f-09a3671f46f7@tycho.nsa.gov>
2018-10-05 20:05                   ` Chris PeBenito
2018-10-09  2:37                     ` Chad Hanson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).