mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Order imports and module-level dunder name assignments.
This commit is contained in:
parent
ea3fb60007
commit
c57138f255
79 changed files with 269 additions and 323 deletions
|
@ -3,6 +3,7 @@
|
||||||
# https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894
|
# https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894
|
||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import LibAppArmor as libapparmor
|
import LibAppArmor as libapparmor
|
||||||
|
|
||||||
TESTDIR = "../../../testsuite/test_multi"
|
TESTDIR = "../../../testsuite/test_multi"
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
# - check cache not used if parser in $PATH is newer
|
# - check cache not used if parser in $PATH is newer
|
||||||
# - check cache used for force-complain, disable symlink, etc.
|
# - check cache used for force-complain, disable symlink, etc.
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
import testlib
|
import testlib
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import os
|
|
||||||
import unittest
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import unittest
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
import testlib
|
import testlib
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
from testlib import read_features_dir
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import os
|
import os
|
||||||
|
from argparse import ArgumentParser
|
||||||
from sys import stderr, exit
|
from sys import stderr, exit
|
||||||
|
|
||||||
|
from testlib import read_features_dir
|
||||||
|
|
||||||
DEFAULT_FEATURES_DIR = '/sys/kernel/security/apparmor/features'
|
DEFAULT_FEATURES_DIR = '/sys/kernel/security/apparmor/features'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,14 @@
|
||||||
# TODO
|
# TODO
|
||||||
# - finish adding suppressions for valgrind false positives
|
# - finish adding suppressions for valgrind false positives
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import testlib
|
from argparse import ArgumentParser
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
|
import testlib
|
||||||
|
|
||||||
DEFAULT_TESTDIR = "./simple_tests/vars"
|
DEFAULT_TESTDIR = "./simple_tests/vars"
|
||||||
VALGRIND_ERROR_CODE = 151
|
VALGRIND_ERROR_CODE = 151
|
||||||
VALGRIND_ARGS = ['--leak-check=full', '--error-exitcode=%d' % (VALGRIND_ERROR_CODE)]
|
VALGRIND_ARGS = ['--leak-check=full', '--error-exitcode=%d' % (VALGRIND_ERROR_CODE)]
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Switch the given programs to audit mode'))
|
parser = argparse.ArgumentParser(description=_('Switch the given programs to audit mode'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Generate a basic AppArmor profile by guessing requirements'))
|
parser = argparse.ArgumentParser(description=_('Generate a basic AppArmor profile by guessing requirements'))
|
||||||
parser.add_argument('--force', action='store_true', default=False, help=_('overwrite existing profile'))
|
parser.add_argument('--force', action='store_true', default=False, help=_('overwrite existing profile'))
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Cleanup the profiles for the given programs'))
|
parser = argparse.ArgumentParser(description=_('Cleanup the profiles for the given programs'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Switch the given program to complain mode'))
|
parser = argparse.ArgumentParser(description=_('Switch the given program to complain mode'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Disable the profile for the given programs'))
|
parser = argparse.ArgumentParser(description=_('Disable the profile for the given programs'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.easyprof
|
|
||||||
from apparmor.easyprof import error
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# setup exception handling
|
import apparmor.easyprof
|
||||||
|
from apparmor.easyprof import error
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
def usage():
|
def usage():
|
||||||
|
|
|
@ -15,14 +15,11 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.tools
|
import apparmor.tools
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Switch the given program to enforce mode'))
|
parser = argparse.ArgumentParser(description=_('Switch the given program to enforce mode'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -23,14 +23,11 @@ import time
|
||||||
import apparmor.aa as apparmor
|
import apparmor.aa as apparmor
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
from apparmor.common import AppArmorException, warn
|
from apparmor.common import AppArmorException, warn
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
|
|
||||||
def sysctl_read(path):
|
def sysctl_read(path):
|
||||||
|
|
|
@ -16,16 +16,12 @@ import argparse
|
||||||
|
|
||||||
import apparmor.aa as apparmor
|
import apparmor.aa as apparmor
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
|
|
||||||
from apparmor.common import AppArmorException
|
from apparmor.common import AppArmorException
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Process log entries to generate profiles'))
|
parser = argparse.ArgumentParser(description=_('Process log entries to generate profiles'))
|
||||||
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
|
||||||
|
|
|
@ -16,19 +16,14 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import apparmor.aa
|
import apparmor.aa
|
||||||
|
|
||||||
import apparmor.severity
|
|
||||||
import apparmor.cleanprofile as cleanprofile
|
import apparmor.cleanprofile as cleanprofile
|
||||||
|
import apparmor.severity
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
|
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_('Merge the given profiles into /etc/apparmor.d/ (or the directory specified with -d)'))
|
parser = argparse.ArgumentParser(description=_('Merge the given profiles into /etc/apparmor.d/ (or the directory specified with -d)'))
|
||||||
parser.add_argument('files', nargs='+', type=str, help=_('Profile(s) to merge'))
|
parser.add_argument('files', nargs='+', type=str, help=_('Profile(s) to merge'))
|
||||||
|
|
|
@ -30,25 +30,25 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import atexit
|
import atexit
|
||||||
|
import grp
|
||||||
import os
|
import os
|
||||||
|
import pwd
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import notify2
|
import notify2
|
||||||
import psutil
|
import psutil
|
||||||
import pwd
|
|
||||||
import grp
|
|
||||||
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
import apparmor.config as aaconfig
|
import apparmor.config as aaconfig
|
||||||
|
import LibAppArmor # C-library to parse one log line
|
||||||
from apparmor.common import DebugLogger, open_file_read
|
from apparmor.common import DebugLogger, open_file_read
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
from apparmor.notify import get_last_login_timestamp
|
from apparmor.notify import get_last_login_timestamp
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
import LibAppArmor # C-library to parse one log line
|
|
||||||
|
|
||||||
|
|
||||||
def get_user_login():
|
def get_user_login():
|
||||||
"""Portable function to get username. Should not trigger any
|
"""Portable function to get username. Should not trigger any
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.sandbox
|
|
||||||
from apparmor.common import error
|
|
||||||
import optparse
|
import optparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# setup exception handling
|
import apparmor.sandbox
|
||||||
|
from apparmor.common import error
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
|
|
|
@ -22,14 +22,11 @@ import sys
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
import apparmor.ui as ui
|
import apparmor.ui as ui
|
||||||
from apparmor.common import AppArmorException, open_file_read
|
from apparmor.common import AppArmorException, open_file_read
|
||||||
|
|
||||||
# setup exception handling
|
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
enable_aa_exception_handler()
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
enable_aa_exception_handler() # setup exception handling
|
||||||
|
_ = init_translation() # setup module translations
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=_("Lists unconfined processes having tcp or udp ports"))
|
parser = argparse.ArgumentParser(description=_("Lists unconfined processes having tcp or udp ports"))
|
||||||
parser.add_argument("--paranoid", action="store_true", help=_("scan all processes from /proc"))
|
parser.add_argument("--paranoid", action="store_true", help=_("scan all processes from /proc"))
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# No old version logs, only 2.6 + supported
|
# No old version logs, only 2.6 + supported
|
||||||
|
import atexit
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -20,37 +21,26 @@ import subprocess # nosec
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import atexit
|
from copy import deepcopy
|
||||||
from shutil import which
|
from shutil import which
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
import apparmor.config
|
import apparmor.config
|
||||||
import apparmor.logparser
|
import apparmor.logparser
|
||||||
import apparmor.severity
|
|
||||||
|
|
||||||
from copy import deepcopy
|
|
||||||
|
|
||||||
from apparmor.aare import AARE
|
|
||||||
|
|
||||||
from apparmor.common import (
|
|
||||||
AppArmorException, AppArmorBug, cmd, is_skippable_file, open_file_read, valid_path, hasher,
|
|
||||||
combine_profname, split_name, open_file_write, DebugLogger)
|
|
||||||
|
|
||||||
import apparmor.ui as aaui
|
|
||||||
|
|
||||||
from apparmor.regex import (
|
|
||||||
RE_PROFILE_START, RE_PROFILE_END, RE_PROFILE_CONDITIONAL,
|
|
||||||
RE_PROFILE_CONDITIONAL_VARIABLE, RE_PROFILE_CONDITIONAL_BOOLEAN,
|
|
||||||
RE_PROFILE_CHANGE_HAT, RE_PROFILE_HAT_DEF, RE_PROFILE_MOUNT,
|
|
||||||
RE_PROFILE_PIVOT_ROOT, RE_PROFILE_UNIX, RE_RULE_HAS_COMMA, RE_HAS_COMMENT_SPLIT,
|
|
||||||
parse_profile_start_line, re_match_include)
|
|
||||||
|
|
||||||
from apparmor.profile_list import ProfileList, preamble_ruletypes
|
|
||||||
|
|
||||||
from apparmor.profile_storage import ProfileStorage, add_or_remove_flag, ruletypes
|
|
||||||
|
|
||||||
import apparmor.rules as aarules
|
import apparmor.rules as aarules
|
||||||
|
import apparmor.severity
|
||||||
|
import apparmor.ui as aaui
|
||||||
|
from apparmor.aare import AARE
|
||||||
|
from apparmor.common import (
|
||||||
|
AppArmorBug, AppArmorException, DebugLogger, cmd, combine_profname, hasher,
|
||||||
|
is_skippable_file, open_file_read, open_file_write, split_name, valid_path)
|
||||||
|
from apparmor.profile_list import ProfileList, preamble_ruletypes
|
||||||
|
from apparmor.profile_storage import ProfileStorage, add_or_remove_flag, ruletypes
|
||||||
|
from apparmor.regex import (
|
||||||
|
RE_HAS_COMMENT_SPLIT, RE_PROFILE_CHANGE_HAT, RE_PROFILE_CONDITIONAL,
|
||||||
|
RE_PROFILE_CONDITIONAL_BOOLEAN, RE_PROFILE_CONDITIONAL_VARIABLE, RE_PROFILE_END,
|
||||||
|
RE_PROFILE_HAT_DEF, RE_PROFILE_MOUNT, RE_PROFILE_PIVOT_ROOT, RE_PROFILE_START,
|
||||||
|
RE_PROFILE_UNIX, RE_RULE_HAS_COMMA, parse_profile_start_line, re_match_include)
|
||||||
from apparmor.rule.abi import AbiRule
|
from apparmor.rule.abi import AbiRule
|
||||||
from apparmor.rule.capability import CapabilityRule
|
from apparmor.rule.capability import CapabilityRule
|
||||||
from apparmor.rule.change_profile import ChangeProfileRule
|
from apparmor.rule.change_profile import ChangeProfileRule
|
||||||
|
@ -60,9 +50,8 @@ from apparmor.rule.include import IncludeRule
|
||||||
from apparmor.rule.network import NetworkRule
|
from apparmor.rule.network import NetworkRule
|
||||||
from apparmor.rule.ptrace import PtraceRule
|
from apparmor.rule.ptrace import PtraceRule
|
||||||
from apparmor.rule.signal import SignalRule
|
from apparmor.rule.signal import SignalRule
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
# Setup logging in case debugging is enabled
|
# Setup logging in case debugging is enabled
|
||||||
|
|
|
@ -16,11 +16,11 @@ import ctypes
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import LibAppArmor
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug, hasher, open_file_read, split_name, DebugLogger
|
|
||||||
|
|
||||||
# setup module translations
|
import LibAppArmor
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException, DebugLogger, hasher, open_file_read, split_name
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,13 @@
|
||||||
from apparmor.aare import AARE
|
from apparmor.aare import AARE
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.profile_storage import ProfileStorage
|
from apparmor.profile_storage import ProfileStorage
|
||||||
from apparmor.rule.alias import AliasRule, AliasRuleset
|
|
||||||
from apparmor.rule.abi import AbiRule, AbiRuleset
|
from apparmor.rule.abi import AbiRule, AbiRuleset
|
||||||
|
from apparmor.rule.alias import AliasRule, AliasRuleset
|
||||||
from apparmor.rule.boolean import BooleanRule, BooleanRuleset
|
from apparmor.rule.boolean import BooleanRule, BooleanRuleset
|
||||||
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
||||||
from apparmor.rule.variable import VariableRule, VariableRuleset
|
from apparmor.rule.variable import VariableRule, VariableRuleset
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
preamble_ruletypes = {
|
preamble_ruletypes = {
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
|
|
||||||
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import parse_profile_start_line
|
||||||
|
from apparmor.rule import quote_if_needed
|
||||||
from apparmor.rule.abi import AbiRule, AbiRuleset
|
from apparmor.rule.abi import AbiRule, AbiRuleset
|
||||||
from apparmor.rule.capability import CapabilityRule, CapabilityRuleset
|
from apparmor.rule.capability import CapabilityRule, CapabilityRuleset
|
||||||
from apparmor.rule.change_profile import ChangeProfileRule, ChangeProfileRuleset
|
from apparmor.rule.change_profile import ChangeProfileRule, ChangeProfileRuleset
|
||||||
|
@ -26,13 +27,8 @@ from apparmor.rule.network import NetworkRule, NetworkRuleset
|
||||||
from apparmor.rule.ptrace import PtraceRule, PtraceRuleset
|
from apparmor.rule.ptrace import PtraceRule, PtraceRuleset
|
||||||
from apparmor.rule.rlimit import RlimitRule, RlimitRuleset
|
from apparmor.rule.rlimit import RlimitRule, RlimitRuleset
|
||||||
from apparmor.rule.signal import SignalRule, SignalRuleset
|
from apparmor.rule.signal import SignalRule, SignalRuleset
|
||||||
|
|
||||||
from apparmor.rule import quote_if_needed
|
|
||||||
|
|
||||||
from apparmor.regex import parse_profile_start_line
|
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
ruletypes = {
|
ruletypes = {
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
|
||||||
|
|
||||||
# setup module translations
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
# Profile parsing Regex
|
# Profile parsing Regex
|
||||||
|
|
|
@ -17,9 +17,8 @@ from abc import abstractmethod
|
||||||
|
|
||||||
from apparmor.aare import AARE
|
from apparmor.aare import AARE
|
||||||
from apparmor.common import AppArmorBug
|
from apparmor.common import AppArmorBug
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,11 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_ABI
|
|
||||||
from apparmor.common import AppArmorBug
|
from apparmor.common import AppArmorBug
|
||||||
|
from apparmor.regex import RE_ABI
|
||||||
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,11 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_ALIAS, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_ALIAS, strip_quotes
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,11 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_BOOLEAN
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_BOOLEAN
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_comment
|
from apparmor.rule import BaseRule, BaseRuleset, parse_comment
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_CAP
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_CAP
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, logprof_value_or_all, parse_modifiers
|
from apparmor.rule import BaseRule, BaseRuleset, logprof_value_or_all, parse_modifiers
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_CHANGE_PROFILE, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_modifiers, logprof_value_or_all, quote_if_needed
|
from apparmor.regex import RE_PROFILE_CHANGE_PROFILE, strip_quotes
|
||||||
|
from apparmor.rule import (
|
||||||
# setup module translations
|
BaseRule, BaseRuleset, logprof_value_or_all, parse_modifiers, quote_if_needed)
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_DBUS, RE_PROFILE_NAME, strip_parenthesis, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all, parse_modifiers, quote_if_needed
|
from apparmor.regex import RE_PROFILE_DBUS, RE_PROFILE_NAME, strip_parenthesis, strip_quotes
|
||||||
|
from apparmor.rule import (
|
||||||
# setup module translations
|
BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all,
|
||||||
|
parse_modifiers, quote_if_needed)
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
|
||||||
|
_ = init_translation()
|
||||||
|
|
||||||
message_keywords = ['send', 'receive', 'r', 'read', 'w', 'write', 'rw']
|
message_keywords = ['send', 'receive', 'r', 'read', 'w', 'write', 'rw']
|
||||||
access_keywords = ['bind', 'eavesdrop'] + message_keywords
|
access_keywords = ['bind', 'eavesdrop'] + message_keywords
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.aare import AARE
|
from apparmor.aare import AARE
|
||||||
from apparmor.regex import RE_PROFILE_FILE_ENTRY, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all, parse_modifiers, quote_if_needed
|
from apparmor.regex import RE_PROFILE_FILE_ENTRY, strip_quotes
|
||||||
|
from apparmor.rule import (
|
||||||
# setup module translations
|
BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all,
|
||||||
|
parse_modifiers, quote_if_needed)
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
|
||||||
|
_ = init_translation()
|
||||||
|
|
||||||
allow_exec_transitions = ('ix', 'ux', 'Ux', 'px', 'Px', 'cx', 'Cx') # 2 chars - len relevant for split_perms()
|
allow_exec_transitions = ('ix', 'ux', 'Ux', 'px', 'Px', 'cx', 'Cx') # 2 chars - len relevant for split_perms()
|
||||||
allow_exec_fallback_transitions = ('pix', 'Pix', 'cix', 'Cix', 'pux', 'PUx', 'cux', 'CUx') # 3 chars - len relevant for split_perms()
|
allow_exec_fallback_transitions = ('pix', 'Pix', 'cix', 'Cix', 'pux', 'PUx', 'cux', 'CUx') # 3 chars - len relevant for split_perms()
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_INCLUDE, re_match_include_parse
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException, is_skippable_file
|
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_comment
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# setup module translations
|
from apparmor.common import AppArmorBug, AppArmorException, is_skippable_file
|
||||||
|
from apparmor.regex import RE_INCLUDE, re_match_include_parse
|
||||||
|
from apparmor.rule import BaseRule, BaseRuleset, parse_comment
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,12 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_NETWORK
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_NETWORK
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, logprof_value_or_all, parse_modifiers
|
from apparmor.rule import BaseRule, BaseRuleset, logprof_value_or_all, parse_modifiers
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
|
||||||
|
_ = init_translation()
|
||||||
|
|
||||||
network_domain_keywords = [
|
network_domain_keywords = [
|
||||||
'unspec', 'unix', 'inet', 'ax25', 'ipx', 'appletalk', 'netrom', 'bridge', 'atmpvc', 'x25', 'inet6',
|
'unspec', 'unix', 'inet', 'ax25', 'ipx', 'appletalk', 'netrom', 'bridge', 'atmpvc', 'x25', 'inet6',
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_PTRACE, RE_PROFILE_NAME, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all, parse_modifiers, quote_if_needed
|
from apparmor.regex import RE_PROFILE_PTRACE, RE_PROFILE_NAME, strip_quotes
|
||||||
|
from apparmor.rule import (
|
||||||
# setup module translations
|
BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all,
|
||||||
|
parse_modifiers, quote_if_needed)
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
|
||||||
|
_ = init_translation()
|
||||||
|
|
||||||
access_keywords = ['r', 'w', 'rw', 'wr', 'read', 'write', 'readby', 'trace', 'tracedby'] # XXX 'wr' and 'write' accepted by the parser, but not documented in apparmor.d.pod
|
access_keywords = ['r', 'w', 'rw', 'wr', 'read', 'write', 'readby', 'trace', 'tracedby'] # XXX 'wr' and 'write' accepted by the parser, but not documented in apparmor.d.pod
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_RLIMIT, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_RLIMIT, strip_quotes
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
rlimit_size = ['fsize', 'data', 'stack', 'core', 'rss', 'as', 'memlock', 'msgqueue'] # NUMBER ( 'K' | 'M' | 'G' )
|
rlimit_size = ['fsize', 'data', 'stack', 'core', 'rss', 'as', 'memlock', 'msgqueue'] # NUMBER ( 'K' | 'M' | 'G' )
|
||||||
|
|
|
@ -14,16 +14,14 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_SIGNAL, RE_PROFILE_NAME
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_SIGNAL, RE_PROFILE_NAME
|
||||||
from apparmor.rule import (
|
from apparmor.rule import (
|
||||||
BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all,
|
BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all,
|
||||||
parse_modifiers, quote_if_needed)
|
parse_modifiers, quote_if_needed)
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
_ = init_translation()
|
|
||||||
|
|
||||||
|
_ = init_translation()
|
||||||
|
|
||||||
access_keywords_read = ['receive', 'r', 'read']
|
access_keywords_read = ['receive', 'r', 'read']
|
||||||
access_keywords_write = ['send', 'w', 'write']
|
access_keywords_write = ['send', 'w', 'write']
|
||||||
|
|
|
@ -13,14 +13,13 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.regex import RE_PROFILE_VARIABLE, strip_quotes
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
|
||||||
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# setup module translations
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.regex import RE_PROFILE_VARIABLE, strip_quotes
|
||||||
|
from apparmor.rule import BaseRule, BaseRuleset, parse_comment, quote_if_needed
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
from apparmor.common import AppArmorException, debug, error, msg, cmd
|
|
||||||
import apparmor.easyprof
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
|
@ -21,6 +19,9 @@ import time
|
||||||
from shutil import which
|
from shutil import which
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
|
import apparmor.easyprof
|
||||||
|
from apparmor.common import AppArmorException, cmd, debug, error, msg
|
||||||
|
|
||||||
|
|
||||||
def check_requirements(binary):
|
def check_requirements(binary):
|
||||||
"""Verify necessary software is installed"""
|
"""Verify necessary software is installed"""
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
import re
|
import re
|
||||||
from apparmor.common import AppArmorException, open_file_read, warn, convert_regexp # , msg, error, debug
|
|
||||||
|
from apparmor.common import AppArmorException, convert_regexp, open_file_read, warn # , debug, error, msg
|
||||||
|
|
||||||
|
|
||||||
class Severity:
|
class Severity:
|
||||||
|
|
|
@ -19,9 +19,8 @@ from shutil import which
|
||||||
import apparmor.aa as apparmor
|
import apparmor.aa as apparmor
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
from apparmor.common import AppArmorException, cmd, is_skippable_file, user_perm
|
from apparmor.common import AppArmorException, cmd, is_skippable_file, user_perm
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
# License published by the Free Software Foundation.
|
# License published by the Free Software Foundation.
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
__apparmor_gettext__ = None
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
TRANSLATION_DOMAIN = 'apparmor-utils'
|
TRANSLATION_DOMAIN = 'apparmor-utils'
|
||||||
|
|
||||||
__apparmor_gettext__ = None
|
|
||||||
|
|
||||||
|
|
||||||
def init_translation():
|
def init_translation():
|
||||||
global __apparmor_gettext__
|
global __apparmor_gettext__
|
||||||
|
|
|
@ -15,17 +15,16 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import sys
|
import os
|
||||||
import re
|
import re
|
||||||
import readline
|
import readline
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from apparmor.common import readkey, AppArmorException, DebugLogger
|
from apparmor.common import AppArmorException, DebugLogger, readkey
|
||||||
|
|
||||||
# setup module translations
|
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
# Set up UI logger for separate messages from UI module
|
# Set up UI logger for separate messages from UI module
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
# Note: --version=... must be the last argument to this script
|
# Note: --version=... must be the last argument to this script
|
||||||
#
|
#
|
||||||
|
|
||||||
from setuptools.command.install import install as _install
|
|
||||||
from setuptools import setup
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
from setuptools.command.install import install as _install
|
||||||
|
|
||||||
|
|
||||||
class Install(_install):
|
class Install(_install):
|
||||||
"""Override setuptools to install the files where we want them."""
|
"""Override setuptools to install the files where we want them."""
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
import unittest
|
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
# def test_readkey(self):
|
# def test_readkey(self):
|
||||||
|
|
|
@ -9,21 +9,18 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import atexit
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
|
|
||||||
# Imports for test code
|
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
# Imports for AppArmor
|
|
||||||
import atexit
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
import apparmor.ui as aaui
|
import apparmor.ui as aaui
|
||||||
from apparmor.common import DebugLogger
|
from apparmor.common import DebugLogger
|
||||||
from apparmor.fail import enable_aa_exception_handler
|
from apparmor.fail import enable_aa_exception_handler
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class AACliBootstrapTest(AATest):
|
class AACliBootstrapTest(AATest):
|
||||||
|
|
|
@ -17,8 +17,8 @@ import time
|
||||||
import unittest
|
import unittest
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
# The location of the aa-notify utility can be overridden by setting
|
# The location of the aa-notify utility can be overridden by setting
|
||||||
# the APPARMOR_NOTIFY environment variable; this is useful for running
|
# the APPARMOR_NOTIFY environment variable; this is useful for running
|
||||||
|
|
|
@ -9,23 +9,19 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
from common_test import read_file, write_file
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import unittest
|
||||||
|
|
||||||
import apparmor.aa # needed to set global vars in some tests
|
import apparmor.aa # needed to set global vars in some tests
|
||||||
from apparmor.aa import (
|
from apparmor.aa import (
|
||||||
check_for_apparmor, get_output, get_reqs, get_interpreter_and_abstraction, create_new_profile,
|
change_profile_flags, check_for_apparmor, create_new_profile, get_file_perms, get_interpreter_and_abstraction, get_output, get_profile_flags, get_reqs,
|
||||||
get_profile_flags, change_profile_flags, set_options_audit_mode, set_options_owner_mode,
|
merged_to_split, parse_profile_data, propose_file_rules, set_options_audit_mode, set_options_owner_mode, split_to_merged)
|
||||||
parse_profile_data,
|
|
||||||
get_file_perms, propose_file_rules, merged_to_split, split_to_merged)
|
|
||||||
from apparmor.aare import AARE
|
from apparmor.aare import AARE
|
||||||
from apparmor.common import AppArmorException, AppArmorBug, is_skippable_file
|
from apparmor.common import AppArmorBug, AppArmorException, is_skippable_file
|
||||||
from apparmor.rule.file import FileRule
|
from apparmor.rule.file import FileRule
|
||||||
from apparmor.rule.include import IncludeRule
|
from apparmor.rule.include import IncludeRule
|
||||||
|
from common_test import AATest, read_file, setup_aa, setup_all_loops, write_file
|
||||||
|
|
||||||
|
|
||||||
class AaTestWithTempdir(AATest):
|
class AaTestWithTempdir(AATest):
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
from copy import deepcopy
|
|
||||||
import re
|
import re
|
||||||
from apparmor.common import convert_regexp, AppArmorBug, AppArmorException
|
import unittest
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException, convert_regexp
|
||||||
from apparmor.aare import AARE, convert_expression_to_aare
|
from apparmor.aare import AARE, convert_expression_to_aare
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestConvert_regexp(AATest):
|
class TestConvert_regexp(AATest):
|
||||||
|
|
|
@ -17,11 +17,12 @@ import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.abi import AbiRule, AbiRuleset
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
# from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
# from apparmor.logparser import ReadLog
|
# from apparmor.logparser import ReadLog
|
||||||
|
# from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.abi import AbiRule, AbiRuleset
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.alias import AliasRule, AliasRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.alias import AliasRule, AliasRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple('exp', ('comment', 'orig_path', 'target'))
|
exp = namedtuple('exp', ('comment', 'orig_path', 'target'))
|
||||||
|
|
|
@ -9,14 +9,13 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
|
import apparmor.severity as severity
|
||||||
from apparmor.common import AppArmorBug
|
from apparmor.common import AppArmorBug
|
||||||
from apparmor.rule import BaseRule, parse_modifiers
|
from apparmor.rule import BaseRule, parse_modifiers
|
||||||
import apparmor.severity as severity
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
class TestBaserule(AATest):
|
class TestBaserule(AATest):
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.boolean import BooleanRule, BooleanRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.boolean import BooleanRule, BooleanRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple('exp', ('comment', 'varname', 'value'))
|
exp = namedtuple('exp', ('comment', 'varname', 'value'))
|
||||||
|
|
|
@ -14,14 +14,15 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import apparmor.severity as severity
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException, hasher
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.capability import CapabilityRule, CapabilityRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.capability import CapabilityRule, CapabilityRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
import apparmor.severity as severity
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug, hasher
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.change_profile import ChangeProfileRule, ChangeProfileRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.change_profile import ChangeProfileRule, ChangeProfileRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
from apparmor.common import AppArmorBug
|
|
||||||
|
|
||||||
from apparmor.common import split_name, combine_profname
|
from apparmor.common import AppArmorBug, combine_profname, split_name
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class AaTest_split_name(AATest):
|
class AaTest_split_name(AATest):
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.dbus import DbusRule, DbusRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.dbus import DbusRule, DbusRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops # , setup_aa
|
|
||||||
# import apparmor.aa as aa # see the setup_aa() call for details
|
# import apparmor.aa as aa # see the setup_aa() call for details
|
||||||
|
from common_test import AATest, setup_all_loops # , setup_aa
|
||||||
|
|
||||||
|
|
||||||
class TestFoo(AATest):
|
class TestFoo(AATest):
|
||||||
|
|
|
@ -15,14 +15,15 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
import apparmor.severity as severity
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.file import FileRule, FileRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.file import FileRule, FileRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
import apparmor.severity as severity
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -13,18 +13,18 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from collections import namedtuple
|
|
||||||
from common_test import AATest, setup_all_loops, write_file
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import unittest
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
# from apparmor.logparser import ReadLog
|
# from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.include import IncludeRule, IncludeRuleset
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
from common_test import AATest, setup_all_loops, write_file
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -9,16 +9,15 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_all_loops, setup_aa, read_file
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from apparmor.common import hasher, open_file_read, split_name
|
import unittest
|
||||||
|
|
||||||
import apparmor.aa
|
import apparmor.aa
|
||||||
|
from apparmor.common import hasher, open_file_read, split_name
|
||||||
from apparmor.logparser import ReadLog
|
from apparmor.logparser import ReadLog
|
||||||
from apparmor.profile_list import ProfileList
|
from apparmor.profile_list import ProfileList
|
||||||
|
from common_test import AATest, read_file, setup_aa, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestLibapparmorTestMulti(AATest):
|
class TestLibapparmorTestMulti(AATest):
|
||||||
|
|
|
@ -14,10 +14,9 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
|
|
||||||
from common_test import AATest, setup_all_loops # , setup_aa
|
|
||||||
from apparmor.common import AppArmorException
|
from apparmor.common import AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from common_test import AATest, setup_all_loops # , setup_aa
|
||||||
|
|
||||||
|
|
||||||
class TestParseEvent(AATest):
|
class TestParseEvent(AATest):
|
||||||
|
|
|
@ -15,10 +15,9 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
|
|
||||||
import apparmor.aa as apparmor
|
import apparmor.aa as apparmor
|
||||||
from common_test import read_file
|
from common_test import AATest, read_file, setup_aa, setup_all_loops
|
||||||
|
|
||||||
python_interpreter = 'python3'
|
python_interpreter = 'python3'
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.aa as aa
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AAParseTest, setup_regex_tests, setup_aa
|
|
||||||
|
import apparmor.aa as aa
|
||||||
|
from common_test import AAParseTest, setup_aa, setup_regex_tests
|
||||||
|
|
||||||
|
|
||||||
class BaseAAParseMountTest(AAParseTest):
|
class BaseAAParseMountTest(AAParseTest):
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException, cmd
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.network import NetworkRule, NetworkRuleset, network_domain_keywords
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.network import NetworkRule, NetworkRuleset, network_domain_keywords
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug, cmd
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
from apparmor.common import AppArmorBug
|
from apparmor.common import AppArmorBug
|
||||||
from apparmor.notify import get_last_login_timestamp, sane_timestamp
|
from apparmor.notify import get_last_login_timestamp, sane_timestamp
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestSane_timestamp(AATest):
|
class TestSane_timestamp(AATest):
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
import apparmor.aa as apparmor
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from apparmor.common import open_file_read, AppArmorException, is_skippable_file
|
import unittest
|
||||||
|
|
||||||
|
import apparmor.aa as apparmor
|
||||||
|
from apparmor.common import AppArmorException, is_skippable_file, open_file_read
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
# This testcase will parse all parser/tst/simple_tests with parse_profile_data(),
|
# This testcase will parse all parser/tst/simple_tests with parse_profile_data(),
|
||||||
# except the files listed in one of the arrays below.
|
# except the files listed in one of the arrays below.
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.aa as aa
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AAParseTest, setup_regex_tests, setup_aa
|
|
||||||
|
import apparmor.aa as aa
|
||||||
|
from common_test import AAParseTest, setup_aa, setup_regex_tests
|
||||||
|
|
||||||
|
|
||||||
class AAParsePivotRootTest(AAParseTest):
|
class AAParsePivotRootTest(AAParseTest):
|
||||||
|
|
|
@ -9,13 +9,11 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_aa, setup_all_loops, write_file
|
|
||||||
|
|
||||||
import apparmor.aa
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import apparmor.aa
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.profile_list import ProfileList
|
from apparmor.profile_list import ProfileList
|
||||||
from apparmor.profile_storage import ProfileStorage
|
from apparmor.profile_storage import ProfileStorage
|
||||||
|
@ -24,6 +22,7 @@ from apparmor.rule.alias import AliasRule
|
||||||
from apparmor.rule.boolean import BooleanRule
|
from apparmor.rule.boolean import BooleanRule
|
||||||
from apparmor.rule.include import IncludeRule
|
from apparmor.rule.include import IncludeRule
|
||||||
from apparmor.rule.variable import VariableRule
|
from apparmor.rule.variable import VariableRule
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops, write_file
|
||||||
|
|
||||||
|
|
||||||
class TestAdd_profile(AATest):
|
class TestAdd_profile(AATest):
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.profile_storage import ProfileStorage, add_or_remove_flag, split_flags, var_transform
|
from apparmor.profile_storage import ProfileStorage, add_or_remove_flag, split_flags, var_transform
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestUnknownKey(AATest):
|
class TestUnknownKey(AATest):
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
# If a profile can't be parsed by the tools, add it to skip_active_profiles or skip_extra_profiles.
|
# If a profile can't be parsed by the tools, add it to skip_active_profiles or skip_extra_profiles.
|
||||||
# Add only the filename (without path), for example 'usr.bin.foo'.
|
# Add only the filename (without path), for example 'usr.bin.foo'.
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.ptrace import PtraceRule, PtraceRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.ptrace import PtraceRule, PtraceRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.aa as aa
|
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops, setup_aa
|
|
||||||
from apparmor.common import AppArmorBug, AppArmorException
|
|
||||||
|
|
||||||
|
import apparmor.aa as aa
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.regex import (
|
from apparmor.regex import (
|
||||||
strip_parenthesis, strip_quotes, parse_profile_start_line, re_match_include,
|
RE_PROFILE_CAP, RE_PROFILE_DBUS, RE_PROFILE_PTRACE, RE_PROFILE_SIGNAL,
|
||||||
re_match_include_parse,
|
RE_PROFILE_START, parse_profile_start_line, re_match_include,
|
||||||
RE_PROFILE_START, RE_PROFILE_DBUS, RE_PROFILE_CAP, RE_PROFILE_PTRACE, RE_PROFILE_SIGNAL)
|
re_match_include_parse, strip_parenthesis, strip_quotes)
|
||||||
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class AARegexTest(AATest):
|
class AARegexTest(AATest):
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
# from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.rlimit import RlimitRule, RlimitRuleset, split_unit
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.rlimit import RlimitRule, RlimitRuleset, split_unit
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
# from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
import apparmor.severity as severity
|
import apparmor.severity as severity
|
||||||
from apparmor.common import AppArmorException
|
from apparmor.common import AppArmorException
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class SeverityBaseTest(AATest):
|
class SeverityBaseTest(AATest):
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
|
from apparmor.logparser import ReadLog
|
||||||
|
from apparmor.rule import BaseRule
|
||||||
|
from apparmor.rule.signal import SignalRule, SignalRuleset
|
||||||
|
from apparmor.translations import init_translation
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.signal import SignalRule, SignalRuleset
|
|
||||||
from apparmor.rule import BaseRule
|
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
|
||||||
from apparmor.logparser import ReadLog
|
|
||||||
from apparmor.translations import init_translation
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple(
|
exp = namedtuple(
|
||||||
|
|
|
@ -9,14 +9,13 @@
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import unittest
|
|
||||||
from common_test import AATest, setup_all_loops
|
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import unittest
|
||||||
|
|
||||||
from apparmor.ui import CMDS, get_translated_hotkey
|
from apparmor.ui import CMDS, get_translated_hotkey
|
||||||
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestHotkeyConflicts(AATest):
|
class TestHotkeyConflicts(AATest):
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
import unittest
|
import unittest
|
||||||
from common_test import AAParseTest, setup_regex_tests, setup_aa
|
|
||||||
|
from common_test import AAParseTest, setup_aa, setup_regex_tests
|
||||||
|
|
||||||
|
|
||||||
class AAParseUnixTest(AAParseTest):
|
class AAParseUnixTest(AAParseTest):
|
||||||
|
|
|
@ -17,10 +17,11 @@ import unittest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from common_test import AATest, setup_all_loops
|
from common_test import AATest, setup_all_loops
|
||||||
|
|
||||||
from apparmor.rule.variable import VariableRule, VariableRuleset, separate_vars
|
from apparmor.common import AppArmorBug, AppArmorException
|
||||||
from apparmor.rule import BaseRule
|
from apparmor.rule import BaseRule
|
||||||
from apparmor.common import AppArmorException, AppArmorBug
|
from apparmor.rule.variable import VariableRule, VariableRuleset, separate_vars
|
||||||
from apparmor.translations import init_translation
|
from apparmor.translations import init_translation
|
||||||
|
|
||||||
_ = init_translation()
|
_ = init_translation()
|
||||||
|
|
||||||
exp = namedtuple('exp', ('comment', 'varname', 'mode', 'values'))
|
exp = namedtuple('exp', ('comment', 'varname', 'mode', 'values'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue