143 lines
4.9 KiB
Diff
143 lines
4.9 KiB
Diff
From e47d19f4985098ca316eea4a383510d419ec6055 Mon Sep 17 00:00:00 2001
|
|
From: Vit Mojzis <vmojzis@redhat.com>
|
|
Date: Fri, 26 Apr 2019 15:27:25 +0200
|
|
Subject: [PATCH 1/2] Do not export/use setools.InfoFlowAnalysis and
|
|
setools.DomainTransitionAnalysis
|
|
|
|
dta and infoflow modules require networkx which brings lot of dependencies.
|
|
These dependencies are not necessary for setools module itself as it's
|
|
used in policycoreutils.
|
|
|
|
Therefore it's better to use setools.infoflow.InfoFlowAnalysis and
|
|
setools.dta.DomainTransitionAnalysis and let the package containing
|
|
sedta and seinfoflow to require python3-networkx
|
|
---
|
|
sedta | 5 +++--
|
|
seinfoflow | 4 ++--
|
|
setools/__init__.py | 4 ----
|
|
setoolsgui/apol/dta.py | 2 +-
|
|
setoolsgui/apol/infoflow.py | 2 +-
|
|
tests/dta.py | 2 +-
|
|
tests/infoflow.py | 2 +-
|
|
7 files changed, 9 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/sedta b/sedta
|
|
index 57070098fe10..51890ea8ea73 100755
|
|
--- a/sedta
|
|
+++ b/sedta
|
|
@@ -23,9 +23,10 @@ import logging
|
|
import signal
|
|
|
|
import setools
|
|
+import setools.dta
|
|
|
|
|
|
-def print_transition(trans: setools.DomainTransition) -> None:
|
|
+def print_transition(trans: setools.dta.DomainTransition) -> None:
|
|
if trans.transition:
|
|
print("Domain transition rule(s):")
|
|
for t in trans.transition:
|
|
@@ -114,7 +115,7 @@ else:
|
|
|
|
try:
|
|
p = setools.SELinuxPolicy(args.policy)
|
|
- g = setools.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
|
|
+ g = setools.dta.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
|
|
|
|
if args.shortest_path or args.all_paths:
|
|
if args.shortest_path:
|
|
diff --git a/seinfoflow b/seinfoflow
|
|
index 0ddcfdc7c1fb..8321718b2640 100755
|
|
--- a/seinfoflow
|
|
+++ b/seinfoflow
|
|
@@ -17,7 +17,7 @@
|
|
# along with SETools. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
-import setools
|
|
+import setools.infoflow
|
|
import argparse
|
|
import sys
|
|
import logging
|
|
@@ -102,7 +102,7 @@ elif args.booleans is not None:
|
|
try:
|
|
p = setools.SELinuxPolicy(args.policy)
|
|
m = setools.PermissionMap(args.map)
|
|
- g = setools.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
|
|
+ g = setools.infoflow.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
|
|
booleans=booleans)
|
|
|
|
if args.shortest_path or args.all_paths:
|
|
diff --git a/setools/__init__.py b/setools/__init__.py
|
|
index d72d343e7e79..642485b9018d 100644
|
|
--- a/setools/__init__.py
|
|
+++ b/setools/__init__.py
|
|
@@ -91,12 +91,8 @@ from .pcideviceconquery import PcideviceconQuery
|
|
from .devicetreeconquery import DevicetreeconQuery
|
|
|
|
# Information Flow Analysis
|
|
-from .infoflow import InfoFlowAnalysis
|
|
from .permmap import PermissionMap, RuleWeight, Mapping
|
|
|
|
-# Domain Transition Analysis
|
|
-from .dta import DomainTransitionAnalysis, DomainEntrypoint, DomainTransition
|
|
-
|
|
# Policy difference
|
|
from .diff import PolicyDifference
|
|
|
|
diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py
|
|
index 62dbf04d9a5e..0ea000e790f0 100644
|
|
--- a/setoolsgui/apol/dta.py
|
|
+++ b/setoolsgui/apol/dta.py
|
|
@@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
|
|
from PyQt5.QtGui import QPalette, QTextCursor
|
|
from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
|
|
QTreeWidgetItem
|
|
-from setools import DomainTransitionAnalysis
|
|
+from setools.dta import DomainTransitionAnalysis
|
|
|
|
from ..logtosignal import LogHandlerToSignal
|
|
from .analysistab import AnalysisSection, AnalysisTab
|
|
diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py
|
|
index 28009aa2329c..92d350bf727c 100644
|
|
--- a/setoolsgui/apol/infoflow.py
|
|
+++ b/setoolsgui/apol/infoflow.py
|
|
@@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
|
|
from PyQt5.QtGui import QPalette, QTextCursor
|
|
from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
|
|
QTreeWidgetItem
|
|
-from setools import InfoFlowAnalysis
|
|
+from setools.infoflow import InfoFlowAnalysis
|
|
from setools.exception import UnmappedClass, UnmappedPermission
|
|
|
|
from ..logtosignal import LogHandlerToSignal
|
|
diff --git a/tests/dta.py b/tests/dta.py
|
|
index a0cc9381469c..177e6fb0b961 100644
|
|
--- a/tests/dta.py
|
|
+++ b/tests/dta.py
|
|
@@ -18,7 +18,7 @@
|
|
import os
|
|
import unittest
|
|
|
|
-from setools import DomainTransitionAnalysis
|
|
+from setools.dta import DomainTransitionAnalysis
|
|
from setools import TERuletype as TERT
|
|
from setools.exception import InvalidType
|
|
from setools.policyrep import Type
|
|
diff --git a/tests/infoflow.py b/tests/infoflow.py
|
|
index aa0e44a7e4f8..fca2848aeca5 100644
|
|
--- a/tests/infoflow.py
|
|
+++ b/tests/infoflow.py
|
|
@@ -18,7 +18,7 @@
|
|
import os
|
|
import unittest
|
|
|
|
-from setools import InfoFlowAnalysis
|
|
+from setools.infoflow import InfoFlowAnalysis
|
|
from setools import TERuletype as TERT
|
|
from setools.exception import InvalidType
|
|
from setools.permmap import PermissionMap
|
|
--
|
|
2.30.0
|
|
|