Product SiteDocumentation Site

Chapter 10. Managing Confined Services

10.1. Introduction
10.2. Targeted policy
10.2.1. Type Enforcement
10.2.2. Confined processes
10.2.3. Unconfined processes
10.3. The Apache HTTP Server
10.3.1. The Apache HTTP Server and SELinux
10.3.2. Types
10.3.3. Booleans
10.3.4. Configuration examples
10.4. Samba
10.4.1. Samba and SELinux
10.4.2. Types
10.4.3. Booleans
10.4.4. Configuration examples
10.5. File Transfer Protocol
10.5.1. FTP and SELinux
10.5.2. Types
10.5.3. Booleans
10.5.4. Configuration Examples
10.6. Network File System
10.6.1. NFS and SELinux
10.6.2. Types
10.6.3. Booleans
10.6.4. Configuration Examples
10.7. Berkeley Internet Name Domain
10.7.1. BIND and SELinux
10.7.2. Types
10.7.3. Booleans
10.7.4. Configuration Examples
10.8. Concurrent Versioning System
10.8.1. CVS and SELinux
10.8.2. Types
10.8.3. Booleans
10.8.4. Configuration Examples
10.9. Squid Caching Proxy
10.9.1. Squid Caching Proxy and SELinux
10.9.2. Types
10.9.3. Booleans
10.9.4. Configuration Examples
10.10. MySQL
10.10.1. MySQL and SELinux
10.10.2. Types
10.10.3. Booleans
10.10.4. Configuration Examples
10.11. PostgreSQL
10.11.1. PostgreSQL and SELinux
10.11.2. Types
10.11.3. Booleans
10.11.4. Configuration Examples
10.12. rsync
10.12.1. rsync and SELinux
10.12.2. Types
10.12.3. Booleans
10.12.4. Configuration Examples
10.13. Postfix
10.13.1. Postfix and SELinux
10.13.2. Types
10.13.3. Booleans
10.13.4. Configuration Examples

10.1. Introduction

Security-Enhanced Linux (SELinux) refers to files, such as directories and devices, as objects. Processes, such as a user running a command or the Mozilla® Firefox® application, are referred to as subjects. Most operating systems use a Discretionary Access Control (DAC) system that controls how subjects interact with objects, and how subjects interact with each other. On operating systems using DAC, users control the permissions of files (objects) that they own. For example, on Linux® operating systems, users could make their home directories world-readable, inadvertently giving users and processes (subjects) access to potentially sensitive information.
DAC mechanisms are fundamentally inadequate for strong system security. DAC access decisions are only based on user identity and ownership, ignoring other security-relevant information such as the role of the user, the function and trustworthiness of the program, and the sensitivity and integrity of the data. Each user has complete discretion over their files, making it impossible to enforce a system-wide security policy. Furthermore, every program run by a user inherits all of the permissions granted to the user and is free to change access to the user's files, so no protection is provided against malicious software. Many system services and privileged programs must run with coarse-grained privileges that far exceed their requirements, so that a flaw in any one of these programs can be exploited to obtain complete system access.[32]
The following is an example of permissions used on Linux operating systems that do not run Security-Enhanced Linux (SELinux). The permissions in these examples may differ from your system. Use the ls -l command to view file permissions:
$ ls -l file1
-rwxrw-r-- 1 user1 group1 0 2010-02-28 07:12 file1
The first three permission bits, rwx, control the access the Linux user1 user (in this case, the owner) has to file1. The next three permission bits, rw-, control the access the Linux group1 group has to file1. The last three permission bits, r--, control the access everyone else has to file1, which includes all users and processes.
Security-Enhanced Linux (SELinux) adds Mandatory Access Control (MAC) to the Linux kernel, and is enabled by default in Fedora. A general purpose MAC architecture needs the ability to enforce an administratively-set security policy over all processes and files in the system, basing decisions on labels containing a variety of security-relevant information. When properly implemented, it enables a system to adequately defend itself and offers critical support for application security by protecting against the tampering with, and bypassing of, secured applications. MAC provides strong separation of applications that permits the safe execution of untrustworthy applications. Its ability to limit the privileges associated with executing processes limits the scope of potential damage that can result from the exploitation of vulnerabilities in applications and system services. MAC enables information to be protected from legitimate users with limited authorization as well as from authorized users who have unwittingly executed malicious applications.[33]
The following is an example of the labels containing security-relevant information that are used on processes, Linux users, and files, on Linux operating systems that run SELinux. This information is called the SELinux context, and is viewed using the ls -Z command:
$ ls -Z file1
-rwxrw-r--  user1 group1 unconfined_u:object_r:user_home_t:s0      file1
In this example, SELinux provides a user (unconfined_u), a role (object_r), a type (user_home_t), and a level (s0). This information is used to make access control decisions. This example also displays the DAC rules, which are shown in the SELinux context via the ls -Z command. SELinux policy rules are checked after DAC rules. SELinux policy rules are not used if DAC rules deny access first.


[32] "Integrating Flexible Support for Security Policies into the Linux Operating System", by Peter Loscocco and Stephen Smalley. This paper was originally prepared for the National Security Agency and is, consequently, in the public domain. Refer to the original paper for details and the document as it was first released. Any edits and changes were done by Murray McAllister.
[33] "Meeting Critical Security Objectives with Security-Enhanced Linux", by Peter Loscocco and Stephen Smalley. This paper was originally prepared for the National Security Agency and is, consequently, in the public domain. Refer to the original paper for details and the document as it was first released. Any edits and changes were done by Murray McAllister.