
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://selinuxproject.org/w/skins/common/feed.css?63"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://selinuxproject.org/w/?title=NB_Networking&amp;action=history&amp;feed=atom</id>
		<title>NB Networking - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://selinuxproject.org/w/?title=NB_Networking&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=NB_Networking&amp;action=history"/>
		<updated>2013-06-20T02:23:17Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.10.4</generator>

	<entry>
		<id>http://selinuxproject.org/w/?title=NB_Networking&amp;diff=1029&amp;oldid=prev</id>
		<title>Jaxelson at 20:47, 13 September 2010</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=NB_Networking&amp;diff=1029&amp;oldid=prev"/>
				<updated>2010-09-13T20:47:25Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 20:47, 13 September 2010&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 142:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 142:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;----&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;----&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;references/&amp;gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;references/&amp;gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;[[Category:Notebook]]&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jaxelson</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=NB_Networking&amp;diff=962&amp;oldid=prev</id>
		<title>RichardHaines at 14:22, 18 May 2010</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=NB_Networking&amp;diff=962&amp;oldid=prev"/>
				<updated>2010-05-18T14:22:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 14:22, 18 May 2010&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 91:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 91:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;A worked example of a Labeled IPSec session showing manual and racoon&amp;lt;ref name=&amp;quot;ftn26&amp;quot;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;sup&lt;/del&gt;&amp;gt;Unfortunately racoon core dumps using the example base module decribed in volume 2 but does work using the standard Red Hat targeted policy.&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/sup&amp;gt;&lt;/del&gt;&amp;lt;/ref&amp;gt; to configure the SAD is described in the Labeled IPSec Module Example section of the Sample Policy Source volume.&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;A worked example of a Labeled IPSec session showing manual and racoon&amp;lt;ref name=&amp;quot;ftn26&amp;quot;&amp;gt;Unfortunately racoon core dumps using the example base module decribed in volume 2 but does work using the standard Red Hat targeted policy.&amp;lt;/ref&amp;gt; to configure the SAD is described in the Labeled IPSec Module Example section of the Sample Policy Source volume.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;There is a further example in the &amp;quot;[http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/ Secure Networking with SELinux]&amp;quot; article.&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;There is a further example in the &amp;quot;[http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/ Secure Networking with SELinux]&amp;quot; article.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 124:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 124:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; font-size: smaller;&quot;&gt;To manually load the above configuration file to populate the SPD and SAD&amp;lt;ref name=&amp;quot;ftn27&amp;quot;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;sup&lt;/del&gt;&amp;gt;If using racoon, the SAs would be negotiated using information from the SPD on each machine, with the SAD then being populated by racoon calling the setkey services.&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/sup&amp;gt;&lt;/del&gt;&amp;lt;/ref&amp;gt; the following command would be used:&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;To manually load the above configuration file to populate the SPD and SAD&amp;lt;ref name=&amp;quot;ftn27&amp;quot;&amp;gt;If using racoon, the SAs would be negotiated using information from the SPD on each machine, with the SAD then being populated by racoon calling the setkey services.&amp;lt;/ref&amp;gt; the following command would be used:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;setkey -f &amp;lt;SPD_configuration_file&amp;gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;setkey -f &amp;lt;SPD_configuration_file&amp;gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>RichardHaines</name></author>	</entry>

	<entry>
		<id>http://selinuxproject.org/w/?title=NB_Networking&amp;diff=961&amp;oldid=prev</id>
		<title>RichardHaines: New page: = SELinux Networking Support = SELinux supports the following types of network labeling:  '''Internal labeling''' - This is where network objects are labeled and managed internally within ...</title>
		<link rel="alternate" type="text/html" href="http://selinuxproject.org/w/?title=NB_Networking&amp;diff=961&amp;oldid=prev"/>
				<updated>2010-05-18T14:19:40Z</updated>
		
		<summary type="html">&lt;p&gt;New page: = SELinux Networking Support = SELinux supports the following types of network labeling:  '''Internal labeling''' - This is where network objects are labeled and managed internally within ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= SELinux Networking Support =&lt;br /&gt;
