web/html/docs/selinux-managing-confined-services-guide/en-US/F11/html chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html, NONE, 1.1 chap-Managing_Confined_Services-Concurrent_Versioning_System.html, NONE, 1.1 chap-Managing_Confined_Services-File_Transfer_Protocol.html, NONE, 1.1 chap-Managing_Confined_Services-Introduction.html, NONE, 1.1 chap-Managing_Confined_Services-MySQL.html, NONE, 1.1 chap-Managing_Confined_Services-Network_File_System.html, NONE, 1.1 chap-Managing_Confined_Services-Postfix.html, NONE, 1.1 chap-Managing_Confined_Services-PostgreSQL.html, NONE, 1.1 chap-Managing_Confined_Services-References.html, NONE, 1.1 chap-Managing_Confined_Services-Samba.html, NONE, 1.1 chap-Managing_Confined_Services-Squid_Caching_Proxy.html, NONE, 1.1 chap-Managing_Confined_Services-Targeted_policy.html, NONE, 1.1 chap-Managing_Confined_Services-The_Apache_HTTP_Server.html, NONE, 1.1 chap-Managing_Confined_Services-Trademark_Information.html, NONE, 1.1 chap-Managing_Confined_Services-rsync.html, NONE, 1.1 index.html, NONE, 1.1 pr01s02.html, NONE, 1.1 pref-Managing_Confined_Services-Preface.html, NONE, 1.1 sect-Managing_Confined_Services-BIND-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-BIND-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-BIND-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html, NONE, 1.1 sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html, NONE, 1.1 sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html, NONE, 1.1 sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html, NONE, 1.1 sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html, NONE, 1.1 sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html, NONE, 1.1 sect-Managing_Confined_Services-MySQL-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-MySQL-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-MySQL-Types.html, NONE, 1.1 sect-Managing_Confined_Services-NFS-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-NFS-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Postfix-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-Postfix-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-Postfix-Types.html, NONE, 1.1 sect-Managing_Confined_Services-PostgreSQL-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-PostgreSQL-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Samba-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-Samba-Configuration_examples.html, NONE, 1.1 sect-Managing_Confined_Services-Samba-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html, NONE, 1.1 sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html, NONE, 1.1 sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html, NONE, 1.1 sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html, NONE, 1.1 sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html, NONE, 1.1 sect-Managing_Confined_Services-rsync-Booleans.html, NONE, 1.1 sect-Managing_Confined_Services-rsync-Configuration_Examples.html, NONE, 1.1 sect-Managing_Confined_Services-rsync-Types.html, NONE, 1.1 sect-Managing_Confined_services-NFS-Booleans.html, NONE, 1.1

sradvan sradvan at fedoraproject.org
Thu Aug 13 23:57:27 UTC 2009


Author: sradvan

Update of /cvs/fedora/web/html/docs/selinux-managing-confined-services-guide/en-US/F11/html
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20086/selinux-managing-confined-services-guide/en-US/F11/html

Added Files:
	chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html 
	chap-Managing_Confined_Services-Concurrent_Versioning_System.html 
	chap-Managing_Confined_Services-File_Transfer_Protocol.html 
	chap-Managing_Confined_Services-Introduction.html 
	chap-Managing_Confined_Services-MySQL.html 
	chap-Managing_Confined_Services-Network_File_System.html 
	chap-Managing_Confined_Services-Postfix.html 
	chap-Managing_Confined_Services-PostgreSQL.html 
	chap-Managing_Confined_Services-References.html 
	chap-Managing_Confined_Services-Samba.html 
	chap-Managing_Confined_Services-Squid_Caching_Proxy.html 
	chap-Managing_Confined_Services-Targeted_policy.html 
	chap-Managing_Confined_Services-The_Apache_HTTP_Server.html 
	chap-Managing_Confined_Services-Trademark_Information.html 
	chap-Managing_Confined_Services-rsync.html index.html 
	pr01s02.html pref-Managing_Confined_Services-Preface.html 
	sect-Managing_Confined_Services-BIND-Booleans.html 
	sect-Managing_Confined_Services-BIND-Configuration_Examples.html 
	sect-Managing_Confined_Services-BIND-Types.html 
	sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html 
	sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html 
	sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html 
	sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html 
	sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html 
	sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html 
	sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html 
	sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html 
	sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html 
	sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html 
	sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html 
	sect-Managing_Confined_Services-MySQL-Booleans.html 
	sect-Managing_Confined_Services-MySQL-Configuration_Examples.html 
	sect-Managing_Confined_Services-MySQL-Types.html 
	sect-Managing_Confined_Services-NFS-Configuration_Examples.html 
	sect-Managing_Confined_Services-NFS-Types.html 
	sect-Managing_Confined_Services-Postfix-Booleans.html 
	sect-Managing_Confined_Services-Postfix-Configuration_Examples.html 
	sect-Managing_Confined_Services-Postfix-Types.html 
	sect-Managing_Confined_Services-PostgreSQL-Booleans.html 
	sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html 
	sect-Managing_Confined_Services-PostgreSQL-Types.html 
	sect-Managing_Confined_Services-Samba-Booleans.html 
	sect-Managing_Confined_Services-Samba-Configuration_examples.html 
	sect-Managing_Confined_Services-Samba-Types.html 
	sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html 
	sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html 
	sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html 
	sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html 
	sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html 
	sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html 
	sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html 
	sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html 
	sect-Managing_Confined_Services-rsync-Booleans.html 
	sect-Managing_Confined_Services-rsync-Configuration_Examples.html 
	sect-Managing_Confined_Services-rsync-Types.html 
	sect-Managing_Confined_services-NFS-Booleans.html 
Log Message:
add services guide


--- NEW FILE chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Berkeley Internet Name Domain</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html" title="7.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-BIND-Types.html" title="8.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/
 images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain">Chapter 8. Berkeley Internet Name Domain</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html#sect-Managing_Confined_Services-BIND-BIND_and_SELinux">8.1. BIND and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Types.html">8.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Booleans.html">8.
 3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html">8.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html#sect-Managing_Confined_Services-BIND-Configuration_Examples-Dynamic_DNS">8.4.1. Dynamic DNS</a></span></dt></dl></dd></dl></div><div class="para">
		BIND performs name resolution services via the <code class="systemitem">named</code> daemon. BIND lets users locate computer resources and services by name instead of numerical addresses.
	</div><div class="para">
		In Fedora, the <span class="package">bind</span> package provides a DNS server. Run <code class="command">rpm -q bind</code> to see if the <span class="package">bind</span> package is installed. If it is not installed and you want to use BIND, run the following command as the root user to install it:
	</div><pre class="screen">
yum install bind
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-BIND-BIND_and_SELinux">8.1. BIND and SELinux</h2></div></div></div><div class="para">
			The default permissions on the <code class="command">/var/named/slaves</code>,<code class="command">/var/named/dynamic</code> and <code class="command">/var/named/data</code> directories allow zone files to be updated via zone transfers and dynamic DNS updates. Files in <code class="command">/var/named</code> are labeled with the <code class="computeroutput">name_zone_t</code> type, which is used for master zone files.
		</div><div class="para">
			For a slave server, configure <code class="filename">/etc/named.conf</code> to place slave zones in <code class="command">/var/named/slaves</code>. The following is an example of a domain entry in <code class="filename">/etc/named.conf</code> for a slave DNS server that stores the zone file for <code class="command">testdomain.com</code> in <code class="command">/var/named/slaves</code>:
		</div><pre class="screen">
zone "testdomain.com" {
			type slave;
			masters { IP-address; };
			file "/var/named/slaves/db.testdomain.com";
		       };
</pre><div class="para">
			If a zone file is labeled <code class="computeroutput">name_zone_t</code>, the <code class="computeroutput">named_write_master_zones</code> Boolean must be enabled to allow zone transfers and dynamic DNS to update the zone file. Also, the mode of the parent directory has to be changed to allow the <code class="systemitem">named</code> user or group read, write and execue access.
		</div><div class="para">
			If zone files in <code class="command">/var/named/</code> are labeled with <code class="computeroutput">name_cache_t</code> type, a file system relabel or running <code class="command">restorecon -R /var/</code> will change their type to <code class="computeroutput">named_zone_t</code>.
		</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html"><strong>Prev</strong>7.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Types.html"><strong>Next</strong>8.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Concurrent_Versioning_System.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 9. Concurrent Versioning System</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html" title="8.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html" title="9.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><
 img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Concurrent_Versioning_System">Chapter 9. Concurrent Versioning System</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html#sect-Managing_Confined_Services-Concurrent_Versioning_System-CVS_and_SELinux">9.1. CVS and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html">9.2. Types</a></span></
 dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html">9.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html">9.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html#sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS">9.4.1. Setting up CVS</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html">9.4.2. Server setup</a></span></dt></dl></dd></dl></div><div class="para">
		The Concurrent Versioning System (CVS) is a free revision-control system. It is used to monitor and keep track of modifications to a central set of files which are usually accessed by several different users. It is commonly used by programmers to manage a source code repository and is widely used by open source programmers.
	</div><div class="para">
		In Fedora, the <span class="package">cvs</span> package provides CVS. Run <code class="command">rpm -q cvs</code> to see if the <span class="package">cvs</span> package is installed. If it is not installed and you want to use CVS, run the following command as the root user to install it:
	</div><pre class="screen">
yum install cvs
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-CVS_and_SELinux">9.1. CVS and SELinux</h2></div></div></div><div class="para">
			The <code class="systemitem">cvs</code> daemon runs as <code class="computeroutput">cvs_t</code>. By default in Fedora, CVS is only allowed to read and write certain directories. The label <code class="computeroutput">cvs_data_t</code> defines which areas the <code class="systemitem">cvs</code> daemon has read and write access to. When using CVS with SELinux, assigning the correct label is essential for clients to have full access to the area reserved for CVS data.
		</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html"><strong>Prev</strong>8.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html"><strong>Next</strong>9.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-File_Transfer_Protocol.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 6. File Transfer Protocol</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html" title="5.4.2. Sharing a website" /><link rel="next" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html" title="6.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><im
 g src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-File_Transfer_Protocol">Chapter 6. File Transfer Protocol</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-File_Transfer_Protocol.html#sect-Managing_Confined_Services-File_Transfer_Protocol-FTP_and_SELinux">6.1. FTP and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html">6.2. Types</a></span></dt><dt><span class="secti
 on"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html">6.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html">6.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html#sect-Managing_Confined_Services-Configuration_Examples-Uploading_to_an_FTP_site">6.4.1. Uploading to an FTP site</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/index.html">Red Hat Enterprise Linux 5 Deployment Guide</a>:
	</div><div class="para">
		File Transfer Protocol (FTP) is one of the oldest and most commonly used protocols found on the Internet today. Its purpose is to reliably transfer files between computer hosts on a network without requiring the user to log directly into the remote host or have knowledge of how to use the remote system. It allows users to access files on remote systems using a standard set of simple commands.<sup>[<a id="id2904004" href="#ftn.id2904004" class="footnote">7</a>]</sup>
	</div><div class="para">
		The Very Secure FTP Daemon (<code class="systemitem">vsftpd</code>) is designed from the ground up to be fast, stable, and, most importantly, secure. Its ability to handle large numbers of connections efficiently and securely is why <code class="systemitem">vsftpd</code> is the only stand-alone FTP distributed with Red Hat Enterprise Linux.<sup>[<a id="id2905902" href="#ftn.id2905902" class="footnote">8</a>]</sup>
	</div><div class="para">
		In Fedora, the <span class="package">vsftpd</span> package provides the Very Secure FTP daemon. Run <code class="command">rpm -q vsftpd</code> to see if <span class="package">vsftpd</span> is installed:
	</div><pre class="screen">
$ rpm -q vsftpd
</pre><div class="para">
		If you want an FTP server and the <span class="package">vsftpd</span> package is not installed, run the following command as the root user to install it:
	</div><pre class="screen">
yum install vsftpd
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-File_Transfer_Protocol-FTP_and_SELinux">6.1. FTP and SELinux</h2></div></div></div><div class="para">
			When running SELinux, the FTP server, <code class="systemitem">vsftpd</code>, runs confined by default. SELinux policy defines how <code class="systemitem">vsftpd</code> interacts with files, processes, and with the system in general. For example, when an authenticated user logs in via FTP, they can not read from or write to files in their home directories: SELinux prevents <code class="systemitem">vsftpd</code> from accessing user home directories by default. Also, by default, <code class="systemitem">vsftpd</code> does not have access to NFS or CIFS file systems, and anonymous users do not have write access, even if such write access is configured in <code class="filename">/etc/vsftpd/vsftpd.conf</code>. Booleans can be turned on to allow the previously mentioned access.
		</div><div class="para">
			The following example demonstrates an authenticated user logging in, and an SELinux denial when trying to view files in their home directory:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">rpm -q vsftpd</code> to see if the <span class="package">vsftpd</span> package is installed. If it is not, run <code class="command">yum install vsftpd</code> as the root user to install it.
				</div></li><li><div class="para">
					In Fedora, <code class="systemitem">vsftpd</code> only allows anonymous users to log in by default. To allow authenticated users to log in, edit <code class="filename">/etc/vsftpd/vsftpd.conf</code> as the root user. Uncomment the <code class="option">local_enable=YES</code> option:
				</div><pre class="screen">
# Uncomment this to allow local users to log in.
local_enable=YES
</pre></li><li><div class="para">
					Run <code class="command">service vsftpd start</code> as the root user to start <code class="systemitem">vsftpd</code>. If the service was running before editing <code class="filename">vsftpd.conf</code>, run <code class="command">service vsftpd restart</code> as the root user to apply the configuration changes:
				</div><pre class="screen">
service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ftp localhost</code> as the user you are currently logged in with. When prompted for your name, make sure your username is displayed. If the correct username is displayed, press <span class="keycap"><strong>Enter</strong></span>, otherwise, enter the correct username:
				</div><pre class="screen">
$ ftp localhost
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.1.0)
Name (localhost:<em class="replaceable"><code>username</code></em>):
331 Please specify the password.
Password: <em class="replaceable"><code>Enter your password</code></em>
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
</pre></li><li><div class="para">
					Run the <code class="command">ls</code> command from the <code class="computeroutput">ftp</code> prompt. With the <code class="computeroutput">ftp_home_dir</code> Boolean off, SELinux prevents <code class="systemitem">vsftpd</code> access to home directories, resulting in this command failing to return a directory listing:
				</div><pre class="screen">
ftp> ls
227 Entering Passive Mode (127,0,0,1,225,210).
150 Here comes the directory listing.
226 Transfer done (but failed to open directory).
</pre><div class="para">
					An SELinux denial similar to the following is logged to <code class="filename">/var/log/messages</code>:
				</div><pre class="screen">
setroubleshoot: SELinux is preventing the ftp daemon from reading users home directories (<em class="replaceable"><code>username</code></em>). For complete SELinux messages. run sealert -l c366e889-2553-4c16-b73f-92f36a1730ce
</pre></li><li><div class="para">
					Enable the <code class="computeroutput">ftp_home_dir</code> Boolean by running the following command as the root user:
				</div><pre class="screen">
# setsebool -P ftp_home_dir=1
</pre><div class="note"><h2>Note</h2><div class="para">
						Do not use the -P option if you do not want changes to persist across reboots.
					</div></div><div class="para">
					Run the <code class="command">ls</code> command again from the <code class="computeroutput">ftp</code> prompt. Now that SELinux is allowing home directory browsing via the <code class="computeroutput">ftp_home_dir</code> Boolean, the directory is displayed:
				</div><pre class="screen">
ftp> ls
227 Entering Passive Mode (127,0,0,1,56,215).
150 Here comes the directory listing.
-rw-rw-r--    1 501      501             0 Mar 30 09:22 file1
-rw-rw-r--    1 501      501             0 Mar 30 09:22 file2
226 Directory Send OK.
ftp>
</pre></li></ol></div></div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2904004" href="#id2904004" class="para">7</a>] </sup>
			The first paragraph of "Chapter 23. FTP" of the Red Hat Enterprise Linux 5 Deployment Guide: <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/ch-ftp.html">http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/ch-ftp.html</a>. Copyright © 2007 Red Hat, Inc.
		</p></div><div class="footnote"><p><sup>[<a id="ftn.id2905902" href="#id2905902" class="para">8</a>] </sup>
			The first paragraph of the "23.2.1. vsftpd" section of the Red Hat Enterprise Linux 5 Deployment Guide: <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s1-ftp-servers.html#s2-ftp-servers-vsftpd">http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s1-ftp-servers.html#s2-ftp-servers-vsftpd</a>. Copyright © 2007 Red Hat, Inc.
		</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html"><strong>Prev</strong>5.4.2. Sharing a website</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html"><strong>Next</strong>6.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Introduction.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 2. Introduction</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="chap-Managing_Confined_Services-Trademark_Information.html" title="Chapter 1. Trademark Information" /><link rel="next" href="chap-Managing_Confined_Services-Targeted_policy.html" title="Chapter 3. Targeted policy" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Co
 ntent/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Trademark_Information.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Targeted_policy.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Introduction">Chapter 2. Introduction</h2></div></div></div><div class="para">
		Security-Enhanced Linux (SELinux) refers to files, such as directories and devices, as objects. Processes, such as a user running a command or the <span class="trademark">Mozilla</span>®<span class="trademark"> Firefox</span>® 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 <span class="trademark">Linux</span>® operating systems, users could make their home directories world-readable, inadvertently giving users and processes (subjects) access to potentially sensitive information.
	</div><div class="para">
		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.<sup>[<a id="id2915685" href="#ftn.id2915685" class="footnote">1</a>]</sup>
	</div><div class="para">
		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 <code class="command">ls -l</code> command to view file permissions:
	</div><pre class="screen">
$ ls -l file1
-rwxrw-r-- 1 user1 group1 0 2009-03-16 14:07 file1
</pre><div class="para">
		The first three permission bits, <code class="computeroutput">rwx</code>, control the access the Linux <code class="computeroutput">user1</code> user (in this case, the owner) has to <code class="filename">file1</code>. The next three permission bits, <code class="computeroutput">rw-</code>, control the access the Linux <code class="computeroutput">group1</code> group has to <code class="filename">file1</code>. The last three permission bits, <code class="computeroutput">r--</code>, control the access everyone else has to <code class="filename">file1</code>, which includes all users and processes.
	</div><div class="para">
		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 au
 thorized users who have unwittingly executed malicious applications.<sup>[<a id="id2892523" href="#ftn.id2892523" class="footnote">2</a>]</sup>
	</div><div class="para">
		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 <code class="command">ls -Z</code> command:
	</div><pre class="screen">
$ ls -Z file1
-rwxrw-r--  user1 group1 unconfined_u:object_r:user_home_t:s0      file1
</pre><div class="para">
		In this example, SELinux provides a user (<code class="computeroutput">unconfined_u</code>), a role (<code class="computeroutput">object_r</code>), a type (<code class="computeroutput">user_home_t</code>), and a level (<code class="computeroutput">s0</code>). 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 <code class="command">ls -Z</code> command. SELinux policy rules are checked after DAC rules. SELinux policy rules are not used if DAC rules deny access first.
	</div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2915685" href="#id2915685" class="para">1</a>] </sup>
			"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 <a href="http://www.nsa.gov/research/_files/selinux/papers/freenix01/index.shtml">original paper</a> for details and the document as it was first released. Any edits and changes were done by Murray McAllister.
		</p></div><div class="footnote"><p><sup>[<a id="ftn.id2892523" href="#id2892523" class="para">2</a>] </sup>
			"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 <a href="http://www.nsa.gov/research/_files/selinux/papers/ottawa01/index.shtml">original paper</a> for details and the document as it was first released. Any edits and changes were done by Murray McAllister.
		</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Trademark_Information.html"><strong>Prev</strong>Chapter 1. Trademark Information</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Targeted_policy.html"><strong>Next</strong>Chapter 3. Targeted policy</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-MySQL.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 11. MySQL</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html" title="10.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-MySQL-Types.html" title="11.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/imag
 es/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-MySQL">Chapter 11. MySQL</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-MySQL.html#sect-Managing_Confined_Services-MySQL-MySQL_and_SELinux">11.1. MySQL and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Types.html">11.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Booleans.html">11.3. Booleans</a></span></dt><dt><span class="sectio
 n"><a href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html">11.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html#sect-Managing_Confined_Services-MySQL-Configuration_Examples-Changing_Database_Location">11.4.1. MySQL Changing Database Location</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.mysql.com/why-mysql/">MySQL</a> project page:
	</div><div class="para">
		"The MySQL® database has become the world's most popular open source database because of its consistent fast performance, high reliability and ease of use. It's used on every continent -- Yes, even Antarctica! -- by individual Web developers as well as many of the world's largest and fastest-growing organizations to save time and money powering their high-volume Web sites, business-critical systems and packaged software -- including industry leaders such as Yahoo!, Alcatel-Lucent, Google, Nokia, YouTube, and Zappos.com."
	</div><div class="para">
		In Fedora, the <span class="package">mysql-server</span> package provides MySQL. Run <code class="command">rpm -q mysql-server</code> to see if the <span class="package">mysql-server</span> package is installed. If it is not installed, run the following command as the root user to install it:
	</div><pre class="screen">
yum install mysql-server
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-MySQL-MySQL_and_SELinux">11.1. MySQL and SELinux</h2></div></div></div><div class="para">
			When MySQL is enabled, it runs confined by default. Confined processes run in their own domains, and are separated from other confined processes. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited. The following example demonstrates the MySQL processes running in their own domain. This example assumes the <span class="package">mysql</span> package is installed:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service mysqld start</code> as the root user to start <code class="systemitem">mysqld</code>:
				</div><pre class="screen">
