mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00

Add a --no-reload parameter to aa-audit, aa-cleanprof, aa-complain, aa-disable and aa-enforce. This makes it possible to change the profile flags without reloading the profile. Also change tools.py to honor the --no-reload parameter. References: https://bugs.launchpad.net/apparmor/+bug/1458480 Acked-by: Kshitij Gupta <kgupta8592@gmail.com> Acked-by: Steve Beattie <steve@nxnw.org> for trunk and 2.9. --fixes lp:1458480
42 lines
1.6 KiB
Python
Executable file
42 lines
1.6 KiB
Python
Executable file
#! /usr/bin/env python
|
|
# ----------------------------------------------------------------------
|
|
# Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
# License as published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# ----------------------------------------------------------------------
|
|
import argparse
|
|
import traceback
|
|
|
|
import apparmor.tools
|
|
|
|
# setup module translations
|
|
from apparmor.translations import init_translation
|
|
_ = init_translation()
|
|
|
|
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('-r', '--remove', action='store_true', help=_('remove audit mode'))
|
|
parser.add_argument('program', type=str, nargs='+', help=_('name of program'))
|
|
parser.add_argument('--trace', action='store_true', help=_('Show full trace'))
|
|
parser.add_argument('--no-reload', dest='do_reload', action='store_false', default=True, help=_('Do not reload the profile after modifying it'))
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
tool = apparmor.tools.aa_tools('audit', args)
|
|
|
|
tool.cmd_audit()
|
|
|
|
except Exception as e:
|
|
if not args.trace:
|
|
print(e.value + "\n")
|
|
|
|
else:
|
|
traceback.print_exc()
|