Proposed patch to add seinfo and sesearch bindings to setools.
Subsystems (2)
setroubleshoot is using sesearch to look for types that domains can access.
For example if I setup apache to bind to port 81, it will generate an AVC that states apache is not allowed to name_bind to port_t. We want to have setroubleshoot state that it can bind to ports named http_port_t ...
Then the instruct the admin to execute
semanage port -a -t http_port_t -P tcp 81
Similarly if we have a domain that tries to read files labeled default_t, we could come up with a list of domains that the domain can read and tell the user to change the type to one of the domains.
We developed a python binding for sesearch to be able to give us this data.
Similarly system-config-selinux/polgengui present data to the user in a gui that needs information that seinfo can provide.
What are the permissive domains, What types are domains, what types are file_types, what domains are user domains ...
Rather then trying to scrape this data from the seinfo command, we wanted to add a python binding.
configure.ac renamed from configure.ac.python +5 -1
@@ -216,6 +216,9 @@ if test "x${enable_jswig}" = xyes; then do_swigify_java=yes do_swigify=yes fi + +AM_PATH_PYTHON(2.6) + AC_ARG_ENABLE(swig-python, AC_HELP_STRING([--enable-swig-python], [build SWIG interfaces for Python]),
@@ -224,7 +227,6 @@ if test "x${enable_pyswig}" = xyes; then if test ${do_swigify} = no; then AC_PROG_SWIG(1.3.28) fi - AM_PATH_PYTHON(2.3) SWIG_PYTHON do_swigify_python=yes do_swigify=yes
@@ -873,6 +875,8 @@ AC_CONFIG_FILES([Makefile VERSION \ sediff/Makefile \ man/Makefile \ debian/Makefile \ + python/Makefile \ + python/setools/Makefile \ packages/Makefile packages/rpm/Makefile \ packages/libqpol.pc packages/libapol.pc packages/libpoldiff.pc packages/libseaudit.pc packages/libsefs.pc])
Makefile.am renamed from Makefile.am.python +1 -1
@@ -10,7 +10,7 @@ if BUILD_GUI endif # sediffx is also built conditionally, from sediffx/Makefile.am -SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) +SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python #old indent opts #INDENT_OPTS = -npro -nbad -bap -sob -ss -l132 -di1 -nbc -br -nbbb -c40 -cd40 -ncdb -ce -cli0 -cp40 -ncs -d0 -nfc1 -nfca -i8 -ts8 -ci8 -lp -ip0 -npcs -npsl -sc
Makefile.in renamed from Makefile.in.python +2 -2
@@ -79,7 +79,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGE ETAGS = etags CTAGS = ctags DIST_SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds \ - sechecker sediff man packages debian apol seaudit + sechecker sediff man packages debian apol seaudit python DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir)
@@ -384,7 +384,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 @BUILD_APOL_TRUE@MAYBE_APOL = apol @BUILD_GUI_TRUE@MAYBE_GUI = seaudit # sediffx is also built conditionally, from sediffx/Makefile.am -SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) +SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python #old indent opts #INDENT_OPTS = -npro -nbad -bap -sob -ss -l132 -di1 -nbc -br -nbbb -c40 -cd40 -ncdb -ce -cli0 -cp40 -ncs -d0 -nfc1 -nfca -i8 -ts8 -ci8 -lp -ip0 -npcs -npsl -sc
python/Makefile.am renamed from python/Makefile.am.python +2 -0
@@ -0,0 +1,2 @@ +SUBDIRS = setools +
python/Makefile.in renamed from python/Makefile.in.python +715 -0
715 lines not on this page · raw message
python/setools/__init__.py renamed from python/setools/__init__.py.python +49 -0
49 lines not on this page · raw message
python/setools/Makefile.am renamed from python/setools/Makefile.am.python +24 -0
@@ -0,0 +1,24 @@ +EXTRA_DIST = \ + sesearch.c \ + seinfo.c \ + __init__.py \ + setup.py \ + $(NULL) + +all-am: python-build + +python-build: sesearch.c seinfo.c + @mkdir -p setools + @cp __init__.py setools + $(PYTHON) setup.py build + +install-exec-hook: + $(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` + +uninstall-hook: + $(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` + +clean-local: + $(PYTHON) setup.py clean -a + rm -f *~ +
python/setools/Makefile.in renamed from python/setools/Makefile.in.python +539 -0
539 lines not on this page · raw message
python/setools/seinfo.c renamed from python/setools/seinfo.c.python +649 -0
649 lines not on this page · raw message
python/setools/sesearch.c renamed from python/setools/sesearch.c.python +477 -0
477 lines not on this page · raw message
python/setools/setup.py renamed from python/setools/setup.py.python +10 -0
@@ -0,0 +1,10 @@ +#!/usr/bin/env python + +# Author: Thomas Liu <[email protected]> + +from distutils.core import setup, Extension +extension_sesearch = Extension("setools._sesearch", [ "sesearch.c"], libraries=["apol", "qpol"] ) +extension_seinfo = Extension("setools._seinfo", [ "seinfo.c"], libraries=["apol", "qpol"] ) + +setup(name = "setools", version="1.0", description="Python setools bindings", author="Thomas Liu", author_email="[email protected]", ext_modules=[extension_sesearch, extension_seinfo], packages=["setools"]) +