Book Image

Red Hat Enterprise Linux Server Cookbook

By : Jakub Gaj, William Leemans
Book Image

Red Hat Enterprise Linux Server Cookbook

By: Jakub Gaj, William Leemans

Overview of this book

Dominating the server market, the Red Hat Enterprise Linux operating system gives you the support you need to modernize your infrastructure and boost your organization’s efficiency. Combining both stability and flexibility, RHEL helps you meet the challenges of today and adapt to the demands of tomorrow. This practical Cookbook guide will help you get to grips with RHEL 7 Server and automating its installation. Designed to provide targeted assistance through hands-on recipe guidance, it will introduce you to everything you need to know about KVM guests and deploying multiple standardized RHEL systems effortlessly. Get practical reference advice that will make complex networks setups look like child’s play, and dive into in-depth coverage of configuring a RHEL system. Also including full recipe coverage of how to set up, configuring, and troubleshoot SELinux, you’ll also discover how secure your operating system, as well as how to monitor it.
Table of Contents (17 chapters)
Red Hat Enterprise Linux Server Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating SELinux policies


In some cases, you'll need to create a new SELinux policy—for instance, when installing a piece of software from source. Although I do not recommend installing software from source on enterprise systems, this is sometimes your only option for company-developed software.

It is then time to create your own SELinux policy.

Getting ready

For this recipe, you need to have policycoreutils-python installed.

How to do it…

We'll use the denied entries in the audit.log log file to build our SELinux policy with audit2allow.

In this recipe, we'll use the same example as in the previous recipe: the SELinux context of /var/www/html/index.html that is changed to system_u:object_r:user_home_t:s0. Perform the following steps:

  1. First, create a human readable policy for verification via the following command:

    ~# egrep 'avc.*denied' /var/log/audit/audit.log |audit2allow -m example_policy
    
    module example_policy 1.0;
    
    require {
            type httpd_t;
            type user_home_t;
            class file...