SELinux supports the following types of network labeling:&lt;br /&gt;
&lt;br /&gt;
'''Internal labeling''' - This is where network objects are labeled and managed internally within a single machine (i.e. their labels are not transmitted as part of the session with remote systems). There are three types supported: those known as &amp;quot;compat_net&amp;quot; controls that label nodes, interfaces and ports; SECMARK that labels packets; and fallback peer labeling.&lt;br /&gt;
&lt;br /&gt;
'''Labeled Networking''' - This is where labels are passed to/from remote systems where they can be interpreted and a MAC policy enforced on each system. This is also known as &amp;quot;peer labeling&amp;quot;. There are two types supported: Labeled IPSec and CIPSO (commercial IP security option).&lt;br /&gt;
&lt;br /&gt;
Note that F-12 does not have NetLabel or IPSec tools installed as standard, therefore yum can be used to install them as shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install netlabel_tools&lt;br /&gt;
&lt;br /&gt;
yum install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== compat_net Controls ==&lt;br /&gt;
These labeling services make use of the [[NetworkStatements | Network Labeling Statements]] to label network object nodes, interfaces and ports with a security context that are then used to enforce controls. The [[NetworkStatements | Network Labeling Statements]] section defines each of the statements with examples of their usage.&lt;br /&gt;
&lt;br /&gt;
The [http://taiga.selinuxproject.org/~rhaines/diagrams/14-compat_net.png compat_net Controls] diagram shows how these network statements are used and the type of allow rules that would be required.&lt;br /&gt;
&lt;br /&gt;
In a future release of the Linux kernel these controls will be removed and replaced by the SECMARK services with the Reference Policy also being updated.&lt;br /&gt;
&lt;br /&gt;
== SECMARK ==&lt;br /&gt;
SECMARK makes use of standard the kernel NetFilter framework that underpins the GNU / Linux IP networking sub-system. NetFilter automatically inspects all incoming and outgoing packets and can place controls on interfaces, IP addresses (nodes) and ports with the added advantage of connection tracking. The SECMARK and CONNSECMARK are security extensions to the Netfilter iptables that allow security contexts to be added to packets (SECMARK) or sessions (CONNSECMARK) such as those used by ftp (as some applications within a single session can use a number of different ports, some fixed and others dynamically allocated).&lt;br /&gt;
&lt;br /&gt;
The NetFilter framework is used to inspect and tag packets with labels as defined within the iptables and then use the security framework (e.g. SELinux) to enforce the policy rules. Therefore SECMARK services are not SELinux specific as other security modules that use the LSM infrastructure could also implement the same services (e.g. SMACK).&lt;br /&gt;
&lt;br /&gt;
While the implementation of iptables / NetFilter is beyond the scope of this Notebook, there are tutorials available&amp;lt;ref name=&amp;quot;ftn19&amp;quot;&amp;gt;There is a very good tutorial at [http://iptables-tutorial.frozentux.net/iptables-tutorial.html http://iptables-tutorial.frozentux.net/iptables-tutorial.html].&amp;lt;/ref&amp;gt;. The [http://taiga.selinuxproject.org/~rhaines/diagrams/15-secmark.png SECMARK Processing] diagram shows the basic structure and the process works as follows:&lt;br /&gt;
&lt;br /&gt;
* A table called the &amp;quot;mangle table&amp;quot; is used to define the parameters that identify and &amp;quot;mark&amp;quot; packets that can then tracked as the packet travels through the networking sub-system. These &amp;quot;marks&amp;quot; are called SECMARK and CONNSECMARK.&lt;br /&gt;
* A SECMARK is placed against a packet if it matches an entry in the mangle table. This marker is used to apply a security context (a label) that can then enforce policy on the packet.&lt;br /&gt;
* The CONNSECMARK &amp;quot;marks&amp;quot; all packets within a session&amp;lt;ref name=&amp;quot;ftn20&amp;quot;&amp;gt;For example, an ftp session where the server is listening on a specific port (the destination port) but the client will be assigned a random source port. The CONNSECMARK will ensure that all packets for the ftp session are marked with the same label.&amp;lt;/ref&amp;gt; with the appropriate label that can then be used to enforce policy.&lt;br /&gt;
&lt;br /&gt;
An example iptables&amp;lt;ref name=&amp;quot;ftn21&amp;quot;&amp;gt;Note that the iptables will not load correctly if the policy does not allow the iptables domain to relabel the SECMARK labels (unless permissive mode is enabled).&amp;lt;/ref&amp;gt; entry is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Flush the mangle table first:&lt;br /&gt;
iptables -t mangle -F&lt;br /&gt;
&lt;br /&gt;
#----------------------------------- INPUT IP Stream ---------------------------------------------#&lt;br /&gt;
# This INPUT rule sets all packets to default_secmark_packet_t&lt;br /&gt;
iptables -t mangle -A INPUT -i lo -p tcp -d 127.0.0.0/8 -j SECMARK --selctx system_u:object_r:default_secmark_packet_t&lt;br /&gt;
&lt;br /&gt;
#------------------------------------ OUTPUT IP Stream -------------------------------------------#&lt;br /&gt;
# This OUTPUT rule sets all packets to default_secmark_packet_t&lt;br /&gt;
iptables -t mangle -A OUTPUT -o lo -p tcp -d 127.0.0.0/8 -j SECMARK --selctx system_u:object_r:default_secmark_packet_t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example loadable module that makes use of SECMARK services is described in the Building the SECMARK Test Loadable Module section of volume 2, there is also an article &amp;quot;[http://james-morris.livejournal.com/11010.html New secmark-based network controls for SELinux]&amp;quot; that explains the services.&lt;br /&gt;
&lt;br /&gt;
As stated in the compat_net Controls section above, SECMARK will be replacing these and there is an article &amp;quot;[http://paulmoore.livejournal.com/4281.html Transitioning to Secmark]&amp;quot; that explains the transition.&lt;br /&gt;
&lt;br /&gt;
== NetLabel - Fallback Peer Labeling ==&lt;br /&gt;
Fallback labeling can optionally be implemented on a system if the Labeled IPSec or CIPSO is not being used (hence &amp;quot;fallback labeling&amp;quot;). If either Labeled IPSec or CIPSO are being used, then these take priority. There is an article &amp;quot;[http://paulmoore.livejournal.com/1758.html Fallback Label Configuration Example]&amp;quot; that explains the usage.&lt;br /&gt;
&lt;br /&gt;
The example message filter has an optional module that makes use of fallback labels as explained in the Overview of modules section of volume 2. &lt;br /&gt;
&lt;br /&gt;
The network peer controls has been extended to support an additional object class of &amp;quot;peer&amp;quot;, although by default this is not enabled in F-12. To enabled this functionality the policy capability needs to be set as explained in the NetLabel Module Support for network_peer_controls section of the Sample Policy Source volume 2 where an example loadable module is given. The [http://taiga.selinuxproject.org/~rhaines/diagrams/16-fallback.png Fallback Labeling] diagram shows the differences between the policy capability &amp;lt;tt&amp;gt;network_peer_controls&amp;lt;/tt&amp;gt; set to 0 and 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Labeled IPSec ==&lt;br /&gt;
Labeled IPSec has been built into the standard GNU / Linux IPSec services as described in the &amp;quot;[http://nsrc.cse.psu.edu/tech_report/NAS-TR-0037-2006.pdf Leveraging IPSec for Distributed Authorization]&amp;quot; document. The [http://taiga.selinuxproject.org/~rhaines/diagrams/17-ipsec.png IPSec communications] diagram shows the basic components that form the IPSec service where it is generally used to set up either an encrypted tunnel between two machines&amp;lt;ref name=&amp;quot;ftn22&amp;quot;&amp;gt;Also known as a virtual private network (VPN).&amp;lt;/ref&amp;gt; or an encrypted transport session. The extensions defined in the &amp;quot;[http://nsrc.cse.psu.edu/tech_report/NAS-TR-0037-2006.pdf Leveraging IPSec for Distributed Authorization]&amp;quot; document describe how the security context is used and negotiated between the two systems (called security associations (SAs) in IPSec terminology).&lt;br /&gt;
&lt;br /&gt;
Basically what happens is as follows&amp;lt;ref name=&amp;quot;ftn23&amp;quot;&amp;gt;There is an &amp;quot;IPSec HOWTO&amp;quot; at [http://www.ipsec-howto.org/ http://www.ipsec-howto.org] that gives the gory details, however it does not cover Labeled IPSec.&amp;lt;/ref&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
# The security policy database (SPD) defines the security communications characteristics to be used between the two systems. This is populated using the setkey(8) utility and an example is shown below.&lt;br /&gt;
# The SAs have their configuration parameters such as protocols used for securing packets, encryption algorithms and how long the keys are valid held in the Security Association database (SAD). For Labeled IPSec the security context (or labels) is also defined within the SAD. SAs can be negotiated between the two systems using either racoon(8)&amp;lt;ref name=&amp;quot;ftn24&amp;quot;&amp;gt;This is the Internet Key Exchange (IKE) daemon that exchanges encryption keys securely and also supports Labeled IPSec parameter exchanges.&amp;lt;/ref&amp;gt; that will automatically populate the SAD or manually by the setkey utility (see the example below).&lt;br /&gt;
# Once the SAs have been negotiated and agreed, the link should be active.&lt;br /&gt;
&lt;br /&gt;
A point to note is that SAs are one way only, therefore if two systems are communicating then (using the above example), one system will have an SA, SAout for processing outbound packets and another SA, SAin, for processing the inbound packets. The other system will also create two SAs for processing its packets. &lt;br /&gt;
&lt;br /&gt;
Each SA will share the same cryptographic parameters such as keys and protocol&amp;lt;ref name=&amp;quot;ftn25&amp;quot;&amp;gt;The GNU / Linux version supports a number of secure protocols, see the setkey man page for details.&amp;lt;/ref&amp;gt; such as AH (authentication header) and ESP (encapsulated security payload). &lt;br /&gt;
&lt;br /&gt;
The object class used for the association of an SA is association and the permissions available are as follows:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| &amp;lt;tt&amp;gt;polmatch&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Match the SPD context (-ctx) entry to an SELinux domain (that is contained in the SAD -ctx entry)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;recvfrom&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Receive from an IPSec association.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;sendto&amp;lt;/tt&amp;gt;&lt;br /&gt;
| Send to an IPSec association.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| setcontext&lt;br /&gt;
| Set the context of an IPSec association on creation (e.g. when running setkey the process will require this permission to set the context in the SAD and SPD, also racoon will need this permission to build the SAD).&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A worked example of a Labeled IPSec session showing manual and racoon&amp;lt;ref name=&amp;quot;ftn26&amp;quot;&amp;gt;&amp;lt;sup&amp;gt;Unfortunately racoon core dumps using the example base module decribed in volume 2 but does work using the standard Red Hat targeted policy.&amp;lt;/sup&amp;gt;&amp;lt;/ref&amp;gt; to configure the SAD is described in the Labeled IPSec Module Example section of the Sample Policy Source volume.&lt;br /&gt;
&lt;br /&gt;
There is a further example in the &amp;quot;[http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/ Secure Networking with SELinux]&amp;quot; article.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# setkey -f configuration file entries&lt;br /&gt;
#&lt;br /&gt;
# Flush the SAD and SPD&lt;br /&gt;
flush;&lt;br /&gt;
spdflush;&lt;br /&gt;
&lt;br /&gt;
# Security Association Database entries. &lt;br /&gt;
# 1) There would be another SAD entry on the other system (the client), where the IP addresses would be reversed.&lt;br /&gt;
# 2) The security context must be that of the running application.&lt;br /&gt;
&lt;br /&gt;
add 172.16.96.30 172.16.96.31 esp 0x201&lt;br /&gt;
-ctx 1 1 &amp;quot;user_u:message_filter_r:ext_gateway_t&amp;quot; &lt;br /&gt;
-E 3des-cbc 0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831;&lt;br /&gt;
&lt;br /&gt;
# Security Policy Database entries. &lt;br /&gt;
# 1) there would be another SPD entry on the other system (the client), where the IP addresses would be reversed.&lt;br /&gt;
# 2) The security context must be valid (i.e. defined in the active policy as it will be used by the polmatch permission &lt;br /&gt;
#    process to find a matching domain. (note only the &amp;quot;type&amp;quot; field is used unlike the SAD, where the context is the active process).&lt;br /&gt;
&lt;br /&gt;
# SAin&lt;br /&gt;
spdadd 172.16.96.30 172.16.96.31 any&lt;br /&gt;
-ctx 1 1 &amp;quot;system_u:object_r:ext_gateway_t&amp;quot;&lt;br /&gt;
-P in ipsec esp/transport//require;&lt;br /&gt;
# SAout&lt;br /&gt;
spdadd 172.16.96.31 172.16.96.30 any&lt;br /&gt;
-ctx 1 1 &amp;quot;system_u:object_r:ext_gateway_t&amp;quot;&lt;br /&gt;
-P out ipsec esp/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To manually load the above configuration file to populate the SPD and SAD&amp;lt;ref name=&amp;quot;ftn27&amp;quot;&amp;gt;&amp;lt;sup&amp;gt;If using racoon, the SAs would be negotiated using information from the SPD on each machine, with the SAD then being populated by racoon calling the setkey services.&amp;lt;/sup&amp;gt;&amp;lt;/ref&amp;gt; the following command would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setkey -f &amp;lt;SPD_configuration_file&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NetLabel - CIPSO ==&lt;br /&gt;
To allow security levels to be passed over a network between MLS systems&amp;lt;ref name=&amp;quot;ftn28&amp;quot;&amp;gt;Note only the security levels are passed over as the SELinux security context is not part of a standard MLS system (as SELinux supports two MAC services (Type Enforcement and MLS)).&amp;lt;/ref&amp;gt;, the CIPSO protocol is used that is defined in the [http://tools.ietf.org/html/draft-ietf-cipso-ipsecurity-01 CIPSO Internet Draft] document (this is an obsolete document, however the protocol is still in use). The protocol defines how security levels are encoded in the IP packet header.&lt;br /&gt;
&lt;br /&gt;
The protocol is implemented by the NetLabel service and can be used by other security modules that use the LSM infrastructure. The NetLabel implementation supports:&lt;br /&gt;
&lt;br /&gt;
# Tag Type 1 bit mapped format that allows a maximum of 256 sensitivity levels and 240 categories to be mapped.&lt;br /&gt;
# A non-translation option where labels are passed to / from systems unchanged (for host to host communications as show in the [http://taiga.selinuxproject.org/~rhaines/diagrams/18-mls1.png MLS Systems on the same network] diagram).&lt;br /&gt;
# A translation option where both the sensitivity and category components can be mapped for systems that have either different definitions for labels or information can be exchanged over different networks (for example using an SELinux enabled gateway as a guard as shown in the [http://taiga.selinuxproject.org/~rhaines/diagrams/19-mls2.png MLS Systems on different networks communicating via a gateway] diagram).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>RichardHaines</name></author>	</entry>

	</feed>