SlideShare une entreprise Scribd logo
1  sur  28
Capsicum: Practical Capabilities for
             UNIX

Robert N. M. Watson, Jonathan Anderson, Ben
           Laurie, Kris Kennaway




      Presented by : Ruchith Fernando
                  CS 626
              March 8, 2011
Context
●   Multiple processes of an application
●   Ambient user privileges
●   Full power of the user
    ●   Access to all resources
Browser
Browser




/home/bob/.browser_settings/
/home/bob/personal/
/home/bob/work/
/bin/
/proc/
/dev/


         Operating System
Least Privilege
Application Sandboxing

(Compartmentalization)
Problem Statement
●   How can the OS support application
    sandboxing?
●   Minimize the effort by the developers?
●   Better performance compared to other
    techniques.
Contribution
●   API extensions to break down application code
    ●   Run them in sanboxes
    ●   Logical application
●   Implementation – FreeBSD
    ●   To be included in version 9
●   Application of the extensions
●   Performance evaluation
Main Idea
●   API extensions
●   libcapsicum
    ●   Capability mode
    ●   Capabilities
Capability Mode
●   No access to global namespaces
    ●   Process ID, File paths, File systems ID, System
        clocks, etc.
●   Restricted access to some syscalls
    ●   sysctl (only 30 params are allowed)
    ●   shm_open
    ●   openat …
●   No privilege elevation via setuid/setgid
Capabilities
●   Wraps normal file descriptors
●   cap_new(FD, mask_of_rights);
●   60 possible mask rights
    ●   CAP_READ
    ●   CAP_WRITE
    ●   CAP_SEEK
    ●   ...
●   Directories
Implementation
●   At kernel services
●   namei – path lookups
●   fget – File descriptors to struct file refs
●   pdfork() – returns a file descriptor
●   Runtime
    ●   fexecve() 
    ●   rtld­elf­cap – Capability aware linker
    ●   fdlists – to declare capabilities to be passed in
Can we use it?
Debugging
●   procstat
    ●   State of ruining processes
    ●   Shows
        –   capability mode
        –   Capability rights masks
●   Missing dependencies
    ●   ENOTCAPABLE
        –   New errno value
●   API to check whether sandboxing is enabled
tcpdump
●   cap_enter()
●   Restricting access to STDIN, STDOUT, 
    STDERR Using lc_limitfd()


●   Problem with lazy DNS resolution
    ●   Need to access /etc/resolv.conf
dhclient
●   Before : chroot + setuid
●   Now : cap_enter()


●   Problems
    ●   Holds write access to the lease db
    ●   Can submit msgs to logs
gzip
●   Three core functions
●   Passed input and output capabilities (FDs)
●   CAP_READ, CAP_WRITE, CAP_SEEK
●   pdfork() and fexecve()



●   Changes were small (406 LOC) but non-trivial
    (16%)
Chromium
●   A renderer process per browser tab
●   lc_limitfd() to limit access to FDs
    ●   pak files
    ●   stdio 
    ●   /dev/random
    ●   Font files
●   cap_enter()
Chromium Comparison
Operating   Model      Line         Description
system                 count
Windows     ACLs          22350 Windows ACLs and SIDs

Linux       chroot             605 setuid root helper sandboxes renderer

Mac OS X    Seatbelt           560 Path-based MAC sandbox

Linux       SELinux            200 Restricted sandbox type enforcement domain

Linux       seccomp        11301 seccomp and userspace syscall wrapper

FreeBSD     Capsicum           100 Capsicum sandboxing using cap enter
Evaluation
Evaluation




vfork() has the least overhead
Evaluation




Run time per gzip invocation with random data
Related work
●   MAC and DAC
●   Micro-kernels
Limitations
●   The amount of effort depends strictly on the
    design of the application
    ●   gzip 409 LOC Vs. Chromium 100


●   Security Policy embedded in code
    ●   No easy access to policy spec
Thank You

Contenu connexe

Tendances

Gluster intro-tdose
Gluster intro-tdoseGluster intro-tdose
Gluster intro-tdoseGluster.org
 
Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster.org
 
Smb gluster devmar2013
Smb gluster devmar2013Smb gluster devmar2013
Smb gluster devmar2013Gluster.org
 
Arbiter volumes in gluster
Arbiter volumes in glusterArbiter volumes in gluster
Arbiter volumes in glusteritisravi
 
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febGluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febbipin kunal
 
Bsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessionsBsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessionsScott Tsai
 
Lisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onLisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onGluster.org
 
