Advertisement
Guest User

Tor Browser Bundle (TBB) 2.2.x AppArmor Profile

a guest
Feb 12th, 2012
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. # Tor Browser Bundle 2.2.x AppArmor profile by Anonymous
  2. # Based on Firefox profile from Jamie Strandboge <jamie@canonical.com>
  3.  
  4. #include <tunables/global>
  5.  
  6. # We want to confine the binaries that match:
  7. /**/tor-browser_*/App/Firefox/firefox {
  8. # FIXME: Some of these abstractions may be a tad permissive
  9. #include <abstractions/audio>
  10. #include <abstractions/cups-client>
  11. #include <abstractions/dbus-session>
  12. #include <abstractions/gnome>
  13. #include <abstractions/ibus>
  14.  
  15. # Tor should be doing our DNS
  16. # #include <abstractions/nameservice>
  17.  
  18. # This is 100% UNSAFE. Allows full read+write access to /home,
  19. # with only a few minor exceptions!!
  20. # #include <abstractions/ubuntu-browsers.d/firefox>
  21.  
  22. # Default profile allows downloads to ~/Downloads and uploads from ~/Public
  23. owner @{HOME}/Public/ r,
  24. owner @{HOME}/Public/* r,
  25. owner @{HOME}/Downloads/ r,
  26. owner @{HOME}/Downloads/* rw,
  27.  
  28. # TBB file access
  29. /**/tor-browser_*/Data/profile/ rk,
  30. /**/tor-browser_*/Data/profile/** rwk,
  31. /**/tor-browser_*/tmp/** rwk,
  32. /**/tor-browser_*/App/Firefox/** rixm,
  33. /**/tor-browser_*/.event/* rk,
  34. /**/tor-browser_*/.cache/* rwk,
  35. /**/tor-browser_*/.pulse-cookie rwk,
  36.  
  37. # for networking, only allow connections to localhost
  38. # network tcp dst 127.0.0.1, # TODO: Needs AppArmor 3.0?
  39. network tcp, # :(
  40.  
  41. /etc/mime.types r,
  42. /etc/mailcap r,
  43. /etc/xdg/*buntu/applications/defaults.list r, # for all derivatives
  44. /usr/share/xubuntu/applications/defaults.list r,
  45. owner @{HOME}/.local/share/applications/defaults.list r,
  46. owner @{HOME}/.local/share/applications/mimeapps.list r,
  47. owner @{HOME}/.local/share/applications/mimeinfo.cache r,
  48.  
  49. /etc/timezone r,
  50. /etc/wildmidi/wildmidi.cfg r,
  51.  
  52. # Firefox likes to inspect its own proc entry, possibly for FS info during
  53. # downloads?
  54. @{PROC}/ r,
  55. @{PROC}/[0-9]*/cmdline r,
  56. @{PROC}/[0-9]*/mountinfo r,
  57. @{PROC}/**/stat r,
  58.  
  59. # FIXME: Not sure why this is needed.. Possibly for JIT optimizations?
  60. # If you're paranoid, you can probably throw a "deny" in front of here
  61. /sys/devices/system/cpu/** r,
  62.  
  63. # FIXME: Firefox needs /etc/password for some gnome shiz :(
  64. /etc/passwd r,
  65. /etc/nsswitch.conf r,
  66.  
  67. # No DNS for you, firefox.
  68. deny /etc/resolv.conf r,
  69. deny /etc/hosts r,
  70. deny /etc/host.conf r,
  71.  
  72. # TODO: This is noisy. Should be silent. Apparmor bug??
  73. #deny network dgram,
  74. network dgram,
  75. }
  76.  
  77. /**/tor-browser_*/App/tor {
  78. #include <abstractions/base>
  79.  
  80. network tcp,
  81.  
  82. # TODO: This is noisy. Should be silent. Apparmor bug??
  83. # XXX: Why does Tor need UDP?
  84. #deny network dgram,
  85. network dgram,
  86.  
  87. /**/tor-browser_*/Data/Tor/* rwk,
  88. /**/tor-browser_*/tmp/* rwk,
  89.  
  90. /**/tor-browser_*/Lib/* mrix,
  91. /**/tor-browser_*/Lib/libz/* mrix,
  92. }
  93.  
  94. /**/tor-browser_*/App/vidalia {
  95. # #include <abstractions/nameservice>
  96. #include <abstractions/fonts>
  97. #include <abstractions/freedesktop.org>
  98. #include <abstractions/dbus-session>
  99. #include <abstractions/ibus>
  100.  
  101. # TODO: :(. Can't restrict to localhost till Apparmor 3.0
  102. network tcp,
  103.  
  104. # We can't use abstractions/base for these because
  105. # it conflicts with the ability to launch tor+firefox somehow (??)
  106. /etc/ld.so.cache r,
  107. /usr/lib/** mr,
  108. /lib/** mr,
  109. /dev/urandom r,
  110. /usr/share/** rk, # Icons, themes, etc
  111. /etc/xdg/Trolltech.conf rk,
  112. /etc/locale.alias r,
  113. /etc/localtime r,
  114.  
  115. deny /proc/** r, # Who needs /proc? STFU, plz
  116.  
  117. /**/tor-browser_*/App/tor px,
  118. /**/tor-browser_*/App/Firefox/firefox px,
  119.  
  120. /**/tor-browser_*/tmp/* rwk,
  121. /**/tor-browser_*/Data/Vidalia/* rwk,
  122. /**/tor-browser_*/Data/Tor/port.conf r,
  123.  
  124. /**/tor-browser_*/Lib/* mrix,
  125. /**/tor-browser_*/Lib/libz/* mrix,
  126.  
  127. /etc/ssl/certs/ r,
  128. /etc/ssl/certs/** r,
  129.  
  130. # Trolltech nonsense...
  131. deny /**/tor-browser_*/.config/ w,
  132. deny /**/tor-browser_*/.config/** rwmk,
  133.  
  134. # XXX: WTF?? Why does vidalia need my xauth???
  135. deny @{HOME}/.Xauthority rwmk,
  136.  
  137. # XXX: WTF?? /etc/passwd?
  138. deny /etc/passwd rmk,
  139.  
  140. # XXX: Vidalia needs DNS?
  141. deny /etc/nsswitch.conf rmk,
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement