mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Fix the minitools (aa-audit, aa-complain, aa-enforce, aa-autodep)
to work with multiple profiles at once. References: https://bugs.launchpad.net/apparmor/+bug/1378095 Acked-by: Steve Beattie <steve@nxnw.org> for trunk and 2.9.
This commit is contained in:
parent
35bbe528d2
commit
c913956554
1 changed files with 10 additions and 7 deletions
|
@ -89,12 +89,12 @@ class aa_tools:
|
|||
yield (program, profile)
|
||||
|
||||
def act(self):
|
||||
apparmor.read_profiles()
|
||||
|
||||
for (program, profile) in self.get_next_to_profile():
|
||||
if program is None:
|
||||
program = profile
|
||||
|
||||
apparmor.read_profiles()
|
||||
|
||||
if not program or not(os.path.exists(program) or apparmor.profile_exists(program)):
|
||||
if program and not program.startswith('/'):
|
||||
program = aaui.UI_GetString(_('The given program cannot be found, please try with the fully qualified path name of the program: '), '')
|
||||
|
@ -148,9 +148,10 @@ class aa_tools:
|
|||
raise apparmor.AppArmorException(cmd_info[1])
|
||||
|
||||
def cmd_enforce(self):
|
||||
apparmor.read_profiles()
|
||||
|
||||
for (program, profile) in self.get_next_to_profile():
|
||||
|
||||
apparmor.read_profiles()
|
||||
output_name = profile if program is None else program
|
||||
|
||||
if not os.path.isfile(profile) or apparmor.is_skippable_file(profile):
|
||||
|
@ -166,9 +167,10 @@ class aa_tools:
|
|||
raise apparmor.AppArmorException(cmd_info[1])
|
||||
|
||||
def cmd_complain(self):
|
||||
apparmor.read_profiles()
|
||||
|
||||
for (program, profile) in self.get_next_to_profile():
|
||||
|
||||
apparmor.read_profiles()
|
||||
output_name = profile if program is None else program
|
||||
|
||||
if not os.path.isfile(profile) or apparmor.is_skippable_file(profile):
|
||||
|
@ -184,9 +186,10 @@ class aa_tools:
|
|||
raise apparmor.AppArmorException(cmd_info[1])
|
||||
|
||||
def cmd_audit(self):
|
||||
apparmor.read_profiles()
|
||||
|
||||
for (program, profile) in self.get_next_to_profile():
|
||||
|
||||
apparmor.read_profiles()
|
||||
output_name = profile if program is None else program
|
||||
|
||||
if not os.path.isfile(profile) or apparmor.is_skippable_file(profile):
|
||||
|
@ -207,13 +210,13 @@ class aa_tools:
|
|||
raise apparmor.AppArmorException(cmd_info[1])
|
||||
|
||||
def cmd_autodep(self):
|
||||
apparmor.read_profiles()
|
||||
|
||||
for (program, profile) in self.get_next_to_profile():
|
||||
if not program:
|
||||
aaui.UI_Info(_('Please pass an application to generate a profile for, not a profile itself - skipping %s.') % profile)
|
||||
continue
|
||||
|
||||
apparmor.read_profiles()
|
||||
|
||||
apparmor.check_qualifiers(program)
|
||||
|
||||
if os.path.exists(apparmor.get_profile_filename(program)) and not self.force:
|
||||
|
|
Loading…
Add table
Reference in a new issue