Esempio n. 1
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
        if util.PY3:
            booleans = [util.decode_input(x) for x in booleans]
    return booleans
Esempio n. 2
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
        if util.PY3:
            booleans = [util.decode_input(x) for x in booleans]
    return booleans
Esempio n. 3
0
def booleans(args):
    from sepolicy import boolean_desc
    if args.all:
        rc, args.booleans = selinux.security_get_boolean_names()
    args.booleans.sort()

    for b in args.booleans:
        print "%s=_(\"%s\")" % (b, boolean_desc(b))
Esempio n. 4
0
def booleans(args):
    from sepolicy import boolean_desc
    if args.all:
        rc, args.booleans = selinux.security_get_boolean_names()
    args.booleans.sort()

    for b in args.booleans:
        print "%s=_(\"%s\")" % (b, boolean_desc(b))
Esempio n. 5
0
 def __getbooleans(self):
     booleans = []
     if not kickstart.selinux_enabled(self.ks) or not os.path.exists("/selinux/enforce"):
         return booleans
     for i in  selinux.security_get_boolean_names()[1]:
         on = selinux.security_get_boolean_active(i)
         booleans.append(("/booleans/%s" % i, "%d %d" % (on, on)))
     return booleans
def has_boolean_value(module, name):
    bools = []
    try:
        rc, bools = selinux.security_get_boolean_names()
    except OSError:
        module.fail_json(msg="Failed to get list of boolean names")
    if name in bools:
        return True
    else:
        return False
Esempio n. 7
0
def booleans(args):
    from sepolicy import boolean_desc
    if args.all:
        rc, args.booleans = selinux.security_get_boolean_names()
        if util.PY3:
            args.booleans = [util.decode_input(x) for x in args.booleans]
    args.booleans.sort()

    for b in args.booleans:
        print("%s=_(\"%s\")" % (b, boolean_desc(b)))
Esempio n. 8
0
def has_boolean_value(module, name):
    bools = []
    try:
        rc, bools = selinux.security_get_boolean_names()
    except OSError:
        module.fail_json(msg="Failed to get list of boolean names")
    if to_bytes(name) in bools:
        return True
    else:
        return False
Esempio n. 9
0
def booleans(args):
    from sepolicy import boolean_desc
    if args.all:
        rc, args.booleans = selinux.security_get_boolean_names()
        if util.PY3:
            args.booleans = [util.decode_input(x) for x in args.booleans]
    args.booleans.sort()

    for b in args.booleans:
        print("%s=_(\"%s\")" % (b, boolean_desc(b)))
Esempio n. 10
0
def has_boolean_value(module, name):
    bools = []
    try:
        rc, bools = selinux.security_get_boolean_names()
    except OSError:
        module.fail_json(msg="Failed to get list of boolean names")
    # work around for selinux who changed its API, see
    # https://github.com/ansible/ansible/issues/25651
    if len(bools) > 0:
        if isinstance(bools[0], binary_type):
            name = to_bytes(name)
    if name in bools:
        return True
    else:
        return False
Esempio n. 11
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
    return booleans
Esempio n. 12
0
def has_boolean_value(module, name):
    bools = []
    try:
        rc, bools = selinux.security_get_boolean_names()
    except OSError, e:
        module.fail_json(msg="Failed to get list of boolean names")
Esempio n. 13
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
    return booleans
Esempio n. 14
0
def has_boolean_value(module, name):
    bools = []
    try:
        rc, bools = selinux.security_get_boolean_names()
    except OSError, e:
        module.fail_json(msg="Failed to get list of boolean names")
Esempio n. 15
0
from setroubleshoot.util import *
se_plugins = {} 
plugins = load_plugins()
for p in plugins:
    se_plugins[p.analysis_id.split(".")[1]] = p

fd = open("/usr/share/system-config-selinux/selinux.tbl")
booll = fd.readlines()
fd.close()
booldict={}
for l in booll:
    temp = l.split(' _("')
    if len(temp) > 1:
        booldict[temp[0].strip()] = [ temp[1].strip('")'), temp[2].strip('")\n') ]

booleans = selinux.security_get_boolean_names()
for b in booleans[1]:
    try:
        se_plugins[p.analysis_id.split(".")[1]] = p
        rec = "<boolean>\n<name>%s</name>\n" % b
        if b in booldict:
            rec += "<description>%s</description>\n" % booldict[b][1]
            rec += "<category>%s</category>\n" % booldict[b][0]
        if b in se_plugins:
            rec += setroubleshoot_print(se_plugins[b])
        rec += "</boolean>"
        print rec
    except:
        raise
        pass
Esempio n. 16
0
plugins = load_plugins()
for p in plugins:
    se_plugins[p.analysis_id.split(".")[1]] = p

fd = open("/usr/share/system-config-selinux/selinux.tbl")
booll = fd.readlines()
fd.close()
booldict = {}
for l in booll:
    temp = l.split(' _("')
    if len(temp) > 1:
        booldict[temp[0].strip()] = [
            temp[1].strip('")'), temp[2].strip('")\n')
        ]

booleans = selinux.security_get_boolean_names()
for b in booleans[1]:
    try:
        se_plugins[p.analysis_id.split(".")[1]] = p
        rec = "<boolean>\n<name>%s</name>\n" % b
        if b in booldict:
            rec += "<description>%s</description>\n" % booldict[b][1]
            rec += "<category>%s</category>\n" % booldict[b][0]
        if b in se_plugins:
            rec += setroubleshoot_print(se_plugins[b])
        rec += "</boolean>"
        print rec
    except:
        raise
        pass