[apparmor] patch for aa-logprof -f given a special file

Peter Maloney peter.maloney at brockmann-consult.de
Tue Nov 4 20:15:40 UTC 2014


Hi,

The perl tools allowed using aa-logprof -f <(...), but the python ones
don't. I find it very useful to use with grep to shorten the list of
questions for modifying a specific profile, without bothering with
updating other profiles with lots of spam you don't care about. And in
this particular case I was using head to try to find out which line
somewhere makes aa-logprof crash with another problem I'm working on.

Would you please accept this patch to change it so it will allow special
files again?


ps. I'm not on the list; be sure to CC me when replying.


root at vpn3:~# aa-logprof -f <(head /var/log/audit/audit.log)
Traceback (most recent call last):
  File "/usr/sbin/aa-logprof", line 37, in <module>
    raise apparmor.AppArmorException(_('The logfile %s does not exist. Please check the path') % filename)
apparmor.common.AppArmorException: 'The logfile /dev/fd/63 does not exist. Please check the path'


root at vpn3:~# diff -u /usr/sbin/aa-logprof{.orig,}
--- /usr/sbin/aa-logprof.orig   2014-11-04 20:41:51.689136187 +0100
+++ /usr/sbin/aa-logprof        2014-11-04 20:42:06.665135040 +0100
@@ -33,7 +33,7 @@
 
 
 if filename:
-    if not os.path.isfile(filename):
+    if not os.path.exists(filename):
         raise apparmor.AppArmorException(_('The logfile %s does not exist. Please check the path') % filename)
     else:
         apparmor.filename = filename


root at vpn3:~# aa-logprof -f <(head /var/log/audit/audit.log)
Reading log entries from /dev/fd/63.
Updating AppArmor profiles in /etc/apparmor.d.
...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aa.diff
Type: text/x-patch
Size: 459 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141104/f0b4d8a4/attachment.bin>


More information about the AppArmor mailing list