Apparmor profile for Subsonic

Tutorials, tips and tricks.

Moderator: moderators

Apparmor profile for Subsonic

Postby Sporkman » Wed Mar 17, 2010 1:43 am

Hi All,

I put together an Apparmor profile for Subsonic, and thought I'd share. I'm running it on Ubuntu, which ships with apparmor installed and enabled.

Here it is - just replace "<<root music folder>>" with the root file path to your music. FYI it is in "complain" mode, you can switch it to enforce mode by commenting out the "complain" line & uncommenting the one below it:

(UPDATED 3/18 - needed some extra additions)

Code: Select all
#include <tunables/global>

/usr/share/subsonic/subsonic.sh flags=(complain) {
# /usr/share/subsonic/subsonic.sh {
  #include <abstractions/base>
  #include <abstractions/fonts>

  capability setgid,
  capability setuid,
  capability dac_override,
  capability net_bind_service,

  network inet,
  network inet6,

  owner /dev/random a,
  owner /dev/random rw,
  owner /etc/fonts/** r,
  owner /etc/gai.conf r,
  owner /home/nas/music/** rw,
  owner /var/subsonic/** rw,

  /bin/dash  rix,
  /bin/mkdir  rix,
  /bin/readlink  rix,
  /bin/rm  rix,
  /dev/random  r,
  /dev/urandom  r,
  /etc/host*  r,
  /etc/java-6-sun/**  r,
  /etc/resolv.conf  r,
  /etc/nsswitch.conf  r,
  /etc/passwd  mr,
  /lib/lib*.so  rix,
  /proc/**  r,
  /sys/devices/system/cpu/  r,
  /tmp/  r,
  /tmp/**  mrw,
  /tmp/subsonic/**  rw,
  /usr/bin/dirname  rix,
  /usr/bin/ffmpeg  rix,
  /usr/bin/lame  rix,
  /usr/lib/jvm/java-6-sun-*/jre/bin/java  rix,
  /usr/lib/jvm/java-6-sun-*/jre/lib/**  mr,
  /usr/share/subsonic/**  mr,
  /usr/share/zoneinfo/  r,
  /var/run/subsonic.pid  rw,
  /var/subsonic/**  r,
  /var/subsonic/db/**  mrwk,
  /var/subsonic/jetty/*/  w,
  /var/subsonic/jetty/*/**  mrw,
  /var/subsonic/subsonic*.log  rw,
  /var/subsonic/subsonic.properties  rw,
  /var/subsonic/thumbs/** rw,

  <<root music folder>>/  r,
  <<root music folder>>/**  r,
  <<root music folder>>/*/*/  w,
  <<root music folder>>/*/*/*.j*  w,
}


...and here is a link to a short apparmor tutorial for ubuntu.
Sporkman
 
Posts: 18
Joined: Wed Mar 17, 2010 1:33 am
Location: The Internet

Postby OM NOM NOM » Fri Mar 26, 2010 4:05 pm

Thanks Sporkman was just looking into something like this. Appreciate you taking the time to write and share it!
User avatar
OM NOM NOM
 
Posts: 11
Joined: Fri Mar 26, 2010 4:02 pm

Postby Sporkman » Wed Mar 31, 2010 12:36 am

OM NOM NOM wrote:Thanks Sporkman was just looking into something like this. Appreciate you taking the time to write and share it!


No problem! 8)
Sporkman
 
Posts: 18
Joined: Wed Mar 17, 2010 1:33 am
Location: The Internet


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 13 guests