Changes between Initial Version and Version 1 of apparmor


Ignore:
Timestamp:
2012-03-19T12:46:42Z (13 years ago)
Author:
mk.fg
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • apparmor

    v1 v1  
     1= Running Tahoe-LAFS with !AppArmor Linux Security Module (LSM, MAC) =
     2
     3
     4== What's it all about ==
     5
     6[http://apparmor.net AppArmor LSM] allows better isolation of privileges and potential exploits than standard linux uid/gid mechanisms, also known as Discretionary Access Control (DAC).
     7
     8Basic idea is that if there will be any kind of remote execution vulnerability in tahoe, python or any of the dozens of the libraries it's built upon (all the way down to a kernel itself), attacker will get access to uid/gid that the node is running under, and from there, there are dozens of attack vectors - from infamous forkbomb DoS attacks, sharing sensitive data with other uid/gid's or network and insecure /tmp files to a numerous kernel zero-day privilege escalation vulnerabilities.\\
     9Mandatory Access Control modules like !AppArmor aim to prevent that by further restricting the app from being able to even do "ls /" to the bare minimum of the capabilities and permissions the app needs to operate.
     10
     11!AppArmor is mainly used on dpkg-oriented linux distributions like SUSE and Ubuntu. Fedora and Red Hat linux (and derivatives) tend to use SELinux LSM by default, but there are no fundamental problems with using !AppArmor there as well.
     12
     13See [#Links links section] for more information about the approach itself and particulars of the technology used.
     14
     15
     16== Profile ==
     17
     18About the only special thing in tahoe apparmor confinement is the fact that python stdlib module "platform" runs binaries like shell (/bin/sh) and file (/usr/bin/file) via os.popen to get information about the unix platform it's running on.\\
     19These particular operations **can** be blocked (platform module will fall back to reporting "generic" values), leaving tahoe with no particulars about the platform it runs on.
     20
     21Sufficient and zero-noise profile for generic non-packaged tahoe build (checked out to /home/tahoe/tahoe-lafs path) follows:
     22
     23{{{
     24#include <tunables/global>
     25
     26/home/tahoe/tahoe-lafs/bin/tahoe {
     27
     28  #include <abstractions/base>
     29  #include <abstractions/python>
     30  #include <abstractions/nameservice>
     31
     32  # Helper binaries
     33  #include <abstractions/bash>
     34  /bin/bash ix,
     35  /bin/uname Ux,
     36  /usr/bin/file Ux,
     37  /sbin/ifconfig Ux,
     38
     39  # Subprocesses
     40  /home/tahoe/tahoe-lafs/bin/tahoe ix,
     41  /home/tahoe/tahoe-lafs/support/bin/tahoe ix,
     42
     43  # Misc harmless access
     44  deny /etc/ r,
     45  /dev/tty rw,
     46  /usr/bin/python2.[changeset:16bb529339e6cbd5] r,
     47  /usr/include/python2.7/pyconfig.h r,
     48
     49  # Build tree of tahoe
     50  /home/tahoe/tahoe-lafs r,
     51  /home/tahoe/tahoe-lafs/** rm,
     52
     53  # Grids and network
     54  network tcp,
     55  /home/tahoe/grids/ rw,
     56  /home/tahoe/grids/** krw,
     57
     58}
     59}}}
     60
     61A few things to note:
     62
     63* Data and configuration resides in /home/tahoe/grids/ path, and should be changed as necessary.
     64* "abstractions/bash" ruleset, execution of /bin/bash, /bin/uname, /usr/bin/file, as well as access to /bin/tty and /usr/bin/python* binary can be left out as noted above. It is only used to determine platform tahoe-lafs runs on.
     65* "owner" rule qualifier can be added if /home/tahoe belongs to the same uid tahoe node runs with.
     66* "network tcp" line can be changed to include only a particular node set, **but** abstractions/nameservice allows fairly liberal network usage, so that aspect is better left to other network control mechanisms like a firewall or user-space IDS.
     67
     68
     69== Links == #Links
     70
     71* [http://apparmor.net/ AppArmor project page].
     72* [http://wiki.apparmor.net/index.php/ProfileLanguage Profile language documentation].
     73* [https://github.com/mk-fg/apparmor-profiles/blob/master/profiles/opt.bin.tahoe Source of the profile], used by the original author of this page (can be more up-to-date than the page).