Presented By: EktaAhujaAppArmor
About MeStudent: MSc.CA at SICSRWindows & Information Security Enthusiast Database Freak
AgendaWhat is Apparmor?Why Use Apparmor?Apparmor ProfilesDemo
IntroductionAppArmoris the most effective and easy-to-use Linux application security system available on the market today. AppArmor is a security framework that proactively protects the operating system and applications from external or internal threats, even zero-day attacks, by enforcing good program behavior and preventing even unknown software flaws from being exploited. AppArmor security profiles completely define what system resources individual programs can access, and with what privileges. A number of default policies are included with AppArmor, and using a combination of advanced static analysis and learning-based tools, AppArmor policies for even very complex applications can be deployed successfully in a matter of hours.
Why AppArmor..??
Which Programs can be Protected..??General recommendation :		Every program that mediates Privileges.Network Services :		Every program(server/client) with open ports.Cron jobs :Cron jobs that run with root privilages can be protected.Web Applications :		CGI scripts, Java Applets etc.
AppArmor ProfilesFor each application that we want to protect we can create a separate profile.A profile contains:The full path of the program that is confined.With the #include directive we can pull in components of other profiles.Add POSIX capabilities with the capability statement.A path entry, specifying which part of filesystem the program can access.
Profile Types:
Generating Profiles
Key of a ProfileEach rule also specifies permissions: r – readw - write ux - unconstrained execute Ux - unconstrained execute -- scrub the environment px - discrete profile execute Px - discrete profile execute -- scrub the environment ix - inherit execute m - allow PROT_EXEC with mmap(2) calls l - link cx- local security profile
Parts of Profile:Example: Hypothetical application -- /usr/bin/foo#include <tunables/global>/usr/bin/foo{   #include <abstractions/base>   capability setgid  , network inettcp  , link /etc/sysconfig/foo -> /etc/foo.conf,   /bin/mount ux, /dev/{,u}  random r, /etc/ld.so.cache r, /etc/foo/* r, /lib/ld-*.so* mr, /lib/lib*.so* mr, /proc/[0-9]** r, /usr/lib/** mr, /tmp/   r, /tmp/foo.pid wr, /tmp/foo.* lrw, /@{HOME}  /.foo_filerw,
Parts of Profile (cont..)/@{HOME}/.foo_lockkw, owner   /shared/foo/** rw, /usr/bin/foobarcx,/bin/** px -> bin_generic, # a comment about foo's local (children)profile for /usr/bin/foobar.profile /usr/bin/foobar   { /bin/bash rmix, /bin/cat rmix, /bin/more rmix, /var/log/foobar* rwl, /etc/foobar r, } # foo's hat, bar. ^bar   { /lib/ld-*.so* mr, /usr/bin/bar px, /var/spool/* rwl, 	} }
Profile ModesEnforce Mode Complain Mode (Learning Mode)
Flow of LogicCollapse a few rules and make it more generic and open.
Demo Time 
References http://en.opensuse.org/SDB:AppArmor_geeks
 http://www.novell.com/documentation

Apparmor

  • 1.
  • 2.
    About MeStudent: MSc.CAat SICSRWindows & Information Security Enthusiast Database Freak
  • 3.
    AgendaWhat is Apparmor?WhyUse Apparmor?Apparmor ProfilesDemo
  • 4.
    IntroductionAppArmoris the mosteffective and easy-to-use Linux application security system available on the market today. AppArmor is a security framework that proactively protects the operating system and applications from external or internal threats, even zero-day attacks, by enforcing good program behavior and preventing even unknown software flaws from being exploited. AppArmor security profiles completely define what system resources individual programs can access, and with what privileges. A number of default policies are included with AppArmor, and using a combination of advanced static analysis and learning-based tools, AppArmor policies for even very complex applications can be deployed successfully in a matter of hours.
  • 5.
  • 6.
    Which Programs canbe Protected..??General recommendation : Every program that mediates Privileges.Network Services : Every program(server/client) with open ports.Cron jobs :Cron jobs that run with root privilages can be protected.Web Applications : CGI scripts, Java Applets etc.
  • 7.
    AppArmor ProfilesFor eachapplication that we want to protect we can create a separate profile.A profile contains:The full path of the program that is confined.With the #include directive we can pull in components of other profiles.Add POSIX capabilities with the capability statement.A path entry, specifying which part of filesystem the program can access.
  • 8.
  • 9.
  • 10.
    Key of aProfileEach rule also specifies permissions: r – readw - write ux - unconstrained execute Ux - unconstrained execute -- scrub the environment px - discrete profile execute Px - discrete profile execute -- scrub the environment ix - inherit execute m - allow PROT_EXEC with mmap(2) calls l - link cx- local security profile
  • 11.
    Parts of Profile:Example:Hypothetical application -- /usr/bin/foo#include <tunables/global>/usr/bin/foo{ #include <abstractions/base> capability setgid , network inettcp , link /etc/sysconfig/foo -> /etc/foo.conf, /bin/mount ux, /dev/{,u} random r, /etc/ld.so.cache r, /etc/foo/* r, /lib/ld-*.so* mr, /lib/lib*.so* mr, /proc/[0-9]** r, /usr/lib/** mr, /tmp/ r, /tmp/foo.pid wr, /tmp/foo.* lrw, /@{HOME} /.foo_filerw,
  • 12.
    Parts of Profile(cont..)/@{HOME}/.foo_lockkw, owner /shared/foo/** rw, /usr/bin/foobarcx,/bin/** px -> bin_generic, # a comment about foo's local (children)profile for /usr/bin/foobar.profile /usr/bin/foobar { /bin/bash rmix, /bin/cat rmix, /bin/more rmix, /var/log/foobar* rwl, /etc/foobar r, } # foo's hat, bar. ^bar { /lib/ld-*.so* mr, /usr/bin/bar px, /var/spool/* rwl, } }
  • 13.
    Profile ModesEnforce ModeComplain Mode (Learning Mode)
  • 14.
    Flow of LogicCollapsea few rules and make it more generic and open.
  • 15.
  • 16.
  • 17.