← Back to team overview

touch-packages team mailing list archive

[Bug 1489196] [NEW] aa-genprof should display a clear error message instead of a stack trace if it doesn't have write permissions to the profile directory

 

Public bug reported:

When attempting to run aa-genprof, I received the following stack trace:

user@user-desktop:~$ aa-genprof airodump-ng
Writing updated profile for /home/user/aircrack/src/airodump-ng.
Traceback (most recent call last):
  File "/usr/sbin/aa-genprof", line 109, in <module>
    apparmor.autodep(program)
  File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 597, in autodep
    write_profile_ui_feedback(pname)
  File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 4307, in write_profile_ui_feedback
    write_profile(profile)
  File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 4316, in write_profile
    newprof = tempfile.NamedTemporaryFile('w', suffix='~', delete=False, dir=profile_dir)
  File "/usr/lib/python3.4/tempfile.py", line 599, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python3.4/tempfile.py", line 339, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: '/etc/apparmor.d/tmpj_2nnooj~'

Practically, this was caused by accidentally not running aa-genprof as
root. But it would be much more useful for a user if AppArmor instead
displayed a helpful error message, like: "Unable to create file in
profile directory(%s).  Try running aa-genprof as root." % profile_dir

** Affects: apparmor
     Importance: Undecided
         Status: New

** Affects: apparmor (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apparmor in Ubuntu.
https://bugs.launchpad.net/bugs/1489196

Title:
  aa-genprof should display a clear error message instead of a stack
  trace if it doesn't have write permissions to the profile directory

Status in AppArmor:
  New
Status in apparmor package in Ubuntu:
  New

Bug description:
  When attempting to run aa-genprof, I received the following stack
  trace:

  user@user-desktop:~$ aa-genprof airodump-ng
  Writing updated profile for /home/user/aircrack/src/airodump-ng.
  Traceback (most recent call last):
    File "/usr/sbin/aa-genprof", line 109, in <module>
      apparmor.autodep(program)
    File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 597, in autodep
      write_profile_ui_feedback(pname)
    File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 4307, in write_profile_ui_feedback
      write_profile(profile)
    File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 4316, in write_profile
      newprof = tempfile.NamedTemporaryFile('w', suffix='~', delete=False, dir=profile_dir)
    File "/usr/lib/python3.4/tempfile.py", line 599, in NamedTemporaryFile
      (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
    File "/usr/lib/python3.4/tempfile.py", line 339, in _mkstemp_inner
      fd = _os.open(file, flags, 0o600)
  PermissionError: [Errno 13] Permission denied: '/etc/apparmor.d/tmpj_2nnooj~'

  Practically, this was caused by accidentally not running aa-genprof as
  root. But it would be much more useful for a user if AppArmor instead
  displayed a helpful error message, like: "Unable to create file in
  profile directory(%s).  Try running aa-genprof as root." % profile_dir

To manage notifications about this bug go to:
https://bugs.launchpad.net/apparmor/+bug/1489196/+subscriptions


Follow ups