Package: tcpdump
Version: 4.99.5-2
Severity: normal
Tags: patch

When using 'tcpdump -z gzip' (or bzip2) to compress rotated capture files, the compression fails due to an AppArmor permission error.

While the AppArmor profile already contains the execution rights for the compressors via '/{usr/,}bin/gzip ixr,', it lacks the file permissions to write the resulting '.gz' or '.bz2' files. AppArmor blocks the write operation as soon as the suffix is appended to the original file name.

Extending the allowed file patterns with the choice syntax '{,.gz,.bz2}' fixes the issue for both standard and numbered suffixes (with -W).

I have attached a patch that resolves the issue by allowing read/write access to the compressed variants.

According to the package sources, the bug is still present in newer versions and the patch should apply unmodified.

Thank you
--- /etc/apparmor.d/usr.bin.tcpdump
+++ /etc/apparmor.d/usr.bin.tcpdump
@@ -53,13 +53,13 @@
   owner @{HOME}/** rw,
 
   # for -r, -F and -w
-  /**.[pP][cC][aA][pP] rw,
-  /**.[pP][cC][aA][pP][nN][gG] rw,
-  /**.[cC][aA][pP] rw,
+  /**.[pP][cC][aA][pP]{,.gz,.bz2} rw,
+  /**.[pP][cC][aA][pP][nN][gG]{,.gz,.bz2} rw,
+  /**.[cC][aA][pP]{,.gz,.bz2} rw,
   # -W adds a numerical suffix
-  /**.[pP][cC][aA][pP][0-9]* rw,
-  /**.[pP][cC][aA][pP][nN][gG][0-9]* rw,
-  /**.[cC][aA][pP][0-9]* rw,
+  /**.[pP][cC][aA][pP][0-9]*{,.gz,.bz2} rw,
+  /**.[pP][cC][aA][pP][nN][gG][0-9]*{,.gz,.bz2} rw,
+  /**.[cC][aA][pP][0-9]*{,.gz,.bz2} rw,
 
   # for convenience with -r (ie, read pcap files from other sources)
   /var/log/snort/*log* r,

Reply via email to