예제 #1
0
파일: __init__.py 프로젝트: rhatdan/selinux
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
예제 #2
0
파일: __init__.py 프로젝트: mgrepl/selinux
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
예제 #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))
예제 #4
0
파일: sepolicy.py 프로젝트: nirs/selinux
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))
예제 #5
0
파일: creator.py 프로젝트: sun7shines/Shell
 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
예제 #7
0
파일: sepolicy.py 프로젝트: mgrepl/selinux
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)))
예제 #8
0
파일: seboolean.py 프로젝트: likewg/DevOps
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
예제 #9
0
파일: sepolicy.py 프로젝트: rhatdan/selinux
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)))
예제 #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
예제 #11
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
    return booleans
예제 #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")
예제 #13
0
def get_all_booleans():
    global booleans
    if not booleans:
        booleans = selinux.security_get_boolean_names()[1]
    return booleans
예제 #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")
예제 #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
예제 #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