Have You Driven an Selinux Lately? an Update on the Security Enhanced Linux Project
Total Page:16
File Type:pdf, Size:1020Kb
Have You Driven an SELinux Lately? An Update on the Security Enhanced Linux Project James Morris Red Hat Asia Pacific Pte Ltd [email protected] Abstract All security-relevant accesses between subjects and ob- jects are controlled according to a dynamically loaded Security Enhanced Linux (SELinux) [18] has evolved mandatory security policy. Clean separation of mecha- rapidly over the last few years, with many enhancements nism and policy provides considerable flexibility in the made to both its core technology and higher-level tools. implementation of security goals for the system, while fine granularity of control ensures complete mediation. Following integration into several Linux distributions, SELinux has become the first widely used Mandatory An arbitrary number of different security models may be Access Control (MAC) scheme. It has helped Linux to composed (or “stacked”) by SELinux, with their com- receive the highest security certification likely possible bined effect being fully analyzable under a unified pol- for a mainstream off the shelf operating system. icy scheme. SELinux has also proven its worth for general purpose Currently, the default SELinux implementation com- use in mitigating several serious security flaws. poses the following security models: Type Enforcement (TE) [7], Role Based Access Control (RBAC) [12], While SELinux has a reputation for being difficult to Muilti-level Security (MLS) [29], and Identity Based use, recent developments have helped significantly in Access Control (IBAC). These complement the standard this area, and user adoption is advancing rapidly. Linux Discretionary Access Control (DAC) scheme. This paper provides an informal update on the project, With these models, SELinux provides comprehensive discussing key developments and challenges, with the mandatory enforcement of least privilege, confidential- aim of helping people to better understand current ity, and integrity. It is able to flexibly meet a wide range SELinux and to make more effective use of it in a wide of general security requirements: variety of situations. • Strong isolation of applications. 1 Introduction • Information flow control. The scope of this paper is to cover significant advances • Ensuring critical processing flow. in the SELinux project since its initial integration with • Protection of system integrity. mainstream Linux distributions. For context, a brief technical overview of SELinux is provided, followed by • Containment of security vulnerabilities. project background information. SELinux is also able to meet the requirements of and 1.1 Technical Overview interoperate with traditional MLS systems. SELinux is a flexible MAC framework for Linux, de- 1.2 Project Background rived from the Flask research project [30], and inte- grated into the Linux kernel via the Linux Security Mod- Based on the growing need for stronger security [19], ules (LSM) API [34]. SELinux was released as an open source project by the • 101 • 102 • Have You Driven an SELinux Lately? US National Security Agency in December 2000. A vi- were key milestones in the the transition of SELinux brant community formed around the project, with De- from a research project into a production-deployable bian developers leading efforts to integrate SELinux into system. a mainstream distribution. Subsequent early integra- tion efforts were also largely community-led, with indi- With SELinux now being distributed to the wider com- vidual developers undertaking SELinux packaging work munity, the project began to evolve rapidly in terms of for the Gentoo, SuSE, and Red Hat distributions. both function and usability. In March 2001, the NSA presented SELinux to senior 2 Policy kernel developers at the Linux Kernel Summit. Feed- back from the summit led to the formation of the LSM Early versions of targeted policy confined only a few project—the aim of which was to allow different secu- critical and typically network-facing applications. On- rity mechanisms to be plugged into the core kernel. going contributions from the community, in conjunction SELinux helped to drive LSM requirements, while with continued efforts by core project developers, led to SELinux developers participated as core contributors in a steady increase in the number of applications confined LSM development. SELinux was ported to the result- by policy. As of April 2008, there was policy support for ing LSM API, and then merged into the mainline Linux several hundred applications in the upstream repository. kernel for the kernel’s v2.6 release in December 2003. 2.1 Booleans Concurrently, SELinux was fully integrated into the Fe- dora Core distribution, version 2 of which was released 1 in May 2004. This marked the first release of an oper- The Booleans facility was developed to allow certain ating system with official support for SELinux. The se- policy features to be selectively enabled or disabled curity policy distributed with Fedora Core 2 was largely without having to reload policy. This was originally de- derived from the initial NSA example policy, as well signed with smaller systems in mind, but has proven to as from ad-hoc community contributions. It had not yet be significantly useful in the general case. been well-tuned to many general Linux deployment sce- Feedback from the community indicated that there were narios and was a noted source of frustration in causing common patterns in the way applications would be cus- many applications to fail unexpectedly due to policy vi- tomized. Booleans were able to provide a suitable high- olations. level mechanism for administrators to effect limited yet In some cases, SELinux was blocking previously unde- useful customization of policy according to these pat- tected programming errors (such as the leaking of open terns. file descriptors), although the initial security policy was For example: policy for an FTP server might have a also generally regarded as being too strict. A solu- boolean which enables remote access to user home di- tion was implemented during the development of Fedora rectories. Rather than having to modify or even know Core 3 (released November 2004), whereby only critical any SELinux policy, the administrator could instead applications were confined by policy. This policy was control this behaviour by simply running a command to designated as targeted, and was considered to be a ma- enable or disable the associated boolean. jor improvement in usability. It allowed SELinux to be enabled by default, leading to what is believed to be the first ever release of a mainstream operating system with 2.2 Loadable Policy Modules mandatory security enabled in a standard configuration. SELinux initially shipped with a monolithic policy Red Hat Enterprise Linux 4, based on Fedora Core 3, scheme, requiring a full rebuild of policy from source shipped a few months later in February 2005 as the first for any modification. The Loadable Policy Module ar- commercial distribution with full SELinux support. chitecture [20] was introduced to provide a more robust and flexible approach to composing and deploying pol- These initial major distribution releases, while shipping icy. with relatively few confined services by default, pro- vided useful mandatory security out of the box. They 1also referred to as Conditional Policy 2008 Linux Symposium, Volume Two • 103 With this new architecture, binary policy modules could high-level security goals and better comprehensibility of be loaded dynamically, eliminating the need for systems policy. to carry a full policy source tree and associated build infrastructure in case customization was required. Reference Policy was first shipped along with Loadable Policy Modules in Fedora Core 5. The core operating system policy was separated into a base policy module, allowing it to be streamlined and 2.4 Other Developments further tailored for different use scenarios. Higher-level components could now be developed and managed in- dependently, enabling the distribution of third-party pol- The (somewhat experimental) MLS functionality sup- icy, as well as the ability to incorporate policy modules plied with the original SELinux release was signifi- with application packages. cantly revised to meet certification requirements and to be more useful in the real world. This included policy Loadable Policy Modules were first shipped with Fedora enhancements and the ability to enable MLS dynami- Core 5 in March 2006. cally. MLS was previously a kernel compile-time option and not enabled at all in mainstream distributions. 2.3 Reference Policy The MLS infrastructure was also adapted to a new secu- rity model, Multi-Category Security (MCS) [24], which One of the most significant advances in the SELinux utilized the category attribute of MLS labels and a sim- project has been the Reference Policy effort [28]. This ple policy to provide end users with a discretionary la- was a fundamental reworking of the policy framework beling scheme. Fedora Core 5 shipped with MCS en- to provide a more structured basis for policy design and abled by default, allowing much of the MLS infrastruc- analysis. A critical goal was to improve the quality of ture to be exercised by general users. The future of MCS policy and thus facilitate increased overall assurance. is currently unclear, as its wider adoption requires ex- tension to applications, and it may be better to instead Key elements of the Reference Policy effort included: utilize TE for the same purpose. The RBAC scheme was greatly improved, allowing • Introducing the principles of layering and inter- roles to be defined and loaded as policy modules, rather faces to the policy language to facilitate better ab- than having to be managed as part of the previous mono- straction and modularization. lithic policy scheme. • Leveraging the new Loadable Policy Module archi- By the time of writing, targeted and strict versions of tecture discussed in Section 2.2. policy in the upstream repository had been merged into a single version. Targeted behavior is now selected by • Building support for documentation into the infras- including the “unconfined” policy module. Strict behav- tructure to encourage the practice of literate pro- ior may also be re-selected incrementally by mapping gramming [17].