This is already fixed upstream (in AppArmor 2.12.2 and 2.13.2),
especially commit f997977e6.
However, the Ubuntu package doesn't have that fix yet, therefore I add
"apparmor (Ubuntu)" to the "affects" list.
Backporting the mentioned commit probably isn't too easy (it's quite big
and IIRC has dependencies on previous commits), so maybe upgrading to
2.12.2 would be easier.
** Also affects: apparmor (Ubuntu)
Importance: Undecided
Status: New
** Changed in: apparmor
Status: New => Fix Released
--
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/1819741
Title:
aa-genprof fails on disabled profile
Status in AppArmor:
Fix Released
Status in apparmor package in Ubuntu:
New
Bug description:
Hi,
I'm following the tutorial at
https://ubuntuforums.org/showthread.php?t=1008906&p=6353894#post6353894
based on my Ubuntu 18.10 as-is presently.
When doing sudo aa-genprof firefox, I get the following error message:
Traceback (most recent call last):
File "/usr/sbin/aa-genprof", line 110, in <module>
apparmor.autodep(program)
File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 590, in autodep
profile_data = get_profile(pname)
File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 500, in
get_profile
inactive_profile[prof_name][prof_name].pop('filename')
AttributeError: 'ProfileStorage' object has no attribute 'pop'
So much as I can see, I have a usr.bin.firefox profile both in apparmor.d and
in the disable directory.
The full trace is below:
----
AttributeError
Python 3.6.7: /usr/bin/python3
Tue Mar 12 18:23:07 2019
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/usr/sbin/aa-genprof in <module>()
105
106 profile_filename = apparmor.get_profile_filename(program)
107 if os.path.exists(profile_filename):
108 apparmor.helpers[program] =
apparmor.get_profile_flags(profile_filename, program)
109 else:
110 apparmor.autodep(program)
111 apparmor.helpers[program] = 'enforce'
112
113 if apparmor.helpers[program] == 'enforce':
114 apparmor.complain(program)
apparmor = <module 'apparmor.aa' from
'/usr/lib/python3/dist-packages/apparmor/aa.py'>
apparmor.autodep = <function autodep>
program = '/usr/lib/firefox/firefox.sh'
/usr/lib/python3/dist-packages/apparmor/aa.py in
autodep(bin_name='/usr/lib/firefox/firefox.sh',
pname='/usr/lib/firefox/firefox.sh')
585 else:
586 bin_full = pname # for named profiles
587
588 pname = bin_full
589 read_inactive_profiles()
590 profile_data = get_profile(pname)
591 # Create a new profile if no existing profile
592 if not profile_data:
593 profile_data = create_new_profile(pname)
594 file = get_profile_filename(pname)
profile_data undefined
global get_profile = <function get_profile>
pname = '/usr/lib/firefox/firefox.sh'
/usr/lib/python3/dist-packages/apparmor/aa.py in
get_profile(prof_name='/usr/lib/firefox/firefox.sh')
495 aaui.UI_Important(_('WARNING: Error fetching profiles from
the repository'))
496 inactive_profile = get_inactive_profile(prof_name)
497 if inactive_profile:
498 uname = 'Inactive local profile for %s' % prof_name
499 inactive_profile[prof_name][prof_name]['flags'] = 'complain'
500 inactive_profile[prof_name][prof_name].pop('filename')
501 profile_hash[uname]['username'] = uname
502 profile_hash[uname]['profile_type'] = 'INACTIVE_LOCAL'
503 profile_hash[uname]['profile'] =
serialize_profile(inactive_profile[prof_name], prof_name, None)
504 profile_hash[uname]['profile_data'] = inactive_profile
inactive_profile = {'/usr/lib/firefox/firefox.sh': defaultdict(<function
hasher at 0x7f8e214ad9d8>,...torage.ProfileStorage object at 0x7f8e2088bc18>})}
prof_name = '/usr/lib/firefox/firefox.sh'
].pop undefined
AttributeError: 'ProfileStorage' object has no attribute 'pop'
__cause__ = None
__class__ = <class 'AttributeError'>
__context__ = None
__delattr__ = <method-wrapper '__delattr__' of AttributeError object>
__dict__ = {}
__dir__ = <built-in method __dir__ of AttributeError object>
__doc__ = 'Attribute not found.'
__eq__ = <method-wrapper '__eq__' of AttributeError object>
__format__ = <built-in method __format__ of AttributeError object>
__ge__ = <method-wrapper '__ge__' of AttributeError object>
__getattribute__ = <method-wrapper '__getattribute__' of AttributeError
object>
__gt__ = <method-wrapper '__gt__' of AttributeError object>
__hash__ = <method-wrapper '__hash__' of AttributeError object>
__init__ = <method-wrapper '__init__' of AttributeError object>
__init_subclass__ = <built-in method __init_subclass__ of type object>
__le__ = <method-wrapper '__le__' of AttributeError object>
__lt__ = <method-wrapper '__lt__' of AttributeError object>
__ne__ = <method-wrapper '__ne__' of AttributeError object>
__new__ = <built-in method __new__ of type object>
__reduce__ = <built-in method __reduce__ of AttributeError object>
__reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
__repr__ = <method-wrapper '__repr__' of AttributeError object>
__setattr__ = <method-wrapper '__setattr__' of AttributeError object>
__setstate__ = <built-in method __setstate__ of AttributeError object>
__sizeof__ = <built-in method __sizeof__ of AttributeError object>
__str__ = <method-wrapper '__str__' of AttributeError object>
__subclasshook__ = <built-in method __subclasshook__ of type object>
__suppress_context__ = False
__traceback__ = <traceback object>
args = ("'ProfileStorage' object has no attribute 'pop'",)
with_traceback = <built-in method with_traceback of AttributeError object>
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File "/usr/sbin/aa-genprof", line 110, in <module>
apparmor.autodep(program)
File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 590, in autodep
profile_data = get_profile(pname)
File "/usr/lib/python3/dist-packages/apparmor/aa.py", line 500, in
get_profile
inactive_profile[prof_name][prof_name].pop('filename')
AttributeError: 'ProfileStorage' object has no attribute 'pop'
To manage notifications about this bug go to:
https://bugs.launchpad.net/apparmor/+bug/1819741/+subscriptions
--
Mailing list: https://launchpad.net/~touch-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp