Rename libapol package to setools.

This commit is contained in:
Chris PeBenito 2014-10-24 21:23:13 -04:00
parent 580ccf880e
commit 109ba68a92
60 changed files with 69 additions and 70 deletions

4
.gitignore vendored
View File

@ -2,6 +2,6 @@
/setools.egg-info /setools.egg-info
*.pyc *.pyc
*.pyo *.pyo
libapol/policyrep/qpol_wrap.c setools/policyrep/qpol_wrap.c
libapol/policyrep/qpol.py setools/policyrep/qpol.py
*.so *.so

2
README
View File

@ -57,7 +57,7 @@ and perform the following:
$ python setup.py install $ python setup.py install
This will put the applications in /usr/bin, data files in /usr/share/setools, This will put the applications in /usr/bin, data files in /usr/share/setools,
and libraries in /usr/lib/pythonX.Y/site-packages/libapol. and libraries in /usr/lib/pythonX.Y/site-packages/setools.
2.2. setup.py flags 2.2. setup.py flags

View File

@ -2,5 +2,4 @@ Warning:
SETools 4.0 is still in early development. The API, classes, package names, SETools 4.0 is still in early development. The API, classes, package names,
etc. should be considered unstable, and should not be used for external etc. should be considered unstable, and should not be used for external
applications yet. Of particular note, the libapol package will be applications yet.
renamed to setools once the SETools 3.3 dependency is eliminated.

8
sedta
View File