Gluster as Block Store in Containers
Gluster as Block Store in ContainersGluster as Block Store in Containers
Gluster as Block Store in ContainersGluster.org
 
Gluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster.org
 
Gluster for sysadmins
Gluster for sysadminsGluster for sysadmins
Gluster for sysadminsGluster.org
 
Glusterfs for sysadmins-justin_clift
Glusterfs for sysadmins-justin_cliftGlusterfs for sysadmins-justin_clift
Glusterfs for sysadmins-justin_cliftGluster.org
 
Red Hat Gluster Storage : GlusterFS
Red Hat Gluster Storage : GlusterFSRed Hat Gluster Storage : GlusterFS
Red Hat Gluster Storage : GlusterFSbipin kunal
 
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Gluster.org
 
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013Gluster.org
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionGluster.org
 
Gluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster.org
 
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicumBsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicumScott Tsai
 

Tendances (20)

Gluster intro-tdose
Gluster intro-tdoseGluster intro-tdose
Gluster intro-tdose
 
Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016
 
Smb gluster devmar2013
Smb gluster devmar2013Smb gluster devmar2013
Smb gluster devmar2013
 
Arbiter volumes in gluster
Arbiter volumes in glusterArbiter volumes in gluster
Arbiter volumes in gluster
 
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_febGluster fs for_storage_admins_glusterfs_meetup_07_feb
Gluster fs for_storage_admins_glusterfs_meetup_07_feb
 
Bsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessionsBsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessions
 
Lisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-onLisa 2015-gluster fs-hands-on
Lisa 2015-gluster fs-hands-on
 
Gluster as Block Store in Containers
Gluster as Block Store in ContainersGluster as Block Store in Containers
Gluster as Block Store in Containers
 
Gluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephantGluster fs hadoop_fifth-elephant
Gluster fs hadoop_fifth-elephant
 
Gluster for sysadmins
Gluster for sysadminsGluster for sysadmins
Gluster for sysadmins
 
Glusterfs for sysadmins-justin_clift
Glusterfs for sysadmins-justin_cliftGlusterfs for sysadmins-justin_clift
Glusterfs for sysadmins-justin_clift
 
Gluster containers!
Gluster containers!Gluster containers!
Gluster containers!
 
Red Hat Gluster Storage : GlusterFS
Red Hat Gluster Storage : GlusterFSRed Hat Gluster Storage : GlusterFS
Red Hat Gluster Storage : GlusterFS
 
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
 
Qemu gluster fs
Qemu gluster fsQemu gluster fs
Qemu gluster fs
 
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013GlusterFs Architecture & Roadmap - LinuxCon EU 2013
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
 
Gdeploy 2.0
Gdeploy 2.0Gdeploy 2.0
Gdeploy 2.0
 
Lisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introductionLisa 2015-gluster fs-introduction
Lisa 2015-gluster fs-introduction
 
Gluster wireshark niels_de_vos
Gluster wireshark niels_de_vosGluster wireshark niels_de_vos
Gluster wireshark niels_de_vos
 
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicumBsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
Bsdtw17: mariusz zaborski: case studies of sandboxing base system with capsicum
 

Similaire à CS 626 - March : Capsicum: Practical Capabilities for UNIX

Docker Security - Secure Container Deployment on Linux
Docker Security - Secure Container Deployment on LinuxDocker Security - Secure Container Deployment on Linux
Docker Security - Secure Container Deployment on LinuxMichael Boelen
 
Time to rethink /proc
Time to rethink /procTime to rethink /proc
Time to rethink /procKir Kolyshkin
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudSalman Baset
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityPhil Estes
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformAll Things Open
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformAll Things Open
 
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo Seidel
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo SeidelOSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo Seidel
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo SeidelNETWAYS
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesAkihiro Suda
 
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Walid Shaari
 
Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...VMware Tanzu
 
A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersDocker, Inc.
 
OFI Overview 2019 Webinar
OFI Overview 2019 WebinarOFI Overview 2019 Webinar
OFI Overview 2019 Webinarseanhefty
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016Phil Estes
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQdotCloud
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersJérôme Petazzoni
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and topOpenVZ
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container SecurityPhil Estes
 
Osdc2012 xtfs.talk
Osdc2012 xtfs.talkOsdc2012 xtfs.talk
Osdc2012 xtfs.talkUdo Seidel
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013dotCloud
 

Similaire à CS 626 - March : Capsicum: Practical Capabilities for UNIX (20)

Docker Security - Secure Container Deployment on Linux
Docker Security - Secure Container Deployment on LinuxDocker Security - Secure Container Deployment on Linux
Docker Security - Secure Container Deployment on Linux
 
