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
*.pyc
*.pyo
libapol/policyrep/qpol_wrap.c
libapol/policyrep/qpol.py
setools/policyrep/qpol_wrap.c
setools/policyrep/qpol.py
*.so

2
README
View File

@ -57,7 +57,7 @@ and perform the following:
$ python setup.py install
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

View File

@ -2,5 +2,4 @@ Warning:
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
applications yet. Of particular note, the libapol package will be
renamed to setools once the SETools 3.3 dependency is eliminated.
applications yet.

8
sedta
View File

@ -21,7 +21,7 @@ from __future__ import print_function
import sys
import argparse
import libapol
import setools
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.",
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(
"-p", "--policy", help="Path to SELinux policy to analyze.", required=True)
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.")
try:
p = libapol.SELinuxPolicy(args.policy)
g = libapol.dta.DomainTransitionAnalysis(p)
p = setools.SELinuxPolicy(args.policy)
g = setools.dta.DomainTransitionAnalysis(p)
except Exception as err:
print(err)
sys.exit(1)

34
seinfo
View File

@ -18,13 +18,13 @@
#
from __future__ import print_function
import libapol
import setools
import argparse
import sys
parser = argparse.ArgumentParser(
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(
"-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()
try:
p = libapol.SELinuxPolicy(args.policy)
p = setools.SELinuxPolicy(args.policy)
except RuntimeError as err:
print(err)
sys.exit(-1)
if args.typequery:
if isinstance(args.typequery, str):
q = libapol.typequery.TypeQuery(p, args.typequery)
q = setools.typequery.TypeQuery(p, args.typequery)
else:
q = libapol.typequery.TypeQuery(p)
q = setools.typequery.TypeQuery(p)
for t in sorted(q.results()):
if args.expand:
@ -87,9 +87,9 @@ if args.typequery:
if args.boolquery:
if isinstance(args.boolquery, str):
q = libapol.boolquery.BoolQuery(p, args.boolquery)
q = setools.boolquery.BoolQuery(p, args.boolquery)
else:
q = libapol.boolquery.BoolQuery(p)
q = setools.boolquery.BoolQuery(p)
for b in sorted(q.results()):
if args.expand:
@ -99,9 +99,9 @@ if args.boolquery:
if args.polcapquery:
if isinstance(args.polcapquery, str):
q = libapol.polcapquery.PolCapQuery(p, args.polcapquery)
q = setools.polcapquery.PolCapQuery(p, args.polcapquery)
else:
q = libapol.polcapquery.PolCapQuery(p)
q = setools.polcapquery.PolCapQuery(p)
for cap in sorted(q.results()):
if args.expand:
@ -111,9 +111,9 @@ if args.polcapquery:
if args.userquery:
if isinstance(args.userquery, str):
q = libapol.userquery.UserQuery(p, args.userquery)
q = setools.userquery.UserQuery(p, args.userquery)
else:
q = libapol.userquery.UserQuery(p)
q = setools.userquery.UserQuery(p)
for u in sorted(q.results()):
if args.expand:
@ -123,9 +123,9 @@ if args.userquery:
if args.rolequery:
if isinstance(args.rolequery, str):
q = libapol.rolequery.RoleQuery(p, args.rolequery)
q = setools.rolequery.RoleQuery(p, args.rolequery)
else:
q = libapol.rolequery.RoleQuery(p)
q = setools.rolequery.RoleQuery(p)
for r in sorted(q.results()):
if args.expand:
@ -135,9 +135,9 @@ if args.rolequery:
if args.classquery:
if isinstance(args.classquery, str):
q = libapol.objclassquery.ObjClassQuery(p, args.classquery)
q = setools.objclassquery.ObjClassQuery(p, args.classquery)
else:
q = libapol.objclassquery.ObjClassQuery(p)
q = setools.objclassquery.ObjClassQuery(p)
for c in sorted(q.results()):
if args.expand:
@ -147,9 +147,9 @@ if args.classquery:
if args.initialsidquery:
if isinstance(args.initialsidquery, str):
q = libapol.initsidquery.InitialSIDQuery(p, args.initialsidquery)
q = setools.initsidquery.InitialSIDQuery(p, args.initialsidquery)
else:
q = libapol.initsidquery.InitialSIDQuery(p)
q = setools.initsidquery.InitialSIDQuery(p)
for i in sorted(q.results()):
if args.expand:

View File

@ -18,13 +18,13 @@
#
from __future__ import print_function
import libapol
import setools
import argparse
import sys
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.")
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",
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.")
try:
p = libapol.SELinuxPolicy(args.policy)
g = libapol.infoflow.InfoFlowAnalysis(
p = setools.SELinuxPolicy(args.policy)
g = setools.infoflow.InfoFlowAnalysis(
p, args.map, minweight=args.min_weight, exclude=args.exclude)
except Exception as err:
print(err)

View File

@ -18,13 +18,13 @@
#
from __future__ import print_function
import libapol
import setools
import argparse
import sys
parser = argparse.ArgumentParser(description="SELinux policy rule search tool.",
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(
"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.")
try:
p = libapol.SELinuxPolicy(args.policy)
p = setools.SELinuxPolicy(args.policy)
except RuntimeError as err:
print(err)
sys.exit(-1)
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,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
tclass_regex=args.tclass_regex, perms_equal=args.perms_equal,
@ -120,7 +120,7 @@ if args.tertypes:
print(r)
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,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
default=args.default, default_regex=args.default_regex,
@ -138,7 +138,7 @@ if args.rbacrtypes:
print(r)
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,
target=args.target, target_indirect=args.target_indirect, target_regex=args.target_regex,
tclass_regex=args.tclass_regex)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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