SELinux is not the most popular of Linux components. For many admins, myself included, disabling SELinux is a critical part of the system installation process. The extra security that SELinux provides is generally seen as not worth the ease-of-use impacts. Fortunately, the tools used to manage SELinux have matured in recent releases and many in Rik Farrow's "Working With SELinux" session on Sunday were those willing to give SELinux another try.
SELinux was developed at the US National Security Agency to enforce the famous Bell-LaPadula model and predictably has more features than most environments require. The contexts in SELinux have three components: user, role, and type. In the most common SELinux implementations (specifically Red Hat's), the type component is the main focus, although Fedora versions after 9 supports confined users.
Rik used a very interesting explanation for the role of SELinux, comparing Linux security to downtown Baghdad. The Linux kernel, hardware, and parts of SELinux are analogous to the "Green Zone" area that is supposed to be very secure. The security is managed by checkpoints (syscalls) and applications reside in the less-secured area outside the city. However, the Green Zone is not impervious to attacks, as mortars and other airborne objects breach the perimeter. In the same manner, kernel exploits can bypass established security measures. SELinux is not a panacea.
Most of the issues that people encounter with SELinux revolve around context not being properly set. This is often the result of moving a file from a directory with one context to a directory with a different context, or with restoring from a backup utility that does not support SELinux context (tar, by default, does not. Using the '--selinux' flag enabled the SELinux support).
The tools for fixing SELinux context make resolving errors fairly simple. In many cases, the restorecon command is sufficient to fix the problem. semanage (command line tool) and system-config-display (GUI tool) can be used to set context for custom directories. When an error occurs, the setroubleshootd daemon provides notification and suggests the appropriate fix. aureport is a relatively new tool which makes extracting information from the "ugly" raw log a much easier task.
Having long been fearful of SELinux, I was very excited to gain an understanding and posted a status to that effect on Facebook. A few friends asked why, and the answer is that SELinux provides a powerful security tool. It isn't necessarily useful on single- or few-user desktops, but for servers and kiosks, it provides a layer of protection in addition to traditional file permissions. It's important to remember, though, that SELinux can't fix everything. Anything an application has permission to access, for example files and databases writable by web applications, can't be protected by using SELinux.
Rik Farrow's course has made a daunting concept seem sane and usable. If you missed this presentation, Rik will be presenting a "The Guru Is In" session on Friday morning. For future LISA attendees, keep an eye out for this course to be offered again. You may just change your mind about SELinux.
- Log in to post comments
Comments
system-config-display? You
system-config-display? You probably mean system-config-selinux.