aa-logprof crash if log contains (encoded) non-utf8 filename
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor |
Triaged
|
Medium
|
Unassigned |
Bug Description
aa-logprof crashes if the log contains an (encoded) filename (for example, for a denied read access) and that filename contains a non-utf8 special character.
# cat audit.log-
type=AVC msg=audit(
(the original event/log was for a test profile - I changed it to klogd as an easy reproducer)
# aa-logprof -f audit.log-
Reading log entries from audit.log-
Aktualisiere AppArmor-Profile in /etc/apparmor.d.
Änderungen im complain-Modus
Traceback (most recent call last):
File "aa-logprof", line 52, in <module>
apparmor.
File "/home/
ask_
File "/home/
ans, selected = q.promptUser()
File "/home/
cmd, arg = self.Text_
File "/home/
sys.
File "/usr/lib64/
return codecs.
UnicodeEncodeError: 'charmap' codec can't encode character '\udce4' in position 54: character maps to <undefined>
Bonus content (note: I'm using de_DE@euro (aka iso-8859-15) as locale, and the filename is also iso-8859-15)
# LANG=C aa-logprof -f audit.log-
Traceback (most recent call last):
File "aa-logprof", line 52, in <module>
apparmor.
File "/home/
aaui.
File "/home/
sys.
UnicodeEncodeError: 'ascii' codec can't encode character '\udce4' in position 36: ordinal not in range(128)
Changed in apparmor: | |
importance: | Undecided → Medium |
status: | New → Triaged |
This is easy to fix - just add errors='ignore' in open_file_read() in /usr/lib/ python3/ dist-packages/ apparmor/ common. py
Nice if this could be added to the release as this is making logprof unusable if there's a single non-ASCII character in the logs.