<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="Bitstream Vera Sans">Subject: apparmor: Apparmor "deny
      network" not working in Jessie<br>
      Package: apparmor<br>
      Version: 2.9.0-3<br>
      Severity: normal<br>
      <br>
      Dear Maintainer,<br>
      <br>
      I would like to prevent a program being able to access the network
      by using <br>
      apparmor.<br>
      I've used apparmor successfully in the past for non-network stuff
      but <br>
      am having some trouble with this.<br>
      <br>
      Here's an example of the issue....<br>
      <br>
      /etc/apparmor.d/usr.bin.wget<br>
      ========================<br>
      /usr/bin/wget {<br>
      # Stop apparmor complaining about some non-network stuff...<br>
      /dev/urandom r,<br>
      /lib/** mr,<br>
      /usr/lib/** mr,<br>
      /etc/** r,<br>
      <br>
      # Attempt to disable network access...<br>
      deny network ,<br>
      deny network inet,<br>
      deny network inet6,<br>
      deny network raw,<br>
      deny network tcp,<br>
      deny network stream,<br>
      }<br>
      ========================<br>
      apparmor_parser -r /etc/apparmor.d/usr.bin.wget<br>
      <br>
      Then test with...<br>
      /usr/bin/wget -qO- <a class="moz-txt-link-freetext" href="http://www.google.com">http://www.google.com</a><br>
      <br>
      Which I would expect to fail, as I've apparently denied network
      access. <br>
      But it returns the page from google anyway.<br>
      <br>
      Problem initially raised in forum: <br>
      <a class="moz-txt-link-freetext" href="http://forums.debian.net/viewtopic.php?f=10&t=126027">http://forums.debian.net/viewtopic.php?f=10&t=126027</a><br>
      <br>
      Looking at the source for the apparmor package in Jessie, I see it
      contains<br>
      a number of 'kernel_patches', but not one for the current Jessie
      kernel<br>
      (I have all security updates applied to date).<br>
      The patches for other versions contain
      'basic-networking-rules.patch'.<br>
      I am suspicious that the lack of such a patch might be the root of
      the problem.<br>
      <br>
      Thanks for looking at this.<br>
      <br>
      -- System Information:<br>
      Debian Release: 8.0<br>
        APT prefers stable<br>
        APT policy: (990, 'stable'), (500, 'stable-updates')<br>
      Architecture: amd64 (x86_64)<br>
      Foreign Architectures: i386<br>
      <br>
      Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)<br>
      Locale: LANG=en_HK.utf8, LC_CTYPE=en_HK.utf8 (charmap=UTF-8)<br>
      Shell: /bin/sh linked to /bin/dash<br>
      Init: systemd (via /run/systemd/system)<br>
      <br>
      Versions of packages apparmor depends on:<br>
      ii  debconf [debconf-2.0]  1.5.56<br>
      ii  initramfs-tools        0.120<br>
      ii  libapparmor-perl       2.9.0-3<br>
      ii  libc6                  2.19-18<br>
      ii  lsb-base               4.1+Debian13+nmu1<br>
      ii  python3                3.4.2-2<br>
      <br>
      apparmor recommends no packages.<br>
      <br>
      Versions of packages apparmor suggests:<br>
      ii  apparmor-docs            2.9.0-3<br>
      ii  apparmor-profiles        2.9.0-3<br>
      ii  apparmor-profiles-extra  1.4<br>
      ii  apparmor-utils           2.9.0-3<br>
      <br>
    </font>
  </body>
</html>