# service mysqld start
Initializing MySQL database:  Installing MySQL system tables... [  OK  ]
Starting MySQL:                                            	[  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep mysqld</code> to view the <code class="systemitem">mysqld</code> processes:
				</div><pre class="screen">
$ ps -eZ | grep mysqld
unconfined_u:system_r:mysqld_safe_t:s0 6035 pts/1 00:00:00 mysqld_safe
unconfined_u:system_r:mysqld_t:s0 6123 pts/1   00:00:00 mysqld
</pre><div class="para">
					The SELinux context associated with the <code class="systemitem">mysqld</code> processes is <code class="computeroutput">unconfined_u:system_r:mysqld_t:s0</code>. The second last part of the context, <code class="computeroutput">mysqld_t</code>, is the type. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">mysqld</code> processes are running in the <code class="computeroutput">mysqld_t</code> domain.
				</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html"><strong>Prev</strong>10.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Types.html"><strong>Next</strong>11.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Network_File_System.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 7. Network File System</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html" title="6.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-NFS-Types.html" title="7.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_
 Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-NFS-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Network_File_System">Chapter 7. Network File System</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Network_File_System.html#sect-Managing_Confined_Services-NFS-NFS_and_SELinux">7.1. NFS and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Types.html">7.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_services-NFS-Booleans.html">7.3. Boolea
 ns</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html">7.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html#sect-Managing_Confined_Services-Configuration_Examples-Sharing_directories_using_NFS">7.4.1. Sharing directories using NFS</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/ch-nfs.html">Red Hat Linux Reference Guide</a>:
	</div><div class="para">
		NFS (Network File System) allows hosts to mount partitions on a remote system and use them as though they are local file systems. This allows the system administrator to store resources in a central location on the network, providing authorized users continuous access to them.
	</div><div class="para">
		In Fedora, the <span class="package">nfs-utils</span> package is required for full NFS support. Run <code class="command">rpm -q nfs-utils</code> to see if the <span class="package">nfs-utils</span> is installed. If it is not installed and you want to use NFS, run the following command as the root user to install it:
	</div><pre class="screen">
yum install nfs-utils
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-NFS-NFS_and_SELinux">7.1. NFS and SELinux</h2></div></div></div><div class="para">
			When running SELinux, the <code class="systemitem">NFS</code> daemons are confined by default. SELinux policy does not allow NFS to share files by default. If you want to share NFS partitions, this can be configured via the <code class="computeroutput">nfs_export_all_ro</code> and <code class="computeroutput">nfs_export_all_rw</code> Booleans, as described below. These Booleans are however not required when files to be shared are labeled with the <code class="computeroutput">public_content_t</code> or <code class="computeroutput">public_content_rw_t</code> types. NFS can share files labeled with these types even if the <code class="computeroutput">nfs_export_all_ro</code> and <code class="computeroutput">nfs_export_all_rw</code> Booleans are off.
		</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html"><strong>Prev</strong>6.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-NFS-Types.html"><strong>Next</strong>7.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Postfix.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 14. Postfix</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html" title="13.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-Postfix-Types.html" title="14.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_r
 ight.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Postfix">Chapter 14. Postfix</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Postfix.html#sect-Managing_Confined_Services-rsync-Postfix_and_SELinux">14.1. Postfix and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Types.html">14.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Booleans.html">14.3. Booleans</a></span></dt><dt><span class="section"><a hr
 ef="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html">14.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html#sect-Managing_Confined_Services-Postfix-Configuration_Examples-SpamAssassin_and_Postfix">14.4.1. SpamAssassin and Postfix</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.postfix.org/">Postfix</a> project page:
	</div><div class="para">
		"What is Postfix? It is Wietse Venema's mailer that started life at IBM research as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure. The outside has a definite Sendmail-ish flavor, but the inside is completely different."
	</div><div class="para">
		In Fedora, the <span class="package">postfix</span> package provides postfix. Run <code class="command">rpm -q postfix</code> to see if the <span class="package">postfix</span> package is installed. If it is not installed, run the following command as the root user to install it:
	</div><pre class="screen">
yum install postfix
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-rsync-Postfix_and_SELinux">14.1. Postfix and SELinux</h2></div></div></div><div class="para">
			When Postfix is enabled, it runs confined by default. Confined processes run in their own domains, and are separated from other confined processes. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited. The following example demonstrates the Postfix and related processes running in their own domain. This example assumes the <span class="package">postfix</span> package is installed and that the Postfix service has been started:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service postfix start</code> as the root user to start <code class="systemitem">postfix</code>:
				</div><pre class="screen">
service postfix start
Starting postfix:                               [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep postfix</code> to view the <code class="systemitem">postfix</code> processes:
				</div><pre class="screen">
ps -eZ | grep postfix
system_u:system_r:postfix_master_t:s0 1651 ?   00:00:00 master
system_u:system_r:postfix_pickup_t:s0 1662 ?   00:00:00 pickup
system_u:system_r:postfix_qmgr_t:s0 1663 ?     00:00:00 qmgr
</pre><div class="para">
					For example, the SELinux context associated with the Postfix <code class="systemitem">master</code> process is <code class="computeroutput">unconfined_u:system_r:postfix_master_t:s0</code>. The second last part of the context, <code class="computeroutput">postfix_master_t</code>, is the type for this process. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">master</code> process is running in the <code class="computeroutput">postfix_master_t</code> domain.
				</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html"><strong>Prev</strong>13.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Types.html"><strong>Next</strong>14.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-PostgreSQL.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 12. PostgreSQL</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html" title="11.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-PostgreSQL-Types.html" title="12.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/i
 mage_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-PostgreSQL">Chapter 12. PostgreSQL</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-PostgreSQL.html#sect-Managing_Confined_Services-PostgreSQL-PostgreSQL_and_SELinux">12.1. PostgreSQL and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Types.html">12.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html">12.3. Booleans</a></span><
 /dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html">12.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html#sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples-Changing_Database_Location">12.4.1. PostgreSQL Changing Database Location</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.postgresql.org/about/">PostgreSQL</a> project page:
	</div><div class="para">
		"PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness."
	</div><div class="para">
		In Fedora, the <span class="package">postgresql-server</span> package provides PostgreSQL. Run <code class="command">rpm -q postgresql-server</code> to see if the <span class="package">postgresql-server</span> package is installed. If it is not installed, run the following command as the root user to install it:
	</div><pre class="screen">
yum install postgresql-server
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-PostgreSQL-PostgreSQL_and_SELinux">12.1. PostgreSQL and SELinux</h2></div></div></div><div class="para">
			When PostgreSQL is enabled, it runs confined by default. Confined processes run in their own domains, and are separated from other confined processes. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited. The following example demonstrates the PostgreSQL processes running in their own domain. This example assumes the <span class="package">postgresql-server</span> package is installed:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service postgresql start</code> as the root user to start <code class="systemitem">postgresql</code>:
				</div><pre class="screen">
service postgresql start
Starting postgresql service:                               [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep postgres</code> to view the <code class="systemitem">postgresql</code> processes:
				</div><pre class="screen">
ps -eZ | grep postgres
unconfined_u:system_r:postgresql_t:s0 395 ?    00:00:00 postmaster
unconfined_u:system_r:postgresql_t:s0 397 ?    00:00:00 postmaster
unconfined_u:system_r:postgresql_t:s0 399 ?    00:00:00 postmaster
unconfined_u:system_r:postgresql_t:s0 400 ?    00:00:00 postmaster
unconfined_u:system_r:postgresql_t:s0 401 ?    00:00:00 postmaster
unconfined_u:system_r:postgresql_t:s0 402 ?    00:00:00 postmaster
</pre><div class="para">
					The SELinux context associated with the <code class="systemitem">postgresql</code> processes is <code class="computeroutput">unconfined_u:system_r:postgresql_t:s0</code>. The second last part of the context, <code class="computeroutput">postgresql_t</code>, is the type. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">postgresql</code> processes are running in the <code class="computeroutput">postgresql_t</code> domain.
				</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html"><strong>Prev</strong>11.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Types.html"><strong>Next</strong>12.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-References.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. References</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html" title="14.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a acces
 skey="p" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-References">Chapter 15. References</h2></div></div></div><div class="para">
		The following references are pointers to additional information that is relevant to SELinux but beyond the scope of this guide. Note that due to the rapid development of SELinux, some of this material may only apply to specific releases of Fedora.
	</div><div class="variablelist" id="vari-Managing_Confined_Services-References-Books"><h6>Books</h6><dl><dt><span class="term">SELinux by Example</span></dt><dd><div class="para">
					Mayer, MacMillan, and Caplan
				</div><div class="para">
					Prentice Hall, 2007
				</div></dd><dt><span class="term">SELinux: NSA's Open Source Security Enhanced Linux</span></dt><dd><div class="para">
					Bill McCarty
				</div><div class="para">
					O'Reilly Media Inc., 2004
				</div></dd></dl></div><div class="variablelist" id="vari-Managing_Confined_Services-References-Tutorials_and_Help"><h6>Tutorials and Help</h6><dl><dt><span class="term">Tutorials and talks from Russell Coker</span></dt><dd><div class="para">
					<a href="http://www.coker.com.au/selinux/talks/ibmtu-2004/">http://www.coker.com.au/selinux/talks/ibmtu-2004/</a>
				</div></dd><dt><span class="term">Dan Walsh's Journal</span></dt><dd><div class="para">
					<a href="http://danwalsh.livejournal.com/">http://danwalsh.livejournal.com/</a>
				</div></dd><dt><span class="term">Red Hat Knowledgebase</span></dt><dd><div class="para">
					<a href="http://kbase.redhat.com/">http://kbase.redhat.com/</a>
				</div></dd></dl></div><div class="variablelist" id="vari-Managing_Confined_Services-References-General_Information"><h6>General Information</h6><dl><dt><span class="term">NSA SELinux main website</span></dt><dd><div class="para">
					<a href="http://www.nsa.gov/research/selinux/index.shtml">http://www.nsa.gov/research/selinux/index.shtml</a>
				</div></dd><dt><span class="term">NSA SELinux FAQ</span></dt><dd><div class="para">
					<a href="http://www.nsa.gov/research/selinux/faqs.shtml">http://www.nsa.gov/research/selinux/faqs.shtml</a>
				</div></dd></dl></div><div class="variablelist" id="vari-Managing_Confined_Services-Mailing_Lists"><h6>Mailing Lists</h6><dl><dt><span class="term">NSA SELinux mailing list</span></dt><dd><div class="para">
					<a href="http://www.nsa.gov/research/selinux/list.shtml">http://www.nsa.gov/research/selinux/list.shtml</a>
				</div></dd><dt><span class="term">Fedora SELinux mailing list</span></dt><dd><div class="para">
					<a href="http://www.redhat.com/mailman/listinfo/fedora-selinux-list">http://www.redhat.com/mailman/listinfo/fedora-selinux-list</a>
				</div></dd></dl></div><div class="variablelist" id="vari-Managing_Confined_Services-References-Community"><h6>Community</h6><dl><dt><span class="term">Fedora SELinux User Guide</span></dt><dd><div class="para">
					<a href="http://docs.fedoraproject.org/selinux-user-guide/">http://docs.fedoraproject.org/selinux-user-guide/</a>
				</div></dd><dt><span class="term">SELinux Project Wiki</span></dt><dd><div class="para">
					<a href="http://selinuxproject.org/page/Main_Page">http://selinuxproject.org/page/Main_Page</a>
				</div></dd><dt><span class="term">SELinux community page</span></dt><dd><div class="para">
					<a href="http://selinux.sourceforge.net/">http://selinux.sourceforge.net/</a>
				</div></dd><dt><span class="term">IRC</span></dt><dd><div class="para">
					irc.freenode.net, #selinux and #fedora-selinux
				</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html"><strong>Prev</strong>14.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Samba.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Samba</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html" title="4.4.4. Changing port numbers" /><link rel="next" href="sect-Managing_Confined_Services-Samba-Types.html" title="5.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/imag
 es/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Samba">Chapter 5. Samba</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Samba.html#sect-Managing_Confined_Services-Samba-Samba_and_SELinux">5.1. Samba and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Types.html">5.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Booleans.html">5.3. Booleans</a></span></dt><dt><span class="section"
 ><a href="sect-Managing_Confined_Services-Samba-Configuration_examples.html">5.4. Configuration examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Configuration_examples.html#sect-Managing_Confined_Services-Configuration_examples-Sharing_directories_you_create">5.4.1. Sharing directories you create</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html">5.4.2. Sharing a website</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://samba.org/">Samba</a> website:
	</div><div class="para">
		"Samba is an <a href="http://www.opensource.org/">Open Source</a>/<a href="http://www.gnu.org/philosophy/free-sw.html">Free Software</a> suite that has, <a href="http://us1.samba.org/samba/docs/10years.html">since 1992</a>, provided file and print services to all manner of SMB/CIFS clients, including the numerous versions of Microsoft Windows operating systems. Samba is freely available under the <a href="http://us1.samba.org/samba/docs/GPL.html">GNU General Public License</a>.".<sup>[<a id="id2965086" href="#ftn.id2965086" class="footnote">6</a>]</sup>
	</div><div class="para">
		In Fedora, the <span class="package">samba</span> package provides the Samba server. Run <code class="command">rpm -q samba</code> to see if the <span class="package">samba</span> package is installed. If it is not installed and you want to use Samba, run the following command as the root user to install it:
	</div><pre class="screen">
yum install samba
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Samba-Samba_and_SELinux">5.1. Samba and SELinux</h2></div></div></div><div class="para">
			When SELinux is enabled, the Samba server (<code class="systemitem">smbd</code>) runs confined by default. Confined services run in their own domains, and are separated from other confined services. The following example demonstrates the <code class="systemitem">smbd</code> process running in its own domain. This example assumes the <span class="package">samba</span> package is installed:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service smbd start</code> as the root user to start <code class="systemitem">smbd</code>:
				</div><pre class="screen">
service smb start
Starting SMB services:                                     [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep smb</code> to view the <code class="systemitem">smbd</code> processes:
				</div><pre class="screen">
$ ps -eZ | grep smb
unconfined_u:system_r:smbd_t:s0 <em class="replaceable"><code>16420</code></em> ?        00:00:00 smbd
unconfined_u:system_r:smbd_t:s0 <em class="replaceable"><code>16422</code></em> ?        00:00:00 smbd
</pre><div class="para">
					The SELinux context associated with the <code class="systemitem">smbd</code> processes is <code class="computeroutput">unconfined_u:system_r:smbd_t:s0</code>. The second last part of the context, <code class="computeroutput">smbd_t</code>, is the type. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">smbd</code> processes are running in the smbd_t domain.
				</div></li></ol></div><div class="para">
			Files must be labeled correctly to allow <code class="systemitem">smbd</code> to access and share them. For example, <code class="systemitem">smbd</code> can read and write to files labeled with the <code class="computeroutput">samba_share_t</code> type, but by default, can not access files labeled with the <code class="computeroutput">httpd_sys_content_t</code> type, which is intended for use by the Apache HTTP Server. Booleans must be turned on to allow certain behavior, such as allowing home directories and NFS file systems to be exported through Samba, as well as to allow Samba to act as a domain controller.
		</div></div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2965086" href="#id2965086" class="para">6</a>] </sup>
			From the opening paragraph on the Samba website: <a href="http://samba.org">http://samba.org</a>. Accessed 20 January 2009.
		</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html"><strong>Prev</strong>4.4.4. Changing port numbers</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Types.html"><strong>Next</strong>5.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Squid_Caching_Proxy.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 10. Squid Caching Proxy</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html" title="9.4.2. Server setup" /><link rel="next" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html" title="10.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http
 ://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Squid_Caching_Proxy">Chapter 10. Squid Caching Proxy</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html#sect-Managing_Confined_Services-Squid_Caching_Proxy-Squid_Caching_Proxy_and_SELinux">10.1. Squid Caching Proxy and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Serv
 ices-Squid_Caching_Proxy-Types.html">10.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html">10.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html">10.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html#sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples-Squid_Connecting_To_Non_Standard_Ports">10.4.1. Squid Connecting to Non-Standard Ports</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.squid-cache.org/">Squid Caching Proxy</a> project page:
	</div><div class="para">
		"Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator."
	</div><div class="para">
		In Fedora, the <span class="package">squid</span> package provides the Squid Caching Proxy. Run <code class="command">rpm -q squid</code> to see if the <span class="package">squid</span> package is installed. If it is not installed and you want to use squid, run the following command as the root user to install it:
	</div><pre class="screen">
# yum install squid
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Squid_Caching_Proxy-Squid_Caching_Proxy_and_SELinux">10.1. Squid Caching Proxy and SELinux</h2></div></div></div><div class="para">
			When SELinux is enabled, squid runs confined by default. Confined processes run in their own domains, and are separated from other confined processes. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited. The following example demonstrates the squid processes running in their own domain. This example assumes the squid package is installed:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service squid start</code> as the root user to start <code class="systemitem">squid</code>:
				</div><pre class="screen">
# service squid start
Starting squid:                                            [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep squid</code> to view the <code class="systemitem">squid</code> processes:
				</div><pre class="screen">
$ ps -eZ | grep squid
unconfined_u:system_r:squid_t:s0 2522 ?        00:00:00 squid
unconfined_u:system_r:squid_t:s0 2524 ?        00:00:00 squid
unconfined_u:system_r:squid_t:s0 2526 ?        00:00:00 ncsa_auth
unconfined_u:system_r:squid_t:s0 2527 ?        00:00:00 ncsa_auth
unconfined_u:system_r:squid_t:s0 2528 ?        00:00:00 ncsa_auth
unconfined_u:system_r:squid_t:s0 2529 ?        00:00:00 ncsa_auth
unconfined_u:system_r:squid_t:s0 2530 ?        00:00:00 ncsa_auth
unconfined_u:system_r:squid_t:s0 2531 ?        00:00:00 unlinkd
</pre><div class="para">
					The SELinux context associated with the <code class="systemitem">squid</code> processes is <code class="computeroutput">unconfined_u:system_r:squid_t:s0</code>. The second last part of the context, <code class="computeroutput">squid_t</code>, is the type. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">squid</code> processes are running in the <code class="computeroutput">squid_t</code> domain.
				</div></li></ol></div><div class="para">
			SELinux policy defines how processes running in confined domains, such as squid_t, interact with files, other processes, and the system in general. Files must be labeled correctly to allow squid access to them.
		</div><div class="para">
			When <code class="filename">/etc/squid/squid.conf</code> is configured so <code class="systemitem">squid</code> listens on a port other than the default TCP ports 3128, 3401 or 4827, the <code class="command">semanage port</code> command must be used to add the required port number to the SELinux policy configuration. The following example demonstrates configuring <code class="systemitem">squid</code> to listen on a port that is not initially defined in SELinux policy configuration for <code class="systemitem">squid</code>, and, as a consequence, <code class="systemitem">squid</code> failing to start. This example also demonstrates how to then configure the SELinux system to allow <code class="systemitem">squid</code> to successfully listen on a non-standard port that is not already defined in the policy. This example assumes the <span class="package">squid</span> package is installed. Run each command in the example as the root user:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">service squid status</code> to confirm <code class="systemitem">squid</code> is not running:
				</div><pre class="screen">
# service squid status
squid is stopped
</pre><div class="para">
					If the output differs, run <code class="command">service squid stop</code> to stop the process:
				</div><pre class="screen">
# service squid stop
Stopping squid:                                            [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">semanage port -l | grep -w squid_port_t</code> to view the ports SELinux allows <code class="systemitem">squid</code> to listen on:
				</div><pre class="screen">
semanage port -l | grep -w -i squid_port_t
squid_port_t                   tcp      3128, 3401, 4827
squid_port_t                   udp      3401, 4827
</pre></li><li><div class="para">
					Edit <code class="filename">/etc/squid/squid.conf</code> as the root user. Configure the <code class="option">http_port</code> option so it lists a port that is not configured in SELinux policy configuration for <code class="systemitem">squid</code>. In this example, <code class="systemitem">squid</code> is configured to listen on port 10000:
				</div><pre class="screen">
# Squid normally listens to port 3128
http_port 10000
</pre></li><li><div class="para">
					Run <code class="command">service squid start</code> to start <code class="systemitem">squid</code>:
				</div><pre class="screen">
# service squid start
Starting squid: ....................                       [FAILED]
</pre><div class="para">
					An SELinux denial similar to the following is logged to <code class="filename">/var/log/messages</code>:
				</div><pre class="screen">
localhost setroubleshoot: SELinux is preventing the squid (squid_t) from binding to port 1000. For complete SELinux messages. run sealert -l 97136444-4497-4fff-a7a7-c4d8442db982
</pre></li><li><div class="para">
					For SELinux to allow <code class="systemitem">squid</code> to listen on port 10000, as used in this example, the following command is required:
				</div><pre class="screen">
# semanage port -a -t squid_port_t -p tcp 10000
</pre></li><li><div class="para">
					Run <code class="command">service squid start</code> again to start <code class="systemitem">squid</code> and have it listen on the new port:
				</div><pre class="screen">
# service squid start
Starting squid:						   [  OK  ]
</pre></li><li><div class="para">
					Now that SELinux has been configured to allow <code class="systemitem">squid</code> to listen on a non-standard port (TCP 10000 in this example), <code class="systemitem">squid</code> starts successfully on this port.
				</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html"><strong>Prev</strong>9.4.2. Server setup</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html"><strong>Next</strong>10.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Targeted_policy.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Targeted policy</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="chap-Managing_Confined_Services-Introduction.html" title="Chapter 2. Introduction" /><link rel="next" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html" title="3.2. Confined processes" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Co
 ntent/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Introduction.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Targeted_policy">Chapter 3. Targeted policy</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Targeted_policy.html#sect-Managing_Confined_Services-Targeted_policy-Type_Enforcement">3.1. Type Enforcement</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html">3.2. Confined processes</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-
 Targeted_policy-Unconfined_processes.html">3.3. Unconfined processes</a></span></dt></dl></div><div class="para">
		Targeted policy is the default SELinux policy used in Fedora. When using targeted policy, processes that are targeted run in a confined domain, and processes that are not targeted run in an unconfined domain. For example, by default, logged in users run in the <code class="computeroutput">unconfined_t</code> domain, and system processes started by init run in the <code class="computeroutput">initrc_t</code> domain - both of these domains are unconfined.
	</div><div class="para">
		SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. This can be achieved via Booleans that allow parts of SELinux policy to be changed at runtime, without any knowledge of SELinux policy writing. This allows changes, such as allowing services access to NFS file systems, without reloading or recompiling SELinux policy. Boolean configuration is discussed later.
	</div><div class="para">
		Other changes, such as using non-default directories to store files for services, and changing services to run on non-default port numbers, require policy configuration to be updated via tools such as <code class="command">semanage</code>. This is discussed later using detailed configuration examples.
	</div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Targeted_policy-Type_Enforcement">3.1. Type Enforcement</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Introduction.html"><strong>Prev</strong>Chapter 2. Introduction</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html"><strong>Next</strong>3.2. Confined processes</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-The_Apache_HTTP_Server.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. The Apache HTTP Server</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html" title="3.3. Unconfined processes" /><link rel="next" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html" title="4.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img s
 rc="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-The_Apache_HTTP_Server">Chapter 4. The Apache HTTP Server</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html#sect-Managing_Confined_Services-The_Apache_HTTP_Server-The_Apache_HTTP_Server_and_SELinux">4.1. The Apache HTTP Server and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html">4.2. Types</a></s
 pan></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html">4.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html">4.4. Configuration examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html#sect-Managing_Confined_Services-Configuration_examples-Running_a_static_site">4.4.1. Running a static site</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html">4.4.2. Sharing NFS and CIFS file systems</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html">4.4.3. Sharing files between services</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Con
 figuration_examples-Changing_port_numbers.html">4.4.4. Changing port numbers</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://httpd.apache.org/">Apache HTTP Server Project</a> page:
	</div><div class="para">
		"The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards".<sup>[<a id="id2904872" href="#ftn.id2904872" class="footnote">5</a>]</sup>
	</div><div class="para">
		In Fedora, the <span class="package">httpd</span> package provides the Apache HTTP Server. Run <code class="command">rpm -q httpd</code> to see if the <span class="package">httpd</span> package is installed. If it is not installed and you want to use the Apache HTTP Server, run the following command as the root user to install it:
	</div><pre class="screen">
yum install httpd
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-The_Apache_HTTP_Server-The_Apache_HTTP_Server_and_SELinux">4.1. The Apache HTTP Server and SELinux</h2></div></div></div><div class="para">
			When SELinux is enabled, the Apache HTTP Server (<code class="systemitem">httpd</code>) runs confined by default. Confined processes run in their own domains, and are separated from other confined processes. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited. The following example demonstrates the <code class="systemitem">httpd</code> processes running in their own domain. This example assumes the <span class="package">httpd</span> package is installed:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
				</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
					The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
				</div></li><li><div class="para">
					Run <code class="command">service httpd start</code> as the root user to start <code class="systemitem">httpd</code>:
				</div><pre class="screen">
# service httpd start
Starting httpd:                                            [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">ps -eZ | grep httpd</code> to view the <code class="systemitem">httpd</code> processes:
				</div><pre class="screen">
$ ps -eZ | grep httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2850</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2852</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2853</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2854</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2855</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2856</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2857</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2858</code></em> ?        00:00:00 httpd
unconfined_u:system_r:httpd_t:s0 <em class="replaceable"><code>2859</code></em> ?        00:00:00 httpd
</pre><div class="para">
					The SELinux context associated with the <code class="systemitem">httpd</code> processes is <code class="computeroutput">unconfined_u:system_r:httpd_t:s0</code>. The second last part of the context, <code class="computeroutput">httpd_t</code>, is the type. A type defines a domain for processes and a type for files. In this case, the <code class="systemitem">httpd</code> processes are running in the <code class="computeroutput">httpd_t</code> domain.
				</div></li></ol></div><div class="para">
			SELinux policy defines how processes running in confined domains, such as <code class="computeroutput">httpd_t</code>, interact with files, other processes, and the system in general. Files must be labeled correctly to allow <code class="systemitem">httpd</code> access to them. For example, <code class="systemitem">httpd</code> can read files labeled with the <code class="computeroutput">httpd_sys_content_t</code> type, but can not write to them, even if Linux permissions allow write access. Booleans must be turned on to allow certain behavior, such as allowing scripts network access, allowing <code class="systemitem">httpd</code> access to NFS and CIFS file systems, and <code class="systemitem">httpd</code> being allowed to execute Common Gateway Interface (CGI) scripts.
		</div><div class="para">
			When <code class="filename">/etc/httpd/conf/httpd.conf</code> is configured so <code class="systemitem">httpd</code> listens on a port other than TCP ports 80, 443, 488, 8008, 8009, or 8443, the <code class="command">semanage port</code> command must be used to add the new port number to SELinux policy configuration. The following example demonstrates configuring <code class="systemitem">httpd</code> to listen on a port that is not defined in SELinux policy configuration for <code class="systemitem">httpd</code>, and, as a consequence, <code class="systemitem">httpd</code> failing to start. This example also demonstrates how to then configure the SELinux system to allow <code class="systemitem">httpd</code> to successfully listen on a non-standard port that is not already defined in the policy. This example assumes the <span class="package">httpd</span> package is installed. Run each command in the example as the root user:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">service httpd status</code> to confirm <code class="systemitem">httpd</code> is not running:
				</div><pre class="screen">
# service httpd status
httpd is stopped
</pre><div class="para">
					If the output differs, run <code class="command">service httpd stop</code> to stop the process:
				</div><pre class="screen">
# service httpd stop
Stopping httpd:                                            [  OK  ]
</pre></li><li><div class="para">
					Run <code class="command">semanage port -l | grep -w http_port_t</code> to view the ports SELinux allows <code class="systemitem">httpd</code> to listen on:
				</div><pre class="screen">
# semanage port -l | grep -w http_port_t
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443
</pre></li><li><div class="para">
					Edit <code class="filename">/etc/httpd/conf/httpd.conf</code> as the root user. Configure the <code class="option">Listen</code> option so it lists a port that is not configured in SELinux policy configuration for <code class="systemitem">httpd</code>. In this example, <code class="systemitem">httpd</code> is configured to listen on port 12345:
				</div><pre class="screen">
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 127.0.0.1:12345
</pre></li><li><div class="para">
					Run <code class="command">service httpd start</code> to start <code class="systemitem">httpd</code>:
				</div><pre class="screen">
# service httpd start
Starting httpd: (13)Permission denied: make_sock: could not bind to address 127.0.0.1:12345
no listening sockets available, shutting down
Unable to open logs					   [FAILED]
</pre><div class="para">
					An SELinux denial similar to the following is logged to <code class="filename">/var/log/messages</code>:
				</div><pre class="screen">
setroubleshoot: SELinux is preventing the httpd (httpd_t) from binding to port 12345. For complete SELinux messages. run sealert -l f18bca99-db64-4c16-9719-1db89f0d8c77
</pre></li><li><div class="para">
					For SELinux to allow <code class="systemitem">httpd</code> to listen on port 12345, as used in this example, the following command is required:
				</div><pre class="screen">
# semanage port -a -t http_port_t -p tcp 12345
</pre></li><li><div class="para">
					Run <code class="command">service httpd start</code> again to start <code class="systemitem">httpd</code> and have it listen on the new port:
				</div><pre class="screen">
# service httpd start
Starting httpd:						   [  OK  ]
</pre></li><li><div class="para">
					Now that SELinux has been configured to allow <code class="systemitem">httpd</code> to listen on a non-standard port (TCP 12345 in this example), <code class="systemitem">httpd</code> starts successfully on this port.
				</div></li><li><div class="para">
					To prove that <code class="systemitem">httpd</code> is listening and communicating on TCP port 12345, open a telnet connection to the specified port and issue a HTTP GET command, as follows:
				</div><pre class="screen">
# telnet localhost 12345
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Date: Tue, 31 Mar 2009 13:12:10 GMT
Server: Apache/2.2.11 (Fedora)
Accept-Ranges: bytes
Content-Length: 3918
Content-Type: text/html; charset=UTF-8
[...continues...]
</pre></li></ol></div></div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2904872" href="#id2904872" class="para">5</a>] </sup>
			From the "The Number One HTTP Server On The Internet" section of the Apache HTTP Server Project page: <a href="http://httpd.apache.org/">http://httpd.apache.org/</a>. Copyright © 2009 The Apache Software Foundation. Accessed 19 January 2009.
		</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html"><strong>Prev</strong>3.3. Unconfined processes</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html"><strong>Next</strong>4.2. Types</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-Trademark_Information.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 1. Trademark Information</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="pr01s02.html" title="2. We Need Feedback!" /><link rel="next" href="chap-Managing_Confined_Services-Introduction.html" title="Chapter 2. Introduction" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /
 ></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="pr01s02.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Introduction.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-Trademark_Information">Chapter 1. Trademark Information</h2></div></div></div><div class="para">
		<span class="trademark">Linux</span>® is the registered trademark of Linus Torvalds in the U.S. and other countries.
	</div><div class="para">
		UNIX is a registered trademark of The Open Group.
	</div><div class="para">
		Type Enforcement is a trademark of Secure Computing, LLC, a wholly owned subsidiary of McAfee, Inc., registered in the U.S. and in other countries. Neither McAfee nor Secure Computing, LLC, has consented to the use or reference to this trademark by the author outside of this guide.
	</div><div class="para">
		Apache is a trademark of The Apache Software Foundation.
	</div><div class="para">
		MySQL is a registered trademark of Sun Microsystems in the United States and other countries.
	</div><div class="para">
		Windows is a registered trademark of Microsoft Corporation in the United States and other countries.
	</div><div class="para">
		Other products mentioned may be trademarks of their respective corporations.
	</div><div class="para">
		This guide includes material drawn from the <a href="http://docs.fedoraproject.org/selinux-user-guide/">Fedora 10 Security-Enhanced Linux User Guide</a>. The Fedora 10 Security-Enhanced Linux User Guide was written by Murray McAllister and Daniel Walsh. Technical editors include Dominick Grift, Eric Paris, and James Morris. Refer to the original document for details and the document as it was first released: <a href="http://docs.fedoraproject.org/selinux-user-guide/">http://docs.fedoraproject.org/selinux-user-guide/</a>. Copyright © 2008 Red Hat, Inc.
	</div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="pr01s02.html"><strong>Prev</strong>2. We Need Feedback!</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Introduction.html"><strong>Next</strong>Chapter 2. Introduction</a></li></ul></body></html>


--- NEW FILE chap-Managing_Confined_Services-rsync.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 13. rsync</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html" title="12.4. Configuration Examples" /><link rel="next" href="sect-Managing_Confined_Services-rsync-Types.html" title="13.2. Types" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_
 right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Types.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="chap-Managing_Confined_Services-rsync">Chapter 13. rsync</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-rsync.html#sect-Managing_Confined_Services-rsync-rsync_and_SELinux">13.1. rsync and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Types.html">13.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Booleans.html">13.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-M
 anaging_Confined_Services-rsync-Configuration_Examples.html">13.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html#sect-Managing_Confined_Services-rsync-Configuration_Examples-Rsync_as_a_daemon">13.4.1. Rsync as a daemon</a></span></dt></dl></dd></dl></div><div class="para">
		From the <a href="http://www.samba.org/rsync/">Rsync</a> project page:
	</div><div class="para">
		"rsync is an open source utility that provides fast incremental file transfer."
	</div><div class="para">
		When using Fedora, the <span class="package">rsync</span> package provides rsync. Run <code class="command">rpm -q rsync</code> to see if the <span class="package">rsync</span> package is installed. If it is not installed, run the following command as the root user to install it:
	</div><pre class="screen">
yum install rsync
</pre><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-rsync-rsync_and_SELinux">13.1. rsync and SELinux</h2></div></div></div><div class="para">
			From the Fedora 11 SELinux <span class="emphasis"><em>rsync_selinux(8)</em></span> man page: "SELinux requires files to have an extended attribute to define the file type. Policy governs the access daemons have to these files. If you want to share files using the rsync daemon, you must label the files and directories <span class="emphasis"><em>public_content_t</em></span>."
		</div><div class="para">
			Like most services, correct labeling is required for SELinux to perform its protection mechanisms over <code class="systemitem">rsync</code>.
		</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html"><strong>Prev</strong>12.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Types.html"><strong>Next</strong>13.2. Types</a></li></ul></body></html>


--- NEW FILE index.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Managing Confined Services</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><meta name="description" content="The Managing Confined Services guide is designed to assist advanced users and administrators when using and configuring SELinux. It is focused on Fedora Linux and describes the components of SELinux as they pertain to services an advanced user or administrator might need to configure. Also included are real-world examples of configuring these services and demonstrations of how SELinux complements their operation." /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="next" href="pref-Managing_Confined_Services-Preface.html" title="Preface" /></head
 ><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"></li><li class="next"><a accesskey="n" href="pref-Managing_Confined_Services-Preface.html"><strong>Next</strong></a></li></ul><div class="book" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div class="producttitle"><span class="productname">SELinux</span> <span class="productnumber">3.6.12</span></div><div><h1 id="id2825634" class="title">Managing Confined Services</h1></div><p class="edition">Edition 1.0</p><div><h3 class="corpauthor">
				<span class="inlinemediaobject"><object data="Common_Content/images/title_logo.svg" type="image/svg+xml"> Logo</object></span>
			</h3></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Scott</span> <span class="surname">Radvan</span></h3><div class="affiliation"><span class="orgname">Red Hat</span> <span class="orgdiv">Engineering Content Services</span></div><code class="email"><a class="email" href="mailto:sradvan at redhat.com">sradvan at redhat.com</a></code></div></div></div><div><p class="copyright">Copyright © 2009 Red Hat, Inc.</p></div><hr /><div><div id="id2932181" class="legalnotice"><h1 class="legalnotice">Legal Notice</h1><div class="para">
		Copyright <span class="trademark"></span>© 2009 Red Hat, Inc. This material may only be distributed subject to the terms and conditions set forth in the Open Publication License, V1.0, (the latest version is presently available at <a href="http://www.opencontent.org/openpub/">http://www.opencontent.org/openpub/</a>).
	</div><div class="para">
		Fedora and the Fedora Infinity Design logo are trademarks or registered trademarks of Red Hat, Inc., in the U.S. and other countries.
	</div><div class="para">
		Red Hat and the Red Hat "Shadow Man" logo are registered trademarks of Red Hat Inc. in the United States and other countries.
	</div><div class="para">
		All other trademarks and copyrights referred to are the property of their respective owners.
	</div><div class="para">
		Documentation, as with software itself, may be subject to export control. Read about Fedora Project export controls at <a href="http://fedoraproject.org/wiki/Legal/Export">http://fedoraproject.org/wiki/Legal/Export</a>. 
	</div></div></div><div><div class="abstract"><h6>Abstract</h6><div class="para">The Managing Confined Services guide is designed to assist advanced
users and administrators when using and configuring SELinux. It is
focused on Fedora Linux and describes the components of SELinux as
they pertain to services an advanced user or administrator might
need to configure. Also included are real-world examples of
configuring these services and demonstrations of how SELinux
complements their operation.</div></div></div></div><hr /></div><div class="toc"><dl><dt><span class="preface"><a href="pref-Managing_Confined_Services-Preface.html">Preface</a></span></dt><dd><dl><dt><span class="section"><a href="pref-Managing_Confined_Services-Preface.html#id2929908">1. Document Conventions</a></span></dt><dd><dl><dt><span class="section"><a href="pref-Managing_Confined_Services-Preface.html#id2904245">1.1. Typographic Conventions</a></span></dt><dt><span class="section"><a href="pref-Managing_Confined_Services-Preface.html#id2885248">1.2. Pull-quote Conventions</a></span></dt><dt><span class="section"><a href="pref-Managing_Confined_Services-Preface.html#id2898364">1.3. Notes and Warnings</a></span></dt></dl></dd><dt><span class="section"><a href="pr01s02.html">2. We Need Feedback!</a></span></dt></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Trademark_Information.html">1. Trademark Information</a></span></dt><dt><span class=
 "chapter"><a href="chap-Managing_Confined_Services-Introduction.html">2. Introduction</a></span></dt><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Targeted_policy.html">3. Targeted policy</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Targeted_policy.html#sect-Managing_Confined_Services-Targeted_policy-Type_Enforcement">3.1. Type Enforcement</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html">3.2. Confined processes</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html">3.3. Unconfined processes</a></span></dt></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html">4. The Apache HTTP Server</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html#sect-Managing_Conf
 ined_Services-The_Apache_HTTP_Server-The_Apache_HTTP_Server_and_SELinux">4.1. The Apache HTTP Server and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html">4.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html">4.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html">4.4. Configuration examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html#sect-Managing_Confined_Services-Configuration_examples-Running_a_static_site">4.4.1. Running a static site</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html">4.4.2. Sharing NFS and CIFS file systems</a></span></dt><dt
 ><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html">4.4.3. Sharing files between services</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html">4.4.4. Changing port numbers</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Samba.html">5. Samba</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Samba.html#sect-Managing_Confined_Services-Samba-Samba_and_SELinux">5.1. Samba and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Types.html">5.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Booleans.html">5.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Configuration_examples.html">5.4. Configurati
 on examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Samba-Configuration_examples.html#sect-Managing_Confined_Services-Configuration_examples-Sharing_directories_you_create">5.4.1. Sharing directories you create</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html">5.4.2. Sharing a website</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-File_Transfer_Protocol.html">6. File Transfer Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-File_Transfer_Protocol.html#sect-Managing_Confined_Services-File_Transfer_Protocol-FTP_and_SELinux">6.1. FTP and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html">6.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Servi
 ces-File_Transfer_Protocol-Booleans.html">6.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html">6.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html#sect-Managing_Confined_Services-Configuration_Examples-Uploading_to_an_FTP_site">6.4.1. Uploading to an FTP site</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Network_File_System.html">7. Network File System</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Network_File_System.html#sect-Managing_Confined_Services-NFS-NFS_and_SELinux">7.1. NFS and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Types.html">7.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Conf
 ined_services-NFS-Booleans.html">7.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html">7.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html#sect-Managing_Confined_Services-Configuration_Examples-Sharing_directories_using_NFS">7.4.1. Sharing directories using NFS</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html">8. Berkeley Internet Name Domain</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html#sect-Managing_Confined_Services-BIND-BIND_and_SELinux">8.1. BIND and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Types.html">8.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confine
 d_Services-BIND-Booleans.html">8.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html">8.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html#sect-Managing_Confined_Services-BIND-Configuration_Examples-Dynamic_DNS">8.4.1. Dynamic DNS</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html">9. Concurrent Versioning System</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html#sect-Managing_Confined_Services-Concurrent_Versioning_System-CVS_and_SELinux">9.1. CVS and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html">9.2. Types</a></span></dt><dt><span class="section"><a href="sect-Mana
 ging_Confined_Services-Concurrent_Versioning_System-Booleans.html">9.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html">9.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html#sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS">9.4.1. Setting up CVS</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html">9.4.2. Server setup</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html">10. Squid Caching Proxy</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html#sect-Managing_Co
 nfined_Services-Squid_Caching_Proxy-Squid_Caching_Proxy_and_SELinux">10.1. Squid Caching Proxy and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html">10.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html">10.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html">10.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html#sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples-Squid_Connecting_To_Non_Standard_Ports">10.4.1. Squid Connecting to Non-Standard Ports</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-MySQL.html">11. MySQL</a></span></dt><dd><dl><dt><span class="
 section"><a href="chap-Managing_Confined_Services-MySQL.html#sect-Managing_Confined_Services-MySQL-MySQL_and_SELinux">11.1. MySQL and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Types.html">11.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Booleans.html">11.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html">11.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html#sect-Managing_Confined_Services-MySQL-Configuration_Examples-Changing_Database_Location">11.4.1. MySQL Changing Database Location</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-PostgreSQL.html">12. PostgreSQL</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Se
 rvices-PostgreSQL.html#sect-Managing_Confined_Services-PostgreSQL-PostgreSQL_and_SELinux">12.1. PostgreSQL and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Types.html">12.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html">12.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html">12.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html#sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples-Changing_Database_Location">12.4.1. PostgreSQL Changing Database Location</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-rsync.html">13. rsync</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Servi
 ces-rsync.html#sect-Managing_Confined_Services-rsync-rsync_and_SELinux">13.1. rsync and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Types.html">13.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Booleans.html">13.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html">13.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html#sect-Managing_Confined_Services-rsync-Configuration_Examples-Rsync_as_a_daemon">13.4.1. Rsync as a daemon</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-Postfix.html">14. Postfix</a></span></dt><dd><dl><dt><span class="section"><a href="chap-Managing_Confined_Services-Postfix.html#sect-Managing_Confined_Services-rsync-Postfix_and_SELinu
 x">14.1. Postfix and SELinux</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Types.html">14.2. Types</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Booleans.html">14.3. Booleans</a></span></dt><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html">14.4. Configuration Examples</a></span></dt><dd><dl><dt><span class="section"><a href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html#sect-Managing_Confined_Services-Postfix-Configuration_Examples-SpamAssassin_and_Postfix">14.4.1. SpamAssassin and Postfix</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="chap-Managing_Confined_Services-References.html">15. References</a></span></dt></dl></div></div><ul class="docnav"><li class="previous"></li><li class="next"><a accesskey="n" href="pref-Managing_Confined_Services-Preface.html"><strong>Next</strong>Preface</a><
 /li></ul></body></html>


--- NEW FILE pr01s02.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2. We Need Feedback!</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="pref-Managing_Confined_Services-Preface.html" title="Preface" /><link rel="prev" href="pref-Managing_Confined_Services-Preface.html" title="Preface" /><link rel="next" href="chap-Managing_Confined_Services-Trademark_Information.html" title="Chapter 1. Trademark Information" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image
 _right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="pref-Managing_Confined_Services-Preface.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Trademark_Information.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="id2906601">2. We Need Feedback!</h2></div></div></div><a id="id2920555" class="indexterm"></a><div class="para">
		If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: <a href="http://bugzilla.redhat.com/bugzilla/">http://bugzilla.redhat.com/bugzilla/</a>
		against the product <span class="application"><strong>SELinux.</strong></span>
	</div><div class="para">
		When submitting a bug report, be sure to mention the manual's identifier: <em class="citetitle">Managing_Confined_Services</em>
	</div><div class="para">
		If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
	</div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="pref-Managing_Confined_Services-Preface.html"><strong>Prev</strong>Preface</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Trademark_Information.html"><strong>Next</strong>Chapter 1. Trademark Information</a></li></ul></body></html>


--- NEW FILE pref-Managing_Confined_Services-Preface.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Preface</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="index.html" title="Managing Confined Services" /><link rel="prev" href="index.html" title="Managing Confined Services" /><link rel="next" href="pr01s02.html" title="2. We Need Feedback!" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p"
  href="index.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="pr01s02.html"><strong>Next</strong></a></li></ul><div class="preface" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h1 id="pref-Managing_Confined_Services-Preface" class="title">Preface</h1></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="id2929908">1. Document Conventions</h2></div></div></div><div class="para">
		This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information.
	</div><div class="para">
		In PDF and paper editions, this manual uses typefaces drawn from the <a href="https://fedorahosted.org/liberation-fonts/">Liberation Fonts</a> set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.
	</div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="id2904245">1.1. Typographic Conventions</h3></div></div></div><div class="para">
			Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.
		</div><div class="para">
			<code class="literal">Mono-spaced Bold</code>
		</div><div class="para">
			Used to highlight system input, including shell commands, file names and paths. Also used to highlight key caps and key-combinations. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				To see the contents of the file <code class="filename">my_next_bestselling_novel</code> in your current working directory, enter the <code class="command">cat my_next_bestselling_novel</code> command at the shell prompt and press <span class="keycap"><strong>Enter</strong></span> to execute the command.
			</div></blockquote></div><div class="para">
			The above includes a file name, a shell command and a key cap, all presented in Mono-spaced Bold and all distinguishable thanks to context.
		</div><div class="para">
			Key-combinations can be distinguished from key caps by the hyphen connecting each part of a key-combination. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				Press <span class="keycap"><strong>Enter</strong></span> to execute the command.
			</div><div class="para">
				Press <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>F1</strong></span> to switch to the first virtual terminal. Press <span class="keycap"><strong>Ctrl</strong></span>+<span class="keycap"><strong>Alt</strong></span>+<span class="keycap"><strong>F7</strong></span> to return to your X-Windows session.
			</div></blockquote></div><div class="para">
			The first sentence highlights the particular key cap to press. The second highlights two sets of three key caps, each set pressed simultaneously.
		</div><div class="para">
			If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in <code class="literal">Mono-spaced Bold</code>. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				File-related classes include <code class="classname">filesystem</code> for file systems, <code class="classname">file</code> for files, and <code class="classname">dir</code> for directories. Each class has its own associated set of permissions.
			</div></blockquote></div><div class="para">
			<span class="application"><strong>Proportional Bold</strong></span>
		</div><div class="para">
			This denotes words or phrases encountered on a system, including application names; dialogue box text; labelled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				Choose <span class="guimenu"><strong>System > Preferences > Mouse</strong></span> from the main menu bar to launch <span class="application"><strong>Mouse Preferences</strong></span>. In the <span class="guilabel"><strong>Buttons</strong></span> tab, click the <span class="guilabel"><strong>Left-handed mouse</strong></span> check box and click <span class="guibutton"><strong>Close</strong></span> to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).
			</div><div class="para">
				To insert a special character into a <span class="application"><strong>gedit</strong></span> file, choose <span class="guimenu"><strong>Applications > Accessories > Character Map</strong></span> from the main menu bar. Next, choose <span class="guimenu"><strong>Search > Find…</strong></span> from the <span class="application"><strong>Character Map</strong></span> menu bar, type the name of the character in the <span class="guilabel"><strong>Search</strong></span> field and click <span class="guibutton"><strong>Next</strong></span>. The character you sought will be highlighted in the <span class="guilabel"><strong>Character Table</strong></span>. Double-click this highlighted character to place it in the <span class="guilabel"><strong>Text to copy</strong></span> field and then click the <span class="guibutton"><strong>Copy</strong></span> button. Now switch back to your document and choose <span class="guimenu"><strong>Edit > Paste</strong></span> from the <
 span class="application"><strong>gedit</strong></span> menu bar.
			</div></blockquote></div><div class="para">
			The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in Proportional Bold and all distinguishable by context.
		</div><div class="para">
			Note the <span class="guimenu"><strong>></strong></span> shorthand used to indicate traversal through a menu and its sub-menus. This is to avoid the difficult-to-follow 'Select <span class="guimenuitem"><strong>Mouse</strong></span> from the <span class="guimenu"><strong>Preferences</strong></span> sub-menu in the <span class="guimenu"><strong>System</strong></span> menu of the main menu bar' approach.
		</div><div class="para">
			<code class="command"><em class="replaceable"><code>Mono-spaced Bold Italic</code></em></code> or <span class="application"><strong><em class="replaceable"><code>Proportional Bold Italic</code></em></strong></span>
		</div><div class="para">
			Whether Mono-spaced Bold or Proportional Bold, the addition of Italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				To connect to a remote machine using ssh, type <code class="command">ssh <em class="replaceable"><code>username</code></em>@<em class="replaceable"><code>domain.name</code></em></code> at a shell prompt. If the remote machine is <code class="filename">example.com</code> and your username on that machine is john, type <code class="command">ssh john at example.com</code>.
			</div><div class="para">
				The <code class="command">mount -o remount <em class="replaceable"><code>file-system</code></em></code> command remounts the named file system. For example, to remount the <code class="filename">/home</code> file system, the command is <code class="command">mount -o remount /home</code>.
			</div><div class="para">
				To see the version of a currently installed package, use the <code class="command">rpm -q <em class="replaceable"><code>package</code></em></code> command. It will return a result as follows: <code class="command"><em class="replaceable"><code>package-version-release</code></em></code>.
			</div></blockquote></div><div class="para">
			Note the words in bold italics above — username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.
		</div><div class="para">
			Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example:
		</div><div class="blockquote"><blockquote class="blockquote"><div class="para">
				When the Apache HTTP Server accepts requests, it dispatches child processes or threads to handle them. This group of child processes or threads is known as a <em class="firstterm">server-pool</em>. Under Apache HTTP Server 2.0, the responsibility for creating and maintaining these server-pools has been abstracted to a group of modules called <em class="firstterm">Multi-Processing Modules</em> (<em class="firstterm">MPMs</em>). Unlike other modules, only one module from the MPM group can be loaded by the Apache HTTP Server.
			</div></blockquote></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="id2885248">1.2. Pull-quote Conventions</h3></div></div></div><div class="para">
			Two, commonly multi-line, data types are set off visually from the surrounding text.
		</div><div class="para">
			Output sent to a terminal is set in <code class="computeroutput">Mono-spaced Roman</code> and presented thus:
		</div><pre class="screen">
books        Desktop   documentation  drafts  mss    photos   stuff  svn
books_tests  Desktop1  downloads      images  notes  scripts  svgs
</pre><div class="para">
			Source-code listings are also set in <code class="computeroutput">Mono-spaced Roman</code> but are presented and highlighted as follows:
		</div><pre class="programlisting">
package org.jboss.book.jca.ex1;

import javax.naming.InitialContext;

public class ExClient
{
   public static void main(String args[]) 
       throws Exception
   {
      InitialContext iniCtx = new InitialContext();
      Object         ref    = iniCtx.lookup("EchoBean");
      EchoHome       home   = (EchoHome) ref;
      Echo           echo   = home.create();

      System.out.println("Created Echo");

      System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
   }
   
}
</pre></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="id2898364">1.3. Notes and Warnings</h3></div></div></div><div class="para">
			Finally, we use three visual styles to draw attention to information that might otherwise be overlooked.
		</div><div class="note"><h2>Note</h2><div class="para">
				A note is a tip or shortcut or alternative approach to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.
			</div></div><div class="important"><h2>Important</h2><div class="para">
				Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring Important boxes won't cause data loss but may cause irritation and frustration.
			</div></div><div class="warning"><h2>Warning</h2><div class="para">
				A Warning should not be ignored. Ignoring warnings will most likely cause data loss.
			</div></div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="index.html"><strong>Prev</strong>Managing Confined Services</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="pr01s02.html"><strong>Next</strong>2. We Need Feedback!</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-BIND-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>8.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html" title="Chapter 8. Berkeley Internet Name Domain" /><link rel="prev" href="sect-Managing_Confined_Services-BIND-Types.html" title="8.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html" title="8.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs
 .fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-BIND-Booleans">8.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Booleans allow you to tell SELinux how you are running NFS:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">named_write_master_zones</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents <code class="systemitem">named</code> from writing to zone files or directories labeled with the <code class="computeroutput">named_zone_t</code> type. <code class="systemitem">named</code> does not usually need to write to zone files; but in the case that it needs to, or if a secondary server needs to write to zone files, enable this Boolean to allow this action.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Types.html"><strong>Prev</strong>8.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Configuration_Examples.html"><strong>Next</strong>8.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-BIND-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>8.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html" title="Chapter 8. Berkeley Internet Name Domain" /><link rel="prev" href="sect-Managing_Confined_Services-BIND-Booleans.html" title="8.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html" title="Chapter 9. Concurrent Versioning System" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a>
 <a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-BIND-Configuration_Examples">8.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-BIND-Configuration_Examples-Dynamic_DNS">8.4.1. Dynamic DNS</h3></div></div></div><div class="para">
				BIND allows hosts to update their records in DNS and zone files dynamically. This is used when a host computer's IP address changes frequently and the DNS record requires real-time modification.
			</div><div class="para">
				Use the <code class="command">/var/named/dynamic</code> directory for zone files you want updated via dynamic DNS. Files created in or copied into <code class="command">/var/named/dynamic</code> inherit Linux permissions that allow <code class="systemitem">named</code> to write to them. As such files are labeled with the <code class="computeroutput">named_cache_t</code> type, SELinux allows <code class="systemitem">named</code> to write to them.
			</div><div class="para">
				If a zone file in <code class="command">/var/named/dynamic</code> is labeled with the <code class="computeroutput">named_zone_t</code> type, dynamic DNS updates may not be successful for a certain period of time as the update needs to be written to a journal first before being merged. If the zone file is labeled with the <code class="computeroutput">named_zone_t</code> type when the journal attempts to be merged, an error such as the following is logged to <code class="filename">/var/log/messages</code>:
			</div><pre class="screen">
named[PID]: dumping master file: rename: /var/named/dynamic/zone-name: permission denied
</pre><div class="para">
				Also, the following SELinux denial is logged to <code class="filename">/var/log/messages</code>:
			</div><pre class="screen">
setroubleshoot: SELinux is preventing named (named_t) "unlink" to zone-name (named_zone_t)
</pre><div class="para">
				To resolve this labeling issue, run the <code class="command">restorecon -R -v /var/named/dynamic</code> command as the Linux root user.
			</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-BIND-Booleans.html"><strong>Prev</strong>8.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html"><strong>Next</strong>Chapter 9. Concurrent Versioning System</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-BIND-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>8.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html" title="Chapter 8. Berkeley Internet Name Domain" /><link rel="prev" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html" title="Chapter 8. Berkeley Internet Name Domain" /><link rel="next" href="sect-Managing_Confined_Services-BIND-Booleans.html" title="8.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right
 " href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-BIND-Types">8.2. Types</h2></div></div></div><div class="para">
			The following types are used with BIND. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">named_zone_t</code></span></dt><dd><div class="para">
						Used for master zone files. Other services can not modify files of this type. <code class="systemitem">named</code> can only modify files of this type if the <code class="computeroutput">named_write_master_zones</code> Boolean is turned on.
					</div></dd><dt><span class="term"><code class="computeroutput">named_cache_t</code></span></dt><dd><div class="para">
						By default, <code class="systemitem">named</code> can write to files labeled with this type, without additional Booleans being set. Files copied or created in the <code class="command">/var/named/slaves</code>,<code class="command">/var/named/dynamic</code> and <code class="command">/var/named/data</code> directories are automatically labeled with the <code class="computeroutput">named_cache_t</code> type.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html"><strong>Prev</strong>Chapter 8. Berkeley Internet Name Domain</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-BIND-Booleans.html"><strong>Next</strong>8.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html" title="Chapter 9. Concurrent Versioning System" /><link rel="prev" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html" title="9.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html" title="9.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product 
 Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans">9.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running CVS:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_cvs_read_shadow</code></span></dt><dd><div class="para">
						This Boolean allows the <code class="systemitem">cvs</code> daemon to access the <code class="filename">/etc/shadow</code> file for user authentication.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html"><strong>Prev</strong>9.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html"><strong>Next</strong>9.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.4.2. Server setup</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html" title="9.4. Configuration Examples" /><link rel="prev" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html" title="9.4. Configuration Examples" /><link rel="next" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html" title="Chapter 10. Squid Caching Proxy" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_
 left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup">9.4.2. Server setup</h3></div></div></div><div class="note"><h2>Note</h2><div class="para">
					Steps 1-9 should be performed on the CVS server, <code class="command">cvs-srv</code>.
				</div></div><div class="orderedlist"><ol><li><div class="para">
						As the root user, install the <span class="package">cvs</span> and <span class="package">xinetd</span> packages. Run <code class="command">rpm -q cvs</code> to see if the <span class="package">cvs</span> package is installed. If it is not installed, run <code class="command">yum install cvs</code> as the root user to install it. Run <code class="command">rpm -q xinetd</code> to see if the <span class="package">xinetd</span> package is installed. If it is not installed, run <code class="command">yum install xinetd</code> as the root user to install it.
					</div></li><li><div class="para">
						Create a group named <code class="command">CVS</code>. This can be done via the <code class="command">groupadd CVS</code> command as the root user, or by using the <span class="emphasis"><em>system-config-users</em></span> tool.
					</div></li><li><div class="para">
						Create a user with a username of <code class="command">cvsuser</code> and make this user a member of the CVS group. This can be done using the <span class="emphasis"><em>system-config-users</em></span> tool.
					</div></li><li><div class="para">
						Edit the <code class="filename">/etc/services</code> file and make sure that the CVS server has uncommented entries looking similar to the following:
					</div><pre class="screen">
cvspserver	2401/tcp			# CVS client/server operations
cvspserver	2401/udp			# CVS client/server operations
</pre></li><li><div class="para">
						Create the CVS repository in the root area of the file system. When using SELinux, it is best to have the repository in the root file system so that recursive labels can be given to it without affecting any other subdirectories. For example, as the root user, create a <code class="command">/cvs</code> directory to house the repository:
					</div><pre class="screen">
[root at cvs-srv]# mkdir /cvs
</pre></li><li><div class="para">
						Give full permissions to the <code class="command">/cvs</code> directory to all users:
					</div><pre class="screen">
[root at cvs-srv]# chmod -R 777 /cvs
</pre><div class="warning"><h2>Warning</h2><div class="para">
							This is an example only and these permissions should not be used in a production system.
						</div></div></li><li><div class="para">
						Edit the <code class="filename">/etc/xinetd.d/cvs</code> file and make sure that the CVS section is uncommented and configured to use the <code class="command">/cvs</code> directory. The file should look similar to:
					</div><pre class="screen">
service cvspserver
{
	disable	= no
	port			= 2401
	socket_type		= stream
	protocol		= tcp
	wait			= no
	user			= root
	passenv			= PATH
	server			= /usr/bin/cvs
	env			= HOME=/cvs
	server_args		= -f --allow-root=/cvs pserver
#	bind			= 127.0.0.1
</pre></li><li><div class="para">
						Start the <code class="systemitem">xinetd</code> daemon by running <code class="command">service xinetd start</code> as the root user.
					</div></li><li><div class="para">
						Add a rule which allows inbound connections using TCP on port 2401 by using the <span class="emphasis"><em>system-config-firewall</em></span> tool.
					</div></li><li><div class="para">
						As the <code class="command">cvsuser</code> user, run the following command:
					</div><pre class="screen">
[cvsuser at cvs-client]$ cvs -d /cvs init
</pre></li><li><div class="para">
						At this point, CVS has been configured but SELinux will still deny logins and file access. To demonstrate this, set the $CVSROOT variable on <code class="command">cvs-client</code> and try to log in remotely. The following step should be performed on <code class="command">cvs-client</code>:
					</div><pre class="screen">
[cvsuser at cvs-client]$ export CVSROOT=:pserver:cvsuser at 192.168.1.1:/cvs
[cvsuser at cvs-client]$
[cvsuser at cvs-client]$ cvs login
Logging in to :pserver:cvsuser at 192.168.1.1:2401/cvs
CVS password: ********
cvs [login aborted]: unrecognized auth response from 192.168.100.1: cvs pserver: cannot open /cvs/CVSROOT/config: Permission denied
</pre><div class="para">
						SELinux has blocked access. In order to get SELinux to allow this access, the following step should be performed on <code class="command">cvs-srv</code>:
					</div></li><li><div class="para">
						Change the context of the <code class="command">/cvs</code> directory as the root user in order to recursively label any existing and new data in the <code class="command">/cvs</code> directory, giving it the <code class="computeroutput">cvs_data_t</code> type:
					</div><pre class="screen">
[root at cvs-srv]# semanage fcontext -a -t cvs_data_t '/cvs(/.*)?'
[root at cvs-srv]# restorecon -R -v /cvs
</pre></li><li><div class="para">
						The client, <code class="command">cvs-client</code> should now be able to log in and access all CVS resources in this repository:
					</div><pre class="screen">
[cvsuser at cvs-client]$ export CVSROOT=:pserver:cvsuser at 192.168.1.1:/cvs
[cvsuser at cvs-client]$
[cvsuser at cvs-client]$ cvs login
Logging in to :pserver:cvsuser at 192.168.1.1:2401/cvs
CVS password: ********
[cvsuser at cvs-client]$
</pre></li></ol></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html"><strong>Prev</strong>9.4. Configuration Examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html"><strong>Next</strong>Chapter 10. Squid Caching Proxy</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html" title="Chapter 9. Concurrent Versioning System" /><link rel="prev" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html" title="9.3. Booleans" /><link rel="next" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html" title="9.4.2. Server setup" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Cont
 ent/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples">9.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setti
 ng_Up_CVS">9.4.1. Setting up CVS</h3></div></div></div><div class="para">
				This example describes a simple CVS setup and an SELinux configuration which allows remote access. Two hosts are used in this example; a CVS server with a hostname of <code class="command">cvs-srv</code> with an IP address of <code class="command">192.168.1.1</code> and a client with a hostname of <code class="command">cvs-client</code> and an IP address of <code class="command">192.168.1.100</code>. Both hosts are on the same subnet (192.168.1.0/24). This is an example only and assumes that the <span class="package">cvs</span> and <span class="package">xinetd</span> packages are installed, that the SELinux targeted policy is used, and that SELinux is running in enforced mode.
			</div><div class="para">
				This example will show that even with full DAC permissions, SELinux can still enforce policy rules based on file labels and only allow access to certain areas that have been specifically labeled for access by CVS.
			</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html"><strong>Prev</strong>9.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Configuration_Examples-Setting_Up_CVS-Server-Setup.html"><strong>Next</strong>9.4.2. Server setup</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Concurrent_Versioning_System-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>9.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html" title="Chapter 9. Concurrent Versioning System" /><link rel="prev" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html" title="Chapter 9. Concurrent Versioning System" /><link rel="next" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html" title="9.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /
 ></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Concurrent_Versioning_System-Types">9.2. Types</h2></div></div></div><div class="para">
			The following types are used with CVS. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">cvs_data_t</code></span></dt><dd><div class="para">
						This type is used for data in a CVS repository. CVS can only gain full access to data if it has this type.
					</div></dd><dt><span class="term"><code class="computeroutput">cvs_exec_t</code></span></dt><dd><div class="para">
						This type is used for the <code class="filename">/usr/bin/cvs</code> binary.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Concurrent_Versioning_System.html"><strong>Prev</strong>Chapter 9. Concurrent Versioning System</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Concurrent_Versioning_System-Booleans.html"><strong>Next</strong>9.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.4.4. Changing port numbers</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html" title="4.4. Configuration examples" /><link rel="prev" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html" title="4.4.3. Sharing files between services" /><link rel="next" href="chap-Managing_Confined_Services-Samba.html" title="Chapter 5. Samba" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt=
 "Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Samba.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers">4.4.4. Changing port numbers</h3></div></div></div><div class="para">
				Depending on policy configuration, services may only be allowed to run on certain port numbers. Attempting to change the port a service runs on without changing policy may result in the service failing to start. Run <code class="command">semanage port -l | grep -w "http_port_t"</code> as the root user to list the ports SELinux allows <code class="systemitem">httpd</code> to listen on:
			</div><pre class="screen">
# semanage port -l | grep -w http_port_t
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443
</pre><div class="para">
				By default, SELinux allows <code class="systemitem">http</code> to listen on TCP ports 80, 443, 488, 8008, 8009, or 8443. If <code class="filename">/etc/httpd/conf/httpd.conf</code> is configured so that <code class="systemitem">httpd</code> listens on any port not listed for <code class="computeroutput">http_port_t</code>, <code class="systemitem">httpd</code> fails to start.
			</div><div class="para">
				To configure <code class="systemitem">httpd</code> to run on a port other than TCP ports 80, 443, 488, 8008, 8009, or 8443:
			</div><div class="orderedlist"><ol><li><div class="para">
						Edit <code class="filename">/etc/httpd/conf/httpd.conf</code> as the root user so the <code class="option">Listen</code> option lists a port that is not configured in SELinux policy for <code class="systemitem">httpd</code>. The following example configures <code class="systemitem">httpd</code> to listen on the 10.0.0.1 IP address, and on port 12345:
					</div><pre class="screen">
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 10.0.0.1:12345
</pre></li><li><div class="para">
						Run <code class="command">semanage port -a -t http_port_t -p tcp 12345</code> as the root user to add the port to SELinux policy configuration.
					</div></li><li><div class="para">
						Run <code class="command">semanage port -l | grep -w http_port_t</code> as the root user to confirm the port is added:
					</div><pre class="screen">
# semanage port -l | grep -w http_port_t
http_port_t                    tcp      12345, 80, 443, 488, 8008, 8009, 8443
</pre></li></ol></div><div class="para">
				If you no longer run <code class="systemitem">httpd</code> on port 12345, run <code class="command">semanage port -d -t http_port_t -p tcp 12345</code> as the root user to remove the port from policy configuration.
			</div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html"><strong>Prev</strong>4.4.3. Sharing files between services</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Samba.html"><strong>Next</strong>Chapter 5. Samba</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.4.2. Sharing NFS and CIFS file systems</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html" title="4.4. Configuration examples" /><link rel="prev" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html" title="4.4. Configuration examples" /><link rel="next" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html" title="4.4.3. Sharing files between services" /></head><body class=""><p id="title"><a class="left" href="http://www.fedorapro
 ject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems">4.4.2. Sharing NFS and CIFS file systems</h3></div></div></div><div class="para">
				By default, NFS mounts on the client side are labeled with a default context defined by policy for NFS file systems. In common policies, this default context uses the <code class="computeroutput">nfs_t</code> type. Also, by default, Samba shares mounted on the client side are labeled with a default context defined by policy. In common policies, this default context uses the <code class="computeroutput">cifs_t</code> type.
			</div><div class="para">
				Depending on policy configuration, services may not be able to read files labeled with the <code class="computeroutput">nfs_t</code> or <code class="computeroutput">cifs_t</code> types. This may prevent file systems labeled with these types from being mounted and then read or exported by other services. Booleans can be turned on or off to control which services are allowed to access the <code class="computeroutput">nfs_t</code> and <code class="computeroutput">cifs_t</code> types.
			</div><div class="para">
				Turn the <code class="computeroutput">httpd_use_nfs</code> Boolean on to allow <code class="systemitem">httpd</code> to access and share NFS file systems (labeled with the <code class="computeroutput">nfs_t</code> type. Run the <code class="command">setsebool</code> command as the root user to turn the Boolean on:
			</div><pre class="screen">
setsebool -P httpd_use_nfs on
</pre><div class="para">
				Turn the <code class="computeroutput">httpd_use_cifs</code> Boolean on to allow <code class="systemitem">httpd</code> to access and share CIFS file systems (labeled with the <code class="computeroutput">cifs_t</code> type. Run the <code class="command">setsebool</code> command as the root user to turn the Boolean on:
			</div><pre class="screen">
setsebool -P httpd_use_cifs on
</pre><div class="note"><h2>Note</h2><div class="para">
					Do not use the <code class="option">-P</code> option if you do not want <code class="command">setsebool</code> changes to persist across reboots.
				</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html"><strong>Prev</strong>4.4. Configuration examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html"><strong>Next</strong>4.4.3. Sharing files between services</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>5.4.2. Sharing a website</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html" title="5.4. Configuration examples" /><link rel="prev" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html" title="5.4. Configuration examples" /><link rel="next" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html" title="Chapter 6. File Transfer Protocol" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><
 a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website">5.4.2. Sharing a website</h3></div></div></div><div class="para">
				It may not be possible to label files with the <code class="computeroutput">samba_share_t</code> type, for example, when wanting to share a website in <code class="filename">/var/www/html/</code>. For these cases, use the <code class="computeroutput">samba_export_all_ro</code> Boolean to share any file or directory (regardless of the current label), allowing read only permissions, or the <code class="computeroutput">samba_export_all_rw</code> Boolean to share any file or directory (regardless of the current label), allowing read and write permissions.
			</div><div class="para">
				The following example creates a file for a website in <code class="filename">/var/www/html/</code>, and then shares that file through Samba, allowing read and write permissions. This example assumes the <span class="package">httpd</span>, <span class="package">samba</span>, <span class="package">samba-common</span>, <span class="package">samba-client</span>, and <span class="package">wget</span> packages are installed:
			</div><div class="orderedlist"><ol><li><div class="para">
						As the root user, create a <code class="filename">/var/www/html/file1.html</code> file. Copy and paste the following content into <code class="filename">/var/www/html/file1.html</code>:
					</div><pre class="screen">
<html>
<h2>File being shared through the Apache HTTP Server and Samba.</h2>
</html>
</pre></li><li><div class="para">
						Run <code class="command">ls -Z /var/www/html/file1.html</code> to view the SELinux context of <code class="filename">file1.html</code>:
					</div><pre class="screen">
$ ls -Z /var/www/html/file1.html
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/file1.html
</pre><div class="para">
						<code class="filename">file1.index.html</code> is labeled with the <code class="computeroutput">httpd_sys_content_t</code>. By default, the Apache HTTP Server can access this type, but Samba can not.
					</div></li><li><div class="para">
						Run <code class="command">service httpd start</code> as the root user to start the Apache HTTP Server:
					</div><pre class="screen">
service httpd start
Starting httpd:                                            [  OK  ]
</pre></li><li><div class="para">
						Change into a directory your user has write access to, and run the <code class="command">wget http://localhost/file1.html</code> command. Unless there are changes to the default configuration, this command succeeds:
					</div><pre class="screen">
$ wget http://localhost/file1.html
--2009-03-02 16:32:01--  http://localhost/file1.html
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 84 [text/html]
Saving to: `file1.html.1'

100%[=======================>] 84          --.-K/s   in 0s      

2009-03-02 16:32:01 (563 KB/s) - `file1.html.1' saved [84/84]
</pre></li><li><div class="para">
						Edit <code class="filename">/etc/samba/smb.conf</code> as the root user. Add the following to the bottom of this file to share the <code class="filename">/var/www/html/</code> directory through Samba:
					</div><pre class="screen">
[website]
comment = Sharing a website
path = /var/www/html/
public = no
writeable = no
</pre></li><li><div class="para">
						The <code class="filename">/var/www/html/</code> directory is labeled with the <code class="computeroutput">httpd_sys_content_t</code> type. By default, Samba can not access files and directories labeled with the <code class="computeroutput">httpd_sys_content_t</code> type, even if Linux permissions allow it. To allow Samba access, run the following command as the root user to turn the <code class="computeroutput">samba_export_all_ro</code> Boolean on:
					</div><pre class="screen">
setsebool -P samba_export_all_ro on
</pre><div class="para">
						Do not use the <code class="option">-P</code> option if you do not want the change to persist across reboots. Note: turning the <code class="computeroutput">samba_export_all_ro</code> Boolean on allows Samba to access any type.
					</div></li><li><div class="para">
						Run <code class="command">service smb start</code> as the root user to start <code class="systemitem">smbd</code>:
					</div><pre class="screen">
service smb start
Starting SMB services:                                     [  OK  ]
</pre></li></ol></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html"><strong>Prev</strong>5.4. Configuration examples</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html"><strong>Next</strong>Chapter 6. File Transfer Protocol</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.4.3. Sharing files between services</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html" title="4.4. Configuration examples" /><link rel="prev" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html" title="4.4.2. Sharing NFS and CIFS file systems" /><link rel="next" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html" title="4.4.4. Changing port numbers" /></head><body class=""><p id="title"><a class="left" href="http://www.fedora
 project.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Sharing_files_between_services">4.4.3. Sharing files between services</h3></div></div></div><div class="para">
				Type Enforcement helps prevent processes from accessing files intended for use by another process. For example, by default, Samba can not read files labeled with the <code class="computeroutput">httpd_sys_content_t</code> type, which are intended for use by the Apache HTTP Server. Files can be shared between the Apache HTTP Server, FTP, rsync, and Samba, if the desired files are labeled with the <code class="computeroutput">public_content_t</code> or <code class="computeroutput">public_content_rw_t</code> type.
			</div><div class="para">
				The following example creates a directory and files, and allows that directory and files to be shared (read only) through the Apache HTTP Server, FTP, rsync, and Samba:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">mkdir /shares</code> as the root user to create a new top-level directory to share files between multiple services.
					</div></li><li><div class="para">
						Files and directories that do not match a pattern in file-context configuration may be labeled with the <code class="computeroutput">default_t</code> type. This type is inaccessible to confined services:
					</div><pre class="screen">
$ ls -dZ /shares
drwxr-xr-x  root root unconfined_u:object_r:default_t:s0 /shares
</pre></li><li><div class="para">
						As the root user, create a <code class="filename">/shares/index.html</code> file. Copy and paste the following content into <code class="filename">/shares/index.html</code>:
					</div><pre class="screen">
<html>
<body>
<p>Hello</p>
</body>
</html>
</pre></li><li><div class="para">
						Labeling <code class="filename">/shares/</code> with the <code class="computeroutput">public_content_t</code> type allows read-only access by the Apache HTTP Server, FTP, rsync, and Samba. Run the following command as the root user to add the label change to file-context configuration:
					</div><pre class="screen">
semanage fcontext -a -t public_content_t "/shares(/.*)?"
</pre></li><li><div class="para">
						Run <code class="command">restorecon -R -v /shares/</code> as the root user to apply the label changes:
					</div><pre class="screen">
# restorecon -R -v /shares/
restorecon reset /shares context unconfined_u:object_r:default_t:s0->system_u:object_r:public_content_t:s0
restorecon reset /shares/index.html context unconfined_u:object_r:default_t:s0->system_u:object_r:public_content_t:s0
</pre></li></ol></div><div class="para">
				To share <code class="filename">/shares/</code> through Samba:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">rpm -q samba samba-common samba-client</code> to confirm the <span class="package">samba</span>, <span class="package">samba-common</span>, and <span class="package">samba-client</span> packages are installed (version numbers may differ):
					</div><pre class="screen">
$ rpm -q samba samba-common samba-client
samba-3.3.0-0.25.fc11.i386
samba-common-3.3.0-0.25.fc11.i386
samba-client-3.3.0-0.25.fc11.i386
</pre><div class="para">
						If any of these packages are not installed, install them by running <code class="command">yum install <em class="replaceable"><code>package-name</code></em></code> as the root user.
					</div></li><li><div class="para">
						Edit <code class="filename">/etc/samba/smb.conf</code> as the root user. Add the following entry to the bottom of this file to share the <code class="filename">/shares/</code> directory through Samba:
					</div><pre class="screen">
[shares]
comment = Documents for Apache HTTP Server, FTP, rsync, and Samba
path = /shares
public = yes
writeable = no
</pre></li><li><div class="para">
						A Samba account is required to mount a Samba file system. Run <code class="command">smbpasswd -a <em class="replaceable"><code>username</code></em></code> as the root user to create a Samba account, where <em class="replaceable"><code>username</code></em> is an existing Linux user. For example, <code class="command">smbpasswd -a testuser</code> creates a Samba account for the Linux testuser user:
					</div><pre class="screen">
# smbpasswd -a testuser
New SMB password: <em class="replaceable"><code>Enter a password</code></em>
Retype new SMB password: <em class="replaceable"><code>Enter the same password again</code></em>
Added user testuser.
</pre><div class="para">
						Running <code class="command">smbpasswd -a <em class="replaceable"><code>username</code></em></code>, where <em class="replaceable"><code>username</code></em> is the username of a Linux account that does not exist on the system, causes a <code class="computeroutput">Cannot locate Unix account for '<em class="replaceable"><code>username</code></em>'!</code> error.
					</div></li><li><div class="para">
						Run <code class="command">service smb start</code> as the root user to start the Samba service:
					</div><pre class="screen">
service smb start
Starting SMB services:                                     [  OK  ]
</pre></li><li><div class="para">
						Run <code class="command">smbclient -U <em class="replaceable"><code>username</code></em> -L localhost</code> to list the available shares, where <em class="replaceable"><code>username</code></em> is the Samba account added in step 3. When prompted for a password, enter the password assigned to the Samba account in step 3 (version numbers may differ):
					</div><pre class="screen">
$ smbclient -U <em class="replaceable"><code>username</code></em> -L localhost
Enter <em class="replaceable"><code>username</code></em>'s password:
Domain=[<em class="replaceable"><code>HOSTNAME</code></em>] OS=[Unix] Server=[Samba 3.3.0-0.25.fc11]

Sharename       Type      Comment
---------       ----      -------
shares          Disk      Documents for Apache HTTP Server, FTP, rsync, and Samba
IPC$            IPC       IPC Service (Samba Server Version 3.3.0-0.25.fc11)
<em class="replaceable"><code>username</code></em>        Disk      Home Directories
Domain=[<em class="replaceable"><code>HOSTNAME</code></em>] OS=[Unix] Server=[Samba 3.3.0-0.25.fc11]

Server               Comment
---------            -------

Workgroup            Master
---------            -------
</pre></li><li><div class="para">
						Run <code class="command">mkdir /test/</code> as the root user to create a new directory. This directory will be used to mount the <code class="computeroutput">shares</code> Samba share.
					</div></li><li><div class="para">
						Run the following command as the root user to mount the <code class="computeroutput">shares</code> Samba share to <code class="filename">/test/</code>, replacing <em class="replaceable"><code>username</code></em> with the username from step 3:
					</div><pre class="screen">
mount //localhost/shares /test/ -o user=<em class="replaceable"><code>username</code></em>
</pre><div class="para">
						Enter the password for <em class="replaceable"><code>username</code></em>, which was configured in step 3.
					</div></li><li><div class="para">
						Run <code class="command">cat /test/index.html</code> to view the file, which is being shared through Samba:
					</div><pre class="screen">
$ cat /test/index.html
<html>
<body>
<p>Hello</p>
</body>
</html>
</pre></li></ol></div><div class="para">
				To share <code class="filename">/shares/</code> through the Apache HTTP Server:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">rpm -q httpd</code> to confirm the <span class="package">httpd</span> package is installed (version number may differ):
					</div><pre class="screen">
$ rpm -q httpd
httpd-2.2.11-6.i386
</pre><div class="para">
						If this package is not installed, run <code class="command">yum install httpd</code> as the root user to install it.
					</div></li><li><div class="para">
						Change into the <code class="filename">/var/www/html/</code> directory. Run the following command as the root user to create a link (named <code class="computeroutput">shares</code>) to the <code class="filename">/shares/</code> directory:
					</div><pre class="screen">
ln -s /shares/ shares
</pre></li><li><div class="para">
						Run <code class="command">service httpd start</code> as the root user to start the Apache HTTP Server:
					</div><pre class="screen">
service httpd start
Starting httpd:                                            [  OK  ]
</pre></li><li><div class="para">
						Use a web browser to navigate to <code class="computeroutput">http://localhost/shares</code>. The <code class="filename">/shares/index.html</code> file is displayed.
					</div></li></ol></div><div class="para">
				By default, the Apache HTTP Server reads an <code class="filename">index.html</code> file if it exists. If <code class="filename">/shares/</code> did not have <code class="filename">index.html</code>, and instead had <code class="filename">file1</code>, <code class="filename">file2</code>, and <code class="filename">file3</code>, a directory listing would occur when accessing <code class="computeroutput">http://localhost/shares</code>:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">rm -i /shares/index.html</code> as the root user to remove the <code class="filename">index.html</code> file.
					</div></li><li><div class="para">
						Run <code class="command">touch /shares/file{1,2,3}</code> as the root user to create three files in <code class="filename">/shares/</code>:
					</div><pre class="screen">
# touch /shares/file{1,2,3}
# ls -Z /shares/
-rw-r--r--  root root system_u:object_r:public_content_t:s0 file1
-rw-r--r--  root root unconfined_u:object_r:public_content_t:s0 file2
-rw-r--r--  root root unconfined_u:object_r:public_content_t:s0 file3
</pre></li><li><div class="para">
						Run <code class="command">service httpd status</code> as the root user to see the status of the Apache HTTP Server. If the server is stopped, run <code class="command">service httpd start</code> as the root user to start it.
					</div></li><li><div class="para">
						Use a web browser to navigate to <code class="computeroutput">http://localhost/shares</code>. A directory listing is displayed:
					</div><div class="mediaobject"><img src="./images/shares_listing.png" /></div></li></ol></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html"><strong>Prev</strong>4.4.2. Sharing NFS and CIFS file systems</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Changing_port_numbers.html"><strong>Next</strong>4.4.4. Changing port numbers</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>6.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html" title="Chapter 6. File Transfer Protocol" /><link rel="prev" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html" title="6.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html" title="6.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="ri
 ght" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans">6.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Booleans allow you to tell SELinux how you are running <code class="systemitem">vsftpd</code>:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_ftpd_anon_write</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents <code class="systemitem">vsftpd</code> from writing to files and directories labeled with the <code class="computeroutput">public_content_rw_t</code> type. Turn this Boolean on to allow users to upload files via FTP. The directory where files are uploaded to must be labeled with the <code class="computeroutput">public_content_rw_t</code> type and Linux permissions set accordingly.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_ftpd_full_access</code></span></dt><dd><div class="para">
						When this Boolean is on, only Linux permissions are used to control access, and authenticated users can read and write to files that are not labeled with the <code class="computeroutput">public_content_t</code> or <code class="computeroutput">public_content_rw_t</code> types.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_ftpd_use_cifs</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows <code class="systemitem">vsftpd</code> to access files and directories labeled with the <code class="computeroutput">cifs_t</code> type; therefore, having this Boolean enabled allows you to share file systems mounted via Samba through <code class="systemitem">vsftpd</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_ftpd_use_nfs</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows <code class="systemitem">vsftpd</code> to access files and directories labeled with the <code class="computeroutput">nfs_t</code> type; therefore, having this Boolean enabled allows you to share file systems mounted via NFS through <code class="systemitem">vsftpd</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">ftp_home_dir</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows authenticated users to read and write to files in their home directories. When this Boolean is off, attempting to download a file from a home directory results in an error such as <code class="computeroutput">550 Failed to open file</code>. An SELinux denial is logged to <code class="filename">/var/log/messages</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">ftpd_connect_db</code></span></dt><dd><div class="para">
						Allow FTP daemons to initiate a connection to a database.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_enable_ftp_server</code></span></dt><dd><div class="para">
						Allow <code class="systemitem">httpd</code> to listen on the FTP port and act as a FTP server.
					</div></dd><dt><span class="term"><code class="computeroutput">tftp_anon_write</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows TFTP access to a public directory, such as an area reserved for common files that otherwise has no special access restrictions.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html"><strong>Prev</strong>6.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html"><strong>Next</strong>6.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>6.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html" title="Chapter 6. File Transfer Protocol" /><link rel="prev" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html" title="6.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-Network_File_System.html" title="Chapter 7. Network File System" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="righ
 t" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Network_File_System.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-File_Transfer_Protocol-Configuration_Examples">6.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_Examples-Uploading_to_an_FTP_site">6.4.1. Uploading to an FTP site</h3></div></div></div><div class="para">
				The following example creates an FTP site that allows a dedicated user to upload files. It creates the directory structure and the required SELinux configuration changes:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">mkdir -p /myftp/pub</code> as the root user to create a new top-level directory.
					</div></li><li><div class="para">
						Set Linux permissions on the <code class="filename">/myftp/pub/</code> directory to allow a Linux user write access. This example changes the owner and group from root to owner user1 and group root. Replace user1 with the user you want to give write access to:
					</div><pre class="screen">
# chown user1:root /myftp/pub
# chmod 775 /myftp/pub
</pre><div class="para">
						The <code class="command">chown</code> command changes the owner and group permissions. The <code class="command">chmod</code> command changes the mode, allowing the user1 user read, write, and execute permissions, and members of the root group read, write, and execute permissions. Everyone else has read and execute permissions: this is required to allow the Apache HTTP Server to read files from this directory.
					</div></li><li><div class="para">
						When running SELinux, files and directories must be labeled correctly to allow access. Setting Linux permissions is not enough. Files labeled with the <code class="computeroutput">public_content_t</code> type allow them to be read by FTP, Apache HTTP Server, Samba, and rsync. Files labeled with the <code class="computeroutput">public_content_rw_t</code> type can be written to by FTP. Other services, such as Samba, require Booleans to be set before they can write to files labeled with the <code class="computeroutput">public_content_rw_t</code> type. Label the top-level directory (<code class="filename">/myftp/</code>) with the <code class="computeroutput">public_content_t</code> type, to prevent copied or newly-created files under <code class="filename">/myftp/</code> from being written to or modified by services. Run the following command as the root user to add the label change to file-context configuration:
					</div><pre class="screen">
semanage fcontext -a -t public_content_t /myftp
</pre></li><li><div class="para">
						Run <code class="command">restorecon -R -v /myftp/</code> to apply the label change:
					</div><pre class="screen">
# restorecon -R -v /myftp/
restorecon reset /myftp context unconfined_u:object_r:default_t:s0->system_u:object_r:public_content_t:s0
</pre></li><li><div class="para">
						Confirm <code class="filename">/myftp</code> is labeled with the <code class="computeroutput">public_content_t</code> type, and <code class="filename">/myftp/pub/</code> is labeled with the <code class="computeroutput">default_t</code> type:
					</div><pre class="screen">
$ ls -dZ /myftp/
drwxr-xr-x. root root system_u:object_r:public_content_t:s0 /myftp/
$ ls -dZ /myftp/pub/
drwxrwxr-x. user1 root unconfined_u:object_r:default_t:s0 /myftp/pub/
</pre></li><li><div class="para">
						FTP must be allowed to write to a directory before users can upload files via FTP. SELinux allows FTP to write to directories labeled with the <code class="computeroutput">public_content_rw_t</code> type. This example uses <code class="filename">/myftp/pub/</code> as the directory FTP can write to. Run the following command as the root user to add the label change to file-context configuration:
					</div><pre class="screen">
semanage fcontext -a -t public_content_rw_t "/myftp/pub(/.*)?"
</pre></li><li><div class="para">
						Run <code class="command">restorecon -R -v /myftp/pub</code> as the root user to apply the label change:
					</div><pre class="screen">
# restorecon -R -v /myftp/pub
restorecon reset /myftp/pub context system_u:object_r:default_t:s0->system_u:object_r:public_content_rw_t:s0
</pre></li><li><div class="para">
						The <code class="computeroutput">allow_ftpd_anon_write</code> Boolean must be on to allow <code class="computeroutput">vsftpd</code> to write to files that are labeled with the <code class="computeroutput">public_content_rw_t</code> type. Run the following command as the root user to turn this Boolean on:
					</div><pre class="screen">
setsebool -P allow_ftpd_anon_write on
</pre><div class="para">
						Do not use the <code class="option">-P</code> option if you do not want changes to persist across reboots.
					</div></li></ol></div><div class="para">
				The following example demonstrates logging in via FTP and uploading a file. This example uses the user1 user from the previous example, where user1 is the dedicated owner of the <code class="filename">/myftp/pub/</code> directory:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">cd ~/</code> to change into your home directory. Then, run <code class="command">mkdir myftp</code> to create a directory to store files to upload via FTP.
					</div></li><li><div class="para">
						Run <code class="command">cd ~/myftp</code> to change into the <code class="filename">~/myftp/</code> directory. In this directory, create an <code class="filename">ftpupload</code> file. Copy the following contents into this file:
					</div><pre class="screen">
File upload via FTP from a home directory.
</pre></li><li><div class="para">
						Run <code class="command">getsebool allow_ftpd_anon_write</code> to confirm the <code class="computeroutput">allow_ftpd_anon_write</code> Boolean is on:
					</div><pre class="screen">
$ getsebool allow_ftpd_anon_write
allow_ftpd_anon_write --> on
</pre><div class="para">
						If this Boolean is off, run <code class="command">setsebool -P allow_ftpd_anon_write on</code> as the root user to turn it on. Do not use the <code class="option">-P</code> option if you do not want the change to persist across reboots.
					</div></li><li><div class="para">
						Run <code class="command">service vsftpd start</code> as the root user to start <code class="systemitem">vsftpd</code>:
					</div><pre class="screen">
# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]
</pre></li><li><div class="para">
						Run <code class="command">ftp localhost</code>. When prompted for a username, enter the the username of the user who has write access, then, enter the correct password for that user:
					</div><pre class="screen">
$ ftp localhost
Connected to localhost (127.0.0.1).
220 (vsFTPd 2.1.0)
Name (localhost:<em class="replaceable"><code>username</code></em>):
331 Please specify the password.
Password: <em class="replaceable"><code>Enter the correct password</code></em>
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
</pre></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html"><strong>Prev</strong>6.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Network_File_System.html"><strong>Next</strong>Chapter 7. Network File System</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-File_Transfer_Protocol-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>6.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html" title="Chapter 6. File Transfer Protocol" /><link rel="prev" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html" title="Chapter 6. File Transfer Protocol" /><link rel="next" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html" title="6.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="ht
 tp://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-File_Transfer_Protocol-Types">6.2. Types</h2></div></div></div><div class="para">
			By default, anonymous users have read access to files in <code class="filename">/var/ftp/</code> when they log in via FTP. This directory is labeled with the <code class="computeroutput">public_content_t</code> type, allowing only read access, even if write access is configured in <code class="filename">/etc/vsftpd/vsftpd.conf</code>. The <code class="computeroutput">public_content_t</code> type is accessible to other services, such as Apache HTTP Server, Samba, and NFS.
		</div><div class="para">
			Use one of the following types to share files through FTP:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">public_content_t</code></span></dt><dd><div class="para">
						Label files and directories you have created with the <code class="computeroutput">public_content_t</code> type to share them read-only through vsftpd. Other services, such as Apache HTTP Server, Samba, and NFS, also have access to files labeled with this type. Files labeled with the <code class="computeroutput">public_content_t</code> type can not be written to, even if Linux permissions allow write access. If you require write access, use the <code class="computeroutput">public_content_rw_t</code> type.
					</div></dd><dt><span class="term"><code class="computeroutput">public_content_rw_t</code></span></dt><dd><div class="para">
						Label files and directories you have created with the <code class="computeroutput">public_content_rw_t</code> type to share them with read and write permissions through <code class="systemitem">vsftpd</code>. Other services, such as Apache HTTP Server, Samba, and NFS, also have access to files labeled with this type; however, Booleans for each service must be turned on before such services can write to files labeled with this type.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-File_Transfer_Protocol.html"><strong>Prev</strong>Chapter 6. File Transfer Protocol</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-File_Transfer_Protocol-Booleans.html"><strong>Next</strong>6.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-MySQL-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>11.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-MySQL.html" title="Chapter 11. MySQL" /><link rel="prev" href="sect-Managing_Confined_Services-MySQL-Types.html" title="11.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html" title="11.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Conte
 nt/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-MySQL-Booleans">11.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running MySQL:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">exim_can_connect_db</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows the <code class="systemitem">exim</code> mailer to initiate connections to a database server.
					</div></dd><dt><span class="term"><code class="computeroutput">ftpd_connect_db</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows <code class="systemitem">ftp</code> daemons to initiate connections to a database server.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_can_network_connect_db</code></span></dt><dd><div class="para">
						Enabling this Boolean is required for a web server to communicate with a database server.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Types.html"><strong>Prev</strong>11.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Configuration_Examples.html"><strong>Next</strong>11.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-MySQL-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>11.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-MySQL.html" title="Chapter 11. MySQL" /><link rel="prev" href="sect-Managing_Confined_Services-MySQL-Booleans.html" title="11.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-PostgreSQL.html" title="Chapter 12. PostgreSQL" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/
 images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-PostgreSQL.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-MySQL-Configuration_Examples">11.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-MySQL-Configuration_Examples-Changing_Database_Location">11.4.1. MySQL Changing Database Location</h3></div></div></div><div class="para">
				When using Fedora 11, the default location for MySQL to store its database is <code class="filename">/var/lib/mysql</code>. This is where SELinux expects it to be by default, and hence this area is already labeled appropriately for you, using the <code class="computeroutput">mysqld_db_t</code> type.
			</div><div class="para">
				The area where the database is located can be changed depending on individual environment requirements or preferences, however it is important that SELinux is aware of this new location - that it is labeled accordingly. This example explains how to change the location of a MySQL database and then how to label the new location so that SELinux can still provide its protection mechanisms to the new area based on its contents.
			</div><div class="para">
				Note that this is an example only and demonstrates how SELinux can affect MySQL. Comprehensive documentation of MySQL is beyond the scope of this document. Refer to the official <a href="http://dev.mysql.com/doc/">MySQL documentation</a> for further details. This example assumes that the <span class="package">mysql-server</span> package is installed and that there is a valid database in the default location of <code class="filename">/var/lib/mysql</code>.
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">ls -lZ /var/lib/mysql</code> to view the SELinux context of the default database location for <code class="systemitem">mysql</code>: 
<pre class="screen">
# ls -lZ /var/lib/mysql
drwx------. mysql mysql unconfined_u:object_r:<span class="emphasis"><em>mysqld_db_t</em></span>:s0 mysql
</pre>
					</div><div class="para">
						This shows <code class="computeroutput">mysqld_db_t</code> which is the default context element for the location of database files. This context will have to be manually applied to the new database location that will be used in this example in order for it to function properly.
					</div></li><li><div class="para">
						Enter <code class="command">mysqlshow -u root -p</code> and enter the <code class="systemitem">mysqld</code> root password to show the available databases: 
<pre class="screen">
# mysqlshow -u root -p
Enter password: *******
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
| wikidb             |
+--------------------+
</pre>
					</div></li><li><div class="para">
						Shut down the <code class="systemitem">mysqld</code> daemon with <code class="command">service mysqld stop</code> as the root user: 
<pre class="screen">
# service mysqld stop
Stopping MySQL:                                            [  OK  ]
</pre>
					</div></li><li><div class="para">
						Create a new directory for the new location of the database(s). In this example, <code class="filename">/opt/mysql</code> is used: 
<pre class="screen">
# mkdir -p /opt/mysql
</pre>
					</div></li><li><div class="para">
						Copy the database files from the old location to the new location: 
<pre class="screen">
# cp -R /var/lib/mysql/* /opt/mysql/
</pre>
					</div></li><li><div class="para">
						Change the ownership of this location to allow access by the mysql user and group. This sets the traditional Unix permissions which SELinux will still observe. 
<pre class="screen">
# chown -R mysql:mysql /opt/mysql
</pre>
					</div></li><li><div class="para">
						Run <code class="command">ls -lZ /opt</code> to see the initial context of the new directory: 
<pre class="screen">
# ls -lZ /opt
drwxr-xr-x. mysql mysql unconfined_u:object_r:<span class="emphasis"><em>usr_t</em></span>:s0   mysql
</pre>
					</div><div class="para">
						The context <code class="computeroutput">usr_t</code> of this newly created directory is not currently suitable to SELinux as a location for MySQL database files. Once the context has been changed, MySQL will be able to function properly in this area.
					</div></li><li><div class="para">
						Open the main MySQL configuration file <code class="filename">/etc/my.cnf</code> with a text editor and modify the <code class="filename">datadir</code> option so that it refers to the new location. In this example the value that should be entered is <code class="filename">/opt/mysql</code>. 
<pre class="screen">
[mysqld]
datadir=/opt/mysql
</pre>
						 Save this file and exit.
					</div></li><li><div class="para">
						Run <code class="command">service mysqld start</code> as the root user to start <code class="systemitem">mysqld</code>. At this point a denial will be logged to <code class="filename">/var/log/messages</code>: 
<pre class="screen">
# service mysqld start

Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

# tail -f /var/log/messages

localhost setroubleshoot: SELinux is preventing mysqld (mysqld_t) "write" usr_t. For complete SELinux messages. run sealert -l 50d8e725-994b-499c-9caf-a676c50fb802
</pre>
					</div><div class="para">
						The reason for this denial is that <code class="filename">/opt/mysql</code> is not labeled correctly for MySQL data files. SELinux is stopping MySQL from having access to the content labeled as <code class="computeroutput">usr_t</code>. Perform the following steps to resolve this problem:
					</div></li><li><div class="para">
						Run the <code class="command">semanage</code> command to add a context mapping for <code class="filename">/opt/mysql</code>: 
<pre class="screen">
semanage fcontext -a -t mysqld_db_t "/opt/mysql(/.*)?"
</pre>
					</div></li><li><div class="para">
						This mapping is written to the <code class="filename">/etc/selinux/targeted/contexts/files/file_contexts.local</code> file: 
<pre class="screen">
# grep -i mysql /etc/selinux/targeted/contexts/files/file_contexts.local

/opt/mysql(/.*)?    system_u:object_r:mysqld_db_t:s0
</pre>
					</div></li><li><div class="para">
						Now use the <code class="filename">restorecon</code> command to apply this context mapping to the running system: 
<pre class="screen">
restorecon -R -v /opt/mysql
</pre>
					</div></li><li><div class="para">
						Now that the <code class="filename">/opt/mysql</code> location has been labeled with the correct context for MySQL, the <code class="systemitem">mysqld</code> daemon starts: 
<pre class="screen">
# service mysqld start
Starting MySQL:                                            [  OK  ]
</pre>
					</div></li><li><div class="para">
						Confirm the context has changed for <code class="filename">/opt/mysql</code>: 
<pre class="screen">
ls -lZ /opt
drwxr-xr-x. mysql mysql system_u:object_r:<span class="emphasis"><em>mysqld_db_t</em></span>:s0 mysql
</pre>
					</div></li><li><div class="para">
						The location has been changed and labeled, and the <code class="systemitem">mysqld</code> daemon has started successfully. At this point all running services should be tested to confirm normal operation.
					</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-MySQL-Booleans.html"><strong>Prev</strong>11.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-PostgreSQL.html"><strong>Next</strong>Chapter 12. PostgreSQL</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-MySQL-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>11.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-MySQL.html" title="Chapter 11. MySQL" /><link rel="prev" href="chap-Managing_Confined_Services-MySQL.html" title="Chapter 11. MySQL" /><link rel="next" href="sect-Managing_Confined_Services-MySQL-Booleans.html" title="11.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt
 ="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-MySQL.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-MySQL-Types">11.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following types are used with <code class="systemitem">mysql</code>. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">mysqld_db_t</code></span></dt><dd><div class="para">
						This type is used for the location of the MySQL database. In Fedora 11, the default location for the database is <code class="filename">/var/lib/mysql</code>, however this can be changed. If the location for the MySQL database is changed, the new location must be labeled with this type. Refer to the following example for instructions on how to change the default database location and how to label the new section appropriately.
					</div></dd><dt><span class="term"><code class="computeroutput">mysqld_etc_t</code></span></dt><dd><div class="para">
						This type is used for the MySQL main configuration file <code class="filename">/etc/my.cnf</code> and any other configuration files in the <code class="filename">/etc/mysql</code> directory.
					</div></dd><dt><span class="term"><code class="computeroutput">mysqld_exec_t</code></span></dt><dd><div class="para">
						This type is used for the <code class="systemitem">mysqld</code> binary located at <code class="filename">/usr/libexec/mysqld</code>, which is the default location for the MySQL binary on Fedora 11. Other systems may locate this binary at <code class="filename">/usr/sbin/mysqld</code> which should also be labeled with this type.
					</div></dd><dt><span class="term"><code class="computeroutput">mysqld_initrc_exec_t</code></span></dt><dd><div class="para">
						This type is used for the initialization file for MySQL, located at <code class="filename">/etc/rc.d/init.d/mysqld</code> by default in Fedora 11.
					</div></dd><dt><span class="term"><code class="computeroutput">mysqld_log_t</code></span></dt><dd><div class="para">
						Logs for MySQL need to be labeled with this type for proper operation. All log files in <code class="filename">/var/log/</code> matching the <code class="filename">mysql.*</code> wildcard must be labeled with this type.
					</div></dd><dt><span class="term"><code class="computeroutput">mysqld_var_run_t</code></span></dt><dd><div class="para">
						This type is used by files in <code class="filename">/var/run/mysqld</code>, specifically the process id (PID) named <code class="filename">/var/run/mysqld/mysqld.pid</code> which is created by the <code class="systemitem">mysqld</code> daemon when it runs. This type is also used for related socket files such as <code class="filename">/var/lib/mysql/mysql.sock</code>. Files such as these must be labeled correctly for proper operation as a confined service.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-MySQL.html"><strong>Prev</strong>Chapter 11. MySQL</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-MySQL-Booleans.html"><strong>Next</strong>11.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-NFS-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>7.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Network_File_System.html" title="Chapter 7. Network File System" /><link rel="prev" href="sect-Managing_Confined_services-NFS-Booleans.html" title="7.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html" title="Chapter 8. Berkeley Internet Name Domain" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" hr
 ef="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_services-NFS-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-NFS-Configuration_Examples">7.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_Examples-Sharing_directories_using_NFS">7.4.1. Sharing directories using NFS</h3></div></div></div><div class="para">
				The example in this section creates a directory and shares it using NFS and SELinux. Two hosts are used in this example; a NFS server with a hostname of <code class="command">nfs-srv</code> with an IP address of <code class="command">192.168.1.1</code>, and a client with a hostname of <code class="command">nfs-client</code> and an IP address of <code class="command">192.168.1.100</code>. Both hosts are on the same subnet (192.168.1.0/24). This is an example only and assumes that the <span class="package">nfs-utils</span> package is installed, that the SELinux targeted policy is used, and that SELinux is running in enforced mode.
			</div><div class="para">
				This example will show that while even with full network availability and Linux file permissions granting access to all users via NFS, SELinux is still able to block mounting of NFS file systems unless the proper permissions are given via SELinux Booleans.
			</div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h4 class="title" id="sect-Managing_Confined_Services-Configuration_Examples-Sharing_directories_using_NFS-Server_Setup">7.4.1.1. Server setup</h4></div></div></div><div class="para">
					Steps 1-10 below should be performed on the NFS server, <code class="command">nfs-srv</code>.
				</div><div class="orderedlist"><ol><li><div class="para">
							Run the <code class="command">setsebool</code> command to disable read/write mounting of NFS file systems:
						</div><pre class="screen">setsebool -P nfs_export_all_rw off
</pre><div class="note"><h2>Note</h2><div class="para">
								Do not use the <code class="option">-P</code> option if you do not want <code class="command">setsebool</code> changes to persist across reboots.
							</div></div></li><li><div class="para">
							Run <code class="command">rpm -q nfs-utils</code> to confirm the <span class="package">nfs-utils</span> package is installed. The <span class="package">nfs-utils</span> package provides support programs for using NFS and should be installed on a NFS server and on any clients in use. If this package is not installed, install it by running <code class="command">yum install <em class="replaceable"><code>nfs-utils</code></em></code> as the root user.
						</div></li><li><div class="para">
							Run <code class="command">mkdir /myshare</code> as the root user to create a new top-level directory to share using NFS.
						</div></li><li><div class="para">
							Run <code class="command">touch /myshare/file1</code> as the root user to create a new empty file in the shared area. This file will be accessed later by the client.
						</div></li><li><div class="para">
							To show that SELinux is still able to block access even when Linux permissions are completely open, give the <code class="command">/myshare</code> directory full Linux access rights for all users:
						</div><pre class="screen"># chmod -R 777 /myshare
</pre><div class="warning"><h2>Warning</h2><div class="para">
								This is an example only and these permissions should not be used in a production system.
							</div></div></li><li><div class="para">
							Edit the <code class="filename">/etc/exports</code> file and add the following line to the top of the file:
						</div><pre class="screen">
/myshare 	192.168.1.100(rw)
</pre><div class="para">
							This entry shows the full path on the server to the shared folder <code class="filename">/myshare</code>, the host or network range that <code class="command">nfs-srv</code> will share to (in this case the IP address of a single host, <code class="command">nfs-client</code> at <code class="command">192.168.1.100</code>), and finally the share permissions. Read and write permissions are given here, as indicated by <code class="command">(rw)</code>.
						</div></li><li><div class="para">
							The TCP and UDP ports used for NFS are assigned dynamically by rpcbind, which can cause problems when creating firewall rules. To simplify the process of allowing NFS traffic through the firewall in this example, edit the <span class="emphasis"><em>/etc/sysconfig/nfs</em></span> file and uncomment the <code class="command">MOUNTD_PORT</code>,<code class="command">STATD_PORT</code>,<code class="command">LOCKD_TCPPORT</code> and <code class="command">LOCKD_UDPPORT</code> variables. Changing the port numbers in this file is not required for this example.
						</div><div class="para">
							Ensure that incoming connections on TCP ports 111, 892 and 2049 are allowed through the server's firewall. This can be done via the <span class="emphasis"><em>system-config-firewall</em></span> tool in Fedora.
						</div></li><li><div class="para">
							Run <code class="command">service nfs start</code> as the root user to start NFS and its related services:
						</div><pre class="screen">
# service nfs start
Starting NFS services:		[  OK  ]
Starting NFS quotas:		[  OK  ]
Starting NFS daemon:		[  OK  ]
Starting NFS mountd:		[  OK  ]
</pre></li><li><div class="para">
							To ensure that the NFS subsystem export table is updated, run <code class="command">exportfs -rv</code> as the root user:
						</div><pre class="screen">
# exportfs -rv
exporting 192.168.1.100:/myshare
</pre></li><li><div class="para">
							Run <code class="command">showmount -e</code> as the root user to show all exported file systems:
						</div><pre class="screen">
# showmount -e
Export list for nfs-srv:
/myshare 192.168.1.100
</pre></li></ol></div><div class="para">
					At this point the server <code class="command">nfs-srv</code> has been configured to allow NFS communications to <code class="command">nfs-client</code> at <code class="command">192.168.1.100</code>, and full Linux file systems permissions are active. If SELinux were disabled, the client would be able to mount this share and have full access over it. However, as the <code class="computeroutput">nfs_export_all_rw</code> Boolean is disabled, the client is currently not able to mount this file system, as shown below. This step should be performed on the client, <code class="command">nfs-client</code>:
				</div><pre class="screen">
[nfs-client]# mkdir /myshare
[nfs-client]# mount.nfs 192.168.1.1:/myshare /myshare
mount.nfs: access denied by server while mounting 192.168.1.1:/myshare/
</pre><div class="para">
					Enable the SELinux Boolean that was disabled in Step 1 above, and the client will be able to successfully mount the shared file system. This step should be performed on the NFS server, <code class="command">nfs-srv</code>:
				</div><pre class="screen">
[nfs-srv]# setsebool -P nfs_export_all_rw on
</pre><div class="para">
					Now try to mount the NFS file system again. This step should be performed on the NFS client, <code class="command">nfs-client</code>:
				</div><pre class="screen">
[nfs-client]# mount.nfs 192.168.1.1:/myshare /myshare
[nfs-client]#
[nfs-client]# ls /myshare
total 0
-rwxrwxrwx.  1 root root 0 2009-04-16 12:07 file1
[nfs-client]#
</pre><div class="para">
					The file system has been mounted successfully by the client. This example demonstrates how SELinux adds another layer of protection and can still enforce SELinux permissions even when Linux permissions are set to give full rights to all users.
				</div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_services-NFS-Booleans.html"><strong>Prev</strong>7.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Berkeley_Internet_Name_Domain.html"><strong>Next</strong>Chapter 8. Berkeley Internet Name Domain</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-NFS-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>7.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Network_File_System.html" title="Chapter 7. Network File System" /><link rel="prev" href="chap-Managing_Confined_Services-Network_File_System.html" title="Chapter 7. Network File System" /><link rel="next" href="sect-Managing_Confined_services-NFS-Booleans.html" title="7.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><i
 mg src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Network_File_System.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_services-NFS-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-NFS-Types">7.2. Types</h2></div></div></div><div class="para">
			By default, mounted NFS file systems on the client side are labeled with a default context defined by policy for NFS file systems. In common policies, this default context uses the <code class="computeroutput">nfs_t</code> type.The following types are used with NFS. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">var_lib_nfs_t</code></span></dt><dd><div class="para">
						This type is used for existing and new files copied to or created in the <code class="command">/var/lib/nfs</code> directory. This type should not need to be changed in normal operation. To restore changes to the default settings, run the <code class="command">restorecon -R -v /var/lib/nfs</code> command as the root user.
					</div></dd><dt><span class="term"><code class="computeroutput">nfsd_exec_t</code></span></dt><dd><div class="para">
						The <code class="filename">/usr/sbin/rpc.nfsd</code> file is labeled with the <code class="computeroutput">nfsd_exec_t</code>, as are other system executables and libraries related to NFS. Users should not label any files with this type. <code class="computeroutput">nfsd_exec_t</code> will transition to <code class="computeroutput">nfs_t</code>.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Network_File_System.html"><strong>Prev</strong>Chapter 7. Network File System</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_services-NFS-Booleans.html"><strong>Next</strong>7.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Postfix-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>14.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Postfix.html" title="Chapter 14. Postfix" /><link rel="prev" href="sect-Managing_Confined_Services-Postfix-Types.html" title="14.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html" title="14.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Comm
 on_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Postfix-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Postfix-Booleans">14.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running Postfix:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_postfix_local_write_mail_spool</code></span></dt><dd><div class="para">
						Having this Boolean enables Postfix to write to the local mail spool on the system. Postfix requires this Boolean to be enabled for normal operation when local spools are used.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Postfix-Types.html"><strong>Prev</strong>14.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Configuration_Examples.html"><strong>Next</strong>14.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Postfix-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>14.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Postfix.html" title="Chapter 14. Postfix" /><link rel="prev" href="sect-Managing_Confined_Services-Postfix-Booleans.html" title="14.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-References.html" title="Chapter 15. References" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Co
 ntent/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Postfix-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-References.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Postfix-Configuration_Examples">14.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Postfix-Configuration_Examples-SpamAssassin_and_Postfix">14.4.1. SpamAssassin and Postfix</h3></div></div></div><div class="para">
				From the <a href="http://spamassassin.apache.org/">SpamAssassin</a> project page:
			</div><div class="para">
				"Open Source mail filter, written in Perl, to identify spam using a wide range of heuristic tests on mail headers and body text. Free software."
			</div><div class="para">
				When using Fedora, the <span class="package">spamassassin</span> package provides SpamAssassin. Run <code class="command">rpm -q spamassassin</code> to see if the <span class="package">spamassassin</span> package is installed. If it is not installed, run the following command as the root user to install it:
			</div><pre class="screen">
yum install spamassassin
</pre><div class="para">
				SpamAssassin operates in tandom with a mailer such as Postfix to provide spam-filtering capabilities. In order for SpamAssassin to effectively intercept, analyze and filter mail, it must listen on a network interface. The default port for SpamAssassin is TCP/783, however this can be changed. The following example provides a real-world demonstration of how SELinux complements SpamAssassin by only allowing it access to a certain port by default. This example will then demonstrate how to change the port and have SpamAssassin operate on a non-default port.
			</div><div class="para">
				Note that this is an example only and demonstrates how SELinux can affect a simple configuration of SpamAssassin. Comprehensive documentation of SpamAssassin is beyond the scope of this document. Refer to the official <a href="http://spamassassin.apache.org/doc.html">SpamAssassin documentation</a> for further details. This example assumes the <span class="package">spamassassin</span> is installed, that any firewall has been configured to allow access on the ports in use, that the SELinux targeted policy is used, and that SELinux is running in enforcing mode:
			</div><div class="orderedlist"><h6>Running SpamAssassin on a non-default port</h6><ol><li><div class="para">
						Run the <code class="command">semanage</code> command to show the port that SELinux allows <code class="systemitem">spamd</code> to listen on by default:
					</div><pre class="screen">
# semanage port -l | grep spamd
spamd_port_t		tcp	783
</pre><div class="para">
						This output shows that TCP/783 is defined in <code class="computeroutput">spamd_port_t</code> as the port for SpamAssassin to operate on.
					</div></li><li><div class="para">
						Edit the <code class="filename">/etc/sysconfig/spamassassin</code> configuration file and modify it so that it will start SpamAssassin on the example port TCP/10000:
					</div><pre class="screen">
# Options to spamd
SPAMDOPTIONS="-d -p 10000 -c m5 -H"
</pre><div class="para">
						This line now specifies that SpamAssassin will operate on port 10000. The rest of this example will show how to modify SELinux policy to allow this socket to be opened.
					</div></li><li><div class="para">
						Start SpamAssassin and an error message similar to the following will appear:
					</div><pre class="screen">
/etc/init.d/spamassassin start
Starting spamd: [2203] warn: server socket setup failed, retry 1: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
[2203] warn: server socket setup failed, retry 2: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
[2203] error: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
                                                           [FAILED]
</pre><div class="para">
						This output means that SELinux has blocked access to this port.
					</div></li><li><div class="para">
						A denial similar to the following will be logged by SELinux:
					</div><pre class="screen">
SELinux is preventing the spamd (spamd_t) from binding to port 10000.
</pre></li><li><div class="para">
						As the root user, run the <code class="command">semanage</code> command to modify SELinux policy in order to allow SpamAssassin to operate on the example port (TCP/10000):
					</div><pre class="screen">
semanage port -a -t spamd_port_t -p tcp 10000
</pre></li><li><div class="para">
						Confirm that SpamAssassin will now start and is operating on TCP port 10000: 
<pre class="screen">
# /etc/init.d/spamassassin start
Starting spamd:					[ OK ]

# netstat -lnp | grep 10000
tcp	0	0 127.0.0.1:10000	0.0.0.0:*	LISTEN	2224/spamd.pid
</pre>
					</div></li><li><div class="para">
						At this point, <code class="systemitem">spamd</code> is properly operating on TCP port 10000 as it has been allowed access to that port by SELinux policy.
					</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Postfix-Booleans.html"><strong>Prev</strong>14.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-References.html"><strong>Next</strong>Chapter 15. References</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Postfix-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>14.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Postfix.html" title="Chapter 14. Postfix" /><link rel="prev" href="chap-Managing_Confined_Services-Postfix.html" title="Chapter 14. Postfix" /><link rel="next" href="sect-Managing_Confined_Services-Postfix-Booleans.html" title="14.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_righ
 t.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Postfix.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Postfix-Types">14.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following types are used with <code class="computeroutput">Postfix</code>. Different types all you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">postfix_etc_t</code></span></dt><dd><div class="para">
						This type is used for configuration files for Postfix in <code class="filename">/etc/postfix</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">postfix_data_t</code></span></dt><dd><div class="para">
						This type is used for Postfix data files in <code class="filename">/var/lib/postfix</code>.
					</div></dd></dl></div><div class="note"><h2>Note</h2><div class="para">
				To see the full list of files and their types for Postfix, run the following command: 
<pre class="screen">
$ grep postfix /etc/selinux/targeted/contexts/files/file_contexts
</pre>
			</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Postfix.html"><strong>Prev</strong>Chapter 14. Postfix</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Postfix-Booleans.html"><strong>Next</strong>14.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-PostgreSQL-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>12.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-PostgreSQL.html" title="Chapter 12. PostgreSQL" /><link rel="prev" href="sect-Managing_Confined_Services-PostgreSQL-Types.html" title="12.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html" title="12.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><i
 mg src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-PostgreSQL-Booleans">12.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running PostgreSQL:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_user_postgresql_connect</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows any user domain (as defined by PostgreSQL) to make connections to the database server.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Types.html"><strong>Prev</strong>12.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html"><strong>Next</strong>12.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>12.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-PostgreSQL.html" title="Chapter 12. PostgreSQL" /><link rel="prev" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html" title="12.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-rsync.html" title="Chapter 13. rsync" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Con
 tent/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-rsync.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples">12.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-PostgreSQL-Configuration_Examples-Changing_Database_Location">12.4.1. PostgreSQL Changing Database Location</h3></div></div></div><div class="para">
				When using Fedora 11, the default location for PostgreSQL to store its database is <code class="filename">/var/lib/pgsql/data</code>. This is where SELinux expects it to be by default, and hence this area is already labeled appropriately for you, using the <code class="computeroutput">postgresql_db_t</code> type.
			</div><div class="para">
				The area where the database is located can be changed depending on individual environment requirements or preferences, however it is important that SELinux is aware of this new location - that it is labeled accordingly. This example explains how to change the location of a PostgreSQL database and then how to label the new location so that SELinux can still provide its protection mechanisms to the new area based on its contents.
			</div><div class="para">
				Note that this is an example only and demonstrates how SELinux can affect PostgreSQL. Comprehensive documentation of PostgreSQL is beyond the scope of this document. Refer to the official <a href="http://www.postgresql.org/docs/">PostgreSQL documentation</a> for further details. This example assumes that the <span class="package">postgresql-server</span> package is installed.
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">ls -lZ /var/lib/pgsql</code> to view the SELinux context of the default database location for <code class="systemitem">postgresql</code>: 
<pre class="screen">
# ls -lZ /var/lib/pgsql
drwx------. postgres postgres system_u:object_r:<span class="emphasis"><em>postgresql_db_t</em></span>:s0 data
</pre>
					</div><div class="para">
						This shows <code class="computeroutput">postgresql_db_t</code> which is the default context element for the location of database files. This context will have to be manually applied to the new database location that will be used in this example in order for it to function properly.
					</div></li><li><div class="para">
						Create a new directory for the new location of the database(s). In this example, <code class="filename">/opt/postgresql/data</code> is used. If you use a different location, replace the text in the following steps with your location: 
<pre class="screen">
# mkdir -p /opt/postgresql/data
</pre>
					</div></li><li><div class="para">
						Perform a directory listing of the new location. Note that the initial context of the new directory is <span class="emphasis"><em>usr_t</em></span>. This context is not sufficient for SELinux to offer its protection mechanisms to PostgreSQL. Once the context has been changed, it will be able to function properly in the new area. 
<pre class="screen">
# ls -lZ /opt/postgresql/
drwxr-xr-x. root root unconfined_u:object_r:<span class="emphasis"><em>usr_t</em></span>:s0   data
</pre>
					</div></li><li><div class="para">
						Change the ownership of the new location to allow access by the postgres user and group. This sets the traditional Unix permissions which SELinux will still observe. 
<pre class="screen">
# chown -R postgres:postgres /opt/postgresql
</pre>
					</div></li><li><div class="para">
						Open the PostgreSQL init file <code class="filename">/etc/rc.d/init.d/postgresql</code> with a text editor and modify all <code class="computeroutput">PGDATA</code> and <code class="computeroutput">PGLOG</code> variables to point to the new location: 
<pre class="screen">
# vi /etc/rc.d/init.d/postgresql
PGDATA=/opt/postgresql/data
PGLOG=/opt/postgresql/data/pgstartup.log
</pre>
						 Save this file and exit the text editor.
					</div></li><li><div class="para">
						Initialize the database in the new location. 
<pre class="screen">
su - postgres -c "initdb -D /opt/postgresql/data"
</pre>
					</div></li><li><div class="para">
						Run the <code class="command">semanage</code> command to add a context mapping for <code class="filename">/opt/postgresql</code> and any other directories/files within it: 
<pre class="screen">
semanage fcontext -a -t postgresql_db_t "/opt/postgresql(/.*)?"
</pre>
					</div></li><li><div class="para">
						This mapping is written to the <code class="filename">/etc/selinux/targeted/contexts/files/file_contexts.local</code> file: 
<pre class="screen">
# grep -i postgresql /etc/selinux/targeted/contexts/files/file_contexts.local

/opt/postgresql(/.*)?    system_u:object_r:postgresql_db_t:s0
</pre>
					</div></li><li><div class="para">
						Now use the <code class="filename">restorecon</code> command to apply this context mapping to the running system: 
<pre class="screen">
restorecon -R -v /opt/postgresql
</pre>
					</div></li><li><div class="para">
						Now that the <code class="filename">/opt/postgresql</code> location has been labeled with the correct context for PostgreSQL, the <code class="systemitem">mysqld</code> service will start successfully: 
<pre class="screen">
# service postgresql start
Starting postgreSQL service:                                            [  OK  ]
</pre>
					</div></li><li><div class="para">
						Confirm the context is correct for <code class="filename">/opt/postgresql</code>: 
<pre class="screen">
ls -lZ /opt
drwxr-xr-x. root root system_u:object_r:<span class="emphasis"><em>postgresql_db_t</em></span>:s0 postgresql
</pre>
					</div></li><li><div class="para">
						Check with the <code class="command">ps</code> command that the <code class="systemitem">postgresql</code> process displays the new location: 
<pre class="screen">
# ps aux | grep -i postmaster

postgres 21564  0.3  0.3  42308  4032 ?        S    10:13   0:00 /usr/bin/postmaster -p 5432 -D <span class="emphasis"><em>/opt/postgresql/data</em></span>
</pre>
					</div></li><li><div class="para">
						The location has been changed and labeled, and the <code class="systemitem">postgresql</code> daemon has started successfully. At this point all running services should be tested to confirm normal operation.
					</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html"><strong>Prev</strong>12.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-rsync.html"><strong>Next</strong>Chapter 13. rsync</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-PostgreSQL-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>12.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-PostgreSQL.html" title="Chapter 12. PostgreSQL" /><link rel="prev" href="chap-Managing_Confined_Services-PostgreSQL.html" title="Chapter 12. PostgreSQL" /><link rel="next" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html" title="12.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/im
 ages/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-PostgreSQL.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-PostgreSQL-Types">12.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following types are used with <code class="systemitem">postgresql</code>. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">postgresql_db_t</code></span></dt><dd><div class="para">
						This type is used for several locations. The locations labeled with this type are used for data files for PostgreSQL: 
						<div class="itemizedlist"><ul><li><div class="para">
									<code class="filename">/usr/lib/pgsql/test/regres</code>
								</div></li><li><div class="para">
									<code class="filename">/usr/share/jonas/pgsql</code>
								</div></li><li><div class="para">
									<code class="filename">/var/lib/pgsql/data</code>
								</div></li><li><div class="para">
									<code class="filename">/var/lib/postgres(ql)?</code>
								</div></li></ul></div>
					</div></dd><dt><span class="term"><code class="computeroutput">postgresql_etc_t</code></span></dt><dd><div class="para">
						This type is used for configuration files in <code class="filename">/etc/postgresql</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">postgresql_exec_t</code></span></dt><dd><div class="para">
						This type is used for several locations. The locations labeled with this type are used for binaries for PostgreSQL: 
						<div class="itemizedlist"><ul><li><div class="para">
									<code class="filename">/usr/bin/initdb(.sepgsql)?</code>
								</div></li><li><div class="para">
									<code class="filename">/usr/bin/(se)?postgres</code>
								</div></li><li><div class="para">
									<code class="filename">/usr/lib(64)?/postgresql/bin/.*</code>
								</div></li><li><div class="para">
									<code class="filename">/usr/lib/phsql/test/regress/pg_regress</code>
								</div></li></ul></div>
					</div></dd><dt><span class="term"><code class="computeroutput">postgresql_initrc_exec_t</code></span></dt><dd><div class="para">
						This type is used for the PostgreSQL initialization file located at <code class="filename">/etc/rc.d/init.d/postgresql</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">postgresql_log_t</code></span></dt><dd><div class="para">
						This type is used for several locations. The locations labeled with this type are used for log files: 
						<div class="itemizedlist"><ul><li><div class="para">
									<code class="filename">/var/lib/pgsql/logfile</code>
								</div></li><li><div class="para">
									<code class="filename">/var/lib/pgsql/pgstartup.log</code>
								</div></li><li><div class="para">
									<code class="filename">/var/lib/sepgsql/pgstartup.log</code>
								</div></li><li><div class="para">
									<code class="filename">/var/log/postgresql</code>
								</div></li><li><div class="para">
									<code class="filename">/var/log/postgres.log.*</code>
								</div></li><li><div class="para">
									<code class="filename">/var/log/rhdb/rhdb</code>
								</div></li><li><div class="para">
									<code class="filename">/var/log/sepostgresql.log.*</code>
								</div></li></ul></div>
					</div></dd><dt><span class="term"><code class="computeroutput">postgresql_var_run_t</code></span></dt><dd><div class="para">
						This type is used for run-time files for PostgreSQL, such as the process id (PID) in <code class="filename">/var/run/postgresql</code>.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-PostgreSQL.html"><strong>Prev</strong>Chapter 12. PostgreSQL</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-PostgreSQL-Booleans.html"><strong>Next</strong>12.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Samba-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>5.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Samba.html" title="Chapter 5. Samba" /><link rel="prev" href="sect-Managing_Confined_Services-Samba-Types.html" title="5.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html" title="5.4. Configuration examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/i
 mages/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Samba-Booleans">5.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Booleans allow you to tell SELinux how you are running Samba:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_smbd_anon_write</code></span></dt><dd><div class="para">
						Having this Boolean enables allows <code class="systemitem">smbd</code> to write to a public directory, such as an area reserved for common files that otherwise has no special access restrictions.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_create_home_dirs</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows Samba to create new home directories independently. This is often done by mechanisms such as PAM.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_domain_controller</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows Samba to act as a domain controller, as well as giving it permission to execute related commands such as <code class="computeroutput">useradd</code>, <code class="computeroutput">groupadd</code> and <code class="computeroutput">passwd</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_enable_home_dirs</code></span></dt><dd><div class="para">
						Enabling this Boolean allows Samba to share users' home directories.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_export_all_ro</code></span></dt><dd><div class="para">
						Export any file or directory, allowing read-only permissions. This allows files and directories that are not labeled with the <code class="computeroutput">samba_share_t</code> type to be shared through Samba. When the <code class="computeroutput">samba_export_all_ro</code> Boolean is on, but the <code class="computeroutput">samba_export_all_rw</code> Boolean is off, write access to Samba shares is denied, even if write access is configured in <code class="filename">/etc/samba/smb.conf</code>, as well as Linux permissions allowing write access.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_export_all_rw</code></span></dt><dd><div class="para">
						Export any file or directory, allowing read and write permissions. This allows files and directories that are not labeled with the <code class="computeroutput">samba_share_t</code> type to be exported through Samba. Permissions in <code class="filename">/etc/samba/smb.conf</code> and Linux permissions must be configured to allow write access.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_run_unconfined</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows Samba to run unconfined scripts in the <code class="filename">/var/lib/samba/scripts</code> directory.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_share_fusefs</code></span></dt><dd><div class="para">
						This Boolean must be enabled for Samba to share <code class="computeroutput">fusefs</code> file systems.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_share_nfs</code></span></dt><dd><div class="para">
						Disabling this Boolean prevents <code class="systemitem">smbd</code> from having full access to NFS shares via Samba. Enabling this Boolean will allow Samba to share NFS file systems.
					</div></dd><dt><span class="term"><code class="computeroutput">use_samba_home_dirs</code></span></dt><dd><div class="para">
						Enable this Boolean to use a remote server for Samba home directories.
					</div></dd><dt><span class="term"><code class="computeroutput">virt_use_samba</code></span></dt><dd><div class="para">
						Allow virt to manage CIFS files.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Types.html"><strong>Prev</strong>5.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Configuration_examples.html"><strong>Next</strong>5.4. Configuration examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Samba-Configuration_examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>5.4. Configuration examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Samba.html" title="Chapter 5. Samba" /><link rel="prev" href="sect-Managing_Confined_Services-Samba-Booleans.html" title="5.3. Booleans" /><link rel="next" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html" title="5.4.2. Sharing a website" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.or
 g"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Samba-Configuration_examples">5.4. Configuration examples</h2></div></div></div><div class="para">
			The following examples provide real-world demonstrations of how SELinux complements the Samba server and how full function of the Samba server can be maintained.
		</div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Sharing_directories_you_create">5.4.1. Sharing directories you create</h3></div></div></div><div class="para">
				The following example creates a new directory, and shares that directory through Samba:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">rpm -q samba samba-common samba-client</code> to confirm the <span class="package">samba</span>, <span class="package">samba-common</span>, and <span class="package">samba-client</span> packages are installed. If any of these packages are not installed, install them by running <code class="command">yum install <em class="replaceable"><code>package-name</code></em></code> as the root user.
					</div></li><li><div class="para">
						Run <code class="command">mkdir /myshare</code> as the root user to create a new top-level directory to share files through Samba.
					</div></li><li><div class="para">
						Run <code class="command">touch /myshare/file1</code> as the root user to create an empty file. This file is used later to verify the Samba share mounted correctly.
					</div></li><li><div class="para">
						SELinux allows Samba to read and write to files labeled with the <code class="computeroutput">samba_share_t</code> type, as long as <code class="filename">/etc/samba/smb.conf</code> and Linux permissions are set accordingly. Run the following command as the root user to add the label change to file-context configuration:
					</div><pre class="screen">
semanage fcontext -a -t samba_share_t "/myshare(/.*)?"
</pre></li><li><div class="para">
						Run <code class="command">restorecon -R -v /myshare</code> as the root user to apply the label changes:
					</div><pre class="screen">
# restorecon -R -v /myshare
restorecon reset /myshare context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0
restorecon reset /myshare/file1 context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0
</pre></li><li><div class="para">
						Edit <code class="filename">/etc/samba/smb.conf</code> as the root user. Add the following to the bottom of this file to share the /myshare/ directory through Samba:
					</div><pre class="screen">
[myshare]
comment = My share
path = /myshare
public = yes
writeable = no
</pre></li><li><div class="para">
						A Samba account is required to mount a Samba file system. Run <code class="command">smbpasswd -a <em class="replaceable"><code>username</code></em></code> as the root user to create a Samba account, where <em class="replaceable"><code>username</code></em> is an existing Linux user. For example, <code class="command">smbpasswd -a testuser</code> creates a Samba account for the Linux testuser user:
					</div><pre class="screen">
# smbpasswd -a testuser
New SMB password: <em class="replaceable"><code>Enter a password</code></em>
Retype new SMB password: <em class="replaceable"><code>Enter the same password again</code></em>
Added user testuser.
</pre><div class="para">
						Running <code class="command">smbpasswd -a <em class="replaceable"><code>username</code></em></code>, where <em class="replaceable"><code>username</code></em> is the username of a Linux account that does not exist on the system, causes a <code class="computeroutput">Cannot locate Unix account for '<em class="replaceable"><code>username</code></em>'!</code> error.
					</div></li><li><div class="para">
						Run <code class="command">service smb start</code> as the root user to start the Samba service:
					</div><pre class="screen">
service smb start
Starting SMB services:                                     [  OK  ]
</pre></li><li><div class="para">
						Run <code class="command">smbclient -U <em class="replaceable"><code>username</code></em> -L localhost</code> to list the available shares, where <em class="replaceable"><code>username</code></em> is the Samba account added in step 7. When prompted for a password, enter the password assigned to the Samba account in step 7 (version numbers may differ):
					</div><pre class="screen">
$ smbclient -U <em class="replaceable"><code>username</code></em> -L localhost
Enter <em class="replaceable"><code>username</code></em>'s password:
Domain=[<em class="replaceable"><code>HOSTNAME</code></em>] OS=[Unix] Server=[Samba 3.3.0-0.25.fc11]

Sharename       Type      Comment
---------       ----      -------
myshare         Disk      My share
IPC$            IPC       IPC Service (Samba Server Version 3.3.0-0.25.fc11)
<em class="replaceable"><code>username</code></em>        Disk      Home Directories
Domain=[<em class="replaceable"><code>HOSTNAME</code></em>] OS=[Unix] Server=[Samba 3.3.0-0.25.fc11]

Server               Comment
---------            -------

Workgroup            Master
---------            -------
</pre></li><li><div class="para">
						Run <code class="command">mkdir /test/</code> as the root user to create a new directory. This directory will be used to mount the <code class="computeroutput">myshare</code> Samba share.
					</div></li><li><div class="para">
						Run the following command as the root user to mount the <code class="computeroutput">myshare</code> Samba share to <code class="filename">/test/</code>, replacing <em class="replaceable"><code>username</code></em> with the username from step 7:
					</div><pre class="screen">
mount //localhost/myshare /test/ -o user=<em class="replaceable"><code>username</code></em>
</pre><div class="para">
						Enter the password for <em class="replaceable"><code>username</code></em>, which was configured in step 7.
					</div></li><li><div class="para">
						Run <code class="command">ls /test/</code> to view the <code class="filename">file1</code> file created in step 3:
					</div><pre class="screen">
$ ls /test/
file1
</pre></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Samba-Booleans.html"><strong>Prev</strong>5.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_a_website.html"><strong>Next</strong>5.4.2. Sharing a website</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Samba-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>5.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Samba.html" title="Chapter 5. Samba" /><link rel="prev" href="chap-Managing_Confined_Services-Samba.html" title="Chapter 5. Samba" /><link rel="next" href="sect-Managing_Confined_Services-Samba-Booleans.html" title="5.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Do
 cumentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Samba.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Samba-Types">5.2. Types</h2></div></div></div><div class="para">
			Label files with the <code class="computeroutput">samba_share_t</code> type to allow Samba to share them. Only label files you have created, and do not relabel system files with the <code class="computeroutput">samba_share_t</code> type: Booleans can be turned on to share such files and directories. SELinux allows Samba to write to files labeled with the <code class="computeroutput">samba_share_t</code> type, as long as <code class="filename">/etc/samba/smb.conf</code> and Linux permissions are set accordingly.
		</div><div class="para">
			The <code class="computeroutput">samba_etc_t</code> type is used on certain files in <code class="filename">/etc/samba/</code>, such as <code class="filename">smb.conf</code>. Do not manually label files with the <code class="computeroutput">samba_etc_t</code> type. If files in <code class="filename">/etc/samba/</code> are not labeled correctly, run <code class="command">restorecon -R -v /etc/samba</code> as the root user to restore such files to their default contexts. If <code class="filename">/etc/samba/smb.conf</code> is not labeled with the <code class="computeroutput">samba_etc_t</code> type, the <code class="command">service smb start</code> command may fail and an SELinux denial may be logged. The following is an example denial logged to <code class="filename">/var/log/messages</code> when <code class="filename">/etc/samba/smb.conf</code> was labeled with the <code class="computeroutput">httpd_sys_content_t</code> type:
		</div><pre class="screen">
setroubleshoot: SELinux is preventing smbd (smbd_t) "read" to ./smb.conf (httpd_sys_content_t). For complete SELinux messages. run sealert -l deb33473-1069-482b-bb50-e4cd05ab18af
</pre></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Samba.html"><strong>Prev</strong>Chapter 5. Samba</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Samba-Booleans.html"><strong>Next</strong>5.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>10.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html" title="Chapter 10. Squid Caching Proxy" /><link rel="prev" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html" title="10.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html" title="10.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" hre
 f="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans">10.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running Squid:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">squid_connect_any</code></span></dt><dd><div class="para">
						When enabled, this Boolean permits squid to initiate a connection to a remote host on any port.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html"><strong>Prev</strong>10.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html"><strong>Next</strong>10.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>10.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html" title="Chapter 10. Squid Caching Proxy" /><link rel="prev" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html" title="10.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-MySQL.html" title="Chapter 11. MySQL" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraprojec
 t.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-MySQL.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples">10.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Squid_Caching_Proxy-Configuration_Examples-Squid_Connecting_To_Non_Standard_Ports">10.4.1. Squid Connecting to Non-Standard Ports</h3></div></div></div><div class="para">
				The following example provides a real-world demonstration of how SELinux complements Squid by enforcing the above Boolean and by default only allowing access to certain ports. This example will then demonstrate how to change the Boolean and show that access is then allowed.
			</div><div class="para">
				Note that this is an example only and demonstrates how SELinux can affect a simple configuration of Squid. Comprehensive documentation of Squid is beyond the scope of this document. Refer to the official <a href="http://www.squid-cache.org/Doc/">Squid documentation</a> for further details. This example assumes that the Squid host has two network interfaces, Internet access, and that any firewall has been configured to allow access on the internal interface using the default TCP port on which Squid listens (TCP 3128).
			</div><div class="orderedlist"><ol><li><div class="para">
						As the root user, install the <span class="package">squid</span> package. Run <code class="command">rpm -q squid</code> to see if the <span class="package">squid</span> package is installed. If it is not installed, run <code class="command">yum install squid</code> as the root user to install it.
					</div></li><li><div class="para">
						Edit the main configuration file, <code class="filename">/etc/squid/squid.conf</code> and confirm that the <code class="computeroutput">cache_dir</code> directive is uncommented and looks similar to the following:
					</div><pre class="screen">
cache_dir ufs /var/spool/squid 100 16 256
</pre><div class="para">
						This line specifies the default settings for the <code class="computeroutput">cache_dir</code> directive to be used in this example; it consists of the Squid storage format (ufs), the directory on the system where the cache resides (/var/spool/squid), the amount of disk space in megabytes to be used for the cache (100), and finally the number of first-level and second-level cache directories to be created (16 and 256 respectively).
					</div></li><li><div class="para">
						In the same configuration file, make sure the <code class="computeroutput">http_access allow localnet</code> directive is uncommented. This allows traffic from the <code class="computeroutput">localnet</code> ACL which is automatically configured in a default installation of Squid on Fedora 11. It will allow client machines on any existing RFC1918 network to have access through the proxy, which is sufficient for this simple example.
					</div></li><li><div class="para">
						In the same configuration file, make sure the <code class="computeroutput">visible_hostname</code> directive is uncommented and is configured to the hostname of the machine. The value should be the fully qualified domain name (FQDN) of the host: 
<pre class="screen">
visible_hostname squid.example.com
</pre>
					</div></li><li><div class="para">
						As the root user, run <code class="command">service squid start</code> to start <code class="systemitem">squid</code>. As this is the first time <code class="systemitem">squid</code> has started, this command will initialise the cache directories as specified above in the <code class="computeroutput">cache_dir</code> directive and will then start the <code class="systemitem">squid</code> daemon. The output is as follows if <code class="systemitem">squid</code> starts successfully:
					</div><pre class="screen">
# /sbin/service squid start
init_cache_dir /var/spool/squid... Starting squid: .       [  OK  ]
</pre></li><li><div class="para">
						Confirm that the <code class="systemitem">squid</code> process ID (PID) has started as a confined service, as seen here by the <code class="computeroutput">squid_var_run_t</code> value: 
<pre class="screen">
# ls -lZ /var/run/squid.pid 
-rw-r--r--. root squid unconfined_u:object_r:<span class="emphasis"><em>squid_var_run_t</em></span>:s0 /var/run/squid.pid
</pre>
					</div></li><li><div class="para">
						At this point, a client machine connected to the <code class="computeroutput">localnet</code> ACL configured earlier is successfully able to use the internal interface of this host as its proxy. This can be configured in the settings for all common web browsers, or system-wide. Squid is now listening on the default port of the target machine (TCP 3128), but the target machine will only allow outgoing connections to other services on the Internet via common ports. This is a policy defined by SELinux itself. SELinux will deny access to non-standard ports, as shown in the next step:
					</div></li><li><div class="para">
						When a client makes a request using a non-standard port through the Squid proxy such as a website listening on TCP port 10000, a denial similar to the following is logged: 
<pre class="screen">
SELinux is preventing the squid daemon from connecting to network port 10000
</pre>
					</div></li><li><div class="para">
						To allow this access, the <code class="computeroutput">squid_connect_any</code> Boolean must be modified, as it is disabled by default. To turn the <code class="computeroutput">squid_connect_any</code> Boolean on, run the following command as the root user: 
<pre class="screen"># setsebool -P squid_connect_any on
</pre>
					</div><div class="note"><h2>Note</h2><div class="para">
							Do not use the <code class="option">-P</code> option if you do not want <code class="command">setsebool</code> changes to persist across reboots.
						</div></div></li><li><div class="para">
						The client will now be able to access non-standard ports on the Internet as Squid is now permitted to initiate connections to any port, on behalf of its clients.
					</div></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html"><strong>Prev</strong>10.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-MySQL.html"><strong>Next</strong>Chapter 11. MySQL</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Squid_Caching_Proxy-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>10.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html" title="Chapter 10. Squid Caching Proxy" /><link rel="prev" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html" title="Chapter 10. Squid Caching Proxy" /><link rel="next" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html" title="10.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.f
 edoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Squid_Caching_Proxy-Types">10.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following types are used with <code class="systemitem">squid</code>. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">httpd_squid_script_exec_t</code></span></dt><dd><div class="para">
						This type is used for utilities such as <code class="filename">cachemgr.cgi</code>, which provides a variety of statistics about squid and its configuration.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_cache_t</code></span></dt><dd><div class="para">
						Use this type for data that is cached by squid, as defined by the <code class="command">cache_dir</code> directive in <code class="filename">/etc/squid/squid.conf</code>. By default, files created in or copied into <code class="filename">/var/cache/squid</code> and <code class="filename">/var/spool/squid</code> are labeled with the <code class="computeroutput">squid_cache_t</code> type. Files for the <a href="http://www.squidguard.org/">squidGuard</a> URL redirector plugin for <code class="systemitem">squid</code> created in or copied to <code class="filename">/var/squidGuard</code> are also labeled with the <code class="computeroutput">squid_cache_t</code> type. Squid is only able to use files and directories that are labeled with this type for its cached data.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_conf_t</code></span></dt><dd><div class="para">
						This type is used for the directories and files that <code class="systemitem">squid</code> uses for its configuration. Existing files, or those created in or copied to <code class="filename">/etc/squid</code> and <code class="filename">/usr/share/squid</code> are labeled with this type, including error messages and icons.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_exec_t</code></span></dt><dd><div class="para">
						This type is used for the squid binary, <code class="filename">/usr/sbin/squid</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_log_t</code></span></dt><dd><div class="para">
						This type is used for logs. Existing files, or those created in or copied to <code class="filename">/var/log/squid</code> or <code class="filename">/var/log/squidGuard</code> must be labeled with this type.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_initrc_exec_t</code></span></dt><dd><div class="para">
						This type is used for the initialization file required to start <code class="systemitem">squid</code> which is located at <code class="filename">/etc/rc.d/init.d/squid</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">squid_var_run_t</code></span></dt><dd><div class="para">
						This type is used by files in <code class="filename">/var/run</code>, especially the process id (PID) named <code class="filename">/var/run/squid.pid</code> which is created by squid when it runs.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Squid_Caching_Proxy.html"><strong>Prev</strong>Chapter 10. Squid Caching Proxy</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Squid_Caching_Proxy-Booleans.html"><strong>Next</strong>10.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>3.2. Confined processes</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Targeted_policy.html" title="Chapter 3. Targeted policy" /><link rel="prev" href="chap-Managing_Confined_Services-Targeted_policy.html" title="Chapter 3. Targeted policy" /><link rel="next" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html" title="3.3. Unconfined processes" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="
 http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Targeted_policy.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Targeted_policy-Confined_processes">3.2. Confined processes</h2></div></div></div><div class="para">
			Almost every service that listens on a network is confined in Fedora. Also, most processes that run as the root user and perform tasks for users, such as the <span class="application"><strong>passwd</strong></span> application, are confined. When a process is confined, it runs in its own domain, such as the <code class="systemitem">httpd</code> process running in the <code class="computeroutput">httpd_t</code> domain. If a confined process is compromised by an attacker, depending on SELinux policy configuration, an attacker's access to resources and the possible damage they can do is limited.
		</div><div class="para">
			The following example demonstrates how SELinux prevents the Apache HTTP Server (<code class="systemitem">httpd</code>) from reading files that are not correctly labeled, such as files intended for use by Samba. This is an example, and should not be used in production. It assumes that the <span class="package">httpd</span>, <span class="package">wget</span>, <span class="package">setroubleshoot-server</span>, and <span class="package">audit</span> packages are installed, that the SELinux targeted policy is used, and that SELinux is running in enforcing mode:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run the <code class="command">sestatus</code> command to confirm that SELinux is enabled, is running in enforcing mode, and that targeted policy is being used:
				</div><pre class="screen">
$ /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 23
Policy from config file:        targeted
</pre><div class="para">
					<code class="computeroutput">SELinux status: enabled</code> is returned when SELinux is enabled. <code class="computeroutput">Current mode: enforcing</code> is returned when SELinux is running in enforcing mode. <code class="computeroutput">Policy from config file: targeted</code> is returned when the SELinux targeted policy is used.
				</div></li><li><div class="para">
					As the root user, run the <code class="command">touch /var/www/html/testfile</code> command to create a file.
				</div></li><li><div class="para">
					Run the <code class="command">ls -Z /var/www/html/testfile</code> command to view the SELinux context:
				</div><pre class="screen">-rw-r--r--  root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/testfile
</pre><div class="para">
					The <code class="filename">testfile</code> file is labeled with the SELinux <code class="computeroutput">unconfined_u</code> user because a Linux user that is mapped to the <code class="computeroutput">unconfined_u</code> SELinux user created the file. Role-Based Access Control (RBAC) is used for processes, not files. Roles do not have a meaning for files - the <code class="computeroutput">object_r</code> role is a generic role used for files (on persistent storage and network file systems). Under the <code class="filename">/proc/</code> directory, files related to processes may use the <code class="computeroutput">system_r</code> role.<sup>[<a id="id2921858" href="#ftn.id2921858" class="footnote">3</a>]</sup> The <code class="computeroutput">httpd_sys_content_t</code> type allows the <code class="systemitem">httpd</code> process to access this file.
				</div></li><li><div class="para">
					As the root user, run the <code class="command">service httpd start</code> command to start the <code class="systemitem">httpd</code> process. The output is as follows if <code class="systemitem">httpd</code> starts successfully:
				</div><pre class="screen"># /sbin/service httpd start
Starting httpd:                                            [  OK  ]
</pre></li><li><div class="para">
					Change into a directory where your Linux user has write access to, and run the <code class="command">wget http://localhost/testfile</code> command. Unless there are changes to the default configuration, this command succeeds:
				</div><pre class="screen">--2009-03-16 23:00:01--  http://localhost/testfile
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/plain]
Saving to: `testfile'

[ <=>                              ] 0     --.-K/s   in 0s
		
2009-03-16 23:00:01 (0.00 B/s) - `testfile' saved [0/0]
</pre></li><li><div class="para">
					The <code class="command">chcon</code> command relabels files; however, such label changes do not survive when the file system is relabeled. For permanent changes that survive a file system relabel, use the <code class="command">semanage</code> command, which is discussed later. As the root user, run the following command to change the type to a type used by Samba:
				</div><div class="para">
					<code class="command">chcon -t samba_share_t /var/www/html/testfile</code>
				</div><div class="para">
					Run the <code class="command">ls -Z /var/www/html/testfile</code> command to view the changes:
				</div><pre class="screen">-rw-r--r--  root root unconfined_u:object_r:samba_share_t:s0 /var/www/html/testfile
</pre></li><li><div class="para">
					Note: the current DAC permissions allow the <code class="systemitem">httpd</code> process access to <code class="filename">testfile</code>. Change into a directory where your Linux user has write access to, and run the <code class="command">wget http://localhost/testfile</code> command. Unless there are changes to the default configuration, this command fails:
				</div><pre class="screen">--2009-03-16 23:00:54--  http://localhost/testfile
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2009-03-16 23:00:54 ERROR 403: Forbidden.
</pre></li><li><div class="para">
					As the root user, run the <code class="command">rm -i /var/www/html/testfile</code> command to remove <code class="filename">testfile</code>.
				</div></li><li><div class="para">
					If you do not require <code class="systemitem">httpd</code> to be running, as the root user, run the <code class="command">service httpd stop</code> command to stop <code class="systemitem">httpd</code>:
				</div><pre class="screen"># /sbin/service httpd stop
Stopping httpd:                                            [  OK  ]
</pre></li></ol></div><div class="para">
			This example demonstrates the additional security added by SELinux. DAC rules allowed the <code class="systemitem">httpd</code> process access to <code class="filename">testfile</code> in step 7, but because the file was labeled with a type that the <code class="systemitem">httpd</code> process does not have access to, SELinux denied access. After step 7, an error similar to the following is logged to <code class="filename">/var/log/messages</code>:
		</div><pre class="screen">Apr  6 23:00:54 localhost setroubleshoot: SELinux is preventing httpd (httpd_t) "getattr"
to /var/www/html/testfile (samba_share_t). For complete SELinux messages.
run sealert -l c05911d3-e680-4e42-8e36-fe2ab9f8e654
</pre><div class="para">
			Previous log files may use a <code class="filename">/var/log/messages.<em class="replaceable"><code>YYYYMMDD</code></em></code> format. When running <span class="application"><strong>syslog-ng</strong></span>, previous log files may use a <code class="filename">/var/log/messages.<em class="replaceable"><code>X</code></em></code> format. If the <code class="systemitem">setroubleshootd</code> and <code class="systemitem">auditd</code> processes are running, errors similar to the following are logged to <code class="filename">/var/log/audit/audit.log</code>:
		</div><pre class="screen">type=AVC msg=audit(1220706212.937:70): avc:  denied  { getattr } for  pid=1904 comm="httpd" path="/var/www/html/testfile" dev=sda5 ino=247576 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:samba_share_t:s0  tclass=file

type=SYSCALL msg=audit(1220706212.937:70): arch=40000003 syscall=196 success=no exit=-13 a0=b9e21da0 a1=bf9581dc a2=555ff4 a3=2008171 items=0 ppid=1902 pid=1904 auid=500 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=1 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)
</pre><div class="para">
			Also, an error similar to the following is logged to <code class="filename">/var/log/httpd/error_log</code>:
		</div><pre class="screen">[Sat Apr 06 23:00:54 2009] [error] [client <em class="replaceable"><code>127.0.0.1</code></em>] (13)Permission denied: access to /testfile denied
</pre><div class="note"><h2>Note</h2><div class="para">
				In Fedora, the <span class="package">setroubleshoot-server</span> and <span class="package">audit</span> packages are installed by default. These packages include the <code class="systemitem">setroubleshootd</code> and <code class="systemitem">auditd</code> daemons respectively. These daemons run by default.
			</div></div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2921858" href="#id2921858" class="para">3</a>] </sup>
						When using other policies, such as MLS, other roles may be used, for example, <code class="computeroutput">secadm_r</code>.
					</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-Targeted_policy.html"><strong>Prev</strong>Chapter 3. Targeted policy</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html"><strong>Next</strong>3.3. Unconfined processes</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>3.3. Unconfined processes</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Targeted_policy.html" title="Chapter 3. Targeted policy" /><link rel="prev" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html" title="3.2. Confined processes" /><link rel="next" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html" title="Chapter 4. The Apache HTTP Server" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="r
 ight" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-Targeted_policy-Unconfined_processes">3.3. Unconfined processes</h2></div></div></div><div class="para">
			Unconfined processes run in unconfined domains. For example, init programs run in the unconfined <code class="computeroutput">initrc_t</code> domain, unconfined kernel processes run in the <code class="computeroutput">kernel_t</code> domain, and unconfined Linux users run in the <code class="computeroutput">unconfined_t</code> domain. For unconfined processes, SELinux policy rules are applied, but policy rules exist that allow processes running in unconfined domains almost all access. Processes running in unconfined domains fall back to using DAC rules exclusively. If an unconfined process is compromised, SELinux does not prevent an attacker from gaining access to system resources and data, but of course, DAC rules are still used. SELinux is a security enhancement on top of DAC rules - it does not replace them.
		</div><div class="para">
			The following example demonstrates how the Apache HTTP Server (<code class="systemitem">httpd</code>) can access data intended for use by Samba, when running unconfined. Note: in Fedora, the <code class="systemitem">httpd</code> process runs in the confined <code class="computeroutput">httpd_t</code> domain by default. This is an example, and should not be used in production. It assumes that the <span class="package">httpd</span>, <span class="package">wget</span>, <span class="package">setroubleshoot-server</span>, and <span class="package">audit</span> packages are installed, that the SELinux targeted policy is used, and that SELinux is running in enforcing mode:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run the <code class="command">sestatus</code> command to confirm that SELinux is enabled, is running in enforcing mode, and that targeted policy is being used:
				</div><pre class="screen">
$ /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 23
Policy from config file:        targeted
</pre><div class="para">
					<code class="computeroutput">SELinux status: enabled</code> is returned when SELinux is enabled. <code class="computeroutput">Current mode: enforcing</code> is returned when SELinux is running in enforcing mode. <code class="computeroutput">Policy from config file: targeted</code> is returned when the SELinux targeted policy is used.
				</div></li><li><div class="para">
					As the root user, run the <code class="command">touch /var/www/html/test2file</code> command to create a file.
				</div></li><li><div class="para">
					Run the <code class="command">ls -Z /var/www/html/test2file</code> command to view the SELinux context:
				</div><pre class="screen">-rw-r--r--  root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/test2file
</pre><div class="para">
					<code class="filename">test2file</code> is labeled with the SELinux <code class="computeroutput">unconfined_u</code> user because a Linux user that is mapped to the <code class="computeroutput">unconfined_u</code> SELinux user created the file. RBAC is used for processes, not files. Roles do not have a meaning for files - the <code class="computeroutput">object_r</code> role is a generic role used for files (on persistent storage and network file systems). Under the <code class="filename">/proc/</code> directory, files related to processes may use the <code class="computeroutput">system_r</code> role.<sup>[<a id="id2975696" href="#ftn.id2975696" class="footnote">4</a>]</sup> The <code class="computeroutput">httpd_sys_content_t</code> type allows the <code class="systemitem">httpd</code> process to access this file.
				</div></li><li><div class="para">
					The <code class="command">chcon</code> command relabels files; however, such label changes do not survive when the file system is relabeled. For permanent changes that survive a file system relabel, use the <code class="command">semanage</code> command, which is discussed later. As the root user, run the following command to change the type to a type used by Samba:
				</div><div class="para">
					<code class="command">chcon -t samba_share_t /var/www/html/test2file</code>
				</div><div class="para">
					Run the <code class="command">ls -Z /var/www/html/test2file</code> command to view the changes:
				</div><pre class="screen">-rw-r--r--  root root unconfined_u:object_r:samba_share_t:s0 /var/www/html/test2file
</pre></li><li><div class="para">
					Run the <code class="command">service httpd status</code> command to confirm that the <code class="systemitem">httpd</code> process is not running:
				</div><pre class="screen">$ /sbin/service httpd status
httpd is stopped
</pre><div class="para">
					If the output differs, run the <code class="command">service httpd stop</code> command as the root user to stop the <code class="systemitem">httpd</code> process:
				</div><pre class="screen"># /sbin/service httpd stop
Stopping httpd:                                            [  OK  ]
</pre></li><li><div class="para">
					To make the <code class="systemitem">httpd</code> process run unconfined, run the following command as the root user to change the type of <code class="filename">/usr/sbin/httpd</code>, to a type that does not transition to a confined domain:
				</div><div class="para">
					<code class="command">chcon -t unconfined_exec_t /usr/sbin/httpd</code>
				</div></li><li><div class="para">
					Run the <code class="command">ls -Z /usr/sbin/httpd</code> command to confirm that <code class="filename">/usr/sbin/httpd</code> is labeled with the <code class="computeroutput">unconfined_exec_t</code> type:
				</div><pre class="screen">-rwxr-xr-x  root root system_u:object_r:unconfined_exec_t /usr/sbin/httpd
</pre></li><li><div class="para">
					As the root user, run the <code class="command">service httpd start</code> command to start the <code class="systemitem">httpd</code> process. The output is as follows if <code class="systemitem">httpd</code> starts successfully:
				</div><pre class="screen"># /sbin/service httpd start
Starting httpd:                                            [  OK  ]
</pre></li><li><div class="para">
					Run the <code class="command">ps -eZ | grep httpd</code> command to view the <code class="systemitem">httpd</code> processes running in the <code class="computeroutput">unconfined_t</code> domain:
				</div><pre class="screen">$ ps -eZ | grep httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7721</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7723</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7724</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7725</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7726</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7727</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7728</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7729</code></em> ?      00:00:00 httpd
unconfined_u:system_r:unconfined_t <em class="replaceable"><code>7730</code></em> ?      00:00:00 httpd
</pre></li><li><div class="para">
					Change into a directory where your Linux user has write access to, and run the <code class="command">wget http://localhost/test2file</code> command. Unless there are changes to the default configuration, this command succeeds:
				</div><pre class="screen">--2008-09-07 01:41:10--  http://localhost/test2file
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/plain]
Saving to: `test2file.1'

[ <=>                            ]--.-K/s   in 0s      
	
2008-09-07 01:41:10 (0.00 B/s) - `test2file.1' saved [0/0]
</pre><div class="para">
					Although the <code class="systemitem">httpd</code> process does not have access to files labeled with the <code class="computeroutput">samba_share_t</code> type, <code class="systemitem">httpd</code> is running in the unconfined <code class="computeroutput">unconfined_t</code> domain, and falls back to using DAC rules, and as such, the <code class="command">wget</code> command succeeds. Had <code class="systemitem">httpd</code> been running in the confined <code class="computeroutput">httpd_t</code> domain, the <code class="command">wget</code> command would have failed.
				</div></li><li><div class="para">
					The <code class="command">restorecon</code> command restores the default SELinux context for files. As the root user, run the <code class="command">restorecon -v /usr/sbin/httpd</code> command to restore the default SELinux context for <code class="filename">/usr/sbin/httpd</code>:
				</div><pre class="screen"># /sbin/restorecon -v /usr/sbin/httpd
restorecon reset /usr/sbin/httpd context system_u:object_r:unconfined_notrans_exec_t:s0->system_u:object_r:httpd_exec_t:s0
</pre><div class="para">
					Run the <code class="command">ls -Z /usr/sbin/httpd</code> command to confirm that <code class="filename">/usr/sbin/httpd</code> is labeled with the <code class="computeroutput">httpd_exec_t</code> type:
				</div><pre class="screen">$ ls -Z /usr/sbin/httpd
-rwxr-xr-x  root root system_u:object_r:httpd_exec_t   /usr/sbin/httpd
</pre></li><li><div class="para">
					As the root user, run the <code class="command">/sbin/service httpd restart</code> command to restart <code class="systemitem">httpd</code>. After restarting, run the <code class="command">ps -eZ | grep httpd</code> to confirm that <code class="systemitem">httpd</code> is running in the confined <code class="computeroutput">httpd_t</code> domain:
				</div><pre class="screen"># /sbin/service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
# ps -eZ | grep httpd
unconfined_u:system_r:httpd_t    8880 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8882 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8883 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8884 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8885 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8886 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8887 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8888 ?        00:00:00 httpd
unconfined_u:system_r:httpd_t    8889 ?        00:00:00 httpd
</pre></li><li><div class="para">
					As the root user, run the <code class="command">rm -i /var/www/html/test2file</code> command to remove <code class="filename">test2file</code>.
				</div></li><li><div class="para">
					If you do not require <code class="systemitem">httpd</code> to be running, as the root user, run the <code class="command">service httpd stop</code> command to stop <code class="systemitem">httpd</code>:
				</div><pre class="screen"># /sbin/service httpd stop
Stopping httpd:                                            [  OK  ]
</pre></li></ol></div><div class="para">
			The examples in these sections demonstrate how data can be protected from a compromised confined process (protected by SELinux), as well as how data is more accessible to an attacker from a compromised unconfined process (not protected by SELinux).
		</div><div class="footnotes"><br /><hr /><div class="footnote"><p><sup>[<a id="ftn.id2975696" href="#id2975696" class="para">4</a>] </sup>
						When using other policies, such as MLS, other roles may also be used, for example, <code class="computeroutput">secadm_r</code>.
					</p></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-Targeted_policy-Confined_processes.html"><strong>Prev</strong>3.2. Confined processes</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html"><strong>Next</strong>Chapter 4. The Apache HTTP Server</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html" title="Chapter 4. The Apache HTTP Server" /><link rel="prev" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html" title="4.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html" title="4.4. Configuration examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="ri
 ght" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans">4.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. This can be achieved via Booleans that allow parts of SELinux policy to be changed at runtime, without any knowledge of SELinux policy writing. This allows changes, such as allowing services access to NFS file systems, without reloading or recompiling SELinux policy.
		</div><div class="para">
			To modify the state of a Boolean, use the <code class="command">setsebool</code> command. For example, to turn the <code class="computeroutput">allow_httpd_anon_write</code> Boolean on, run the following command as the root user:
		</div><pre class="screen"># setsebool -P allow_httpd_anon_write on
</pre><div class="para">
			To turn a Boolean off, using the same example, simply change <code class="command">on</code> to<code class="command"> off</code> in the command, as shown below:
		</div><pre class="screen"># setsebool -P allow_httpd_anon_write off
</pre><div class="note"><h2>Note</h2><div class="para">
				Do not use the <code class="option">-P</code> option if you do not want <code class="command">setsebool</code> changes to persist across reboots.
			</div></div><div class="para">
			Below is a description of common Booleans available that cater for the way <code class="systemitem">httpd</code> is running:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_httpd_anon_write</code></span></dt><dd><div class="para">
						When disabled, this Boolean allows <code class="systemitem">httpd</code> only read access to files labeled with the <code class="computeroutput">public_content_rw_t</code> type. Enabling this Boolean will allow <code class="systemitem">httpd</code> to write to files labeled with the <code class="computeroutput">public_content_rw_t</code> type, such as a public directory containing files for a public file transfer service.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_httpd_mod_auth_ntlm_winbind</code></span></dt><dd><div class="para">
						Enabling this Boolean allows access to NTLM and Winbind authentication mechanisms via the <code class="computeroutput">mod_auth_ntlm_winbind</code> module in <code class="systemitem">httpd</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_httpd_mod_auth_pam</code></span></dt><dd><div class="para">
						Enabling this Boolean allows access to PAM authentication mechanisms via the <code class="computeroutput">mod_auth_pam</code> module in <code class="systemitem">httpd</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_httpd_sys_script_anon_write</code></span></dt><dd><div class="para">
						This Boolean defines whether or not HTTP scripts are allowed write access to files labeled with the <code class="computeroutput">public_content_rw_t</code> type, as used in a public file transfer service.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_builtin_scripting</code></span></dt><dd><div class="para">
						This Boolean defines access to <code class="systemitem">httpd</code> scripting. Having this Boolean enabled is often required for PHP content.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_can_network_connect</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents HTTP scripts and modules from initiating a connection to a network or remote port. Turn this Boolean on to allow this access.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_can_network_connect_db</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents HTTP scripts and modules from initiating a connection to database servers. Turn this Boolean on to allow this access.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_can_network_relay</code></span></dt><dd><div class="para">
						Turn this Boolean on when <code class="systemitem">httpd</code> is being used as a forward or reverse proxy.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_can_sendmail</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents HTTP modules from sending mail. This can prevent spam attacks should a vulnerability be found in <code class="systemitem">httpd</code>. Turn this Boolean on to allow HTTP modules to send mail.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_dbus_avahi</code></span></dt><dd><div class="para">
						When off, this Boolean denies <code class="systemitem">httpd</code> access to the <code class="computeroutput">avahi</code> service via <code class="computeroutput">D-Bus</code>. Turn this Boolean on to allow this access.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_enable_cgi</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents <code class="systemitem">httpd</code> from executing CGI scripts. Turn this Boolean on to allow <code class="systemitem">httpd</code> to execute CGI scripts (CGI scripts must be labeled with the <code class="computeroutput">httpd_sys_script_exec_t</code> type).
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_enable_ftp_server</code></span></dt><dd><div class="para">
						Turning this Boolean on will allow <code class="systemitem">httpd</code> to listen on the FTP port and act as an FTP server.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_enable_homedirs</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents <code class="systemitem">httpd</code> from accessing user home directories. Turn this Boolean on to allow <code class="systemitem">httpd</code> access to user home directories; for example, content in <code class="filename">/home/*/</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_execmem</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows <code class="systemitem">httpd</code> to execute programs that require memory addresses that are both executable and writeable. Enabling this Boolean is not recommended from a security standpoint as it reduces protection against buffer overflows, however certain modules and applications (such as Java and Mono applications) require this privilege.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_ssi_exec</code></span></dt><dd><div class="para">
						This Boolean defines whether or not server side include (SSI) elements in a web page can be executed.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_tty_comm</code></span></dt><dd><div class="para">
						This Boolean defines whether or not <code class="systemitem">httpd</code> is allowed access to the controlling terminal. Usually this access is not required, however in cases such as configuring an SSL certificate file, terminal access is required to display and process a password prompt.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_unified</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows <code class="computeroutput">httpd_t</code> complete access to all of the <code class="systemitem">httpd</code> types (i.e. to execute, read, or write sys_content_t). When disabled, there is separation in place between web content that is read-only, writeable or executable. Disabling this Boolean ensures an extra level of security but adds the administrative overhead of having to individually label scripts and other web content based on the file access that each should have.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_use_cifs</code></span></dt><dd><div class="para">
						Turn this Boolean on to allow <code class="systemitem">httpd</code> access to files on CIFS file systems that are labeled with the <code class="computeroutput">cifs_t</code> type, such as file systems mounted via Samba.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_use_nfs</code></span></dt><dd><div class="para">
						Turn this Boolean on to allow <code class="systemitem">httpd</code> access to files on NFS file systems that are labeled with the <code class="computeroutput">nfs_t</code> type, such as file systems mounted via NFS.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html"><strong>Prev</strong>4.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html"><strong>Next</strong>4.4. Configuration examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.4. Configuration examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html" title="Chapter 4. The Apache HTTP Server" /><link rel="prev" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html" title="4.3. Booleans" /><link rel="next" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html" title="4.4.2. Sharing NFS and CIFS file systems" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_lef
 t.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Configuration_examples">4.4. Configuration examples</h2></div></div></div><div class="para">
			The following examples provide real-world demonstrations of how SELinux complements the Apache HTTP Server and how full function of the Apache HTTP Server can be maintained.
		</div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-Configuration_examples-Running_a_static_site">4.4.1. Running a static site</h3></div></div></div><div class="para">
				To create a static website, label the <code class="filename">.html</code> files for that website with the <code class="computeroutput">httpd_sys_content_t</code> type. By default, the Apache HTTP Server can not write to files that are labeled with the <code class="computeroutput">httpd_sys_content_t</code> type. The following example creates a new directory to store files for a read-only website:
			</div><div class="orderedlist"><ol><li><div class="para">
						Run <code class="command">mkdir /mywebsite</code> as the root user to create a top-level directory.
					</div></li><li><div class="para">
						As the root user, create a <code class="filename">/mywebsite/index.html</code> file. Copy and paste the following content into <code class="filename">/mywebsite/index.html</code>:
					</div><pre class="screen">
<html>
<h2>index.html from /mywebsite/</h2>
</html>
</pre></li><li><div class="para">
						To allow the Apache HTTP Server read only access to <code class="filename">/mywebsite/</code>, as well as files and subdirectories under it, label <code class="filename">/mywebsite/</code> with the <code class="computeroutput">httpd_sys_content_t</code> type. Run the following command as the root user to add the label change to file-context configuration:
					</div><pre class="screen">
# semanage fcontext -a -t httpd_sys_content_t "/mywebsite(/.*)?"
</pre></li><li><div class="para">
						Run <code class="command">restorecon -R -v /mywebsite</code> as the root user to make the label changes:
					</div><pre class="screen">
# restorecon -R -v /mywebsite
restorecon reset /mywebsite context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
restorecon reset /mywebsite/index.html context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
</pre></li><li><div class="para">
						For this example, edit <code class="filename">/etc/httpd/conf/httpd.conf</code> as the root user. Comment out the existing <code class="option">DocumentRoot</code> option. Add a <code class="option">DocumentRoot "/mywebsite"</code> option. After editing, these options should look as follows:
					</div><pre class="screen">
#DocumentRoot "/var/www/html"
DocumentRoot "/mywebsite"
</pre></li><li><div class="para">
						Run <code class="command">service httpd status</code> as the root user to see the status of the Apache HTTP Server. If the server is stopped, run <code class="command">service httpd start</code> as the root user to start it. If the server is running, run <code class="command">service httpd restart</code> as the root user to restart the service (this also applies any changes made to <code class="filename">httpd.conf</code>).
					</div></li><li><div class="para">
						Use a web browser to navigate to <code class="computeroutput">http://localhost/index.html</code>. The following is displayed:
					</div><pre class="screen">
index.html from /mywebsite/
</pre></li></ol></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html"><strong>Prev</strong>4.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-Configuration_examples-Sharing_NFS_and_CIFS_file_systems.html"><strong>Next</strong>4.4.2. Sharing NFS and CIFS file systems</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>4.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html" title="Chapter 4. The Apache HTTP Server" /><link rel="prev" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html" title="Chapter 4. The Apache HTTP Server" /><link rel="next" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html" title="4.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="ht
 tp://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types">4.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following example creates a new file in the <code class="filename">/var/www/html/</code> directory, and shows the file inheriting the <code class="computeroutput">httpd_sys_content_t</code> type from its parent directory (<code class="filename">/var/www/html/</code>):
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">ls -dZ /var/www/html</code> to view the SELinux context of <code class="filename">/var/www/html/</code>:
				</div><pre class="screen">
$ ls -dZ /var/www/html
drwxr-xr-x  root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html
</pre><div class="para">
					This shows <code class="filename">/var/www/html/</code> is labeled with the <code class="computeroutput">httpd_sys_content_t</code> type.
				</div></li><li><div class="para">
					Run <code class="command">touch /var/www/html/file1</code> as the root user to create a new file.
				</div></li><li><div class="para">
					Run <code class="command">ls -Z /var/www/html/file1</code> to view the SELinux context:
				</div><pre class="screen">
$ ls -Z /var/www/html/file1
-rw-r--r--  root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/file1
</pre></li></ol></div><div class="para">
			The <code class="command">ls -Z</code> command shows <code class="filename">file1</code> labeled with the <code class="computeroutput">httpd_sys_content_t</code> type. SELinux allows <code class="systemitem">httpd</code> to read files labeled with this type, but not write to them, even if Linux permissions allow write access. SELinux policy defines what types a process running in the <code class="computeroutput">httpd_t</code> domain (where <code class="systemitem">httpd</code> runs) can read and write to. This helps prevent processes from accessing files intended for use by another process.
		</div><div class="para">
			For example, <code class="systemitem">httpd</code> can access files labeled with the <code class="computeroutput">httpd_sys_content_t</code> type (intended for the Apache HTTP Server), but by default, can not access files labeled with the <code class="computeroutput">samba_share_t</code> type (intended for Samba). Also, files in user home directories are labeled with the <code class="computeroutput">user_home_t</code> type: by default, this prevents <code class="systemitem">httpd</code> from reading or writing to files in user home directories.
		</div><div class="para">
			The following types are used with <code class="systemitem">httpd</code>. Different types allow you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">httpd_sys_content_t</code></span></dt><dd><div class="para">
						Use this type for static web content, such as <code class="filename">.html</code> files used by a static website. Files labeled with this type are accessible (read only) to <code class="systemitem">httpd</code> and scripts executed by <code class="systemitem">httpd</code>. By default, files and directories labeled with this type can not be written to or modified by <code class="systemitem">httpd</code> or other processes. Note: by default, files created in or copied into <code class="filename">/var/www/html/</code> are labeled with the <code class="computeroutput">httpd_sys_content_t</code> type.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_sys_script_exec_t</code></span></dt><dd><div class="para">
						Use this type for scripts you want <code class="systemitem">httpd</code> to execute. This type is commonly used for Common Gateway Interface (CGI) scripts in <code class="filename">/var/www/cgi-bin/</code>. By default, SELinux policy prevents <code class="systemitem">httpd</code> from executing CGI scripts. To allow this, label the scripts with the <code class="computeroutput">httpd_sys_script_exec_t</code> type and turn the <code class="computeroutput">httpd_enable_cgi</code> Boolean on. Scripts labeled with <code class="computeroutput">httpd_sys_script_exec_t</code> run in the <code class="computeroutput">httpd_sys_script_t</code> domain when executed by <code class="systemitem">httpd</code>. The <code class="computeroutput">httpd_sys_script_t</code> domain has access to other system domains, such as <code class="computeroutput">postgresql_t</code> and <code class="computeroutput">mysqld_t</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_sys_content_rw_t</code></span></dt><dd><div class="para">
						Files labeled with this type can be written to by scripts labeled with the <code class="computeroutput">httpd_sys_script_exec_t</code> type, but can not be modified by scripts labeled with any other type. You must use the <code class="computeroutput">httpd_sys_content_rw_t</code> type to label files that will be read from and written to by scripts labeled with the <code class="computeroutput">httpd_sys_script_exec_t</code> type.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_sys_content_ra_t</code></span></dt><dd><div class="para">
						Files labeled with this type can be appended to by scripts labeled with the <code class="computeroutput">httpd_sys_script_exec_t</code> type, but can not be modified by scripts labeled with any other type. You must use the <code class="computeroutput">httpd_sys_content_ra_t</code> type to label files that will be read from and appended to by scripts labeled with the <code class="computeroutput">httpd_sys_script_exec_t</code> type.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_unconfined_script_exec_t</code></span></dt><dd><div class="para">
						Scripts labeled with this type run without SELinux protection. Only use this type for complex scripts, after exhausting all other options. It is better to use this type instead of turning SELinux protection off for <code class="systemitem">httpd</code>, or for the entire system.
					</div></dd></dl></div><div class="formalpara"><h5 class="formalpara" id="form-Managing_Confined_Services-Types-Changing_the_SELinux_Context">Changing the SELinux Context</h5>
				The type for files and directories can be changed with the <code class="command">chcon</code> command. Changes made with <code class="command">chcon</code> do not survive a file system relabel or the <code class="command">restorecon</code> command. SELinux policy controls whether users are able to modify the SELinux context for any given file. The following example demonstrates creating a new directory and an <code class="filename">index.html</code> file for use by <code class="systemitem">httpd</code>, and labeling that file and directory to allow <code class="systemitem">httpd</code> access to them:
			</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">mkdir -p /my/website</code> as the root user to create a top-level directory structure to store files to be used by <code class="systemitem">httpd</code>.
				</div></li><li><div class="para">
					Files and directories that do not match a pattern in file-context configuration may be labeled with the <code class="computeroutput">default_t</code> type. This type is inaccessible to confined services:
				</div><pre class="screen">
$ ls -dZ /my
drwxr-xr-x  root root unconfined_u:object_r:default_t:s0 /my
</pre></li><li><div class="para">
					Run <code class="command">chcon -R -t httpd_sys_content_t /my/</code> as the root user to change the type of the <code class="filename">/my/</code> directory and subdirectories, to a type accessible to <code class="systemitem">httpd</code>. Now, files created under <code class="filename">/my/website/</code> inherit the <code class="computeroutput">httpd_sys_content_t</code> type, rather than the <code class="computeroutput">default_t</code> type, and are therefore accessible to httpd:
				</div><pre class="screen">
# chcon -R -t httpd_sys_content_t /my/
# touch /my/website/index.html
# ls -Z /my/website/index.html
-rw-r--r--  root root unconfined_u:object_r:httpd_sys_content_t:s0 /my/website/index.html
</pre></li></ol></div><div class="para">
			Refer to the <a href="http://docs.fedoraproject.org/selinux-user-guide/f10/en-US/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html#sect-Security-Enhanced_Linux-SELinux_Contexts_Labeling_Files-Temporary_Changes_chcon">Temporary Changes: chcon</a> section of the <a href="http://docs.fedoraproject.org/selinux-user-guide/">Fedora 10 SELinux User Guide</a> for further information about <code class="command">chcon</code>.
		</div><div class="para">
			Use the <code class="command">semanage fcontext</code> command to make label changes that survive a relabel and the <code class="command">restorecon</code> command. This command adds changes to file-context configuration. Then, run the <code class="command">restorecon</code> command, which reads file-context configuration, to apply the label change. The following example demonstrates creating a new directory and an <code class="filename">index.html</code> file for use by <code class="systemitem">httpd</code>, and persistently changing the label of that directory and file to allow <code class="systemitem">httpd</code> access to them:
		</div><div class="orderedlist"><ol><li><div class="para">
					Run <code class="command">mkdir -p /my/website</code> as the root user to create a top-level directory structure to store files to be used by <code class="systemitem">httpd</code>.
				</div></li><li><div class="para">
					Run the following command as the root user to add the label change to file-context configuration:
				</div><pre class="screen">
semanage fcontext -a -t httpd_sys_content_t "/my(/.*)?"
</pre><div class="para">
					The <code class="computeroutput">"/my(/.*)?"</code> expression means the label change applies to the <code class="filename">/my/</code> directory and all files and directories under it.
				</div></li><li><div class="para">
					Run <code class="command">touch /my/website/index.html</code> as the root user to create a new file.
				</div></li><li><div class="para">
					Run <code class="command">restorecon -R -v /my/</code> as the root user to apply the label changes (<code class="command">restorecon</code> reads file-context configuration, which was modified by the <code class="command">semanage</code> command in step 2):
				</div><pre class="screen">
# restorecon -R -v /my/
restorecon reset /my context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
restorecon reset /my/website context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
restorecon reset /my/website/index.html context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0
</pre></li></ol></div><div class="para">
			Refer to the <a href="http://docs.fedoraproject.org/selinux-user-guide/f10/en-US/sect-Security-Enhanced_Linux-SELinux_Contexts_Labeling_Files-Persistent_Changes_semanage_fcontext.html">Persistent Changes: semanage fcontext</a> section of the <a href="http://docs.fedoraproject.org/selinux-user-guide/">Fedora 10 SELinux User Guide</a> for further information on semanage.
		</div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-The_Apache_HTTP_Server.html"><strong>Prev</strong>Chapter 4. The Apache HTTP Server</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html"><strong>Next</strong>4.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-rsync-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>13.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-rsync.html" title="Chapter 13. rsync" /><link rel="prev" href="sect-Managing_Confined_Services-rsync-Types.html" title="13.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html" title="13.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Conte
 nt/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-rsync-Booleans">13.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Boolean allows you to tell SELinux how you are running rsync:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_rsync_anon_write</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows <code class="systemitem">rsync</code> in the <span class="emphasis"><em>rsync_t</em></span> domain to manage files, links and directories that have a type of <span class="emphasis"><em>public_content_rw_t</em></span>. Often these are public files used for public file transfer services. Files and directories must be labeled <code class="computeroutput">public_content_rw_t</code>.
					</div></dd><dt><span class="term"><code class="computeroutput">rsync_client</code></span></dt><dd><div class="para">
						Having this Boolean enabled aloows <code class="systemitem">rsync</code> to initiate connections to ports defined as <span class="emphasis"><em>rsync_port_t</em></span>, as well as allowing <code class="systemitem">rsync</code> to manage files, links and directories that have a type of <span class="emphasis"><em>rsync_data_t</em></span>. Note that the <code class="systemitem">rsync</code> daemon must be in the <span class="emphasis"><em>rsync_t</em></span> domain in order for SELinux to enact its control over <code class="systemitem">rsync</code>. The configuration example in this chapter demonstrates <code class="systemitem">rsync</code> running in the <span class="emphasis"><em>rsync_t</em></span> domain.
					</div></dd><dt><span class="term"><code class="computeroutput">rsync_export_all_ro</code></span></dt><dd><div class="para">
						Having this Boolean enabled allows <code class="systemitem">rsync</code> in the <span class="emphasis"><em>rsync_t</em></span> domain to export NFS and CIFS file systems with read-only access to clients.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Types.html"><strong>Prev</strong>13.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Configuration_Examples.html"><strong>Next</strong>13.4. Configuration Examples</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-rsync-Configuration_Examples.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>13.4. Configuration Examples</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-rsync.html" title="Chapter 13. rsync" /><link rel="prev" href="sect-Managing_Confined_Services-rsync-Booleans.html" title="13.3. Booleans" /><link rel="next" href="chap-Managing_Confined_Services-Postfix.html" title="Chapter 14. Postfix" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images
 /image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Booleans.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Postfix.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-rsync-Configuration_Examples">13.4. Configuration Examples</h2></div></div></div><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h3 class="title" id="sect-Managing_Confined_Services-rsync-Configuration_Examples-Rsync_as_a_daemon">13.4.1. Rsync as a daemon</h3></div></div></div><div class="para">
				When using Fedora, rsync can be used as a daemon so that multiple clients can directly communicate with it as a central server, in order to house centralized files and keep them synchronized. The following example will demonstrate running rsync as a daemon over a network socket in the correct domain, and how SELinux expects this daemon to be running on a pre-defined (in SELinux policy) TCP port. This example will then show how to modify SELinux policy to allow the <code class="systemitem">rsync</code> daemon to run normally on a non-standard port.
			</div><div class="para">
				This example will be performed on a single system to demonstrate SELinux policy and its control over local daemons and processes. Note that this is an example only and demonstrates how SELinux can affect rsync. Comprehensive documentation of rsync is beyond the scope of this document. Refer to the official <a href="http://www.samba.org/rsync/documentation.html">rsync documentation</a> for further details. This example assumes that the <span class="package">rsync</span>, <span class="package">setroubleshoot-server</span> and <span class="package">audit</span> packages are installed, that the SELinux targeted policy is used and that SELinux is running in enforcing mode.
			</div><div class="orderedlist"><h6>Getting rsync to launch as rsync_t</h6><ol><li><div class="para">
						Run <code class="command">getenforce</code> to confirm SELinux is running in enforcing mode:
					</div><pre class="screen">
$ getenforce
Enforcing
</pre><div class="para">
						The <code class="command">getenforce</code> command returns <code class="computeroutput">Enforcing</code> when SELinux is running in enforcing mode.
					</div></li><li><div class="para">
						Run the <code class="command">which</code> command to confirm that the rsync binary is in the system path:
					</div><pre class="screen">
$ which rsync
/usr/bin/rsync
</pre></li><li><div class="para">
						When running <code class="systemitem">rsync</code> as a daemon, a configuration file should be used and saved as <code class="filename">/etc/rsyncd.conf</code>. Note that the following configuration file used in this example is very simple and is not indicative of all the possible options that are available, rather it is just enough to demonstrate the <code class="systemitem">rsync</code> daemon:
					</div><pre class="screen">
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[files]
        path = /srv/files
        comment = file area
        read only = false
	timeout = 300
</pre></li><li><div class="para">
						Now that a simple configuration file exists for rsync to operate in daemon mode, this step demonstrates that simply running <code class="command">rsync --daemon</code> is not sufficient for SELinux to offer its protection over rsync. Refer to the following output:
					</div><pre class="screen">
# rsync --daemon

# ps x | grep rsync
 8231 ?        Ss     0:00 rsync --daemon
 8233 pts/3    S+     0:00 grep rsync

# ps -eZ | grep rsync
unconfined_u:unconfined_r:<span class="emphasis"><em>unconfined_t</em></span>:s0-s0:c0.c1023 8231 ? 00:00:00 rsync
</pre><div class="para">
						Note that in the output from the final <code class="command">ps</code> command, the context shows the <code class="systemitem">rsync</code> daemon running in the <code class="computeroutput">unconfined_t</code> domain. This indicates that rsync has not transitioned to the <code class="computeroutput">rsync_t</code> domain as it was launched by the <code class="command">rsync --daemon</code> command. At this point SELinux can not enforce its rules and policy over this daemon. Refer to the following steps to see how to fix this problem. In the following steps, <code class="systemitem">rsync</code> will transition to the <code class="computeroutput">rsync_t</code> domain by launching it from a properly-labeled init script. Only then can SELinux and its protection mechanisms have an effect over <code class="systemitem">rsync</code>. This <code class="systemitem">rsync</code> process should be killed before proceeding to the next step.
					</div></li><li><div class="para">
						A custom init script for rsync is needed for this step. There is an example init script available at <a href="http://www.fredshack.com/docs/rsync.html">http://www.fredshack.com/docs/rsync.html</a>. Save it to <code class="filename">/etc/rc.d/init.d/rsyncd</code>. The following steps show how to label this script as <code class="computeroutput">initrc_exec_t</code>:
					</div></li><li><div class="para">
						Run the <code class="command">semanage</code> command to add a context mapping for <code class="filename">/etc/rc.d/init.d/rsyncd</code>: 
<pre class="screen">
semanage fcontext -a -t initrc_exec_t "/etc/rc.d/init.d/rsyncd"
</pre>
					</div></li><li><div class="para">
						This mapping is written to the <code class="filename">/etc/selinux/targeted/contexts/files/file_contexts.local</code> file: 
<pre class="screen">
# grep rsync /etc/selinux/targeted/contexts/files/file_contexts.local

/etc/rc.d/init.d/rsyncd    system_u:object_r:initrc_exec_t:s0
</pre>
					</div></li><li><div class="para">
						Now use the <code class="filename">restorecon</code> command to apply this context mapping to the running system: 
<pre class="screen">
restorecon -R -v /etc/rc.d/init.d/rsyncd
</pre>
					</div></li><li><div class="para">
						Run the <code class="command">ls</code> to confirm the script has been labeled appropriately. Note that in the following output the script has been labeled as <code class="computeroutput">initrc_exec_t</code>: 
<pre class="screen">
 ls -lZ /etc/rc.d/init.d/rsyncd
-rwxr-xr-x. root root system_u:object_r:<span class="emphasis"><em>initrc_exec_t</em></span>:s0 /etc/rc.d/init.d/rsyncd
</pre>
					</div></li><li><div class="para">
						Launch <code class="systemitem">rsyncd</code> via the new script. Now that rsync has started from an init script that has been appropriately labeled, the process will start as <code class="computeroutput">rsync_t</code>: 
<pre class="screen">
# /etc/rc.d/init.d/rsync start
Starting rsyncd:                                           [  OK  ]

ps -eZ | grep rsync
unconfined_u:system_r:<span class="emphasis"><em>rsync_t</em></span>:s0 9794 ?        00:00:00 rsync
</pre>
						 SELinux can now enforce its protection mechanisms over the <code class="systemitem">rsync</code> daemon as it is now runing in the <code class="computeroutput">rsync_t</code> domain.
					</div></li></ol></div><div class="para">
				This example demonstrated how to get <code class="systemitem">rsyncd</code> running in the <code class="computeroutput">rsync_t</code> domain. The next example shows how to get this daemon successfully running on a non-default port. TCP port 10000 is used in the next example.
			</div><div class="orderedlist"><h6>Running the rsync daemon on a non-default port</h6><ol><li><div class="para">
						Modify the <code class="filename">/etc/rsyncd.conf</code> file and add the <code class="command">port = 10000</code> line at the top of the file in the global configuration area (ie., before any file areas are defined). The new configuration file will look like: 
<pre class="screen">
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
<span class="emphasis"><em>port = 10000</em></span>
[files]
        path = /srv/files
        comment = file area
        read only = false
	timeout = 300
</pre>
					</div></li><li><div class="para">
						After launching rsync from the init script with this new setting, a denial similar to the following is logged by SELinux: 
<pre class="screen">
Jul 22 10:46:59 localhost setroubleshoot: SELinux is preventing the rsync (rsync_t) from binding to port 10000. For complete SELinux messages. run sealert -l c371ab34-639e-45ae-9e42-18855b5c2de8
</pre>
					</div></li><li><div class="para">
						Run the <code class="command">semanage</code> command to add TCP port 10000 to SELinux policy in <code class="computeroutput">rsync_port_t</code>: 
<pre class="screen">
# semanage port -a -t rsync_port_t -p tcp 10000
</pre>
					</div></li><li><div class="para">
						Now that TCP port 10000 has been added to SELinux policy for <code class="computeroutput">rsync_port_t</code>, <code class="systemitem">rsyncd</code> will start and operate normally on this port: 
<pre class="screen">
# /etc/rc.d/init.d/rsync start
Starting rsyncd:                                           [  OK  ]
</pre>
						
<pre class="screen">
# netstat -lnp | grep 10000
tcp        0      0 0.0.0.0:<span class="emphasis"><em>10000</em></span>   0.0.0.0:*      LISTEN      9910/rsync
</pre>
					</div></li></ol></div><div class="para">
				SELinux has had its policy modified and is now permitting <code class="systemitem">rsyncd</code> to operate on TCP port 10000.
			</div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-rsync-Booleans.html"><strong>Prev</strong>13.3. Booleans</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="chap-Managing_Confined_Services-Postfix.html"><strong>Next</strong>Chapter 14. Postfix</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_Services-rsync-Types.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>13.2. Types</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-rsync.html" title="Chapter 13. rsync" /><link rel="prev" href="chap-Managing_Confined_Services-rsync.html" title="Chapter 13. rsync" /><link rel="next" href="sect-Managing_Confined_Services-rsync-Booleans.html" title="13.3. Booleans" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><img src="Common_Content/images/image_right.png" alt
 ="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-rsync.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Booleans.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_Services-rsync-Types">13.2. Types</h2></div></div></div><div class="para">
			Type Enforcement is the main permission control used in SELinux targeted policy. All files and processes are labeled with a type: types define a domain for processes and a type for files. SELinux policy rules define how types access each other, whether it be a domain accessing a type, or a domain accessing another domain. Access is only allowed if a specific SELinux policy rule exists that allows it.
		</div><div class="para">
			The following types are used with <code class="computeroutput">rsync</code>. Different types all you to configure flexible access:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">public_content_t</code></span></dt><dd><div class="para">
						This is a generic type used for the location of files (and the actual files) to be shared via <code class="systemitem">rsync</code>. If a special directory is created to house files to be shared with <code class="systemitem">rsync</code>, the directory and its contents need to have this label applied to them.
					</div></dd><dt><span class="term"><code class="computeroutput">rsync_exec_t</code></span></dt><dd><div class="para">
						This type is used for the <code class="filename">/usr/bin/rsync</code> system binary.
					</div></dd><dt><span class="term"><code class="computeroutput">rsync_log_t</code></span></dt><dd><div class="para">
						This type is used for the <code class="systemitem">rsync</code> log file, located at <code class="filename">/var/log/rsync.log</code> by default. To change the location of the file rsync logs to, use the <code class="filename">--log-file=FILE</code> option to the <code class="command">rsync</code> command at run-time.
					</div></dd><dt><span class="term"><code class="computeroutput">rsync_var_run_t</code></span></dt><dd><div class="para">
						This type is used for the <code class="systemitem">rsyncd</code> lock file, located at <code class="filename">/var/run/rsyncd.lock</code>. This lock file is used by the <code class="systemitem">rsync</code> server to manage connection limits.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="chap-Managing_Confined_Services-rsync.html"><strong>Prev</strong>Chapter 13. rsync</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-rsync-Booleans.html"><strong>Next</strong>13.3. Booleans</a></li></ul></body></html>


--- NEW FILE sect-Managing_Confined_services-NFS-Booleans.html ---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>7.3. Booleans</title><link rel="stylesheet" href="./Common_Content/css/default.css" type="text/css" /><meta name="generator" content="publican" /><meta name="package" content="SELinux-Managing_Confined_Services-3.6.12-en-US-1.0-0" /><link rel="home" href="index.html" title="Managing Confined Services" /><link rel="up" href="chap-Managing_Confined_Services-Network_File_System.html" title="Chapter 7. Network File System" /><link rel="prev" href="sect-Managing_Confined_Services-NFS-Types.html" title="7.2. Types" /><link rel="next" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html" title="7.4. Configuration Examples" /></head><body class=""><p id="title"><a class="left" href="http://www.fedoraproject.org"><img src="Common_Content/images/image_left.png" alt="Product Site" /></a><a class="right" href="http://docs.fedoraproject.org"><i
 mg src="Common_Content/images/image_right.png" alt="Documentation Site" /></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-NFS-Types.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html"><strong>Next</strong></a></li></ul><div class="section" lang="en-US" xml:lang="en-US"><div class="titlepage"><div><div><h2 class="title" id="sect-Managing_Confined_services-NFS-Booleans">7.3. Booleans</h2></div></div></div><div class="para">
			SELinux is based on the least level of access required for a service to run. Services can be run in a variety of ways; therefore, you must tell SELinux how you are running services. The following Booleans allow you to tell SELinux how you are running NFS:
		</div><div class="variablelist"><dl><dt><span class="term"><code class="computeroutput">allow_ftpd_use_nfs</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows <code class="systemitem">ftpd</code> access to NFS mounts.
					</div></dd><dt><span class="term"><code class="computeroutput">allow_nfsd_anon_write</code></span></dt><dd><div class="para">
						When enabled, this Boolean allows <code class="systemitem">nfsd</code> to write to a public directory anonymously; such as to an area reserved for common files that otherwise has no special access restrictions.
					</div></dd><dt><span class="term"><code class="computeroutput">httpd_use_nfs</code></span></dt><dd><div class="para">
						When enabled, this Boolean will allow <code class="systemitem">httpd</code> to access files stored on a NFS filesystem.
					</div></dd><dt><span class="term"><code class="computeroutput">nfs_export_all_ro</code></span></dt><dd><div class="para">
						Export any file or directory via NFS, allowing read-only permissions.
					</div></dd><dt><span class="term"><code class="computeroutput">nfs_export_all_rw</code></span></dt><dd><div class="para">
						Export any file or directory via NFS, allowing read and write permissions.
					</div></dd><dt><span class="term"><code class="computeroutput">qemu_use_nfs</code></span></dt><dd><div class="para">
						Allow qemu to use NFS file systems.
					</div></dd><dt><span class="term"><code class="computeroutput">samba_share_nfs</code></span></dt><dd><div class="para">
						When disabled, this Boolean prevents <code class="systemitem">smbd</code> from having full access to NFS shares via Samba. Enabling this Boolean will allow Samba to share NFS file systems.
					</div></dd><dt><span class="term"><code class="computeroutput">use_nfs_home_dirs</code></span></dt><dd><div class="para">
						Having this Boolean enabled adds support for NFS home directories.
					</div></dd><dt><span class="term"><code class="computeroutput">virt_use_nfs</code></span></dt><dd><div class="para">
						Allow virt to use NFS files.
					</div></dd><dt><span class="term"><code class="computeroutput">xen_use_nfs</code></span></dt><dd><div class="para">
						Allow xen to manage NFS files.
					</div></dd></dl></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="sect-Managing_Confined_Services-NFS-Types.html"><strong>Prev</strong>7.2. Types</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="sect-Managing_Confined_Services-NFS-Configuration_Examples.html"><strong>Next</strong>7.4. Configuration Examples</a></li></ul></body></html>




More information about the Fedora-docs-commits mailing list