logo

apparmor.d

Unnamed repository; edit this file 'description' to name the repository. git clone https://hacktivis.me/git/apparmor.d.git

usr.sbin.apache2 (3043B)


  1. # Author: Marc Deslauriers <marc.deslauriers@ubuntu.com>
  2. abi <abi/3.0>,
  3. include <tunables/global>
  4. profile apache2 /usr/{bin,sbin}/apache2 flags=(attach_disconnected) {
  5. # This profile is completely permissive.
  6. # It is designed to target specific applications using mod_apparmor,
  7. # hats, and the apache2.d directory.
  8. #
  9. # In order to enable this profile, you must:
  10. #
  11. # 0- Stop apache:
  12. # sudo service apache2 stop
  13. #
  14. # 1- Enable the profile:
  15. # sudo aa-enforce /etc/apparmor.d/usr.sbin.apache2
  16. #
  17. # 2- Load the mpm_prefork and mod_apparmor modules:
  18. # sudo a2dismod <other non-prefork mpm>
  19. # sudo a2enmod mpm_prefork
  20. # sudo a2enmod apparmor
  21. # sudo service apache2 restart
  22. #
  23. # 3- Place an appropriate profile containing the desired hat in the
  24. # /etc/apparmor.d/apache2.d directory. Such profiles must include
  25. # the "apache2-common" abstraction:
  26. #
  27. # ^example.com {
  28. # include <abstractions/apache2-common>
  29. # /var/www/html/ r,
  30. # /var/www/html/** r,
  31. # /var/log/apache2/*.log w,
  32. # }
  33. #
  34. # 4- Use the "AADefaultHatName" apache configuration option to specify a
  35. # hat to be used for a given apache virtualhost or "AAHatName" for
  36. # a given apache directory or location directive:
  37. #
  38. # <VirtualHost example.com:80>
  39. # <IfModule mod_apparmor.c>
  40. # AADefaultHatName example.com
  41. # </IfModule>
  42. # ...
  43. # </VirtualHost>
  44. #
  45. #
  46. # There is an example profile for phpsysinfo included in the
  47. # apparmor-profiles package. To try it:
  48. #
  49. # 1- Install the phpsysinfo and the apparmor-profiles packages:
  50. # sudo apt-get install phpsysinfo apparmor-profiles
  51. #
  52. # 2- Enable the main apache2 profile
  53. # sudo aa-enforce /etc/apparmor.d/usr.sbin.apache2
  54. #
  55. # 3- Configure apache with the following (or similar):
  56. # Alias /phpsysinfo /usr/share/phpsysinfo
  57. # <Location /phpsysinfo>
  58. # <IfModule mod_apparmor.c>
  59. # AAHatName phpsysinfo
  60. # </IfModule>
  61. #
  62. # # adjust as necessary:
  63. # Options None
  64. # Require local
  65. # Require ip 192.168.0.0/16
  66. # </Location>
  67. #
  68. include <abstractions/base>
  69. include <abstractions/nameservice>
  70. # Send signals to all hats.
  71. signal (send) peer=@{profile_name}//*,
  72. capability dac_override,
  73. capability kill,
  74. capability net_bind_service,
  75. capability setgid,
  76. capability setuid,
  77. capability sys_tty_config,
  78. / rw,
  79. /** mrwlkix,
  80. ^DEFAULT_URI flags=(attach_disconnected) {
  81. include <abstractions/base>
  82. include <abstractions/apache2-common>
  83. / rw,
  84. /** mrwlkix,
  85. }
  86. ^HANDLING_UNTRUSTED_INPUT flags=(attach_disconnected) {
  87. include <abstractions/apache2-common>
  88. / rw,
  89. /** mrwlkix,
  90. }
  91. # This directory contains web application
  92. # package-specific apparmor files.
  93. include <apache2.d>
  94. # Site-specific additions and overrides. See local/README for details.
  95. include if exists <local/usr.sbin.apache2>
  96. }