Security with Apache is an important topic, of which SELinux is a part. However, the frustration that results in trying to manage SELinux and how it relates to an Apache Web Server is huge. Most of the time, administrators bail and shut down SELinux because they do not have the time to correctly configure the system. SELinux can be a key to good security for the Apache daemon. This tutorial with help you develop several skills that will provide some level of SELinux management for the Apache Web Server. View Processes protected by SELinux You may view processes which are restricted by SELinux with ps. While your Apache Web Server is running you can view the processes under management. Remember that by default Apache will start 8 web servers when it is initialized so that is why you see this number of processes running. The ps command had to be completely rewritten to provide these SELinux attributes. # ps -ZC httpd LABEL PID TTY TIME CMD root:system_r:httpd_t 11759 ? 00:00:00 httpd root:system_r:httpd_t 15899 ? 00:00:00 httpd root:system_r:httpd_t 15900 ? 00:00:00 httpd root:system_r:httpd_t 15901 ? 00:00:00 httpd root:system_r:httpd_t 15902 ? 00:00:00 httpd root:system_r:httpd_t 15903 ? 00:00:00 httpd root:system_r:httpd_t 15918 ? 00:00:00 httpd root:system_r:httpd_t 15919 ? 00:00:00 httpd root:system_r:httpd_t 15920 ? 00:00:00 httpd If you wanted to view the entire list of processes currently protected with SELinux you would use this command: # ps -eZ LABEL PID TTY TIME CMD system_u:system_r:init_t 1 ? 00:00:00 init system_u:system_r:kernel_t 2 ? 00:00:00 migration/0 system_u:system_r:kernel_t 3 ? 00:00:00 ksoftirqd/0 system_u:system_r:kernel_t 4 ? 00:00:00 watchdog/0 system_u:system_r:kernel_t 5 ? 00:00:00 events/0 system_u:system_r:kernel_t 6 ? 00:00:00 khelper system_u:system_r:kernel_t 7 ? 00:00:00 kthread system_u:system_r:kernel_t 10 ? 00:00:00 kblockd/0 system_u:system_r:kernel_t 11 ? 00:00:00 kacpid ---cut--- SELinux sees everything as an object. Access to objects are controlled by security elements stored in the inode, which now has extended fields. The security elements combined create a security context which consists of five elements. user The role is used to indicate the user of the context. If a user logs in as root they will have a user value of root. If they log in as a regular user, like tom, they will have the value of user_u. Users who su to root will continue to have the value of user_u. Processes also have a value, system_u. role This is used to define the role of the user. Files have a role of object_r and processes have a role of system_r. Users, like processes have the role of system_r. type Types are used to create a type enforcement which determines which process types can have access to which file types. sensitivity This is a security feature used by government agencies. category This provides a way to block access to categories of people including root. user: role: type: sensitivity: category If you view the settings for the index.html file in /var/www/html you will see these attributes listed. # ls -Z -rw-r--r-- root root root:object_r:httpd_sys_content_t index.html user: root: role: object_r: type: httpd_sys_content_t sensitivity: category It is important to note that the type: httpd_sys_content_t is required in order to