<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>ClearNet Security: Quickly allowing SELinux to run an application</title>
    <link>http://blog.clearnetsec.com/articles/2006/07/31/quickly-allowing-selinux-to-run-an-application</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Quickly allowing SELinux to run an application</title>
      <description>&lt;p&gt;
I've been setting up&amp;nbsp; &lt;a href="http://www.nsa.gov/selinux/"&gt;SELinux&lt;/a&gt; from scratch for a machine lately.&amp;nbsp;&amp;nbsp; Here is the quick and dirty way to let an application run that doesn't have permissions.
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
Copy the log messages for the blocked application to a file, say tomcatlog.msg which looks something like this:&lt;br /&gt;

&lt;/p&gt;

&lt;p&gt;
avc:&amp;nbsp; denied&amp;nbsp; { ioctl } for&amp;nbsp; pid=6256 comm=&amp;quot;su&amp;quot; name=&amp;quot;tomcat.log&amp;quot; dev=tmpfs ino=23418 scontext=system_u:system_r:initrc_su_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
run audit2allow which compiles the log message in to an selinux package:
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
audit2allow -M tomcatlog &amp;lt; ./tomcatlog.msg
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
Then load the new selinux package into selinux with semodule:
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
sudo /usr/sbin/semodule -i tomcatlog.pp&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;

&lt;p&gt;
I don't recommend building a whole system this way but after beating on it for a while this is just a really easy way to allow something to run.&amp;nbsp;
&lt;/p&gt;
&lt;!-- technorati tags begin --&gt;&lt;p style="font-size:10px;text-align:right;"&gt;technorati tags: &lt;a href="http://technorati.com/tag/linux" rel="tag"&gt;linux&lt;/a&gt;, &lt;a href="http://technorati.com/tag/selinux" rel="tag"&gt;selinux&lt;/a&gt;&lt;/p&gt;&lt;!-- technorati tags end --&gt;

</description>
      <pubDate>Mon, 31 Jul 2006 06:30:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:5686a4e1-23df-4bcb-bb78-dc4e47b45c1e</guid>
      <author>ian@ClearNetSec.com (Ian S. Nelson)</author>
      <link>http://blog.clearnetsec.com/articles/2006/07/31/quickly-allowing-selinux-to-run-an-application</link>
      <category>linux</category>
      <category>selinux</category>
    </item>
  </channel>
</rss>
