Hello,

the attached patch splits off various permissions from the httpd2-
prefork profile to abstractions/apache2-common. Additionally, it adds 
read permissions for /**/.htaccess and /dev/urandom to apache2-common.

The patch is based on a profile abstraction from darix. I made some 
things more strict (compared to darix' profile), and OTOH added some 
things that are needed on my servers.

For reference: Darix sent me a file abstractons/apache-vhost-base (note 
the different name, I merged into apache2-common).
Original abstractions/apache-vhost-base from darix:

  network,

  @{PROC}/**/attr/current rw,

  # htaccess files - for what ever it is worth
  /**.htaccess            r,

  # error pages
  /usr/share/apache2/**   r,


BTW: Darix' profile has @{PROC}/**/attr/current rw, however my 
experience is I only need @{PROC}/*/attr/current w (no r). 
I never needed   @{PROC}/*/task/*/attr/current.
- Does apache really need write access to both variants? (I doubt.)
- What's the difference between both variants?

Note: My version of abstractions/apache2-common does not allow to read 
/.htaccess (I changed /**.htaccess -> /**/.htaccess) which slightly 
reduces permissions for ^HANDLING_UNTRUSTED_INPUT. However I doubt 
someone has a .htaccess in / ;-)

The other changes I did do not remove permissions from the profile in 
bzr because those permissions didn't exist there - they exist only in 
the profile and abstractions from darix.

I'm also nominating this patch for the 2.7 branch (maybe except 
disallowing /.htaccess for ^HANDLING_UNTRUSTED_INPUT  if you are afraid 
it breaks some setups)


Regards,

Christian Boltz
-- 
>> Why? As long as [the bug] is not solved, somebody is working on it.
> or sleeping on it :-)
You mean like zmd? :)
[>> houghi, > jdd and Anders Norrbring in opensuse]
=== modified file 'profiles/apparmor.d/abstractions/apache2-common'
--- profiles/apparmor.d/abstractions/apache2-common	2010-01-03 21:16:38 +0000
+++ profiles/apparmor.d/abstractions/apache2-common	2011-12-21 23:57:10 +0000
@@ -1,9 +1,20 @@
 # vim:syntax=apparmor
 
+# This file contains basic permissions for Apache and every vHost
+
+  #include <abstractions/nameservice>
+
   # Apache
   network inet stream,
+  network inet6 stream,
+  # apache manual, error pages and icons
   /usr/share/apache2/** r,
 
   # changehat itself
   /proc/*/attr/current                        w,
 
+  # htaccess files - for what ever it is worth
+  /**/.htaccess            r,
+
+  /dev/urandom            r,
+

=== modified file 'profiles/apparmor/profiles/extras/usr.sbin.httpd2-prefork'
--- profiles/apparmor/profiles/extras/usr.sbin.httpd2-prefork	2011-08-08 20:22:03 +0000
+++ profiles/apparmor/profiles/extras/usr.sbin.httpd2-prefork	2011-12-21 23:58:09 +0000
@@ -12,6 +12,7 @@
 #include <tunables/global>
 
 /usr/sbin/httpd2-prefork {
+  #include <abstractions/apache2-common>
   #include <abstractions/base>
   #include <abstractions/consoles>
   #include <abstractions/kerberosclient>
@@ -78,8 +79,6 @@
   /usr/local/tomcat/conf/mod_jk.conf r,
   /usr/local/tomcat/conf/workers-ajp12.properties r,
   /usr/sbin/httpd2-prefork r,
-  /usr/share/apache2/error/* r,
-  /usr/share/apache2/error/include/* r,
   /usr/share/misc/magic.mime r,
   /usr/share/snmp/mibs r,
   /usr/share/snmp/mibs/*.{txt,mib} r,
@@ -125,21 +124,18 @@
   /srv/www/icons/*.{gif,jpg,png}     r,
   /srv/www/vhosts                    r,
   /srv/www/vhosts/**                 r,
-  # SuSE location of the apache manual + error pages
-  /usr/share/apache2/**              r,
 
   # php session state
   /var/lib/php/sess_*                rwl,
 
 
   ^HANDLING_UNTRUSTED_INPUT {
-    #include <abstractions/nameservice>
+    #include <abstractions/apache2-common>
     /var/log/apache2/*     w,
-    /**.htaccess           r,
   }
 
   ^DEFAULT_URI {
-    #include <abstractions/nameservice>
+    #include <abstractions/apache2-common>
     #include <abstractions/base>
 
     # Note that mod_perl, mod_php, mod_python, etc, allows in-apache
@@ -176,8 +172,6 @@
     /srv/www/icons/*.{gif,jpg,png}     r,
     /srv/www/vhosts                    r,
     /srv/www/vhosts/**                 r,
-    # SuSE location of the apache manual + error pages
-    /usr/share/apache2/**              r,
 
     # php session state
     /var/lib/php/sess_*                rwl,

-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to