O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SELinux System Administration

Book Description

With a command of SELinux you can enjoy watertight security on your Linux servers. This guide shows you how through examples taken from real-life situations, giving you a good grounding in all the available features.

  • Use SELinux to further control network communications
  • Enhance your system's security through SELinux access controls
  • Set up SELinux roles, users and their sensitivity levels

In Detail

NSA Security-Enhanced Linux (SELinux) is a set of patches and added utilities to the Linux kernel to incorporate a strong, flexible, mandatory access control architecture into the major subsystems of the kernel. With its fine-grained yet flexible approach, it is no wonder Linux distributions are firing up SELinux as a default security measure.

SELinux System Administration covers the majority of SELinux features through a mix of real-life scenarios, descriptions, and examples. Everything an administrator needs to further tune SELinux to suit their needs are present in this book.

This book touches on various SELinux topics, guiding you through the configuration of SELinux contexts, definitions, and the assignment of SELinux roles, and finishes up with policy enhancements. All of SELinux's configuration handles, be they conditional policies, constraints, policy types, or audit capabilities, are covered in this book with genuine examples that administrators might come across.

By the end, SELinux System Administration will have taught you how to configure your Linux system to be more secure, powered by a formidable mandatory access control.

Table of Contents

  1. SELinux System Administration
    1. Table of Contents
    2. SELinux System Administration
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
      2. Why Subscribe?
      3. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. Who this book is for
      3. Conventions
      4. Reader feedback
      5. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Fundamental SELinux Concepts
      1. Providing more security to Linux
        1. Linux security modules to the rescue
        2. SELinux versus regular DAC
          1. Restricting root privileges
        3. Enabling SELinux – not just a switch
      2. Everything gets a label
        1. The context fields
          1. SELinux types
          2. SELinux roles
          3. SELinux users
          4. Sensitivity labels
      3. Policies – the ultimate dictators
        1. SELinux policy store names and options
          1. MLS status
          2. Dealing with unknown permissions
          3. Supporting unconfined domains
          4. User-based access control
        2. Policies across distributions
          1. MCS versus MLS
          2. Policy binaries
            1. SELinux policy modules
      4. Summary
    9. 2. Understanding SELinux Decisions and Logging
      1. Disabling SELinux
      2. SELinux on, SELinux off
        1. Switching to permissive (or enforcing) temporarily
        2. Using kernel boot parameters
        3. Disabling SELinux protections for a single service
        4. Applications that "speak" SELinux
      3. SELinux logging and auditing
        1. Configuring SELinux' log destination
        2. Reading SELinux denials
        3. Uncovering more denials
        4. Getting help with denials
          1. setroubleshoot to the rescue
          2. Using audit2why
          3. Using common sense
      4. Summary
    10. 3. Managing User Logins
      1. So, who am I?
        1. The rationale behind unconfined
      2. SELinux users and roles
        1. We all are one SELinux user
        2. Creating additional users
        3. Limiting access based on confidentiality
      3. Jumping from one role to another
        1. Full role switching with newrole
        2. Managing role access with sudo
        3. Switching to the system role
        4. The runcon user application
      4. Getting in the right context
        1. Context switching during authentication
        2. Application-based contexts
      5. Summary
    11. 4. Process Domains and File-level Access Controls
      1. Reading and changing file contexts
        1. Getting context information
        2. Working with context expressions
        3. Setting context information
        4. Using customizable types
        5. Inheriting the context
        6. Placing categories on files and directories
      2. The context of a process
        1. Transitioning towards a domain
        2. Other supported transitions
        3. Working with mod_selinux
      3. Dealing with types, permissions, and constraints
        1. Type attributes
        2. Querying domain permissions
        3. Understanding constraints
      4. Summary
    12. 5. Controlling Network Communications
      1. TCP and UDP support
        1. Labeling ports
      2. Integrating with Linux netfilter
        1. Packet labeling through netfilter
        2. Assigning labels to packets
        3. Differentiating between server and client communication
      3. Introducing labeled networking
        1. Common labeling approach
          1. Limiting flows based on the network interface
          2. Accepting communication from selected hosts
          3. Verifying peer-to-peer flow
        2. Example – labeled IPSec
          1. Setting up regular IPSec
          2. Enabling labeled IPSec
        3. About NetLabel/CIPSO
      4. Summary
    13. 6. Working with SELinux Policies
      1. Manipulating SELinux policies
        1. Overview of SELinux Booleans
        2. Changing Boolean values
        3. Inspecting the impact of Boolean
      2. Enhancing SELinux policies
        1. Handling SELinux policy modules
        2. Troubleshooting using audit2allow
        3. Using refpolicy macros
        4. Using selocal
      3. Creating our own modules
        1. Building native modules
        2. Building reference policy modules
      4. Creating roles and user domains
        1. The pgsql_admin role and user
          1. Creating the user rights
          2. Shell access
      5. Creating new application domains
        1. An example application domain
        2. Creating interfaces
      6. Other uses of policy enhancements
        1. Creating customized SECMARK types
        2. Using different interfaces and nodes
        3. Auditing access attempts
        4. Creating customizable types
      7. Summary
    14. Index