@ -21,7 +21,7 @@ from __future__ import print_function
import sys import sys
import argparse import argparse
import libapol import setools
def print_transition(trans, entrypoints, setexec, dyntrans, setcur): def print_transition(trans, entrypoints, setexec, dyntrans, setcur):
@ -68,7 +68,7 @@ def print_transition(trans, entrypoints, setexec, dyntrans, setcur):
parser = argparse.ArgumentParser(description="SELinux policy domain transition analysis tool.", parser = argparse.ArgumentParser(description="SELinux policy domain transition analysis tool.",
epilog="If no analysis algorithm is selected, all transitions out of a domain will be calculated.") epilog="If no analysis algorithm is selected, all transitions out of a domain will be calculated.")
parser.add_argument("--version", action="version", version=libapol.__version__) parser.add_argument("--version", action="version", version=setools.__version__)
parser.add_argument( parser.add_argument(
"-p", "--policy", help="Path to SELinux policy to analyze.", required=True) "-p", "--policy", help="Path to SELinux policy to analyze.", required=True)
parser.add_argument( parser.add_argument(
@ -90,8 +90,8 @@ if not args.target and (args.shortest_path or args.all_paths):
parser.error("The target type must be specified to determine a path.") parser.error("The target type must be specified to determine a path.")
try: try:
p = libapol.SELinuxPolicy(args.policy) p = setools.SELinuxPolicy(args.policy)
g = libapol.dta.DomainTransitionAnalysis(p) g = setools.dta.DomainTransitionAnalysis(p)
except Exception as err: except Exception as err:
print(err) print(err)
sys.exit(1) sys.exit(1)

34
seinfo
View File

@ -18,13 +18,13 @@
# #
from __future__ import print_function from __future__ import print_function
import libapol import setools
import argparse import argparse
import sys import sys
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="SELinux policy information tool.") description="SELinux policy information tool.")
parser.add_argument("--version", action="version", version=libapol.__version__) parser.add_argument("--version", action="version", version=setools.__version__)
parser.add_argument("policy", help="Path to the SELinux policy to query.") parser.add_argument("policy", help="Path to the SELinux policy to query.")
parser.add_argument( parser.add_argument(
"-x", "--expand", help="Print additional information about the specified components.", action="store_true") "-x", "--expand", help="Print additional information about the specified components.", action="store_true")
@ -68,16 +68,16 @@ queries.add_argument("--polcap", help="Print policy capabilities.",
args = parser.parse_args() args = parser.parse_args()
try: try:
p = libapol.SELinuxPolicy(args.policy) p = setools.SELinuxPolicy(args.policy)
except RuntimeError as err: except RuntimeError as err:
print(err) print(err)
sys.exit(-1) sys.exit(-1)
if args.typequery: if args.typequery:
if isinstance(args.typequery, str): if isinstance(args.typequery, str):
q = libapol.typequery.TypeQuery(p, args.typequery) q = setools.typequery.TypeQuery(p, args.typequery)
else: else:
q = libapol.typequery.TypeQuery(p) q = setools.typequery.TypeQuery(p)
for t in sorted(q.results()): for t in sorted(q.results()):
if args.expand: if args.expand:
@ -87,9 +87,9 @@ if args.typequery:
if args.boolquery: if args.boolquery:
if isinstance(args.boolquery, str): if isinstance(args.boolquery, str):
q = libapol.boolquery.BoolQuery(p, args.boolquery) q = setools.boolquery.BoolQuery(p, args.boolquery)
else: else:
q = libapol.boolquery.BoolQuery(p) q = setools.boolquery.BoolQuery(p)
for b in sorted(q.results()): for b in sorted(q.results()):
if args.expand: if args.expand:
@ -99,9 +99,9 @@ if args.boolquery:
if args.polcapquery: if args.polcapquery:
if isinstance(args.polcapquery, str): if isinstance(args.polcapquery, str):
q = libapol.polcapquery.PolCapQuery(p, args.polcapquery) q = setools.polcapquery.PolCapQuery(p, args.polcapquery)
else: else:
q = libapol.polcapquery.PolCapQuery(p) q = setools.polcapquery.PolCapQuery(p)
for cap in sorted(q.results()): for cap in sorted(q.results()):
if args.expand: if args.expand:
@ -111,9 +111,9 @@ if args.polcapquery:
if args.userquery: if args.userquery:
if isinstance(args.userquery, str): if isinstance(args.userquery, str):
q = libapol.userquery.UserQuery(p, args.userquery) q = setools.userquery.UserQuery(p, args.userquery)
else: else:
q = libapol.userquery.UserQuery(p) q = setools.userquery.UserQuery(p)
for u in sorted(q.results()): for u in sorted(q.results()):
if args.expand: if args.expand:
@ -123,9 +123,9 @@ if args.userquery:
if args.rolequery: if args.rolequery:
if isinstance(args.rolequery, str): if isinstance(args.rolequery, str):
q = libapol.rolequery.RoleQuery(p, args.rolequery) q = setools.rolequery.RoleQuery(p, args.rolequery)
else: else:
q = libapol.rolequery.RoleQuery(p) q = setools.rolequery.RoleQuery(p)
for r in sorted(q.results()): for r in sorted(q.results()):
if args.expand: if args.expand:
@ -135,9 +135,9 @@ if args.rolequery:
if args.classquery: if args.classquery:
if isinstance(args.classquery, str): if isinstance(args.classquery, str):
q = libapol.objclassquery.ObjClassQuery(p, args.classquery) q = setools.objclassquery.ObjClassQuery(p, args.classquery)
else: else:
q = libapol.objclassquery.ObjClassQuery(p) q = setools.objclassquery.ObjClassQuery(p)
for c in sorted(q.results()): for c in sorted(q.results()):
if args.expand: if args.expand:
@ -147,9 +147,9 @@ if args.classquery:
if args.initialsidquery: if args.initialsidquery:
if isinstance(args.initialsidquery, str): if isinstance(args.initialsidquery, str):
q = libapol.initsidquery.InitialSIDQuery(p, args.initialsidquery) q = setools.initsidquery.InitialSIDQuery(p, args.initialsidquery)
else: else:
q = libapol.initsidquery.InitialSIDQuery(p) q = setools.initsidquery.InitialSIDQuery(p)
for i in sorted(q.results()): for i in sorted(q.results()):
if args.expand: if args.expand:

View File

@ -18,13 +18,13 @@
# #
from __future__ import print_function from __future__ import print_function
import libapol import setools
import argparse import argparse
import sys import sys
parser = argparse.ArgumentParser(description="SELinux policy information flow analysis tool.", parser = argparse.ArgumentParser(description="SELinux policy information flow analysis tool.",
epilog="If no analysis algorithm is selected, all information flow out of the source domain will be calculated.") epilog="If no analysis algorithm is selected, all information flow out of the source domain will be calculated.")
parser.add_argument("--version", action="version", version=libapol.__version__) parser.add_argument("--version", action="version", version=setools.__version__)
parser.add_argument("--stats", action="store_true", parser.add_argument("--stats", action="store_true",
help="Display statistics at the end of the analysis.") help="Display statistics at the end of the analysis.")
@ -61,8 +61,8 @@ if args.limit_flows < 0:
parser.error("Limit on information flows cannot be negative.") parser.error("Limit on information flows cannot be negative.")
try: try:
p = libapol.SELinuxPolicy(args.policy) p = setools.SELinuxPolicy(args.policy)
g = libapol.infoflow.InfoFlowAnalysis( g = setools.infoflow.InfoFlowAnalysis(
p, args.map, minweight=args.min_weight, exclude=args.exclude) p, args.map, minweight=args.min_weight, exclude=args.exclude)
except Exception as err: except Exception as err:
print(err) print(err)

View File

@ -18,13 +18,13 @@
# #
from __future__ import print_function from __future__ import print_function
import libapol import setools
import argparse import argparse
import sys import sys
parser = argparse.ArgumentParser(description="SELinux policy rule search tool.", parser = argparse.ArgumentParser(description="SELinux policy rule search tool.",
epilog="TE/MLS rule searches cannot be mixed with RBAC rule searches.") epilog="TE/MLS rule searches cannot be mixed with RBAC rule searches.")
parser.add_argument("--version", action="version", version=libapol.__version__) parser.add_argument("--version", action="version", version=setools.__version__)
parser.add_argument( parser.add_argument(
"policy", type=str, help="Path to the SELinux policy to search.") "policy", type=str, help="Path to the SELinux policy to search.")
@ -93,13 +93,13 @@ if (args.tertypes or args.mlsrtypes) and args.rbacrtypes:
"TE/MLS rule searches cannot be mixed with RBAC rule searches.") "TE/MLS rule searches cannot be mixed with RBAC rule searches.")
try: try:
p = libapol.SELinuxPolicy(args.policy) p = setools.SELinuxPolicy(args.policy)
except RuntimeError as err: except RuntimeError as err:
print(err) print(err)
sys.exit(-1) sys.exit(-1)
if args.tertypes: if args.tertypes:
q = libapol.terulequery.TERuleQuery(p, ruletype=args.tertypes, q = setools.terulequery.TERuleQuery(p, ruletype=args.tertypes,
source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex, source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex, target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
tclass_regex=args.tclass_regex, perms_equal=args.perms_equal, tclass_regex=args.tclass_regex, perms_equal=args.perms_equal,
@ -120,7 +120,7 @@ if args.tertypes:
print(r) print(r)
if args.rbacrtypes: if args.rbacrtypes:
q = libapol.rbacrulequery.RBACRuleQuery(p, ruletype=args.rbacrtypes, q = setools.rbacrulequery.RBACRuleQuery(p, ruletype=args.rbacrtypes,
source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex, source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex, target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
default=args.default, default_regex=args.default_regex, default=args.default, default_regex=args.default_regex,
@ -138,7 +138,7 @@ if args.rbacrtypes:
print(r) print(r)
if args.mlsrtypes: if args.mlsrtypes:
q = libapol.mlsrulequery.MLSRuleQuery(p, ruletype=args.mlsrtypes, q = setools.mlsrulequery.MLSRuleQuery(p, ruletype=args.mlsrtypes,
source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex, source=args.source, source_indirect=args.source_indirect, source_regex=args.source_regex,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex, target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
tclass_regex=args.tclass_regex) tclass_regex=args.tclass_regex)

View File

@ -8,8 +8,8 @@ from distutils.core import Extension
# using the following commands: # using the following commands:
# bison -y -d policy_parse.y -o policy_parse.c # bison -y -d policy_parse.y -o policy_parse.c
# flex -o policy_scan.c policy_scan.l # flex -o policy_scan.c policy_scan.l
ext_py_mods=[Extension('libapol.policyrep._qpol', ext_py_mods=[Extension('setools.policyrep._qpol',
['libapol/policyrep/qpol.i', ['setools/policyrep/qpol.i',
'libqpol/avrule_query.c', 'libqpol/avrule_query.c',
'libqpol/bool_query.c', 'libqpol/bool_query.c',
'libqpol/bounds_query.c', 'libqpol/bounds_query.c',
@ -58,7 +58,7 @@ setup(name='setools',
author='Tresys Technology, LLC', author='Tresys Technology, LLC',
author_email='setools@tresys.com', author_email='setools@tresys.com',
url='https://github.com/TresysTechnology/setools', url='https://github.com/TresysTechnology/setools',
packages=['libapol', 'libapol.policyrep'], packages=['setools', 'setools.policyrep'],
scripts = ['seinfo', 'seinfoflow', 'sesearch', 'sedta'], scripts = ['seinfo', 'seinfoflow', 'sesearch', 'sedta'],
data_files=[('/usr/share/setools', ['data/perm_map'])], data_files=[('/usr/share/setools', ['data/perm_map'])],
ext_modules=ext_py_mods, ext_modules=ext_py_mods,

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.boolquery import BoolQuery from setools.boolquery import BoolQuery
class BoolQueryTest(unittest.TestCase): class BoolQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.commonquery import CommonQuery from setools.commonquery import CommonQuery
class CommonQueryTest(unittest.TestCase): class CommonQueryTest(unittest.TestCase):

View File

@ -19,9 +19,9 @@ import unittest
import networkx as nx import networkx as nx
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.dta import DomainTransitionAnalysis from setools.dta import DomainTransitionAnalysis
from libapol.policyrep.rule import RuleNotConditional from setools.policyrep.rule import RuleNotConditional
class InfoFlowAnalysisTest(unittest.TestCase): class InfoFlowAnalysisTest(unittest.TestCase):

View File

@ -19,10 +19,10 @@ import unittest
import networkx as nx import networkx as nx
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.infoflow import InfoFlowAnalysis from setools.infoflow import InfoFlowAnalysis
from libapol.permmap import PermissionMap from setools.permmap import PermissionMap
from libapol.policyrep.rule import RuleNotConditional from setools.policyrep.rule import RuleNotConditional
class InfoFlowAnalysisTest(unittest.TestCase): class InfoFlowAnalysisTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.initsidquery import InitialSIDQuery from setools.initsidquery import InitialSIDQuery
class InitialSIDQueryTest(unittest.TestCase): class InitialSIDQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.objclassquery import ObjClassQuery from setools.objclassquery import ObjClassQuery
class ObjClassQueryTest(unittest.TestCase): class ObjClassQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.permissivequery import PermissiveQuery from setools.permissivequery import PermissiveQuery
class PolCapQueryTest(unittest.TestCase): class PolCapQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.polcapquery import PolCapQuery from setools.polcapquery import PolCapQuery
class PolCapQueryTest(unittest.TestCase): class PolCapQueryTest(unittest.TestCase):

View File

@ -17,9 +17,9 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.rbacrulequery import RBACRuleQuery from setools.rbacrulequery import RBACRuleQuery
from libapol.policyrep.rule import InvalidRuleUse, RuleNotConditional from setools.policyrep.rule import InvalidRuleUse, RuleNotConditional
class RBACRuleQueryTest(unittest.TestCase): class RBACRuleQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.rolequery import RoleQuery from setools.rolequery import RoleQuery
class RoleQueryTest(unittest.TestCase): class RoleQueryTest(unittest.TestCase):

View File

@ -17,9 +17,9 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.terulequery import TERuleQuery from setools.terulequery import TERuleQuery
from libapol.policyrep.rule import RuleNotConditional from setools.policyrep.rule import RuleNotConditional
class TERuleQueryTest(unittest.TestCase): class TERuleQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.typequery import TypeQuery from setools.typequery import TypeQuery
class TypeQueryTest(unittest.TestCase): class TypeQueryTest(unittest.TestCase):

View File

@ -17,8 +17,8 @@
# #
import unittest import unittest
from libapol import SELinuxPolicy from setools import SELinuxPolicy
from libapol.userquery import UserQuery from setools.userquery import UserQuery
class UserQueryTest(unittest.TestCase): class UserQueryTest(unittest.TestCase):