2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-10-17 14:26:10 +00:00

Add --no-reload parameter to minitools

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
This commit is contained in:
Christian Boltz
2015-06-06 14:21:21 +02:00
parent 59c5683526
commit e88148d0c8
6 changed files with 12 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ class aa_tools:
self.profiling = args.program
self.check_profile_dir()
self.silent = None
self.do_reload = args.do_reload
if tool_name in ['audit']:
self.remove = args.remove
@@ -244,6 +245,9 @@ class aa_tools:
apparmor.create_symlink('disable', filename)
def unload_profile(self, profile):
if not self.do_reload:
return
# FIXME: should ensure profile is loaded before unloading
cmd_info = cmd([apparmor.parser, '-I%s' % apparmor.profile_dir, '--base', apparmor.profile_dir, '-R', profile])
@@ -251,6 +255,9 @@ class aa_tools:
raise apparmor.AppArmorException(cmd_info[1])
def reload_profile(self, profile):
if not self.do_reload:
return
cmd_info = cmd([apparmor.parser, '-I%s' % apparmor.profile_dir, '--base', apparmor.profile_dir, '-r', profile])
if cmd_info[0] != 0: