<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TuXHaT&#187; Selinux Archives  &#8211; Blog Title</title>
	<atom:link href="http://www.tuxhat.com/category/linux/selinux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tuxhat.com</link>
	<description>Linux / sysadmin / Debian / Ubuntu / Red Hat / Centos</description>
	<lastBuildDate>Tue, 13 Oct 2009 07:25:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>selinux denials on 3ware RAID SMART check</title>
		<link>http://www.tuxhat.com/linux/selinux-denials-and-smartd-in-linux/</link>
		<comments>http://www.tuxhat.com/linux/selinux-denials-and-smartd-in-linux/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 10:02:40 +0000</pubDate>
		<dc:creator>tux</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Selinux]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[3ware RAID]]></category>
		<category><![CDATA[SMART]]></category>
		<category><![CDATA[smartd]]></category>

		<guid isPermaLink="false">http://www.tuxhat.com/?p=54</guid>
		<description><![CDATA[  If you have a selinux enabled linux machine and is using smartd to check hard drives connected to 3ware RAID controller, you may encounter with couple of denials as below,
 kernel: type=1400 audit(1252046658.420:122): avc:  denied  { ioctl } for  pid=28988 comm=&#8221;smartd&#8221; path=&#8221;/dev/twa0&#8243; dev=tmpfs ino=7729 scontext=root:system_r:fsdaemon_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file
kernel: type=1400 audit(1252049165.256:123): avc: [...]]]></description>
			<content:encoded><![CDATA[<p>  If you have a selinux enabled linux machine and is using smartd to check hard drives connected to 3ware RAID controller, you may encounter with couple of denials as below,</p>
<p> kernel: type=1400 audit(1252046658.420:122): avc:  denied  { ioctl } for  pid=28988 comm=&#8221;smartd&#8221; path=&#8221;/dev/twa0&#8243; dev=tmpfs ino=7729 scontext=root:system_r:fsdaemon_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file</p>
<p>kernel: type=1400 audit(1252049165.256:123): avc:  denied  { getattr } for  pid=18264 comm=&#8221;smartd&#8221; path=&#8221;/dev/twa0&#8243; dev=tmpfs ino=7729 scontext=user_u:system_r:fsdaemon_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file</p>
<p> kernel: type=1400 audit(1252049165.258:124): avc:  denied  { read } for  pid=18264 comm=&#8221;smartd&#8221; name=&#8221;twa0&#8243; dev=tmpfs ino=7729 scontext=user_u:system_r:fsdaemon_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file</p>
<p> kernel: type=1400 audit(1252049165.258:125): avc:  denied  { ioctl } for  pid=18264 comm=&#8221;smartd&#8221; path=&#8221;/dev/twa0&#8243; dev=tmpfs ino=7729 scontext=user_u:system_r:fsdaemon_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file</p>
<p> For default the 3ware RAID controller device /dev/twa0 will be having generic filecontext for /dev which is device_t. But smartd runs under context fsdaemon_t, which do not have access to object type device_t.</p>
<p>  So you need to relabel /dev/twa0 as below,</p>
<pre>chcon -t fixed_disk_device_t /dev/twa*</pre>
<p>Conclusion:</p>
<p> fsdaemon_t can operate on object types fixed_disk_device_t</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tuxhat.com/linux/selinux-denials-and-smartd-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting selinux</title>
		<link>http://www.tuxhat.com/linux/troubleshooting-selinux/</link>
		<comments>http://www.tuxhat.com/linux/troubleshooting-selinux/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 06:45:37 +0000</pubDate>
		<dc:creator>tux</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Selinux]]></category>
		<category><![CDATA[centos 5]]></category>
		<category><![CDATA[selinux for production]]></category>
		<category><![CDATA[selinux on centos5]]></category>

		<guid isPermaLink="false">http://www.tuxhat.com/?p=36</guid>
		<description><![CDATA[I have been recently working on Selinux. It was way invented on 1970&#8217;s, but it is getting great acceptance as a user space security standard these days.
So I was implementing selinux for my production servers,  I can&#8217;t go directly with enforcing mode. But stay with permissive mode and watch avc denials from selinux and [...]]]></description>
			<content:encoded><![CDATA[<p>I have been recently working on Selinux. It was way invented on 1970&#8217;s, but it is getting great acceptance as a user space security standard these days.</p>
<p>So I was implementing selinux for my production servers,  I can&#8217;t go directly with enforcing mode. But stay with permissive mode and watch avc denials from selinux and justify it for it to be allowed / denied. The tiering thing is you need to go through each and every selinux denials from the kernel log facility in syslog. More over one type of denial will be repeated thousands time a day. So I thought of a simple script to unique the duplicate denials. Please see below,</p>
<p>Usage :  avc_uniquer.sh &lt;file containing selinux denials&gt;</p>
<p>avc_uniquer.sh</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;color: #FCFFBA;"><span style="color: #000000; font-weight: bold;color: #B83A24;">for</span> n <span style="color: #000000; font-weight: bold;color: #B83A24;">in</span> <span style="color: #000000; font-weight: bold;color: #CCC;">`</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">cat</span> <span style="color: #660033;">-n</span> $<span style="color: #000000;color: #DDD;">1</span> <span style="color: #000000; font-weight: bold;color: #CCC;">|</span> <span style="color: #c20cb9; font-weight: bold;color: #577A61;">sed</span>  <span style="color: #ff0000;">'s/\(\ *[[:digit:]]\{1,\}\ *\)\(.*\)\({.*}\)\(.*\)\(scontext.*\)/\1\ \3\ \5/; '</span><span style="color: #000000; font-weight: bold;color: #CCC;">|</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">sort</span> -k3<span style="color: #000000; font-weight: bold;color: #CCC;">|</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">uniq</span> <span style="color: #660033;">-f</span> <span style="color: #000000;color: #DDD;">2</span><span style="color: #000000; font-weight: bold;color: #CCC;">|</span><span style="color: #c20cb9; font-weight: bold;color: #577A61;">awk</span> <span style="color: #7a0874; font-weight: bold;color: #CCC;">&#123;</span><span style="color: #ff0000;">'print $1'</span><span style="color: #7a0874; font-weight: bold;color: #CCC;">&#125;</span><span style="color: #000000; font-weight: bold;color: #CCC;">`</span>;
<span style="color: #000000; font-weight: bold;color: #B83A24;">do</span>
<span style="color: #c20cb9; font-weight: bold;color: #577A61;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;color: #666666;">&quot;<span style="color: #007800;">$n</span> p&quot;</span> $<span style="color: #000000;color: #DDD;">1</span>;
<span style="color: #000000; font-weight: bold;color: #B83A24;">done</span></pre></div></div>

<p>TIP1:</p>
<pre>
avc_uniquer.sh &lt;filename&gt;|audit2allow
</pre>
<p>The above will give you the selinux rules corresponding to the denials.</p>
<p>Eg:</p>
<pre>Tue Jul 21 11:11:39 IST 2009$avc_uniquer.sh selinux_denial |audit2allow
allow smbd_t httpd_sys_content_t:dir { add_name create write };
allow smbd_t httpd_sys_content_t:file { create getattr lock read write };</pre>
<p>Hope it will be helpful for some <img src='http://www.tuxhat.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tuxhat.com/linux/troubleshooting-selinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