Time to rethink /proc
Time to rethink /procTime to rethink /proc
Time to rethink /proc
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production Cloud
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker Security
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container Platform
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container Platform
 
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo Seidel
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo SeidelOSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo Seidel
OSDC 2012 | Extremes Wolken Dateisystem!? by Dr. Udo Seidel
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
 
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...
 
Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...Customize and Secure the Runtime and Dependencies of Your Procedural Language...
Customize and Secure the Runtime and Dependencies of Your Procedural Language...
 
A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and Containers
 
OFI Overview 2019 Webinar
OFI Overview 2019 WebinarOFI Overview 2019 Webinar
OFI Overview 2019 Webinar
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
 
Speeding up ps and top
Speeding up ps and topSpeeding up ps and top
Speeding up ps and top
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container Security
 
Osdc2012 xtfs.talk
Osdc2012 xtfs.talkOsdc2012 xtfs.talk
Osdc2012 xtfs.talk
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 

CS 626 - March : Capsicum: Practical Capabilities for UNIX

  • 1. Capsicum: Practical Capabilities for UNIX Robert N. M. Watson, Jonathan Anderson, Ben Laurie, Kris Kennaway Presented by : Ruchith Fernando CS 626 March 8, 2011
  • 2. Context ● Multiple processes of an application ● Ambient user privileges ● Full power of the user ● Access to all resources
  • 7. Problem Statement ● How can the OS support application sandboxing? ● Minimize the effort by the developers? ● Better performance compared to other techniques.
  • 8. Contribution ● API extensions to break down application code ● Run them in sanboxes ● Logical application ● Implementation – FreeBSD ● To be included in version 9 ● Application of the extensions ● Performance evaluation
  • 9. Main Idea ● API extensions ● libcapsicum ● Capability mode ● Capabilities
  • 10. Capability Mode ● No access to global namespaces ● Process ID, File paths, File systems ID, System clocks, etc. ● Restricted access to some syscalls ● sysctl (only 30 params are allowed) ● shm_open ● openat … ● No privilege elevation via setuid/setgid
  • 11. Capabilities ● Wraps normal file descriptors ● cap_new(FD, mask_of_rights); ● 60 possible mask rights ● CAP_READ ● CAP_WRITE ● CAP_SEEK ● ... ● Directories
  • 12.
  • 13. Implementation ● At kernel services ● namei – path lookups ● fget – File descriptors to struct file refs ● pdfork() – returns a file descriptor ● Runtime ● fexecve()  ● rtld­elf­cap – Capability aware linker ● fdlists – to declare capabilities to be passed in
  • 14. Can we use it?
  • 15. Debugging ● procstat ● State of ruining processes ● Shows – capability mode – Capability rights masks ● Missing dependencies ● ENOTCAPABLE – New errno value ● API to check whether sandboxing is enabled
  • 16. tcpdump ● cap_enter() ● Restricting access to STDIN, STDOUT,  STDERR Using lc_limitfd() ● Problem with lazy DNS resolution ● Need to access /etc/resolv.conf
  • 17. dhclient ● Before : chroot + setuid ● Now : cap_enter() ● Problems ● Holds write access to the lease db ● Can submit msgs to logs
  • 18. gzip ● Three core functions ● Passed input and output capabilities (FDs) ● CAP_READ, CAP_WRITE, CAP_SEEK ● pdfork() and fexecve() ● Changes were small (406 LOC) but non-trivial (16%)
  • 19. Chromium ● A renderer process per browser tab ● lc_limitfd() to limit access to FDs ● pak files ● stdio  ● /dev/random ● Font files ● cap_enter()
  • 20. Chromium Comparison Operating Model Line Description system count Windows ACLs 22350 Windows ACLs and SIDs Linux chroot 605 setuid root helper sandboxes renderer Mac OS X Seatbelt 560 Path-based MAC sandbox Linux SELinux 200 Restricted sandbox type enforcement domain Linux seccomp 11301 seccomp and userspace syscall wrapper FreeBSD Capsicum 100 Capsicum sandboxing using cap enter
  • 22. Evaluation vfork() has the least overhead
  • 23. Evaluation Run time per gzip invocation with random data
  • 24. Related work ● MAC and DAC ● Micro-kernels
  • 25. Limitations ● The amount of effort depends strictly on the design of the application ● gzip 409 LOC Vs. Chromium 100 ● Security Policy embedded in code ● No easy access to policy spec
  • 26.
  • 27.