<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">

<channel>
	<title>Planet SELinux</title>
	<link>http://selinuxnews.org/planet/</link>
	<language>en</language>
	<description>Planet SELinux - http://selinuxnews.org/planet/</description>

<item>
	<title>James Morris: Reminder: CFP for the 2012 Linux Security Summit closes in 1 week!</title>
	<guid>http://blog.namei.org/?p=535</guid>
	<link>http://blog.namei.org/2012/05/17/reminder-cfp-for-the-2012-linux-security-summit-closes-in-1-week/</link>
	<description>&lt;p&gt;A reminder for folks planning to submit proposals for the upcoming &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;Linux Security Summit&lt;/a&gt; in San Diego &amp;#8212; the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012#Call_for_Participation&quot;&gt;CFP&lt;/a&gt; closes on the 23rd of May, a week from now.&lt;/p&gt;
&lt;p&gt;LSS is one of &lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon/co-located-events&quot;&gt;eight co-located developer events&lt;/a&gt; at &lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon&quot;&gt;LinuxCon&lt;/a&gt; this year, including the Kernel Summit and Plumbers.   It&amp;#8217;s shaping up to be an epic event!&lt;/p&gt;</description>
	<pubDate>Wed, 16 May 2012 21:45:17 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>James Morris: Kernel Security Talk at LinuxCon Japan</title>
	<guid>http://blog.namei.org/?p=533</guid>
	<link>http://blog.namei.org/2012/05/02/kernel-security-talk-at-linuxcon-japan/</link>
	<description>&lt;p&gt;Just to let folk know &amp;#8212; I&amp;#8217;ll be giving a talk on the state of Linux kernel security development at&lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon-japan&quot;&gt; LinuxCon Japan&lt;/a&gt; in Yokohama on June 8th.  From the abstract:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;In this talk, we&amp;#8217;ll examine the current state of the Linux kernel security subsystem. Starting with a brief overview of existing features, we&amp;#8217;ll discuss recent developments, current efforts and future directions. We&amp;#8217;ll also discuss the evolving threat landscape, and the increasing need for mobile and cloud security. This will be a high-level technical discussion aimed at IT professionals. A good general knowledge of operating system and computer security concepts will be advantageous.
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;#8217;ll also likely be in Tokyo briefly &amp;#8212; if any kernel security development folk there want to meet up, let me know.&lt;/p&gt;</description>
	<pubDate>Wed, 02 May 2012 01:57:49 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part X - Firewalld</title>
	<guid>http://danwalsh.livejournal.com/56179.html</guid>
	<link>http://danwalsh.livejournal.com/56179.html</link>
	<description>&lt;p&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/FirewallD&quot; rel=&quot;nofollow&quot;&gt;FirewallD is a service daemon with a D-BUS interface that provides a dynamic managed firewall.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It will be the default firewall in Fedora 18, but will be available to run in Fedora 17.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NOTE:&amp;nbsp; I was informed that this feature was supposed to be default in Fedora 17, but has been decided to wait until Fedora 18.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The problem with the previous firewall model was that it was static, you would need to basically reload the firewall rules any time you made a change, and this would break established connections.&amp;nbsp; This is a real problem for virtualization (libvirt), since you might be changing your firewall often bringing up and down virtual machines.&amp;nbsp; FirewallD provides a daemon that applications can talk to over DBUS, to request modifications to firewall rules.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Another nice feature would be to allow a user to have rules that control firewall rules depending on the wireless network to which they connect.&amp;nbsp; For example NetworkManager could come up with a question of whether this is the Home Network, Work Network or Public Network.&amp;nbsp;&amp;nbsp; Firewall rules might allow Avahi to connect if you are on a Home or Work network but not a Public Network.&lt;br /&gt;&lt;br /&gt;In the future I would like to add make FirewallD a SELinux Userpace Manager.&amp;nbsp; This would allow a policy writer could to control which applications are able to manipulate firewall rules pertaining to which ports.&amp;nbsp; Something like&lt;br /&gt;&lt;br /&gt;allow cupsd_t cups_port_t:tcp_firewall { open close };&lt;/p&gt;</description>
	<pubDate>Wed, 25 Apr 2012 12:37:48 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part IX - File Name Transitions</title>
	<guid>http://danwalsh.livejournal.com/55837.html</guid>
	<link>http://danwalsh.livejournal.com/55837.html</link>
	<description>&lt;a href=&quot;http://danwalsh.livejournal.com/46018.html&quot;&gt;File Name Transitions were introduced to the kernel in Fedora 16 by Eric Paris.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Eric actually expected policy writers to only add a few dozen file name transition rules, well in Fedora 17 we now have nearly 100,000 rules:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sesearch -T /etc/selinux/targeted/policy/policy.27 | grep \&amp;quot; | wc -l&lt;br /&gt;94736&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Most of these rules are to make devices created in /dev and files/directories created by the unconfined/admin processes be labelled correctly.&amp;nbsp; A common problem users of SELinux have seen was when an unconfined_t user creating /root/.ssh or $HOME/.ssh.&amp;nbsp; Then they would place authorization content in the directory.&amp;nbsp; When they tried to use the content to gain access to the system via sshd, sshd would be blocked from the directory by SELinux because the directory and its contents had the wrong label.&amp;nbsp; The user needs to run &lt;span&gt;restorecon -R -v /root/.ssh&lt;/span&gt; to fix the labels.&lt;br /&gt;&lt;br /&gt;Before File Name Transitions the directory would be created with the label based on the label of /root, admin_home_t.&amp;nbsp;&amp;nbsp; But as of Fedora 16 Policy Writers write rules that say:&amp;nbsp; &amp;quot;If the &lt;span&gt;unconfined_t&lt;/span&gt; user creates a &lt;span&gt;directory&lt;/span&gt; named &lt;span&gt;.ssh&lt;/span&gt; in a directory labelled &lt;span&gt;admin_home_&lt;/span&gt;t, it will get created as &lt;span&gt;ssh_home_t&lt;/span&gt;.&amp;quot;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;span&gt;type_transition unconfined_t admin_home_t : dir ssh_home_t &amp;quot;.ssh&amp;quot;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How is this a security feature?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/43170.html&quot;&gt;I explained in a previous blog, there are three ways content gets labeled within a directory.&lt;/a&gt;&amp;nbsp; The File Transition rule is a mechanism the policy writer has used since SELinux was first developed to create content within a directory with a different label then the directories label.&amp;nbsp; Policy writers wrote rules that said if a process running as &lt;span&gt;NetworkManager_t&lt;/span&gt; created a &lt;span&gt;file&lt;/span&gt; in a directory labeled &lt;span&gt;etc_t&lt;/span&gt; it would be labeled &lt;span&gt;net_conf_t.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;span&gt;type_transition NetworkManager_t etc_t : file net_conf_t; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Or if a process running as &lt;span&gt;mozilla_t &lt;/span&gt;created a &lt;span&gt;directory&lt;/span&gt; in a directory labeled &lt;span&gt;user_home_dir_t&lt;/span&gt;, it would get created as &lt;span&gt;mozilla_home_t&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; type_transition mozilla_t user_home_dir_t : dir mozilla_home_t;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But this is not very fine grained control.&amp;nbsp; A hacked NetworkManager could create any file in a any directory labeled etc_t, if it did not exist.&amp;nbsp; If /etc/passwd did not exist for some reason SELinux would not block a confined NetworkManager from creating its own /etc/passwd.&amp;nbsp; A hacked firefox running as mozilla_t would not be blocked from creating a missing $HOME/.ssh directory.&lt;br /&gt;&lt;br /&gt;With File Name Transition rules, policy writers can now specify the file name.&amp;nbsp; Meaning we can writer finer grained control.&amp;nbsp; We can say NetworkManager can only create the &amp;quot;resolv.conf&amp;quot; file in a directory labeled etc_t or a &amp;nbsp; confined firefox can only create the .mozilla directory in a users home directory&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/54092.html&quot;&gt;As an example of this the Thumbnail confinement added in Fedora 17 has:&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;type_transition thumb_t user_home_dir_t : file thumb_home_t &amp;quot;missfont.log&amp;quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir thumb_home_t &amp;quot;.thumbnails&amp;quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &amp;quot;.gstreamer-12&amp;quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &amp;quot;.gstreamer-10&amp;quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &amp;quot;.gstreamer-0.10&amp;quot;;&lt;br /&gt;type_transition thumb_t user_home_dir_t : dir gstreamer_home_t &amp;quot;.gstreamer-0.12&amp;quot;; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Which means thumbnailers running as thumb_t can only create a file labelled missfont.log or directories labeled .thumbnails or .gstreamer-* in the home directory.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Nice job Eric, you increased the Security of SELinux and made it easier to use at the same time!&lt;/span&gt;</description>
	<pubDate>Tue, 24 Apr 2012 14:12:18 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Russell Coker (security): Neighborhood Watch</title>
	<guid>http://etbe.coker.com.au/?p=3263</guid>
	<link>http://etbe.coker.com.au/2012/04/23/neighborhood-watch/</link>
	<description>&lt;p&gt;While writing my previous post I heard a huge noise at the front of my house. I found one man being restrained in a seated position on the ground at my front door, the man who was holding him down was accusing him of theft and asking me to call the police, and a woman was hanging around and crying.&lt;/p&gt;
&lt;p&gt;When calling the police I discovered that Optus (the Telco that provides the virtual service which Virgin Mobile uses) doesn&amp;#8217;t accept 112 as an emergency number! This combined with the fact that CyanogenMod 7 on my phone doesn&amp;#8217;t accept 000 as an emergency number meant that I had to unlock my phone before calling the police. Unlocking your phone late at night when there&amp;#8217;s a situation that needs police attention isn&amp;#8217;t as easy as you would hope. As an aside there are usually no penalties for testing the emergency service on your phone, people who install PABX systems and other significant telephony devices test emergency services calls as a matter of routine, so testing emergency calls from your phone is a really good idea. If anyone knows how to configure CyanogenMod 7 to support 000 as an emergency call then please let me know!&lt;/p&gt;
&lt;p&gt;Anyway the man who was held down claimed that a friend of his had given him a bag containing tools that he had lugged from some place not particularly near my house. The man who was holding him down said that he witnessed the other man stealing the tools from his neighbor &amp;#8211; not far from my house. The woman was apparently the girlfriend of the man who was accused of burglary.&lt;/p&gt;
&lt;p&gt;The end result was that the police arrested the man who was accused of burglary and his girlfriend. He didn&amp;#8217;t have any obvious injuries and the police said that the man who detained him did them a favor, so it seems unlikely that there will be any assault charges filed. Presumably the man who detained the burglar is explaining it all at the police station now, I hope the police gave him a chance to put on pants and shoes first.&lt;/p&gt;
&lt;p&gt;The man who made the burglary accusation said that his house was robbed last night which is why he was more observant than usual tonight.&lt;/p&gt;
&lt;p&gt;This makes me glad of my policy of rejecting every job offer which involves moving to the US. In Australia hand guns are really hard to get so there&amp;#8217;s no way that a house burglary will involve a gun and there&amp;#8217;s also no way that someone who wants to help the police will have a gun. So while it was unpleasant to have this happen at my front door it didn&amp;#8217;t involve any risk to me. It could have ended up with someone other than me getting a beating but the probability of serious injury or death for them was quite low. As everyone knew that no-one had a gun and no-one wanted to be charged with assault it made sense for everyone to avoid excessive force. From what I saw no excessive force was used.&lt;/p&gt;
&lt;p&gt;The police arrived fairly quickly and EVERYONE was glad to see them. All up it took a bit more than 30 minutes from the first noise to the police departing after arresting both suspects and filling out a bunch of paperwork. I was impressed by that!&lt;/p&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2011/12/05/cyanogenmod-galaxy-s/&quot; rel=&quot;bookmark&quot; title=&quot;CyanogenMod and the Galaxy S&quot;&gt;CyanogenMod and the Galaxy S&lt;/a&gt; &lt;small&gt;Thanks to some advice from Philipp Kern I have now...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Sun, 22 Apr 2012 16:00:28 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>James Morris: 2012 Linux Security Summit (San Diego) – Call for Particpation</title>
	<guid>http://blog.namei.org/?p=529</guid>
	<link>http://blog.namei.org/2012/04/13/2012-linux-security-summit-san-diego-call-for-particpation/</link>
	<description>&lt;p&gt;The &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;2012 Linux Security Summit&lt;/a&gt; (LSS) has been &lt;a href=&quot;http://marc.info/?l=linux-security-module&amp;#038;m=133423790901851&amp;#038;w=2&quot;&gt;announced&lt;/a&gt;.  The CFP is open from now until the 23rd of May.&lt;/p&gt;
&lt;p&gt;This year, the summit will be a two-day event, co-located with &lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon&quot;&gt;LinuxCon&lt;/a&gt;, &lt;a href=&quot;http://www.linuxplumbersconf.org/2012/&quot;&gt;Linux Plumbers&lt;/a&gt;, and the &lt;a href=&quot;https://events.linuxfoundation.org/events/linux-kernel-summit&quot;&gt;Kernel Summit&lt;/a&gt;.  We&amp;#8217;re planning on holding developer break-out sessions for much of the second day, and extending the length of the main talks to the more traditional 45 minute + 15 minute break format.   There will still be shorter 30 minute talks, and roundtable discussions.&lt;/p&gt;
&lt;p&gt;Check out the programs from previous years to see what kind of proposals have been previously accepted:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://security.wiki.kernel.org/articles/l/i/n/LinuxSecuritySummit2011_Schedule_14a8.html&quot;&gt;LSS 2011&lt;/a&gt;, Santa Rosa&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://security.wiki.kernel.org/articles/l/i/n/LinuxSecuritySummit2010_Schedule_e566.html&quot;&gt;LSS 2010&lt;/a&gt;, Boston&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Send your proposals to the program committee per the &lt;a href=&quot;http://marc.info/?l=linux-security-module&amp;#038;m=133423790901851&amp;#038;w=2&quot;&gt;announcement&lt;/a&gt;.&lt;/p&gt;</description>
	<pubDate>Thu, 12 Apr 2012 14:00:09 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Russell Coker (security): The Security Benefits of Automation</title>
	<guid>http://etbe.coker.com.au/?p=3232</guid>
	<link>http://etbe.coker.com.au/2012/03/30/security-benefits-automation/</link>
	<description>&lt;h3&gt;Some Random WTFs&lt;/h3&gt;
&lt;p&gt;The Daily WTF is an educational and amusing site that recounts anecdotes about failed computer projects. One of their stories &lt;a href=&quot;http://thedailywtf.com/Articles/Remotely-Incompetent.aspx&quot;&gt;titled &amp;#8220;Remotely Incompetent&amp;#8221; concerns someone who breaks networking on a server and is then granted administrative access to someone else&amp;#8217;s server by the Data Center staff [1]&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;In one of the discussions about that I saw people make various claims about Data Center security, such as claiming that having their own locked room helps. My experience indicates that such things don&amp;#8217;t do much good, I have often been granted access to server rooms without appropriate checks.&lt;/p&gt;
&lt;p&gt;My experience is that security guards on site generally don&amp;#8217;t directly do any good. I once had a guard hold a door for me when I was removing a server from a DC without even bothering to ask for ID! On another occasion in the Netherlands I had a security guard who didn&amp;#8217;t speak English unlock the wrong server room for me, I used hand gestures to inform him that I needed access to the room with the big computers and he gave me the access I needed! It seems that the benefit of security guards is solely based on scaring people who don&amp;#8217;t have the confidence needed to bluff their way in. Preventing children from thieving is a good thing, &lt;/p&gt;
&lt;p&gt;On another occasion I showed ID and signed in for access to a DC owned by my employer and I used my security key to go through a locked door with a sign that promised many bad consequences if I failed to lock the door behind me. Then I discovered that the back door was wide open for the benefit of some electricians who were working in the building. Presumably the electricians who had no security training were expected to act as ad-hoc security guards if someone tried to enter through the back door &amp;#8211; presumably they would not have been good at it.&lt;/p&gt;
&lt;p&gt;When a company uses part of their own office for a server room then many of these problems disappear. But a common issue in such ad-hoc DCs is the lack of planning and procedures, I have lost count of the number of times I&amp;#8217;ve seen doors (and even windows) propped open to allow ventilation because there were too many servers for the air-conditioning to cope. The most ironic example of this is the company that had a walk-in safe (think of a small bank vault with concrete walls and thick solid steel door) used for storing servers but with it&amp;#8217;s door propped open to allow cooling. The advantage of a serious hosting company is that they will have procedures for cooling etc and will be very unlikely to do strange and silly things.&lt;/p&gt;
&lt;p&gt;Having a locked room in a DC makes some sense, but if security guards have the master keys and are allowed to use them then it might not do much good. The one time I locked my keys in such a room I had a guard let me in without verifying my ID or the claim that there were actually keys locked in the room. Presumably anyone could just claim to have forgotten their keys and get the door unlocked &amp;#8211; just like a cheap hotel.&lt;/p&gt;
&lt;p&gt;Locking a rack sounds like a good idea, but the racks I&amp;#8217;ve seen have had locks which are quite easy to pick. On the one occasion when I had to pick a lock on a rack (due to keys being too difficult to manage for the relevant people) the security guards didn&amp;#8217;t investigate, so either the security cameras were not supervised or they just didn&amp;#8217;t care about people picking locks in a shared server room. Also if you allow people to do things freely in a shared server room they could install devices to monitor network traffic.&lt;/p&gt;
&lt;p&gt;A locked cage in a server room should work well. In the one case where I worked for a company that used such a cage I found it to mostly work well &amp;#8211; apart from the few weeks when the lock was broken.&lt;/p&gt;
&lt;p&gt;One company that I worked for had scales before the door between a server room and the car-park to prevent people from stealing heavy servers. Of course that wouldn&amp;#8217;t stop people stealing hard drives full of data which is worth more than the servers! Also an over-weight colleague had to have the scales disabled for him (as they were based on absolute mass not unexpected changes in an individual&amp;#8217;s mass) which presumably means that any skinny employee could steal a 2RU server and still be below the mass threshold.&lt;/p&gt;
&lt;h3&gt;How to Solve some of these Problems&lt;/h3&gt;
&lt;p&gt;Computers are subject to all manner of security problems. But they tend not to do arbitrary things for no apparent reason and they will never give in to someone who is charming, attractive, or aggressive &amp;#8211; unlike humans.&lt;/p&gt;
&lt;p&gt;I have servers running on &lt;a href=&quot;http://www.hetzner.de/&quot;&gt;Hetzner&lt;/a&gt;, &lt;a href=&quot;http://www.linode.com/&quot;&gt;Linode&lt;/a&gt;, and &lt;a href=&quot;http://www.rackspace.com/cloud/&quot;&gt;the Rackspace Cloud&lt;/a&gt;. I am always concerned about possible security compromises. But I am not worried about someone climbing in a window of a server room or convincing a security guard to let them in through the door. All three of those hosting companies have the vast majority of interactions automated. I can change many aspects of the servers without involving ANY human interaction. Out of the three of those companies I have had some human interaction with Hetzner (who provide managed servers) when a hard drive needed to be replaced &amp;#8211; obviously replacing a disk in the wrong server would have been a significant system integrity issue even though everyone would be running RAID-1 and if Hetzner improperly disposed of the broken disk then there could be security issues &amp;#8211; but this is an unlikely mistake in the face of a rare occurrence. With Linode and the Rackspace Cloud (and the previous Slicehost hosting that was purchased by Rackspace) the most common interactions I have with employees of those companies are when my clients don&amp;#8217;t pay their bills on time &amp;#8211; and that&amp;#8217;s an administrative not a technical issue. When I do have to contact the support people about a technical issue it&amp;#8217;s usually something that&amp;#8217;s not immediately connected to the virtual server (EG a loss of routing to the DC).&lt;/p&gt;
&lt;p&gt;It seems most likely that there are a fairly small number of people who are allowed in the DCs for companies like Hetzner, Linode, and Rackspace. Those people would probably be recognised by the security guards and their work would be restricted to replacing failing hardware and not involve granting access requests. There are some unusual requests that they can process (EG one of my clients recently transferred a virtual server between business units) but even in those cases the administrative software controls who gets access. This is much better than just handing hardware access to what seems to be the correct physical server to a client.&lt;/p&gt;
&lt;p&gt;If you have software running a few computers and operating correctly then you can probably scale it up to run thousands of computers and have it still work correctly. But if you have a team of people controlling access requests and want to scale it up significantly then there are huge problems in hiring skilled people and training them correctly. There is a real risk of security flaws in such administrative software, if someone managed to exploit the automated management system for one of those three companies then they could probably gain access to the private data of any of their customers. But the risk of this seems a lot less than the risk of general incompetence among humans who perform routine and boring tasks which have the potential for great errors.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://thedailywtf.com/Articles/Remotely-Incompetent.aspx&quot;&gt; http://thedailywtf.com/Articles/Remotely-Incompetent.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2008/10/07/the-security-benefits-of-being-unimportant/&quot; rel=&quot;bookmark&quot; title=&quot;The Security Benefits of Being Unimportant&quot;&gt;The Security Benefits of Being Unimportant&lt;/a&gt; &lt;small&gt;A recent news item is the &amp;#8220;hacking&amp;#8221; of the Yahoo...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/01/20/security-lessons-from-a-ferry/&quot; rel=&quot;bookmark&quot; title=&quot;Security Lessons from a Ferry&quot;&gt;Security Lessons from a Ferry&lt;/a&gt; &lt;small&gt;On Saturday I traveled from Victoria to Tasmania via the...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/10/05/public-security-cameras/&quot; rel=&quot;bookmark&quot; title=&quot;Public Security Cameras&quot;&gt;Public Security Cameras&lt;/a&gt; &lt;small&gt;There is ongoing debate about the issue of security cameras,...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Fri, 30 Mar 2012 12:42:29 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: runuser versus su</title>
	<guid>http://danwalsh.livejournal.com/55588.html</guid>
	<link>http://danwalsh.livejournal.com/55588.html</link>
	<description>&lt;p&gt;Many years ago, we noticed SELinux having problems with the su command.&amp;nbsp; Many confined domains were using su to switch user from root to some non privileged user.&amp;nbsp; But this would generate lots of bogus SELinux errors such as:&lt;br /&gt;&lt;br /&gt;Domain X_t wants to getattr on the fingerprint device or look at the pid file of the Smart Card reader.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;su using the pam_stack was the cause of these errors.&amp;nbsp; Depending on which pam_modules you had in the /etc/pam.d/su configuration, certain access would be checked.&amp;nbsp; Services using su do not want/need these side effects of using the pam stack.&amp;nbsp; SELinux policy writers do not want to allow the access or add dontaudit rules all over the place.&lt;br /&gt;&lt;br /&gt;In order to fix this, we built a new application called runuser.&amp;nbsp; runuser is actually built from the su.c source code.&amp;nbsp; You just define the RUNUSER constant when compiling su.c.&amp;nbsp; Basically runuser is just the su command with the pam stack removed as well as verifying the command is running as root, not setuid.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Whenever an service is running as root and wants to change UID using the shell it should use &lt;span&gt;runuser&lt;/span&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;When you are logged in to a shell as a user and want to become root, you should use su.&amp;nbsp; (Or better yet sudo)&lt;/p&gt;</description>
	<pubDate>Wed, 28 Mar 2012 12:40:09 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Eating my own dogfood.</title>
	<guid>http://danwalsh.livejournal.com/55324.html</guid>
	<link>http://danwalsh.livejournal.com/55324.html</link>
	<description>I am going on a trip tomorrow, I went to the Jet Blue web site to print my boarding pass.&amp;nbsp; The Jet Blue site has what I believe is a java application&amp;nbsp; running in the browser that displays your boarding pass.&amp;nbsp; I pressed the &amp;quot;Print&amp;quot; button on the screen and a print dialog came up, without any printers, and the &amp;quot;Print&amp;quot; button grayed out.&amp;nbsp;&amp;nbsp; I did not notice the, setroubleshoot warning in gnome 3.&amp;nbsp; Figuring the print application was just broken, I decided to select print from the browser.&amp;nbsp; Sadly the browser printed a blank page.&amp;nbsp; I then bad mouthed Firefox/Linux printing.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Mia Culpa&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I noticed that I had AVC's that looked like mozilla_plugin_t was trying to getattr on lpr_exec_t.&amp;nbsp;&amp;nbsp;&amp;nbsp; I put mozilla_plugin_t into permissive mode, to find out all the access required.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage permissive -a mozilla_plugin_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I went back to Jet Blue and tried to print the boarding pass again.&amp;nbsp; This time the printers showed up and I was able to print my boarding pass.&lt;br /&gt;&lt;br /&gt;Now I had AVC's that indicated&amp;nbsp; mozilla_plugin_t was executing lpr_exec_t.&amp;nbsp; Also lpr was connecting to the cups and gnome-keyring daemon.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should I transition or add allow rules for mozilla_plugin_t?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;As a policy writer I had to choice whether to allow mozilla_plugin_t all of these accesses or have mozilla_plugin_t transition to the lpr_t domain when it executes&amp;nbsp; /usr/bin/lpr.&amp;nbsp;&amp;nbsp; These decisions are key to writing good security policy.&amp;nbsp; My rule of thumb is if the domain i would transition to is very powerful, I hesitate to transition. &amp;nbsp; Especially if the parent application requires limited access when executing the child. For example a user can run rpm in their current domain (staff_T) to list all rpm packages, while if I allowed them to transition to the rpm_t domain, they would be allowed install rpm packages.&amp;nbsp; In the mozilla_plugin_t case the advantage of transitioning to lpr_t allows me to continue to prevent mozilla plugins from talking directly to the cups server and&amp;nbsp; the gnome-keyring and lpr_t is a very limited domain, so I chose to transition.&lt;br /&gt;&lt;br /&gt;My initial policy looked like this:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;policy_module(mypol, 1.0)&lt;br /&gt;&lt;br /&gt;require {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type mozilla_plugin_t;&lt;br /&gt;}&lt;br /&gt;lpd_domtrans_lpr(mozilla_plugin_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now I tried to print the boarding pass again, and now I had AVC's that stated lpr_t was trying to connect to keyring.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;audit2allow -R&lt;/span&gt; indicated that I should use:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;gnome_stream_connect_gkeyringd(lpr_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;audit2allow also showed that I was failing on Roles Based Access Control (RBAC).&amp;nbsp;&amp;nbsp; Users seldom see these types of errors. They show up in the log file as SELINUX_ERR rather then AVC.&lt;br /&gt;&lt;br /&gt;type=&lt;b&gt;SELINUX_ERR&lt;/b&gt; msg=audit(1332420617.119:909): security_compute_sid:&amp;nbsp; invalid context &lt;span&gt;staff_u:staff_r:lpr_t:s0-s0:c0.c1023&lt;/span&gt; for scontext=staff_u:staff_r:lpr_t:s0-s0:c0.c1023 tcontext=staff_u:staff_r:lpr_t:s0-s0:c0.c1023 tclass=unix_stream_socket&lt;br /&gt;&lt;br /&gt;This AVC is basically saying the &lt;span&gt;staff_u:staff_r:lpr_t:&lt;/span&gt;&lt;span&gt;s0-s0:c0.c1023&lt;/span&gt; is an invalid label.&lt;br /&gt;&lt;br /&gt;Hard to tell from this error what is wrong, but luckily audit2allow translates this into:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;role staff_r types lpr_t;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since I run with the staff_r role, I had to add an RBAC rule that would allow staff_r role to reach the lpr_t type.&lt;br /&gt;&lt;br /&gt;My final policy looks like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;policy_module(mypol, 1.0)&lt;br /&gt;require {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type mozilla_plugin_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type lpr_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; role staff_r;&lt;br /&gt;}&lt;br /&gt;lpd_domtrans_lpr(mozilla_plugin_t)&lt;br /&gt;role staff_r types lpr_t;&lt;br /&gt;gnome_stream_connect_gkeyringd(lpr_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice how I am transitioning from mozilla_plugin_t to lpr_t.&amp;nbsp; This does not mean staff_t will transition to lpr_t when running /usr/bin/lpr. &amp;nbsp;&lt;br /&gt;In fact, staff_t executes lpr in the staff_t domain, since the staff_t domain has the ability to connect to the cups and gnome-keyring daemons.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But when staff_t executes a firefox plugin, the plugin will transition to a locked down domain mozilla_plugin_t.&amp;nbsp; When the mozilla_plugin_t plugin executes /usr/bin/lpr, the lpr command will transition to the lpr_t domain.&lt;br /&gt;&lt;br /&gt;Printing now works well.&amp;nbsp; Now I can remove the permissive flag from mozilla_plugin_t.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage permissive -d mozilla_plugin_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have added all these rules into Fedora 17 policy, it should show up in the next policy update.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;This is why I live in Rawhide, I want to find problems before users do.&lt;/b&gt;</description>
	<pubDate>Thu, 22 Mar 2012 14:19:45 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Solution to /myapache labeling problem from yesterday...</title>
	<guid>http://danwalsh.livejournal.com/55229.html</guid>
	<link>http://danwalsh.livejournal.com/55229.html</link>
	<description>Twitter's @Plaimclock&amp;nbsp; tweeted me @&lt;a href=&quot;https://twitter.com/#!/rhatdan&quot; rel=&quot;nofollow&quot;&gt;rhatdan&lt;/a&gt; yester.&amp;nbsp;&lt;br /&gt;He pointed out that&amp;nbsp; &lt;a href=&quot;http://danwalsh.livejournal.com/54803.html&quot;&gt;yesterdays blog&lt;/a&gt; on SELinux Labeling did not provide a solution to the /myapache problem.&lt;br /&gt;&lt;br /&gt;The solution is to label /myapache and all its children with a label httpd can read.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You can figure this out by using:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man httpd_selinux&lt;/span&gt;&lt;br /&gt;...&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_sys_content_t&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Set files with the httpd_sys_content_t type, if you want to treat the&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; files as httpd sys content.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Paths:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/icecast(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/htdig(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /etc/htdig(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /var/www/svn/conf(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/doc/ghc/html(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/mythtv/data(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /var/lib/htdig(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /srv/gallery2(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /srv/([^/]*/)?www(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/ntop/html(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/mythweb(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /var/lib/cacti/rra(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/openca/htdocs(/.*)?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /usr/share/selinux-pol‐&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; icy[^/]*/html(/.*)?,&amp;nbsp;&amp;nbsp; /usr/share/drupal.*,&amp;nbsp;&amp;nbsp; /var/lib/trac(/.*)?,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /var/www(/.*)?, /var/www/icons(/.*)?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# ls -lZd /var/www/html&lt;br /&gt;drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You could simply put the labels in place using chcon.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;chcon -R -t httpd_sys_content_t /myapache&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The best solution is to tell SELinux about the label change.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -a -t httpd_sys_content_t '/myapache(/.*)?'&lt;br /&gt;# restorecon -R -v /myapache&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Done&lt;br /&gt;&lt;br /&gt;Note:&amp;nbsp; If you wanted to allow httpd to write to the directory you would use the httpd_sys_rw_content_t type.&lt;br /&gt;</description>
	<pubDate>Tue, 20 Mar 2012 13:30:25 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: SELinux Types Revisited.</title>
	<guid>http://danwalsh.livejournal.com/54803.html</guid>
	<link>http://danwalsh.livejournal.com/54803.html</link>
	<description>A common mistake people make with SELinux is thinking all types are the same.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I often get bugzilla's from people who first got a bug saying that httpd_t can not read some directory, say /myapache.&amp;nbsp; The admin then does some limited research and discovers the chcon command.&amp;nbsp; The admin then assumes if he uses the chcon command with the httpd type, it will solve his problem.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# chcon -t httpd_t /myapache&lt;br /&gt;chcon: failed to change context of `/myapache' to `staff_u:object_r:httpd_t:s0': Permission denied&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What, wait I am unconfined_t, why won't this be allowed.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setenforce 0&lt;br /&gt;# chcon -t httpd_t /myapache&lt;br /&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Works, I guess I am all set.&lt;br /&gt;&lt;span&gt;# setenforce 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Apache blows up.&lt;br /&gt;&lt;br /&gt;Now they have AVC messages that indicate they need&lt;br /&gt;&lt;br /&gt;&lt;span&gt;allow unconfined_t httpd_t:dir relabelto;&lt;br /&gt;allow httpd_t fs_t:filesystem associate;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since the admin forced the label onto the system, other parts of SELinux start to break. &amp;nbsp;Later locate runs and they get an AVC that requires&lt;br /&gt;&lt;br /&gt;&lt;span&gt;allow locate_t httpd_t:dir getattr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What the ...&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The assumption, the administrator mistakenly made, was that all types are created equally.&amp;nbsp; But SELinux groups different types and then controls what &amp;quot;Classes&amp;quot; they can be assigned to.&amp;nbsp; SELinux block you from assigning a type to unsupported objects.&lt;br /&gt;&lt;br /&gt;For example SELinux has types for Files (file_type), Processes(domain), Ports (port_type), Ethernet Interfaces (netif_type), Node names (node_type), filesystems (filesystem_type) ...&lt;br /&gt;&lt;br /&gt;Types are grouped together using the policy attribute notated above within the ().&lt;br /&gt;&lt;br /&gt;SELinux only allows administrators to assign file_type to a filesystem_type object.&amp;nbsp; This access is controlled by the associate access.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s file_type -t filesystem_type -p associate&amp;nbsp; | grep file_type&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow file_type fs_t : filesystem associate ;&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to list all file_types, execute:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;seinfo -afile_type -x&lt;br /&gt;&amp;nbsp;&amp;nbsp; file_type&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bluetooth_conf_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmirrord_exec_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; colord_exec_t&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have added an setroubleshoot plugin to Fedora 17 to try to help the administrator out.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;SELinux is preventing chcon from relabelto access on the directory myapache.&lt;br /&gt;&lt;br /&gt;*****&amp;nbsp; Plugin associate (99.5 confidence) suggests&amp;nbsp; **************************&lt;br /&gt;&lt;br /&gt;If you want to change the label of myapache to httpd_t, you are not allowed to since it is not a valid file type.&lt;br /&gt;Then you must pick a valid file label.&lt;br /&gt;Do&lt;br /&gt;select a valid file type.&amp;nbsp; List valid file labels by executing:&lt;br /&gt;# seinfo -afile_type -x&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this hopes, although I agree this is a difficult concept to understand.</description>
	<pubDate>Mon, 19 Mar 2012 16:06:00 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Secure Boot versus Ksplice.</title>
	<guid>http://danwalsh.livejournal.com/54707.html</guid>
	<link>http://danwalsh.livejournal.com/54707.html</link>
	<description>I have been attending many talks on Secure Boot.&amp;nbsp; The basic idea behind secure boot is to ensure that the bios/bootloader and kernel have not been hacked.&amp;nbsp; My understanding of how this is done is everything is signed and verified during the bootup.&amp;nbsp; Nothing can run in the kernel that was not signed and verified. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;Then we Oracle pushing Ksplice.&lt;br /&gt;&lt;br /&gt;I can't help but ask the question?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is ksplice a security disaster waiting to happen?&lt;/b&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 15 Mar 2012 12:50:56 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part VIII - New SELinux Domains in F17</title>
	<guid>http://danwalsh.livejournal.com/54343.html</guid>
	<link>http://danwalsh.livejournal.com/54343.html</link>
	<description>Each Fedora we release a bunch of new domains that will run in permissive mode for the release.&amp;nbsp; When the next release is released, the permissive domains are made enforcing.&lt;br /&gt;&lt;br /&gt;In my blog,&lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt;10 things you probably did not know about SELinux.. #4&lt;/a&gt;, I describe how you can interact with permissive domains.&lt;br /&gt;&lt;br /&gt;Any ways these are the permissive domains in Fedora 16 that will now be confined.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 16 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;pptp_t quota_nld_t sshd_sandbox_t nova_ajax_t nova_api_t nova_compute_t nova_direct_t nova_network_t nova_objectstore_t nova_scheduler_t nova_vncproxy_t nova_volume_t rabbitmq_epmd_t rabbitmq_beam_t deltacloudd_t iwhd_t mongod_t thin_t chrome_sandbox_nacl_t matahari_sysconfigd_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 17 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;couchdb_t (/usr/bin/couchdb)&lt;br /&gt;blueman_t (/usr/libexec/blueman-mechanism)&lt;br /&gt;httpd_zoneminder_script_t (/usr/libexec/zoneminder/cgi-bin(/.*)?)&lt;br /&gt;zoneminder_t (/usr/bin/zmpkg.pl)&lt;br /&gt;selinux_munin_plugin_t (/usr/share/munin/plugins/selinux_avcstat)&lt;br /&gt;sge_shepherd_t (/usr/bin/sge_shepherd)&lt;br /&gt;sge_execd_t (/usr/bin/sge_execd)&lt;br /&gt;sge_job_t&lt;br /&gt;matahari_rpcd_t (/usr/bin/sge_execd)&lt;br /&gt;keystone_t (/usr/bin/keystone-all)&lt;br /&gt;pacemaker_t (/usr/sbin/pacemakerd)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Of course I reserve the right to add to this list.&amp;nbsp; our goal is to make sure all init/dbus services run with a type other then initrc_t.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you see a process on your machine that is shipped from Fedora running as initrc_t, please open a bugzilla on SELinux policy.</description>
	<pubDate>Tue, 13 Mar 2012 14:47:35 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part VII - thumbnail protection.</title>
	<guid>http://danwalsh.livejournal.com/54092.html</guid>
	<link>http://danwalsh.livejournal.com/54092.html</link>
	<description>&lt;p&gt;John Leyden wrote an interesting article &lt;a href=&quot;http://www.theregister.co.uk/2011/02/09/linux_autorun_problems/&quot; rel=&quot;nofollow&quot;&gt;Linux vulnerable to Windows-style autorun exploits&lt;/a&gt;, about how security researches had discovered that Linux is potentially vulnerable to a user sticking a USB device or CDRom into a locked machine.&amp;nbsp; The basic idea was that &amp;quot;Nautilus&amp;quot; would execute thumbnail drive code, to display thumbnails icons in the file browsers based on the content on the removable media, even if the machine was locked.&amp;nbsp; If the thumbnail executables were vulnerabile, a cracker could use the code used to process the thumbnail images to kill the screensaver/lock.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Never mind this, just plugging in a USB stick when you a logged in, could allow a cracker to take over your machine.&lt;br /&gt;&lt;br /&gt;At that time, I wrote policy for all thumbnail drivers to be locked down with SELinux, but I only turned it on for confined users.&lt;br /&gt;I and other users have been running this confinement thoughout Fedora 16.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In Fedora 17 I have turned this on for the unconfined user.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We are confining the following applications.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;/usr/bin/evince-thumbnailer&lt;br /&gt;/usr/bin/ffmpegthumbnailer&lt;br /&gt;/usr/bin/gnome-exe-thumbnailer.sh&lt;br /&gt;/usr/bin/gnome-nds-thumbnailer&lt;br /&gt;/usr/bin/gnome-xcf-thumbnailer&lt;br /&gt;/usr/bin/gsf-office-thumbnailer&lt;br /&gt;/usr/bin/raw-thumbnailer&lt;br /&gt;/usr/bin/shotwell-video-thumbnailer&lt;br /&gt;/usr/bin/totem-video-thumbnailer&lt;br /&gt;/usr/bin/whaaw-thumbnailer&lt;br /&gt;/usr/lib(64)?/tumbler-1/tumblerd&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have seen these applications try to &amp;quot;execstack&amp;quot; when running mplayer executable on an thumbnails, kind of scary.&lt;br /&gt;&lt;br /&gt;If you know of other thumbnail applications that get launched as thumbnails, please tell me.&lt;br /&gt;&lt;/p&gt;</description>
	<pubDate>Mon, 12 Mar 2012 15:55:56 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - man pages for SELinux user/role domains</title>
	<guid>http://danwalsh.livejournal.com/53878.html</guid>
	<link>http://danwalsh.livejournal.com/53878.html</link>
	<description>Ok, maybe this should be Security Feature IV.5 but Roman numerals do not support decimal points.&amp;nbsp; :^)&lt;br /&gt;&lt;br /&gt;After I wrote the tool to &lt;a href=&quot;http://danwalsh.livejournal.com/52156.html&quot;&gt;generate service domains man pages&lt;/a&gt;, Miroslav Grepl thought it would be a good idea to generate similar policy for user domains and roles.&lt;br /&gt;&lt;br /&gt;We hacked up a new script called &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/segenuserman&quot; rel=&quot;nofollow&quot;&gt;segenuserman&lt;/a&gt;, which generates 13 new SELinux user and Role man pages.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;auditadm_selinux.8&amp;nbsp; git_shell_selinux.8&amp;nbsp; logadm_selinux.8 secadm_selinux.8&amp;nbsp;&amp;nbsp;&amp;nbsp; sysadm_selinux.8 user_selinux.8&amp;nbsp;&amp;nbsp;&amp;nbsp; xguest_selinux.8 dbadm_selinux.8 guest_selinux.8&amp;nbsp; nx_server_selinux.8&amp;nbsp; staff_selinux.8 unconfined_selinux.8&amp;nbsp; webadm_selinux.8&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Note segenuserman also requires &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/senetwork.py&quot; rel=&quot;nofollow&quot;&gt;senetwork.py&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is the &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/staff_selinux.html&quot; rel=&quot;nofollow&quot;&gt;staff_selinux.8&lt;/a&gt; for an SELinux user, and &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/webadm_selinux.html&quot; rel=&quot;nofollow&quot;&gt;webadm_selinux.8&lt;/a&gt; for an SELinux role.&lt;br /&gt;&lt;br /&gt;I have also updated the SELinux service domain man pages to include booleans,process types, file context paths, better descriptions, network ports.&lt;br /&gt;&lt;br /&gt;Here is an update &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/zebra_selinux.html&quot; rel=&quot;nofollow&quot;&gt;zebra_selinux.8&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 08 Mar 2012 16:46:18 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Excuse me son, but your code is leaking !!!</title>
	<guid>http://danwalsh.livejournal.com/53603.html</guid>
	<link>http://danwalsh.livejournal.com/53603.html</link>
	<description>I have written over the years about leaked file descriptors, and what a pain they have been to SELinux.&lt;br /&gt;&lt;br /&gt;C on Unix many many years ago was designed to leak by default.&amp;nbsp; A file descriptor is leaked if you open a file descriptor or socket and then do a fork/exec.&amp;nbsp; The new process will automatically get access to the file descriptor unless SELinux blocks it.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;When SELinux blocks the leaked file descriptor you usually end up with a strange looking AVC about the new domain trying to read or write a random file or a socket owned by the parent or even worse an ancestor.&lt;br /&gt;&lt;br /&gt;Talking with Uli Drepper the other day about leaked file descriptors.&amp;nbsp; He reminded me that the gcc/glibc teams had added a flags to open,fopen, socket, accept4 to change the default.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man open&lt;br /&gt;...&lt;br /&gt;By&amp;nbsp; default,&amp;nbsp; the&amp;nbsp; new&amp;nbsp; file descriptor is set to remain open across an execve(2) (i.e., the&amp;nbsp; FD_CLOEXEC&amp;nbsp; file&amp;nbsp; descriptor&amp;nbsp; flag&amp;nbsp; described&amp;nbsp; in fcntl(2)&amp;nbsp; is&amp;nbsp; initially&amp;nbsp; disabled; the O_CLOEXEC flag, described below, can be used to change this default).&lt;br /&gt;...&lt;br /&gt;O_CLOEXEC (Since Linux 2.6.23)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Enable the close-on-exec&amp;nbsp; flag&amp;nbsp; for&amp;nbsp; the&amp;nbsp; new&amp;nbsp; file&amp;nbsp; descriptor. Specifying&amp;nbsp; this&amp;nbsp; flag&amp;nbsp; permits&amp;nbsp; a&amp;nbsp; program&amp;nbsp; to avoid additional fcntl(2) F_SETFD operations to set the FD_CLOEXEC&amp;nbsp; flag.&amp;nbsp;&amp;nbsp; Additionally,&amp;nbsp; use&amp;nbsp; of&amp;nbsp; this flag is essential in some multithreaded programs since using a separate fcntl(2)&amp;nbsp; F_SETFD&amp;nbsp; operation&amp;nbsp; to set&amp;nbsp; the&amp;nbsp; FD_CLOEXEC&amp;nbsp; flag does not suffice to avoid race conditions where one thread opens a file descriptor at the same&amp;nbsp; time as another thread does a fork(2) plus execve(2).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sadly this can not be made the default, but as a good programing practice all open/socket,accept and fopen calls should use this flag in order to close the file descriptor by default.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;open(path, O_CLOEXEC | flags)&lt;br /&gt;socket(DOMAIN, SOCK_CLOEXEC | type, PROTOCOL)&lt;br /&gt;accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, SOCK_CLOEXEC | flags);&lt;br /&gt;fopen(path, &amp;quot;re&amp;quot;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you can not open a file descriptor with one of these commands then you can execute&lt;br /&gt;&lt;br /&gt;&lt;span&gt;fctnl(fd, F_SETFD, FD_CLOEXEC)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;He gcc developers or code analysys tools, you probably should catch when leaks happen, especially if they are not STDIN, STDOUT, STDERR.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Just be neat and stop leaking all over the place.&lt;/b&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 08 Mar 2012 04:34:27 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: bash completion for setsebool/getsebool added for Fedora 17</title>
	<guid>http://danwalsh.livejournal.com/53378.html</guid>
	<link>http://danwalsh.livejournal.com/53378.html</link>
	<description>&lt;span&gt;policycoreutils-python-2.1.10-26.fc17.x86_64 now has bash completion scripts for semanage and setsebool/getsebool&lt;br /&gt;&lt;br /&gt;/etc/bash_completion.d/semanage-bash-completion.sh&lt;br /&gt;/etc/bash_completion.d/setsebool-bash-completion.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# getsebool -&amp;lt;tab&amp;gt;&lt;br /&gt;# getsebool -a&lt;br /&gt;&lt;br /&gt;# getsebool samba_&amp;lt;tab&amp;gt;&lt;br /&gt;samba_create_home_dirs&amp;nbsp;&amp;nbsp; samba_export_all_ro&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_share_fusefs&lt;br /&gt;samba_domain_controller&amp;nbsp; samba_export_all_rw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_share_nfs&lt;br /&gt;samba_enable_home_dirs&amp;nbsp;&amp;nbsp; samba_run_unconfined&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;# setsebool -&amp;lt;tab&amp;gt;&lt;br /&gt;# setsebool -P&amp;lt;tab&amp;gt;&lt;br /&gt;&lt;br /&gt;# setsebool -P samba_&amp;lt;tab&amp;gt;&lt;br /&gt;samba_create_home_dirs&amp;nbsp;&amp;nbsp; samba_export_all_ro&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_share_fusefs&lt;br /&gt;samba_domain_controller&amp;nbsp; samba_export_all_rw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_share_nfs&lt;br /&gt;samba_enable_home_dirs&amp;nbsp;&amp;nbsp; samba_run_unconfined &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;semanage completion is a little more complicated.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage &amp;lt;tab&amp;gt;&lt;br /&gt;boolean&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcontext&amp;nbsp;&amp;nbsp;&amp;nbsp; login&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; node&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; port&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;dontaudit&amp;nbsp;&amp;nbsp; interface&amp;nbsp;&amp;nbsp; module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; permissive&amp;nbsp; user&lt;br /&gt;&lt;br /&gt;# semanage fcontext -&amp;lt;tab&amp;gt;&lt;br /&gt;-a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --deleteall&amp;nbsp; -f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --help&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --modify&lt;br /&gt;--add&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --ftype&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --locallist&amp;nbsp; -t&lt;br /&gt;-C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --delete&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --equal&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -m&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --type&lt;br /&gt;&lt;br /&gt;# semanage fcontext -a -t samba&amp;lt;tab&amp;gt;&lt;br /&gt;samba_etc_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_secrets_t&lt;br /&gt;sambagui_exec_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_share_t&lt;br /&gt;samba_initrc_exec_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_unconfined_script_exec_t&lt;br /&gt;samba_log_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; samba_unit_file_t&lt;br /&gt;samba_net_exec_t&lt;br /&gt;&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Try it out.&amp;nbsp; If you find problems, patches accepted... :^)</description>
	<pubDate>Tue, 06 Mar 2012 16:43:32 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Russell Coker (security): SE Linux Status in Debian 2012-03</title>
	<guid>http://etbe.coker.com.au/?p=3189</guid>
	<link>http://etbe.coker.com.au/2012/03/06/selinux-debian-2012-03/</link>
	<description>&lt;p&gt;I have just finished updating the user-space SE Linux code in Debian/Unstable to the version released on 2012-02-16. There were some changes to the build system from upstream which combined with the new Debian multi-arch support involved a fair bit of work for me. While I was at it I converted more of them to the new Quilt format to make it easier to send patches upstream. In the past I have been a bit slack about sending patches upstream, my aim for the next upstream release of user-space is to have at least half of my patches included upstream &amp;#8211; this will make things easier for everyone.&lt;/p&gt;
&lt;p&gt;Recently Mika Pflüger and Laurent Bigonville have started work on Debian SE Linux, they have done some good work converting the refpolicy source (which is used to build selinux-policy-default) to Quilt. Now it will be a lot easier to send policy patches upstream and porting them to newer versions of the upstream refpolicy.&lt;/p&gt;
&lt;p&gt;Now the next significant thing that I want to do is to get systemd working correctly with SE Linux. But first I have to get it working correctly wit cryptsetup.&lt;/p&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2011/10/31/selinux-status-2011-10/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux Status in Debian 2011-10&quot;&gt;SE Linux Status in Debian 2011-10&lt;/a&gt; &lt;small&gt;Debian/Unstable Development deb http://www.coker.com.au wheezy selinux The above APT sources.list...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2012/01/25/se-linux-status-2012-01/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux Status in Debian 2012-01&quot;&gt;SE Linux Status in Debian 2012-01&lt;/a&gt; &lt;small&gt;Since my last SE Linux in Debian status report [1]...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2008/03/28/debian-se-linux-status/&quot; rel=&quot;bookmark&quot; title=&quot;Debian SE Linux Status&quot;&gt;Debian SE Linux Status&lt;/a&gt; &lt;small&gt;At the moment I&amp;#8217;ve got more time to work on...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Tue, 06 Mar 2012 06:44:33 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: senetwork: new tool for examining SELinux networking policy.</title>
	<guid>http://danwalsh.livejournal.com/53182.html</guid>
	<link>http://danwalsh.livejournal.com/53182.html</link>
	<description>A couple of years ago I added some python bindings for setools.&amp;nbsp; I hoped we would start to see new tools arise to analyze SELinux policy.&amp;nbsp; Maybe making SELinux easier to user and understand.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Lately I have gone back to these tools and started playing with them to see what tools I could build.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Last couple of days I have hacked together a little script called &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/senetwork&quot; rel=&quot;nofollow&quot;&gt;senetwork&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The goal was to answering questions like:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What ports can a particular domain connect to?&amp;nbsp; Bind to?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# senetwork ftpd_t&lt;br /&gt;ftpd_t tcp name_connect&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ephemeral_port_t: 32768-61000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldap_port_t: 389,636,3268&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dns_port_t: 53&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ocsp_port_t: 9080&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kerberos_port_t: 88,750,4444&lt;br /&gt;ftpd_t tcp name_bind&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ephemeral_port_t: 32768-61000&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_port_t: 21,990&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ftp_data_port_t: 20&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unreserved_port_t: 1024-32767,61001-65535&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port_t: all ports with out defined types&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What type(s) are associated with a particular port number?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# senetwork 8080&lt;br /&gt;8080: tcp unreserved_port_t 1024-32767&lt;br /&gt;8080: udp unreserved_port_t 1024-32767&lt;br /&gt;8080: tcp http_cache_port_t 8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What ports are associated with a particular port_type?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# senetwork ftp_port_t&lt;br /&gt;ftp_port_t: tcp: 21,990&lt;br /&gt;ftp_port_t: udp: 990&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically senetwork looks at the argument and figures out whether or not it is a number, port type or domain type&lt;br /&gt;and then prints out the information.&lt;br /&gt;&lt;br /&gt;I plan on packaging up these little scriptlets with setools-console.&lt;br /&gt;</description>
	<pubDate>Fri, 02 Mar 2012 21:35:09 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: VMWare wants you to turn SELinux off?  Really?</title>
	<guid>http://danwalsh.livejournal.com/52958.html</guid>
	<link>http://danwalsh.livejournal.com/52958.html</link>
	<description>i&amp;middot;ro&amp;middot;ny&lt;br /&gt;1.&amp;nbsp; The use of words to convey a meaning that is the opposite of its literal meaning: the irony of her reply, &amp;ldquo;How nice!&amp;rdquo; when I said I had to work all weekend.&lt;br /&gt;2. an outcome of events contrary to what was, or might have been, expected.&lt;br /&gt;&lt;br /&gt;One of the great features of KVM Virtualization is that each virtual machine is wrapped in an SELinux sandbox.&amp;nbsp;&amp;nbsp; All the software used to run a virtual machine on a host is called a hypervisor.&amp;nbsp; When you run virtual machines, you have to worry about hypervisor vulnerabilities, which would allow your guest operating system to attack the host or other virtual machines you have running on the host.&lt;br /&gt;&lt;br /&gt;We strive to make the Linux KVM Hypervisor as secure as possible, but bugs happen.&amp;nbsp; SELinux can control what the virtual machine process can and can not do on the host machine.&amp;nbsp;&amp;nbsp; If you are running virtual machines on you Fedora or Red Hat box, you really should be running SELinux in enforcing mode.&lt;br /&gt;&lt;br /&gt;It has come to my attention that VMWare support is suggesting people turn off SELinux...&amp;nbsp; I guess SELiux is too complicated for the VMWare crack support team to handle.&lt;br /&gt;&lt;br /&gt;At Red Hat we consider security a priority, VMWare I am not so sure.&lt;br /&gt;&lt;br /&gt;If you are having a problem running any VMWare product on a RHEL or Fedora Operating system, contact me dwalsh@redhat.com and I will help you run your virtual machines and leave the security in place...&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.popsci.com/science/article/2011-03/april-2011-how-it-works&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;Hacking the Cloud&quot; height=&quot;1024&quot; src=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/Presentations/hackthecloud.png&quot; width=&quot;768&quot; /&gt;&lt;/a&gt;&lt;br /&gt;April 2011 &amp;quot;How it Works&amp;quot; issue of Popular Science, &amp;nbsp; by Marie Pacella&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 01 Mar 2012 13:50:07 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - systemd-journal</title>
	<guid>http://danwalsh.livejournal.com/52550.html</guid>
	<link>http://danwalsh.livejournal.com/52550.html</link>
	<description>There has been a lot written about the systemd-journal, this link gives a pretty good description of why it is good from a security point of view, although I don't see this as a full replacement of syslog.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://techspear.com/2011/11/systemd-journal-an-alternate-for-the-syslog/&quot; rel=&quot;nofollow&quot;&gt;http://techspear.com/2011/11/systemd-journal-an-alternate-for-the-syslog/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since the syslog format is ubiquitous, I don't see it going away.&amp;nbsp; Also systemd-journal caused a lot of people who were working on &amp;quot;Structured Logging&amp;quot; to get all up in arms over it, since Lennart and Kay did not work with them.&lt;br /&gt;&lt;br /&gt;I still like it.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;systemd has become the central point of launching system apps, so it knows more about what is going on in the system then any other process save the kernel.&lt;br /&gt;&lt;br /&gt;Years ago when the audit system was being build Karl MacMillan of Tresys believed that some of the problems that the audit system was trying to fix could be handled by extending syslog to record all the information about the sending process.&amp;nbsp; ALL of the UIDs associated with a process as well as recording the SELinux Context.&amp;nbsp;&amp;nbsp; Systemd-journald now does this.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Let me give an example of where systemd-journal could be used to increase security.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;SELinux controls processes by only allowing them to do what they were designed to do.&amp;nbsp; Sometimes even less depending on the security goals of the policy writer.&amp;nbsp; This means SELinux would prevent a hacked ntpd process from doing anything other then handle&amp;nbsp; Network Time.&amp;nbsp; SELinux would prevent the hacked ntpd from reading mysql database or credit card data from the users home directory,&amp;nbsp; even if the ntpd process was running as root.&amp;nbsp; However, since the ntpd process sends syslog messages, SELinux would allow the hacked process to continue to send syslog messages.&amp;nbsp; The hacked ntpd could format syslog messages to match other daemons and potentially trick and administrator or even better a tool that reads the syslog file (Intrusion detection tools?) into doing something bad.&amp;nbsp;&amp;nbsp; If all messages were verified with the systemd-journal then the administrator or syslog analysis tool could notice that ntpd_t is sending messages about sshd, and we could realize your ntpd daemon was hacked.&lt;br /&gt;&lt;br /&gt;.cursor=s=f328cc4b2615417189ab76b00c7ae041;i=2;b=4c3d0faf6b774fb7930972c1a4a5f87&lt;br /&gt;.realtime=1329940273078467&lt;br /&gt;...skipping...&lt;br /&gt;SYSLOG_IDENTIFIER=sshd&lt;br /&gt;SYSLOG_PID=2302&lt;br /&gt;MESSAGE=sshd Fake message from sshd.&lt;br /&gt;_PID=2302&lt;br /&gt;_UID=0&lt;br /&gt;_GID=0&lt;br /&gt;_COMM=ntpd&lt;br /&gt;_EXE=/usr/sbin/ntpd&lt;br /&gt;_CMDLINE=/usr/sbin/ntpd -n -u ntp:ntp -g&lt;br /&gt;_SYSTEMD_CGROUP=/system/ntpd.service&lt;br /&gt;_SYSTEMD_UNIT=ntpd.service&lt;br /&gt;_SELINUX_CONTEXT=system_u:system_r:ntpd_t:s0&lt;br /&gt;_SOURCE_REALTIME_TIMESTAMP=1330527027590337&lt;br /&gt;_BOOT_ID=4c3d0faf6b774fb7930972c1a4a5f870&lt;br /&gt;_MACHINE_ID=432d8198a8fc421caf2dca48ccde1cf2&lt;br /&gt;_HOSTNAME=dhcp-189-250.bos.redhat.com&lt;br /&gt;&amp;nbsp;</description>
	<pubDate>Wed, 29 Feb 2012 14:53:13 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part V - sudo can now use sssd for authorization data (sudoers)</title>
	<guid>http://danwalsh.livejournal.com/52281.html</guid>
	<link>http://danwalsh.livejournal.com/52281.html</link>
	<description>Currently sudo can be configure to read the /etc/sudoers file locally or to look it up via sudoers content via LDAP.&amp;nbsp; The LDAP server provides a useful feature for organizations&amp;nbsp; which wanted to centralize authorization data.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But, as in all types of centralized authorization/authentications systems, it does not work well when your machine is disconnected&lt;br /&gt;from the network.&lt;br /&gt;&lt;br /&gt;sssd - System Security Services Daemon to the rescue.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/42186.html&quot;&gt;sssd was added to Fedora a few releases ago, as I blogged about back in March 2011.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the biggest benefits of sssd is that it allows for disconnected access to cached authorization/authentication data.&amp;nbsp;&lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SSSDSudoIntegration&quot; rel=&quot;nofollow&quot;&gt;A new feature in Fedora 17 adds sssd as a source for sudoers data.&lt;/a&gt;&lt;br /&gt;&lt;p&gt;The benefits of this integration as described on the feature page are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;offline access - sudoers rules would be stored in a persistent cache, allowing sudo to fetch the rules seamlessly even in cases when the LDAP server is not reachable such as user roaming with a laptop.&lt;/li&gt;&lt;li&gt;unified configuration of LDAP parameters such as the servers used, timeout options and security properties at one places (sssd.conf)&lt;/li&gt;&lt;li&gt;sudo would take advantage of the advanced features SSSD has such as server fail over, server discovery using DNS SRV lookups and more&lt;/li&gt;&lt;li&gt;only one connection to the LDAP server open at a time resulting in less load on the LDAP server and better performance&lt;/li&gt;&lt;/ul&gt;And from an SELinux point of view one less network access for the sudoers application.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;caching of the rules - less load on the LDAP server and better performance on the client side as the client wouldn't have to go to the server with each request&lt;/li&gt;&lt;li&gt;back end abstraction - data may be stored in NIS or other databases and accessed by the sudo transparently&lt;/li&gt;&lt;/ul&gt;Imagine if sssd and IPA could eventually cache SELinux Roles/Confined Users, maybe sometime in the not too distant future ...&lt;br /&gt;</description>
	<pubDate>Tue, 28 Feb 2012 17:03:55 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part IV - man pages for SELinux service domains</title>
	<guid>http://danwalsh.livejournal.com/52156.html</guid>
	<link>http://danwalsh.livejournal.com/52156.html</link>
	<description>A couple of weeks ago, I began to look at the man pages for SELinux policy that we had written for SELinux several years ago.&amp;nbsp;&amp;nbsp;&amp;nbsp; I wanted to update them and maybe add a few new ones.&amp;nbsp;&amp;nbsp;&amp;nbsp; When I looked at the httpd_selinux man page, I noticed it was missing lots of descriptions of booleans and file types associated with the httpd domain.&amp;nbsp; When I started adding the boolean definitions, I quickly became board and realized this would not scale.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I decided to write a tool &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/genman.py&quot; rel=&quot;nofollow&quot;&gt;genman.py&lt;/a&gt;, that would query the SELinux Policy and write a man page for every executable service domain.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;DOMAIN_selinux.8&lt;br /&gt;&lt;br /&gt;I made a few assumptions that a service domain had an entrypoint ending in &amp;quot;_exec_t&amp;quot;.&amp;nbsp; Which we have pretty much standardized on.&amp;nbsp; Then I truncated the first part of the name off and searched for types and booleans containing this name.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;httpd_exec_t -&amp;gt; httpd for example.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I actually took is a step further and truncated a &amp;quot;d&amp;quot; off if the domain name ended in &amp;quot;d&amp;quot;, since this is common.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;httpd -&amp;gt; http.&lt;br /&gt;&lt;br /&gt;Booleans have a description in policy so this was fairly easy to add to the man pages.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage boolean -l | grep http &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Would give you all the booleans that mention http, for example.&lt;br /&gt;&lt;br /&gt;Since we don't have a description for each file type associated with a domain, I had to hard code a big it/then table with common definitions,&amp;nbsp; for example.&lt;br /&gt;&lt;br /&gt;def explain(f, k):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if f.endswith(&amp;quot;_var_run_t&amp;quot;):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &amp;quot;store the %s files under the /run directory.&amp;quot; % prettyprint(f, &amp;quot;_var_run_t&amp;quot;)&lt;br /&gt;&lt;br /&gt;Then I added a special section for any domains that use public_content_t.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Bottom line the tool was generated over 400 man pages that have been added to the selinux-policy-doc rpm.&lt;br /&gt;&lt;br /&gt;For example&lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/abrt_selinux.html&quot; rel=&quot;nofollow&quot;&gt; abrt man page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Are these man pages perfect? NO.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But they are a lot better then nothing.&amp;nbsp; Now if you want to know the types/and or booleans associated with a service, all you need to execute is man SERVICE_selinux.&lt;br /&gt;&lt;br /&gt;If anyone wishes to enhance this, by perhaps adding file context definitions, patches welcomed...&lt;br /&gt;</description>
	<pubDate>Mon, 27 Feb 2012 16:11:34 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part III - systemd starting daemons</title>
	<guid>http://danwalsh.livejournal.com/51942.html</guid>
	<link>http://danwalsh.livejournal.com/51942.html</link>
	<description>&lt;p&gt;Ok, this is not really a new feature in Fedora 17.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;systemd has been starting some daemons in Fedora 16, but more and more daemons and privileged processes are being started by systemd in 17.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Why is this a security feature? &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Symbols: &lt;span&gt;@&lt;/span&gt; means Execute, &lt;span&gt;-&amp;gt;&lt;/span&gt; indicates transition, &lt;span&gt;===&lt;/span&gt; indicates a client/server communication &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the past daemons would be started in two ways.&amp;nbsp; At boot init (sysV) launches an initrc script and then this script would launch the daemon, or an admin could log in and launch the init script by hand causing the daemon to run.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;From an SELinux point of view this looked like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;init_t @ initrc_exec_t -&amp;gt; initrc_t @ httpd_exec_t -&amp;gt; httpd_t:&amp;nbsp; &lt;/span&gt;&lt;br /&gt;This&amp;nbsp; apache processes would end up running with the full label of:&lt;br /&gt;&lt;span&gt;system_u:system_r:httpd_t:s0 &lt;/span&gt;&lt;br /&gt;If apache created content it would be labeled&lt;br /&gt;&lt;span&gt;system_u:object_r:httpd_sys_content_rw_t:s0 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When an administrator started restarted the process say through &lt;span&gt;service httpd restart&lt;/span&gt;&lt;br /&gt;&lt;span&gt;unconfined_t @initrc_exec_t -&amp;gt; initrc_t @httpd_exec_t -&amp;gt; httpd_t &lt;/span&gt;&lt;br /&gt;The process would adopt the user portion of the SELinux label that started it&lt;br /&gt;&lt;span&gt;unconfined_u:system_r:httpd_t:s0&lt;/span&gt;&lt;br /&gt;Content would be created by this apache would be:&lt;br /&gt;&lt;span&gt;unconfined_u:object_r:httpd_sys_content_rw_t:s0 &lt;/span&gt;&lt;br /&gt;SELinux ends up confusing the user since we have to ignore the user componant of the SELinux label. If you wanted to write policy to confine based on user type, you can't.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;With systemd this improves greatly.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The transitions is very different.&lt;br /&gt;&lt;span&gt;init_t @ httpd_exec_t -&amp;gt; httpd_t&lt;br /&gt;system_u:system_r:httpd_t:s0 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But if you want to restart the Apache daemon as admin you now do.&lt;br /&gt;&lt;span&gt;unconfined_t === init_t @ httpd_exec_t -&amp;gt; httpd_t&lt;br /&gt;system_u:system_r:httpd_t:s0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With systemd we don't have the labeling problem and we can tighten up the SELinux policy.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Systemd starting daemons affects more than just SELinux.&amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Over the years lots of vulnerabilities and administration failures had to be worked around because of admins restarting daemons.&amp;nbsp; Daemons need to be coded to cleanup any leaked information from the admin process influencing the way the Daemon ran.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Need to clean $ENV&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Need to change working directory&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; cd / in order to make sure they don't blow up because they lack access to the current working directory (service script does for them).&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Need do something with the terminal, close stdin, stdout, stderr after they start.&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; In SELinux we are always in a quandary about this, since if we allow the daemon access to the terminal, a hacked daemon could present the admin with passwd:&amp;nbsp; and trick him into revealing the admin password.)&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp; &amp;nbsp; Changing the controlling terminal&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Change the handling of signals&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;If a daemon writer screws up on one of these he could make the system vulnerable or end up with unexpected bugs.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Using systemd to start daemons, guarantees the daemon always gets started with&amp;nbsp; the same environment whether they are started at boot or restarted by an administrator.&lt;/b&gt;&lt;/p&gt;</description>
	<pubDate>Fri, 24 Feb 2012 17:02:20 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New Security Feature part II - PrivateTmp</title>
	<guid>http://danwalsh.livejournal.com/51459.html</guid>
	<link>http://danwalsh.livejournal.com/51459.html</link>
	<description>One of the reasons I am really excited about Fedora 17 is amount of new Security Features we have added, and not all of them involve SELinux ...&lt;br /&gt;&lt;br /&gt;As&amp;nbsp; I blogged a few weeks ago, we have stopped the ability for one process to look at another processes memory even if they have same UID, with the&lt;a href=&quot;http://danwalsh.livejournal.com/49336.html&quot;&gt; deny_ptrace&lt;/a&gt; feature.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PrivateTmp&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;But today I want to talk about PrivateTmp.&amp;nbsp;&amp;nbsp;&amp;nbsp; One of my goals over the years has been to stop system services from using /tmp.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/11467.html&quot;&gt;I blogged about this back in 2007.&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Any time I have found out a daemon was using /tmp, I tried to convince the packager to move the content to /run directory if it was temporary or /var/lib if it was permanent.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Over the years there have been several vulnerabilities&amp;nbsp; (CVEs) about this.&amp;nbsp; For example:&lt;br /&gt;&lt;pre&gt;CVE-2011-2722, which covered a case where hplib actually included code like.

&lt;span&gt;fp = fopen (&amp;quot;/tmp/hpcupsfax.out&amp;quot;, &amp;quot;w&amp;quot;); // &amp;lt;- VULN
system (&amp;quot;chmod 666 /tmp/hpcupsfax.out&amp;quot;); // &amp;lt;- &amp;quot;&lt;/span&gt;

Meaning if you setup a machine running cups daemon, a bad user or a application that a user ran could attack your system.

I have convinced a lot of packages to stop using /tmp, but I can't get them all and in some cases services like Apache,  need to use /tmp.   Apache runs lots of other packages that might store content in /tmp.

Well systemd has added lots of new security features (more on these later).  

PrivateTmp, which showed up in Fedora 16,  is an option in systemd unit configuration files. 

&lt;/pre&gt;&lt;pre&gt;&lt;span&gt;&amp;nbsp;     &amp;gt; man system.unit
       ...
       A unit configuration file encodes information about a service, a socket, a device, a mount point, an automount point, a   
&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span&gt;swap file or partition, a start-up target, a file system path or a timer controlled and supervised by systemd(1).
&lt;/span&gt;
&lt;/pre&gt;&lt;pre&gt;&lt;span&gt;     &amp;gt; man systemd.exec
&amp;nbsp; &amp;nbsp; &amp;nbsp;NAME
       systemd.exec - systemd execution environment configuration
&amp;nbsp; &amp;nbsp; &amp;nbsp;SYNOPSIS
     &amp;nbsp; systemd.service, systemd.socket, systemd.mount, systemd.swap
&amp;nbsp; &amp;nbsp; &amp;nbsp;DESCRIPTION
       Unit configuration files for services, sockets, mount points and swap devices share a subset of configuration 
       options which define the execution environment of spawned processes.
      ...
       PrivateTmp=
           Takes a boolean argument. If true sets up a new file system namespace for the executed processes and mounts a 
           private /tmp directory inside it, that is not shared by processes outside of the namespace. This is useful to secure 
           access to temporary files of the process, but makes sharing between processes via /tmp impossible. 
           Defaults to false.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;PrivateTmp causes systemd to do the following any time it starts a service with this option turned on:

&amp;nbsp;&amp;nbsp; Allocate a private &amp;quot;tmp&amp;quot; directory
   Create a new file system namespace 
   Bind mount this private &amp;quot;tmp&amp;quot; directory within the namespace over /tmp
   Start the service.  

This means that processes running with this flag would see a different and unique /tmp from the one users and other daemons sees or can access.

&lt;b&gt;&lt;span&gt;Note:  We have found bugs using PrivateTmp in Fedora 16, so make sure you test this well before turning it on in Production.&lt;/span&gt;&lt;/b&gt;

For Fedora 17, I opened a &lt;a href=&quot;http://fedoraproject.org/wiki/Features/ServicesPrivateTmp&quot; rel=&quot;nofollow&quot;&gt;feature page&lt;/a&gt; that requested all daemons that were using systemd unit files and /tmp to turn this feature on by default.

Apache and Cups now have PrivateTmp turned on by default in Fedora 17, along will several other daemons.

Giving three options as a Developer of System Service, I still believe that you should not use /tmp, you should use /run or /var/lib.  But if you have to use /tmp and do not communicate with other users then use PrivateTmp.  If you need to communicate with users be careful...
&lt;/pre&gt;</description>
	<pubDate>Thu, 23 Feb 2012 14:34:28 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: How can I allow a process to listing all processes on a system.</title>
	<guid>http://danwalsh.livejournal.com/51435.html</guid>
	<link>http://danwalsh.livejournal.com/51435.html</link>
	<description>SELinux blocks lots of domains from listing all processes on the system.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Lots of useful information can be optained from reading the process info on a machine, so we would like to block this by default.&amp;nbsp; But sometimes users/policy writers really need to allow their domains to be able to list the processes on a system.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;Ole on the Fedora SELinux Users Mail list asked:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;I have a problem with SELinux not allowing PHP to list other users' processes with the &amp;quot;ps&amp;quot; command.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;If I disable SELinux with &amp;quot;setenforce 0&amp;quot; it works immediately.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;Is it possible to allow PHP to do this without disabling SELinux completely?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;Processes are listed by reading all of the contents of /proc.&amp;nbsp; SELinux linux labels everything in /proc based on the label of the process.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;ps -eZ | grep sshd | head -1&lt;br /&gt;system_u:system_r:sshd_t:s0-s0:c0.c1023 853 ?&amp;nbsp; 00:00:00 sshd&lt;br /&gt;&lt;br /&gt;ls -lZ /proc/853 | head -1&lt;br /&gt;dr-xr-xr-x. root root system_u:system_r:sshd_t:s0-s0:c0.c1023 attr&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want a confined process to run ps, it needs to list /proc/PID, it needs to read certain files in this directory, needs to read symbolic links in this directory and needs to getattr on the process.&amp;nbsp;&amp;nbsp; When writing policy we have added a macro for this access.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;define(`ps_process_pattern',`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 $2:dir list_dir_perms;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 $2:file read_file_perms;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 $2:lnk_file read_lnk_file_perms;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 $2:process getattr;&lt;br /&gt;')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we wanted to allow one process type (myuser_t) to read another process /proc data on sshd (sshd_t), we would need to write a line like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;ps_process_pattern(myuser_t, sshd_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What if I want to allow a type to list all processes types?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In SELinux policy language we use &lt;b&gt;attributes&lt;/b&gt; are used to group multiple types together.&amp;nbsp;&lt;br /&gt;SELinux calls processes &amp;quot;domains&amp;quot;.&amp;nbsp; When we write policy we always give process types the &lt;b&gt;domain&lt;/b&gt; attribute.&lt;br /&gt;&lt;br /&gt;So if you wanted to allow a process myuser_t to&amp;nbsp; list all the processes on a system, you would write a rule like.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;ps_process_pattern(myuser_t, domain)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Dominic Grift answered Ole question by suggesting he install a local policy module that looked like:&lt;br /&gt;&lt;pre&gt;&lt;span&gt;policy_module(mytest, 1.0.0)
gen_require(` 
&amp;nbsp;&amp;nbsp;type httpd_t; 
  attribute domain; 
')
ps_process_pattern(httpd_t, domain)&lt;/span&gt;

This works great.  Note that the apache daemon runs all php scripts within its process space, to they run as &lt;b&gt;httpd_t&lt;/b&gt;.

Another solution would be to use an interface that we have defined in policy to allow this, &lt;b&gt;domain_read_all_domains_state&lt;/b&gt;.  

The &lt;b&gt;/usr/share/selinux/devel/include/kernel/domain.if&lt;/b&gt; interface file defines several interfaces that can be used to interact with all domains.  An alternative policy module could have been written:

&lt;span&gt;policy_module(mytest, 1.0.0)
gen_require(` 
&amp;nbsp;&amp;nbsp;type httpd_t; 
')
domain_read_all_domains_state(httpd_t)&lt;/span&gt;

&lt;/pre&gt;</description>
	<pubDate>Mon, 20 Feb 2012 16:45:00 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: SELinux problems on Fedora 17.</title>
	<guid>http://danwalsh.livejournal.com/50980.html</guid>
	<link>http://danwalsh.livejournal.com/50980.html</link>
	<description>Anyone that has tried Fedora 17 over the last couple of days, might have noticed SELinux going nuts and blocking logins.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;systemd had a bug which was causing transitions to break.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The way the system is supposed to work is during boot systemd reads in the policy file on disk and then loads policy into the kernel.&lt;br /&gt;This causes all processes at that are running to be labeled kernel_t.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;systemd then reads the label on its image file /sbin/systemd (init_exec_t) and the label that it is currently running as (kernel_t), then it asks the kernel what label would the /sbin/systemd process get if kernel_t executed it.&amp;nbsp; The answer would be init_t, and then systemd is supposed to set the current label to init_t.&amp;nbsp;&amp;nbsp; From that point on all processes started by systemd would transition to their proper domains.&lt;br /&gt;&lt;br /&gt;Well just before systemd/Fedora 17 Alpha was about to be released.&amp;nbsp; Systemd changed the location of its executable from /bin/systemd to /usr/lib/systemd/systemd.&amp;nbsp; But they never changed the checking code.&amp;nbsp; We fixed policy to look at the new location and labeled /usr/lib/systemd/systemd correctly, but when systemd checked for the label of /bin/systemd, there was no file and systemd just continued running as kernel_t.&amp;nbsp; Since there are few rules for transitions of kernel_t to any other label, most of the system was labeled as kernel_t.&amp;nbsp; Finally when a user logged in via gdm or login or sshd, they were running as kernel_t and the code transitioned them to abrt_t, one of the few domains kernel_t will transition to.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;systemd-42-1.fc17&lt;/span&gt; fixes this problem, so if you update to this systemd or later, you should be able to run your system in enforcing mode.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Needless to say, we have been flooded with bug reports...</description>
	<pubDate>Mon, 13 Feb 2012 20:35:38 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>James Morris: End of an Era (for me)</title>
	<guid>http://blog.namei.org/?p=520</guid>
	<link>http://blog.namei.org/2012/02/10/end-of-an-era-for-me/</link>
	<description>&lt;p&gt;I just finished my last day at Red Hat, where I&amp;#8217;ve worked as a kernel hacker since 2003.   I&amp;#8217;ve been fortunate to work with so many brilliant people there on challenging and rewarding projects&amp;mdash;like SELinux.  If someone had told me in 1999 that Linux would by now be fitted with a mandatory access control system from the NSA, which was enabled by default in major distributions, and certified and deployed in the field, I would have been skeptical.  To play a direct role in that would have been a dream come true.  It was.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve also had the opportunity to work extensively within the community, during which time I&amp;#8217;ve co-maintained or maintained kernel networking, crypto, SELinux and, currently, the security subsystem.  This work has taken me around the world and allowed me to make many new friends.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s been a great adventure.&lt;/p&gt;
&lt;p&gt;Recently, I decided to make some changes in my career path and seek out some new challenges.  I&amp;#8217;ll be starting in a new role the week after next.  I can&amp;#8217;t say much about that now, but I will be continuing with my current upstream commitments.&lt;/p&gt;</description>
	<pubDate>Fri, 10 Feb 2012 08:31:45 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Dan Walsh: secommunicate is a handy little tool to analyze policy communication</title>
	<guid>http://danwalsh.livejournal.com/50790.html</guid>
	<link>http://danwalsh.livejournal.com/50790.html</link>
	<description>&lt;dl&gt;&lt;dd&gt;&lt;div&gt;I wrote about &lt;a href=&quot;http://danwalsh.livejournal.com/46653.html&quot;&gt;setrans&lt;/a&gt; back in October.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;setrans is a tool that you could use to analyze policy to see if how one process domain transitions to another process domain.&lt;br /&gt;&lt;br /&gt;Today I got asked what type should a user assign to a file so that one process type &amp;quot;syslogd_t&amp;quot; could write and another process type &amp;quot;httpd_t&amp;quot; could read.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I answered the question that httpd_log_t would be a good candidate.&amp;nbsp; Then he asked could figure this out?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;My suggestion was he could use these commands.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s syslogd_t -c file -p write &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Which will search for all types that syslogd_t can write.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s httpd_t -c file -p read&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Which will search for types httpd_t can read, then he could look at the intersection of these commands.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Only that did not work...&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s syslogd_t -c file -p write &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Does not return my suggestion of httpd_log_t.&amp;nbsp; It did however return an attribute &amp;quot;logfile&amp;quot; which includes httpd_log_t.&lt;br /&gt;Attributes are the way to group lots of types together.&amp;nbsp; And the sesearch command does not expand out the attributes.&lt;br /&gt;&lt;br /&gt;I decided to go off an play with python and create &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/secommunicate&quot; rel=&quot;nofollow&quot;&gt;secommunicate&lt;/a&gt;.&amp;nbsp; The goal of this command is to print out a list of types that a source process type can write and a target process type can read.&lt;br /&gt;&lt;br /&gt;This little python script takes a source process type and a target process type and an optional class, defaulting to &amp;quot;file&amp;quot;.&amp;nbsp; It uses the sesearch python bindings to search the selinux policy for:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;What class types can the source type write?&lt;/li&gt;&lt;li&gt;What class types can the target type read?&amp;nbsp;&lt;/li&gt;&lt;li&gt;It expands all attributes into the associated types&lt;/li&gt;&lt;li&gt;Then it generates the intersection of these types, and prints them out.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;span&gt;./secommunicate syslogd_t httpd_t&lt;br /&gt;puppet_tmp_t&lt;br /&gt;afs_cache_t&lt;br /&gt;dirsrv_var_log_t&lt;br /&gt;nagios_log_t&lt;br /&gt;httpd_log_t&lt;br /&gt;user_cron_spool_t&lt;br /&gt;root_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;./secommunicate -c chr_file syslogd_t httpd_t&lt;br /&gt;user_tty_device_t&lt;br /&gt;devtty_t&lt;br /&gt;initrc_devpts_t&lt;br /&gt;null_device_t&lt;br /&gt;zero_device_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Seems like it could be a handy tool.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Not sure how we should package or ship setrans and secommunicate, or what the correct syntax would be, but for those struggling to understand policy these seem to be handy tools.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;./secommunicate -h&lt;br /&gt;usage: secommunicate [-h] [-c TCLASS] [-s SOURCEACCESS] [-t TARGETACCESS]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source target&lt;br /&gt;&lt;br /&gt;SELinux Communication Analysys Tool&lt;br /&gt;&lt;br /&gt;positional arguments:&lt;br /&gt;&amp;nbsp; source&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source type&lt;br /&gt;&amp;nbsp; target&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source type&lt;br /&gt;&lt;br /&gt;optional arguments:&lt;br /&gt;&amp;nbsp; -h, --help&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; show this help message and exit&lt;br /&gt;&amp;nbsp; -c TCLASS, --class TCLASS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Class to use for communications, Default 'file'&lt;br /&gt;&amp;nbsp; -s SOURCEACCESS, --sourceaccess SOURCEACCESS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Comma separate list of permissions for the source type&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to use, Default 'open,write'&lt;br /&gt;&amp;nbsp; -t TARGETACCESS, --targetaccess TARGETACCESS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Comma separated list of permissions for the target&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type to use, Default 'open,read'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note&lt;/b&gt;:&lt;br /&gt;If you wanted to know if a one domain can communicate with another domain via signals, you could just use&lt;br /&gt;&lt;br /&gt;sesearch -A -s syslogd_t -t httpd_t -c process&lt;br /&gt;Found 1 semantic av rules:&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow syslogd_t domain : process getattr ;&lt;/div&gt;&lt;/dd&gt;&lt;/dl&gt;</description>
	<pubDate>Tue, 07 Feb 2012 16:50:33 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Dan Walsh on Twitter @rhatdan</title>
	<guid>http://danwalsh.livejournal.com/50526.html</guid>
	<link>http://danwalsh.livejournal.com/50526.html</link>
	<description>I guess I never blogged this.&amp;nbsp; But I have been tweeting for a while as rhatdan.&amp;nbsp; (Not so creative name).&lt;br /&gt;&lt;br /&gt;And as always I will almost never tweet something that does not have to do with SELinux or Security....&lt;br /&gt;&lt;br /&gt;Follow me if you like.</description>
	<pubDate>Mon, 06 Feb 2012 22:03:25 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Small change to semanage login record creation.</title>
	<guid>http://danwalsh.livejournal.com/50380.html</guid>
	<link>http://danwalsh.livejournal.com/50380.html</link>
	<description>For those of you that use confined users, I have recently made a change to semanage that you may or may not notice.&amp;nbsp; This change will be back ported to RHEl6 also.&lt;br /&gt;&lt;br /&gt;In the previous version of semanage, when you created a login user mapping, if you did not specify the level or range of the user, semanage would default the level to s0.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;OLD&lt;/b&gt;&lt;br /&gt;# semanage login -a -s staff_u dwalsh&lt;br /&gt;# semanage login -l | grep dwalsh&lt;br /&gt;dwalsh&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; staff_u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s0&lt;br /&gt;&lt;br /&gt;In the new version of the tool, the semanage command will take the range of the SELinux user, staff_u, and assign it to the login record.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NEW&lt;/b&gt;&lt;br /&gt;# semanage user -l | grep staff_u&lt;br /&gt;staff_u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s0-s0:c0.c1023&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; staff_r sysadm_r system_r unconfined_r&lt;br /&gt;# semanage login -a -s staff_u dwalsh&lt;br /&gt;# semanage login -l | grep dwalsh&lt;br /&gt;dwalsh&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; staff_u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s0-s0:c0.c1023&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I believe this is the correct behavior especially since if you specified a SELinux whose range did not include s0, the tool would blow up.&lt;br /&gt;&lt;br /&gt;# semanage user -l | grep topsecret_u&lt;br /&gt;topsecret_u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s15 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s15-s15:c0.c1023&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; staff_r sysadm_r system_r&lt;br /&gt;# semanage login -a -s topsecret_u dwalsh&lt;br /&gt;Would generate a error saying invalid range.&lt;br /&gt;&lt;br /&gt;Of course if you specify the level/range it will override the SELinux user level.&lt;br /&gt;</description>
	<pubDate>Mon, 06 Feb 2012 15:24:04 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Why I love Open Source...  II</title>
	<guid>http://danwalsh.livejournal.com/50014.html</guid>
	<link>http://danwalsh.livejournal.com/50014.html</link>
	<description>When SELinux does a full relabel, it prints a * for each 1000 files that it relabels.&lt;br /&gt;&lt;br /&gt;Some users were complaining about a full relabel and not being able to estimate how much time was left.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I explained to them that I did not know how many files were on the file system, so I could not estimate how much time was left.&amp;nbsp; They explained to me that there was ways to look at the file system and get then number of inodes, and then you could estimate how much time was left.&amp;nbsp; I told them patches accepted, and within a couple of days, I got a patch from John Reiser.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;As of policycoreutils-2.1.10-21.fc17&lt;br /&gt;&lt;br /&gt;If you do a &lt;span&gt;touch /.autorelabel; reboot&lt;/span&gt; or a&lt;span&gt; fixfiles restore&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You will see output like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# fixfiles&amp;nbsp; restore&lt;br /&gt;10%&lt;br /&gt;&lt;br /&gt;With the counter slowly rising.&lt;br /&gt;&lt;br /&gt;Open source opens the possibility for all of us to contribute and make the whole better.&lt;br /&gt;&lt;br /&gt;Thanks John.</description>
	<pubDate>Fri, 03 Feb 2012 17:23:11 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux,  #10 shipping policy versions</title>
	<guid>http://danwalsh.livejournal.com/49762.html</guid>
	<link>http://danwalsh.livejournal.com/49762.html</link>
	<description>&lt;b&gt;Can I install a policy module built on RHEL6 on a RHEL5 box?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First you need to understand policy is compiled statically.&amp;nbsp; Even if you use interfaces, all the rules are compiled into the policy.pp file.&lt;br /&gt;If you use policy_module(mypol, 1.0), this will generate a gen_require(` ') block for all of the permissions, classes defined in policy.&amp;nbsp;&lt;br /&gt;Meaning if you compile a policy on RHEL6 and install it on RHEL5 using policy_module(mypol,1.0) you are likely to fail with an error like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semodule -i mypol.pp&lt;br /&gt;libsepol.permission_copy_callback: Module mypol depends on permission open in class file, not satisfied&lt;br /&gt;libsemanage.semanage_link_sandbox: Link packages failed semodule:&amp;nbsp; Failed!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the compiler telling you that you tried to install a policy module that required the &amp;quot;open&amp;quot; permission and RHEL5 policy, and kernel for that matter, has no idea what the &amp;quot;open&amp;quot; permission is.&lt;br /&gt;&lt;br /&gt;I guess the analogy would be compiling an executable on RHEL6 that uses a function call in a shared library that does not exists on a RHEL5 box, it won't work.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Usually we recommend that you compile policy on the oldest machines policy that you plan on supporting, then it should be installable on all future versions of that policy.&amp;nbsp; We don't tend to remove accesses.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Can I install a policy module built on RHEL5 on a RHEL6 box? &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Yes you can, but it probably will not work the way you expect!&lt;br /&gt;&lt;br /&gt;In RHEL5 the access required to read a file was:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;define(`read_file_perms',`{&amp;nbsp; getattr read ioctl lock }')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In RHEL6 the access required to read a file was:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;define(`read_file_perms',`{ open getattr read ioctl lock }')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So if you compile in a line like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;allow httpd_t mysecret_t:file read_file_perms;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On RHEL5 this would allow the apache type to read files labeled mysecret_t, but if you compiled it on RHEL5 and installed it on RHEL6, apache would not be allowed to &amp;quot;open&amp;quot; the file so the access would fail.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span&gt;Bottom Line:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you want to ship policy for two MAJOR&amp;nbsp; DIFFERENT VERSIONS of RHEL then you would need to compile a version for RHEL5 and for RHEL6.&lt;br /&gt;&lt;br /&gt;Policy should work for all Minor versions, as long as you compile on the oldest, supported version, although it might work if you compile on a newer version and install on an older version.&lt;br /&gt;&lt;br /&gt;Meaning a compiled version of policy on RHEL6.1 should work on RHEL6.2, RHEL6.3 ...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 02 Feb 2012 15:14:21 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: More on deny_ptrace ...</title>
	<guid>http://danwalsh.livejournal.com/49564.html</guid>
	<link>http://danwalsh.livejournal.com/49564.html</link>
	<description>This boolean brings into conflict two of my top goals with SELinux.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/25265.html&quot;&gt;&lt;b&gt;1. Make the system secure by default.&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The problem with most security systems is NO ONE turns them on.&amp;nbsp; NO ONE increases the security of their system.&lt;br /&gt;Now while these are exaggerations, I would bet you that 99 % of SELinux users never turn on &lt;a href=&quot;http://danwalsh.livejournal.com/37404.html&quot;&gt;confined users&lt;/a&gt;, or &lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt;disable the unconfined module&lt;/a&gt; .&amp;nbsp; There are large numbers of people who run SELinux in permissive mode or even disabled.&amp;nbsp;&amp;nbsp;&amp;nbsp; If we shipped Fedora and RHEL with SELinux disabled, I would bet the number of people who would enable it would be infinitesimally small.&amp;nbsp;&amp;nbsp;&amp;nbsp; So when I add a feature, I always think about how it would help the vast majority of people.&amp;nbsp;&amp;nbsp;&amp;nbsp; Will this boolean make my Wife's computer more secure.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/30084.html&quot;&gt;&lt;b&gt;2. Keep the unconfined domain unconfined...&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Read the blog for why uses expect things to just work, especially from their logged in accounts, especially if they are the admin.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should deny_ptrace be on by default????&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Well deny_ptrace actually confines the unconfined domain, so it conflicts with #2, but if I don't turn it on, for the most part people will not take advantage.&amp;nbsp; Most users would not see the benefit.&amp;nbsp; Right now I am going to turn it on by default (Of course I reserve the right to change my mind, or be beaten into submission.)&amp;nbsp; Any person who wants to disable it permanently can execute.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P deny_ptrace 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Programmers and system admins if you get a &amp;quot;permission denied&amp;quot; or &amp;quot;Operation not supported&amp;quot; error with ptrace, strace or gdb, it is SELinux causing the problem, and if you need to debug a problem, you can turn the boolean on temporarily.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool deny_ptrace 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And do your thing.&lt;br /&gt;&lt;br /&gt;Since sysadmins and programmers understand Linux best, it would be easier for them to toggle the security feature.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Now some questions about this feature.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What happened to allow_ptrace boolean in RHEL versions and older Fedora's?&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I originally thought about extending allow_ptrace, but I thought I had better just create a new boolean and remove the old.&lt;br /&gt;&lt;br /&gt;allow_ptrace only effected confined users. But since hardly anyone used confined users, I thought I needed a better way to describe the feature, and change its name.&amp;nbsp; I have removed allow_ptrace and now deny_ptrace will remove all ptrace, sys_ptrace that I know about from the system.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Does deny_ptrace guarantee no domains on my system can ptrace another domain?&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;NO&lt;br /&gt;If you load a custom policy with an &amp;quot;allow XYZ self:process ptrace&amp;quot;, this boolean will not effect it.&amp;nbsp; So it only effects actually policy shipped by Fedora or Red Hat.&lt;br /&gt;deny_ptrace does not effect permissive domains,&amp;nbsp; or permissive mode (obviously),&amp;nbsp; so if you want to make sure no processes can execute ptrace, you need to &lt;a href=&quot;http://danwalsh.livejournal.com/46245.html&quot;&gt;disable permissive domains&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;After you turn on the deny_ptrace boolean, you can check if any domains are still able to ptrace by executing&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch&amp;nbsp; -A -C -p ptrace,sys_ptrace | grep -v ^D&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;What about separation between root and users?&lt;/h3&gt;Well SELinux does not know anything about UID users, so root and non root mean nothing to SELinux.&amp;nbsp; The only way to get this distinction is by setting up confined users and then say run as staff_t as non root and then transition to unconfined_t, or sysadm_t or a confined admin type.&amp;nbsp; But since hardly anyone uses confined users, this is not an option, if I want to make most computers more secure.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Could you add a bunch of booleans that allows us to turn on and off ptrace per confined domain?&lt;/h3&gt;Well this is not really necessary, since most confined domains can not ptrace now, or only could ptrace because of some bugs in the kernel that generated ptrace avc's when running the ps command as root or if a process examined the /proc/PID files of another process.&amp;nbsp;&amp;nbsp;&amp;nbsp; We have fixed these kernel issues and are removing most domains ability to ptrace permanently, Ie turning deny_ptrace off DOES not allow every domain the ability to ptrace, only a few select domains that we believe might need it.&amp;nbsp; (Really just user domains.)&lt;br /&gt;</description>
	<pubDate>Wed, 01 Feb 2012 15:03:43 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 17 New SELinux Feature part I - deny_ptrace</title>
	<guid>http://danwalsh.livejournal.com/49336.html</guid>
	<link>http://danwalsh.livejournal.com/49336.html</link>
	<description>The deny_ptrace feature allows an administrator to toggle the ability of processes on the computer system from examining other processes on the system, including user processes.&amp;nbsp;&amp;nbsp; It can even block processes running as root.&lt;br /&gt;&lt;br /&gt;Most people do not realize that any program they run can examine the memory of any other process run by them.&amp;nbsp; Meaning the computer game you are running on your desktop can watch everything going on in Firefox or a programs like pwsafe or kinit or other program that attempts to hide passwords..&lt;br /&gt;&lt;br /&gt;SELinux defines this access as ptrace and sys_ptrace.&amp;nbsp; These accesses allow one process to read the memory of another process.&amp;nbsp;&amp;nbsp; ptrace allows developers and administrators to debug how a process is running using tools like strace, ptrace and gdb.&amp;nbsp;&amp;nbsp;&amp;nbsp; You can even use gdb (GNU Debugger) to manipulate another process running memory and environment.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The problem is this is allowed by default.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;My wife does not debug programs, why is she allowed to debug them?&amp;nbsp; As a matter of fact most of the time, I am not debugging applications, so it would be more secure if we could disable it by default.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SELinuxDenyPtrace&quot; rel=&quot;nofollow&quot;&gt;I created a feature for Fedora 17 called SELinuxDenyPtrace&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a youtube video demonstrating the SELinuxDenyPtrace feature.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://youtu.be/WVRS9krNFxU&quot; rel=&quot;nofollow&quot;&gt;Check it out.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Tue, 31 Jan 2012 18:43:57 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Russell Coker (security): SE Linux Status in Debian 2012-01</title>
	<guid>http://etbe.coker.com.au/?p=3133</guid>
	<link>http://etbe.coker.com.au/2012/01/25/se-linux-status-2012-01/</link>
	<description>&lt;p&gt;Since &lt;a href=&quot;http://etbe.coker.com.au/2011/10/31/selinux-status-2011-10/&quot;&gt;my last SE Linux in Debian status report [1]&lt;/a&gt; there have been some significant changes.&lt;/p&gt;
&lt;h3&gt;Policy&lt;/h3&gt;
&lt;p&gt;Last year I reported that the policy wasn&amp;#8217;t very usable, on the 18th of January I uploaded version 2:2.20110726-2 of the policy packages that fixes many bugs. The policy should now be usable by most people for desktop operations and as a server. Part of the delay was that I wanted to include support for systemd, but as my work on systemd proceeded slowly and others didn&amp;#8217;t contribute policy I could use I gave up and just released it. Systemd is still a priority for me and I plan to use it on all my systems when Wheezy is released.&lt;/p&gt;
&lt;h3&gt;Kernel&lt;/h3&gt;
&lt;p&gt;Some time between Debian kernel 3.0.0-2 and 3.1.0-1 support for an upstream change to the security module configuration was incorporated. Instead of using &lt;b&gt;selinux=1&lt;/b&gt; on the kernel command line to enable SE Linux support the kernel option is &lt;b&gt;security=selinux&lt;/b&gt;. This change allows people to boot with &lt;b&gt;security=tomoyo&lt;/b&gt; or &lt;b&gt;security=apparmor&lt;/b&gt; if they wish. No support for Smack though.&lt;/p&gt;
&lt;p&gt;As the kernel silently ignores command line parameters that it doesn&amp;#8217;t understand so there is no harm in having both &lt;b&gt;selinux=1&lt;/b&gt; and &lt;b&gt;security=selinux&lt;/b&gt; on both older and newer kernels. So version &lt;b&gt;0.5.0&lt;/b&gt; of &lt;b&gt;selinux-basics&lt;/b&gt; now adds both kernel command-line options to GRUB configuration when &lt;b&gt;selinux-activate&lt;/b&gt; is run. Also when the package is upgraded it will search for &lt;b&gt;selinux=1&lt;/b&gt; in the GRUB configuration and if it&amp;#8217;s there it will add &lt;b&gt;security=selinux&lt;/b&gt;. This will give users the functionality that they expect, systems which have SE Linux activated will keep running SE Linux after a kernel upgrade or downgrade! Prior to updating &lt;b&gt;selinux-basics&lt;/b&gt; systems running Debian/Unstable won&amp;#8217;t work with SE Linux.&lt;/p&gt;
&lt;p&gt;As an aside the postinst file for &lt;b&gt;selinux-basics&lt;/b&gt; was last changed in 2006 (thanks Erich Schubert). This package is part of the new design of SE Linux in Debian and some bits of it haven&amp;#8217;t needed to be changed for 6 years! SE Linux isn&amp;#8217;t a new thing, it&amp;#8217;s been in production for a long time.&lt;/p&gt;
&lt;h3&gt;Audit&lt;/h3&gt;
&lt;p&gt;While the audit daemon isn&amp;#8217;t strictly a part of SE Linux (each can be used without the other) it seems that most of the time they are used together (in Debian at least). I have prepared a NMU of the new upstream version of audit and uploaded it to delayed/7. I want to get everything related to SE Linux up to date or at least with comparable versions to Fedora. Also I sent some of the Debian patches for the auditd upstream which should reduce the maintenance effort in future.&lt;/p&gt;
&lt;h3&gt;Libraries&lt;/h3&gt;
&lt;p&gt;There have been some NMUs of libraries that are part of SE Linux. Due to a combination of having confidence in the people doing the NMUs and not having much spare time I have let them go through without review. I&amp;#8217;m sure that I will notice soon enough if they don&amp;#8217;t work, my test systems exercise enough SE Linux functionality that it would be difficult to break things without me noticing.&lt;/p&gt;
&lt;h3&gt;Play Machine&lt;/h3&gt;
&lt;p&gt;I am now preparing a new SE Linux &amp;#8220;Play Machine&amp;#8221; running Debian/Unstable. I wore my Play Machine shirt at LCA so I&amp;#8217;ve got to get one going again soon. This is a good exercise of the strict features of SE Linux policy, I&amp;#8217;ve found some bugs which need to be fixed. Running Play Machines really helps improve the overall quality of SE Linux.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://etbe.coker.com.au/2011/10/31/selinux-status-2011-10/&quot;&gt; http://etbe.coker.com.au/2011/10/31/selinux-status-2011-10/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/01/20/status-se-linux-debian-lca2009/&quot; rel=&quot;bookmark&quot; title=&quot;Status of SE Linux in Debian LCA 2009&quot;&gt;Status of SE Linux in Debian LCA 2009&lt;/a&gt; &lt;small&gt;This morning I gave a talk at the Security mini-conf...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/05/18/se-linux-in-debian/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux in Debian&quot;&gt;SE Linux in Debian&lt;/a&gt; &lt;small&gt;I have now got a Debian Xen domU running the...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2008/03/28/debian-se-linux-status/&quot; rel=&quot;bookmark&quot; title=&quot;Debian SE Linux Status&quot;&gt;Debian SE Linux Status&lt;/a&gt; &lt;small&gt;At the moment I&amp;#8217;ve got more time to work on...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Wed, 25 Jan 2012 11:36:31 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>KaiGai Kohei: [OSS/Linux] PG-Stromにプロファイラをつけてみた</title>
	<guid>http://d.hatena.ne.jp/kaigai/20120119/1326955553</guid>
	<link>http://d.hatena.ne.jp/kaigai/20120119/1326955553</link>
	<description>&lt;div class=&quot;section&quot;&gt;
&lt;p&gt;1月6日(金)に書いた『しゅとろ〜む、しゅとろ〜む』の記事は割と反響が大きかったようだ。&lt;/p&gt;
&lt;p&gt;コメント欄に次のような質問を頂いたので、試してみることにする。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;deco&quot;&gt;通りすがりさん wrote:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;すばらしい成果ですね．&lt;/p&gt;
&lt;p&gt;カラム指向的にデータを持っていること自体が性能向上に寄与しているということはないですか？&lt;/p&gt;
&lt;p&gt;(通常 + CPU) vs (カラム指向+GPU)で比較をされていますが，&lt;/p&gt;
&lt;p&gt;(通常 + CPU) vs (カラム指向+CPU) vs (カラム指向+GPU) の評価にも興味があります．&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;plan.c 内の is_device_executable_qual() 関数が常に false を返すようにすれば、条件句の処理をCPUだけで行うようになる。これは (カラム指向+CPU) と同等である。&lt;/p&gt;
&lt;p&gt;1,000万件のレコードを持つ、通常のテーブル t1 と、PG-Strom管理下のテーブル t2 に対してそれぞれ以下のクエリを実行してみた。&lt;/p&gt;
&lt;p&gt;■ １回目（バッファにデータが乗っていない状態）&lt;/p&gt;
&lt;pre&gt;
(通常 + CPU)
Timing is on.
postgres=# SELECT COUNT(&amp;#42;) FROM t1 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 8041.237 ms

(カラム指向 + CPU)
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 8660.486 ms

(カラム指向 + GPU)
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 4667.643 ms

&lt;/pre&gt;

&lt;p&gt;■ ２回目（バッファにデータが乗っている状態）&lt;/p&gt;
&lt;pre&gt;
(通常 + CPU)
postgres=# SELECT COUNT(&amp;#42;) FROM t1 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 7016.732 ms

(カラム指向 + CPU)
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 6733.771 ms

(カラム指向 + GPU)
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
 count
-------
  6718
(1 row)

Time: 173.351 ms
&lt;/pre&gt;

&lt;p&gt;(通常+CPU)と(カラム指向+CPU)の比較で、ディスクからの読み出しが発生する場合にカラム指向の方が8%程度遅いという結果になっている。&lt;/p&gt;
&lt;p&gt;複雑な条件句を設定したために、I/OよりもCPUバウンドな処理になっている事、xとyにはランダムな値を入れているために、全く圧縮が効いていないのが一因かもしれない。&lt;/p&gt;
&lt;p&gt;(カラム指向 + GPU)で２回目の方が早くなっているのは、主にGPUコードのJITコンパイルの処理時間の違いによるものだろう。JITコンパイルにここまで時間がかかることは稀だが、確実にI/Oを発生させるために Linux の Page Cache をクリアしてから測定を行ったため、nvccコマンドもOSのキャッシュから弾き出されたという事だろう。&lt;/p&gt;
&lt;p&gt;ただ、psql の \timing ではトータルの実行時間を表示するだけで、何が要因で時間を食っているのかは分からない。PG-Stromは性能改善を目的とするモジュールなので、どの辺を改善したら良いのか探るには先ず、どの辺にボトルネックがあるのかを探る必要がある。&lt;/p&gt;
&lt;p&gt;という訳で、PG-StromのGUCパラメータ pg_strom.exec_profile を追加してみた。&lt;/p&gt;
&lt;p&gt;これに &quot;on&quot; をセットすると、各々コンポーネントで消費した時間を表示してくれる。&lt;/p&gt;
&lt;pre&gt;
postgres=# SET pg_strom.exec_profile = ON;
SET
&lt;/pre&gt;

&lt;p&gt;（カラム指向 + GPU; １回目）&lt;/p&gt;
&lt;pre&gt;
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
INFO:  PG-Strom Exec Profile on &quot;t2&quot;
INFO:  Total PG-Strom consumed time: 4367.067 ms
INFO:  Time to JIT Compile GPU code: 1741.505 ms
INFO:  Time to initialize devices:   345.353 ms
INFO:  Time to Load column-stores:   2119.669 ms
INFO:  Time to Scan column-stores:   3.566 ms
INFO:  Time to Fetch virtual tuples: 110.920 ms
INFO:  Time of GPU Synchronization:  31.244 ms
INFO:  Time of Async memcpy:         31.320 ms
INFO:  Time of Async kernel exec:    27.906 ms
INFO:  Num of registers/thread &amp;#91;0]:  25
INFO:  Constant memory usage &amp;#91;0]:    40 byte
INFO:  Max device memory usage&amp;#91;0]:   536 KB
 count
-------
  6718
(1 row)

Time: 4514.738 ms
&lt;/pre&gt;

&lt;p&gt;\timing で計測した応答時間 4514.738ms のうち、PG-Strom モジュール内の処理時間は 4367.067 msで、そのうち、大部分を占めるのが、GPUコードのJITコンパイル（1741.505ms）と、カラムストアからのロード（2119.669ms）になる。これと比べると、GPUでの処理時間・メモリ転送は桁が違う。&lt;/p&gt;
&lt;p&gt;（カラム指向 + GPU; ２回目）&lt;/p&gt;
&lt;pre&gt;
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
INFO:  PG-Strom Exec Profile on &quot;t2&quot;
INFO:  Total PG-Strom consumed time: 183.302 ms
INFO:  Time to JIT Compile GPU code: 0.043 ms
INFO:  Time to initialize devices:   1.134 ms
INFO:  Time to Load column-stores:   54.883 ms
INFO:  Time to Scan column-stores:   3.425 ms
INFO:  Time to Fetch virtual tuples: 96.384 ms
INFO:  Time of GPU Synchronization:  27.462 ms
INFO:  Time of Async memcpy:         30.737 ms
INFO:  Time of Async kernel exec:    27.906 ms
INFO:  Num of registers/thread &amp;#91;0]:  25
INFO:  Constant memory usage &amp;#91;0]:    40 byte
INFO:  Max device memory usage&amp;#91;0]:   536 KB
 count
-------
  6718
(1 row)

Time: 186.867 ms
&lt;/pre&gt;

&lt;p&gt;１回目で時間を食っていた、GPUコードのJITコンパイル処理時間が消え、カラムストアからのロード時間も大幅に減っている。また、地味にデバイスの初期化にも345.353 ms要していたが、これがほぼ無くなっている。&lt;/p&gt;
&lt;p&gt;この結果、トータルの処理時間が4514.738 ms⇒186.867msに減少。&lt;/p&gt;
&lt;p&gt;カラムストアのロード/スキャンと、タプルをフェッチする処理（これはFDWの仕様なので減らすのが難しい）、それにGPUの処理の同期で合わせて 182.154 ms が消費されている。&lt;/p&gt;
&lt;p&gt;1/6(金)の時点から少しアルゴリズムを変更しているが、メモリ使用量はほとんど問題になっていない。&lt;/p&gt;
&lt;p&gt;これは、I/O周りで時間がかかっているために、２個、３個とチャンクを非同期に処理しようとしても、次のチャンクを読み込んでGPUに渡す頃には、前のチャンクの処理が既に終わっているからという事だろう。&lt;/p&gt;
&lt;p&gt;この辺、もっと足回りの良いマシンなら変わってくるのだろうか。&lt;/p&gt;
&lt;p&gt;なお、Time to scan... というのは、条件句を評価した結果に基づいてカラムストアをスキャンする処理で、条件句には使われていないものの、Target-listに含まれるカラムが存在する場合に発生する。今回のクエリは COUNT(*) を返すだけなので、追加のスキャンは発生していない。&lt;/p&gt;
&lt;br /&gt;

&lt;p&gt;おまけ。(カラム指向 + CPU)の実行結果だとこうなる。&lt;/p&gt;
&lt;pre&gt;
postgres=# SELECT COUNT(&amp;#42;) FROM t2 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) &amp;#60; 15;
INFO:  PG-Strom Exec Profile on &quot;t2&quot;
INFO:  Total PG-Strom consumed time: 2314.374 ms
INFO:  Time to JIT Compile GPU code: 0.000 ms
INFO:  Time to initialize devices:   0.000 ms
INFO:  Time to Load column-stores:   6.881 ms
INFO:  Time to Scan column-stores:   1435.570 ms
INFO:  Time to Fetch virtual tuples: 871.891 ms
INFO:  Time of GPU Synchronization:  0.000 ms
INFO:  Time of Async memcpy:         0.000 ms
INFO:  Time of Async kernel exec:    0.000 ms
 count
-------
  6718
(1 row)

Time: 8063.461 ms
&lt;/pre&gt;

&lt;p&gt;トータル 8063ms のうち、PS-Strom内の処理は 2314 ms。つまり、必死こいてPG-Stromから本体側にメモリコピーの後、CPUで条件句を処理という流れが見える。PG-Strom内での結果の絞込みができないので、Fetch virtual tuplesの時間が大幅に増加しているのが分かる。&lt;/p&gt;
&lt;p&gt;それと、Scan column-store の時間もやや気がかり。足回りとして、この辺は改善の余地があるやも。&lt;/p&gt;
&lt;/div&gt;</description>
	<pubDate>Thu, 19 Jan 2012 06:45:53 +0000</pubDate>
	<dc:creator>kaigai</dc:creator>
</item>
<item>
	<title>James Morris: Save the date: 2012 Linux Security Summit, 30-31 August, San Diego</title>
	<guid>http://blog.namei.org/?p=517</guid>
	<link>http://blog.namei.org/2012/01/18/save-the-date-2012-linux-security-summit-30-31-august-san-diego/</link>
	<description>&lt;p&gt;This is a pre-announcement so people can start planning travel for the year.&lt;/p&gt;
&lt;p&gt;The Linux Security Summit for 2012 will be held on the 30th and 31st of August in San Diego, CA, USA.  It will be co-located with &lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon&quot;&gt;LinuxCon North America&lt;/a&gt;, plumbers and the kernel summit.&lt;/p&gt;
&lt;p&gt;More details to follow.&lt;/p&gt;</description>
	<pubDate>Wed, 18 Jan 2012 00:43:18 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>James Morris: New git repository for the Linux kernel security subsystem</title>
	<guid>http://blog.namei.org/?p=512</guid>
	<link>http://blog.namei.org/2012/01/16/new-git-repository-for-the-linux-kernel-security-subsystem/</link>
	<description>&lt;p&gt;I&amp;#8217;ve set up a new git repository for the Linux kernel security subsystem on the new kernel.org server.&lt;/p&gt;
&lt;p&gt;The URLs are:&lt;/p&gt;
&lt;p&gt;git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git&lt;br /&gt;
http://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git&lt;br /&gt;
https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git&lt;/p&gt;
&lt;p&gt;Developers should work against the &amp;#8220;next&amp;#8221; branch.&lt;/p&gt;
&lt;p&gt;A web-browsable interface via gitweb may be found at:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://git.kernel.org/?p=linux/kernel/git/jmorris/linux-security.git;a=summary&quot;&gt;http://git.kernel.org/?p=linux/kernel/git/jmorris/linux-security.git;a=summary&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The temporary repo on selinuxproject.org will go away soon, so please update your repositories.&lt;/p&gt;</description>
	<pubDate>Mon, 16 Jan 2012 05:02:20 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>KaiGai Kohei: [OSS/Linux]PG-Strom</title>
	<guid>http://d.hatena.ne.jp/kaigai/20120109/1326139650</guid>
	<link>http://d.hatena.ne.jp/kaigai/20120109/1326139650</link>
	<description>&lt;div class=&quot;section&quot;&gt;
&lt;p&gt;I've checked up an idea whether it is feasible to implement, or not, since I saw a &lt;a href=&quot;http://www.pgcon.org/2011/schedule/events/352.en.html&quot; target=&quot;_blank&quot;&gt;presentation by Tim Child&lt;/a&gt; in Ottawa last year.&lt;/p&gt;
&lt;p&gt;Is it possible to accelerate sequential-scan of PostgreSQL?&lt;/p&gt;
&lt;p&gt;We often see sequential-scan instead of index-scan in case of queries with complex calculation. I thought GPU works fine in these cases.&lt;/p&gt;
&lt;p&gt;I tried to implement a module that works as FDW (foreign data wrapper) of PostgreSQL, since I could have a time to develop during Christmas vacation.&lt;/p&gt;
&lt;p&gt;The name of module is PG-Strom that is pronounced as shutt-row-me; being pronounced in German style.&lt;/p&gt;
&lt;p&gt;Its name originates &quot;Streaming Multiprocessor&quot; that is a unit of process in GPU.&lt;/p&gt;
&lt;p&gt;Of course, it assumes existing interface of FDW, so it is unavailable to update, and some more restrictions like sort or aggregate functions. However, it achieves good performance as a prototype.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that the following description is based on author's understanding (quite newbie for CUDA), so please point out if something incorrect.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt; Benchmark&lt;/h4&gt;
&lt;p&gt;Even though it is an arbitrary testcase, I tries to execute a query that scans a table with 20-million records in my development environment. NVidia's GTS450eco is installed.&lt;/p&gt;
&lt;pre&gt;
-- A regular table
mytest=# SELECT count(&amp;#42;) FROM pgbench_accounts
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 629291
(1 row)

Time: 29030.738 ms

-- with PG-Strom
mytest=# SELECT count(&amp;#42;) FROM pgstrom_accounts
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 629291
(1 row)

Time: 2337.475 ms
&lt;/pre&gt;

&lt;p&gt;It is a surprising result. PG-Strom returns the result with 10 times faster!&lt;/p&gt;
&lt;p&gt;In addition, we may be able to expect more improvement because GPU is quite cheap one (about 100Euro).&lt;/p&gt;
&lt;p&gt;Let's try again. I reduced the number of records (5-million records, with shared_buffer=960MB) to store whole of the table on the buffer; to eliminate affects from disk-I/O.&lt;/p&gt;
&lt;pre&gt;
-- A regular table
mytest=# SELECT count(&amp;#42;) FROM t1
   WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 157800
(1 row)

Time: 4106.045 ms

-- with PG-Strom
mytest=# SELECT count(&amp;#42;) FROM t2
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 157800
(1 row)

Time: 393.346 ms
&lt;/pre&gt;

&lt;p&gt;Wow!&lt;/p&gt;
&lt;h4&gt; Idea&lt;/h4&gt;
&lt;p&gt;PostgreSQL iterates (1) fetch a tuple from storage (or buffer), and (2) evaluation of qualifier of WHERE clause according to contents of the tuple during sequential-scan. Thus, it unavailable to handle (2) during execution of (1), and also unavailable to handle (1) during execution of (2). An idea is CPU multi-threading, however, it is hard to implement because PostgreSQL does not have thread-safe design including memory or I/O management.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194226&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194226.png&quot; alt=&quot;f:id:kaigai:20120106194226p:image:w512&quot; title=&quot;f:id:kaigai:20120106194226p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PG-Strom entrusts GPU device the (2) portion (evaluation of WHERE clause), and make CPU focus on I/O stuff.&lt;/p&gt;
&lt;p&gt;The calculation stuff shall be handled on GPU device side asynchronously, so it shall be finished during CPU handles more I/O stuff.&lt;/p&gt;
&lt;p&gt;However, GPU is not a magic bullet for anything.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194225&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194225.png&quot; alt=&quot;f:id:kaigai:20120106194225p:image:w512&quot; title=&quot;f:id:kaigai:20120106194225p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We need to transfer data to be calculated by GPU into device memory mounted on GPU. It requires to transfer via PCI-E that has narrow bandwidth compared to the one between CPU and Memory. (Max 2.5GB/s in x16 lane)&lt;/p&gt;
&lt;p&gt;Thus, amount of data to be copied should be smaller as we can as possible.&lt;/p&gt;
&lt;p&gt;In most cases, it is rare case that WHERE clause reference all the columns within the table, because the purpose of query is to fetch a record that satisfies the condition of XXXXX.&lt;/p&gt;
&lt;p&gt;PG-Strom handles execution of WHERE clause on GPU device. At that time, all copied to GPU device are contents of referenced columns. I expect 10%-20% of table size needs to be copied to GPU device via PCI-E, because numeric data is smaller than text data.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194224&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194224.png&quot; alt=&quot;f:id:kaigai:20120106194224p:image:w512&quot; title=&quot;f:id:kaigai:20120106194224p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt; Data structure and Asynchronous process&lt;/h4&gt;
&lt;p&gt;The internal data structure of PG-Strom is organized according to the above idea.&lt;/p&gt;
&lt;p&gt;For example, when we create a foreign table with four-columns: a, b, c and d, PG-Strom creates tables corresponding to each columns within pg_strom schema. These tables have rowid (int64) to identify a particular row and an array-type to store multiple original data.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194223&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194223.png&quot; alt=&quot;f:id:kaigai:20120106194223p:image:w512&quot; title=&quot;f:id:kaigai:20120106194223p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Even though it is a column-oriented data structure recently well used, it does not go out of transaction management of PostgreSQL, PG-Strom does not need to touch them.&lt;/p&gt;
&lt;p&gt;This type of data structure allows PG-Strom to load data into GPU devices via PCI-E bus effectively.&lt;/p&gt;
&lt;p&gt;The contents read from the databases are temporarily stored on fixed-length buffer called &quot;chunk&quot;, then it shall be moved to GPU devices and calculated, and the results shall be written back at last. These steps are executed asynchronously, thus, CPU can scan the database concurrently to set up next chunk. This design enables to utilize both of CPU and GPU.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194222&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194222.png&quot; alt=&quot;f:id:kaigai:20120106194222p:image:w512&quot; title=&quot;f:id:kaigai:20120106194222p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt; Just-in-time compile and native-code execution&lt;/h4&gt;
&lt;p&gt;CPU and GPU have its own advantage and disadvantage for each. GPU has much higher computing capability using large number of calculation units in parallel, however, one of its disadvantage is conditional branch.&lt;/p&gt;
&lt;p&gt;NVidia's GPU synchronously run 32 of execution units (that is called as SM:Streaming-Multiprocessor) like as a SIMD operations. In the case when device code contains conditional-branch part, a particular thread has 'true' on the condition, and other thread has 'false' on the condition, then, all the threads execute both of true-block and false-block and result of the block to be skipped shall be ignored. Thus, we cannot ignore the cost to execute branch statement within GPU device, especially, if-block is big.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194221&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194221.png&quot; alt=&quot;f:id:kaigai:20120106194221p:image:w512&quot; title=&quot;f:id:kaigai:20120106194221p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PostgreSQL has internal representation of WHERE clause as tree-structure, and we scan the tree-structure using switch statement on execute them. It shall be worst effectiveness.&lt;/p&gt;
&lt;p&gt;Thus, PG-Strom adopts Just-in-time compile to generate native binary code of GPU to avoid execution control on GPU device.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194219&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194219.png&quot; alt=&quot;f:id:kaigai:20120106194219p:image:w512&quot; title=&quot;f:id:kaigai:20120106194219p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When the supplied query tries to reference a foreign-table managed by PG-Strom, the query planner requires PG-Strom to generate execution plan. At that time, PG-Strom dynamically generate a source code towards GPU device, then kicks nvcc (compiler of NVidia's device) to build a native code of GPU device.&lt;/p&gt;
&lt;p&gt;Of course, it shall be cached on shared memory to avoid execute compiler so frequently.&lt;/p&gt;
&lt;p&gt;Next, when query-executor calls PG-Strom's executor, as I mentioned above, this native code shall be transferred to the device side with data read from pg_strom schema, and executed asynchronously.&lt;/p&gt;
&lt;p&gt;The qualifiers of WHERE clause is already extracted on the planner stage, no need to handle a big switch statement.&lt;/p&gt;
&lt;p&gt;We can confirm the automatically generated code of GPU device.&lt;/p&gt;
&lt;pre&gt;
mytest=# EXPLAIN SELECT &amp;#42; FROM pgstrom_accounts
         WHERE (xval - 23.45) &amp;#42; (xval - 23.45) +
               (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
                        QUERY PLAN
--------------------------------------------------------------
 Foreign Scan on pgstrom_accounts  (cost=2.00..0.00 rows=1000 width=368)
    Required Cols : aid, bid, abalance, filler, xval, yval
   Used in clause : xval, yval
      1: typedef unsigned long size_t;
      2: typedef long __clock_t;
      3: typedef __clock_t clock_t;
      4: #include &quot;crt/device_runtime.h&quot;
      5:
      6: typedef char  bool_t;
      7:
      8: __global__ void
      9: pgstrom_qual(unsigned char rowmap&amp;#91;],
     10:              double c5_values&amp;#91;],
     11:              unsigned char c5_nulls&amp;#91;],
     12:              double c6_values&amp;#91;],
     13:              unsigned char c6_nulls&amp;#91;])
     14: {
     15:     int offset_base = blockIdx.x &amp;#42; blockDim.x + threadIdx.x;
     16:     int offset = offset_base &amp;#42; 8;
     17:     unsigned char result = rowmap&amp;#91;offset_base];
     18:     unsigned char errors = 0;
     19:     unsigned char cn5 = c5_nulls&amp;#91;offset_base];
     20:     unsigned char cn6 = c6_nulls&amp;#91;offset_base];
     21:     int bitmask;
     22:
     23:     for (bitmask=1; bitmask &amp;#60; 256; bitmask &amp;#60;&amp;#60;= 1)
     24:     {
     25:         double cv5 = c5_values&amp;#91;offset];
     26:         double cv6 = c6_values&amp;#91;offset];
     27:
     28:         if ((result &amp;#38; bitmask) &amp;#38;&amp;#38;
                    !((((cv5 - 23.45) &amp;#42; (cv5 - 23.45)) +
                       ((cv6 - 54.32) &amp;#42; (cv6 - 54.32))) &amp;#60; 100))
     29:             result &amp;#38;= ~bitmask;
     30:         offset++;
     31:     }
     32:     rowmap&amp;#91;offset_base] = (result &amp;#38; ~errors);
     33: }
(36 rows)
&lt;/pre&gt;

&lt;h4&gt; Publication&lt;/h4&gt;
&lt;p&gt;Right now, it is in public at GitHub. GPLv3 is applied.&lt;/p&gt;
&lt;p&gt;  &lt;a href=&quot;https://github.com/kaigai/pg_strom&quot; target=&quot;_blank&quot;&gt;https://github.com/kaigai/pg_strom&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Even though it is a prototype, thus, its specification depends on my feeling, and we cannot expect documentation for a while, if you'd like to use, please call me (@kkaigai) on twitter.&lt;/p&gt;
&lt;h4&gt; A short demonstration&lt;/h4&gt;
&lt;p&gt;This is a short demonstration. The 't1' table is a regular table with 5-million records, and the 't2' table is a foreign table managed by PG-Strom also with 5-million records.&lt;/p&gt;
&lt;p&gt;In the case of sequential-scan with complex qualifier, scan on 't2' was finished x10 times faster than the case of 't1'.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://d.hatena.ne.jp/video/youtube/xrUBffs9aJ0&quot; alt=&quot;この動画を含む日記&quot;&gt;&lt;img src=&quot;http://d.hatena.ne.jp/images/d_entry.gif&quot; alt=&quot;D&quot; border=&quot;0&quot; title=&quot;この動画を含む日記&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</description>
	<pubDate>Mon, 09 Jan 2012 20:07:30 +0000</pubDate>
	<dc:creator>kaigai</dc:creator>
</item>
<item>
	<title>KaiGai Kohei: [OSS/Linux] しゅとろ〜む、しゅとろ〜む</title>
	<guid>http://d.hatena.ne.jp/kaigai/20120106/1325852100</guid>
	<link>http://d.hatena.ne.jp/kaigai/20120106/1325852100</link>
	<description>&lt;div class=&quot;section&quot;&gt;
&lt;p&gt;昨年、オタワで&lt;a href=&quot;http://www.pgcon.org/2011/schedule/events/352.en.html&quot; target=&quot;_blank&quot;&gt;Tim Child氏の発表&lt;/a&gt;を聞いて以来、実装できないものかと思って暖めていたアイデアがある。GPUの処理能力を使って、PostgreSQLの検索処理を高速化できないか？というものである。&lt;/p&gt;
&lt;p&gt;特に複雑な計算を含むクエリの場合、Index-Scanに落ちないで、全件スキャンが走ることが往々にしてあるが、こういったケースで有効に作用するのではなかろうか？という着想である。&lt;/p&gt;
&lt;p&gt;クリスマス休暇の間、割とまとまった開発時間を取る事ができたので、PostgreSQLのFDW(Foreign Data Wrapper)として動作するモジュールを作成してみた。&lt;/p&gt;
&lt;p&gt;モジュールの名前は PG-Strom で、ドイツ風に『しゅとろ〜む』と発音する。&lt;/p&gt;
&lt;p&gt;これは GPU の処理単位である Streaming Multiprocessor に由来する。&lt;/p&gt;
&lt;p&gt;もちろん、現状のFDWのI/F前提なので、更新は不可能でソートや集約関数もモジュール側に出せないという諸々制約はあるが、プロトタイプとしてはまずまずの性能である。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;※ なお、下記のGPU関連の記述は著者（CUDAプログラミング歴１ヶ月）の理解によるものです。間違っていたらご指摘ください。むしろ教えてくださいｗ&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt; ベンチマーク&lt;/h4&gt;
&lt;p&gt;かなり恣意的なテストケースではあるが、2,000万件のレコードからなるテーブルを全件スキャンするクエリを手元の環境で実施してみた。なお、搭載しているGPUはNvidia GTX450ecoである。&lt;/p&gt;
&lt;pre&gt;
-- 従来のテーブル
mytest=# SELECT count(&amp;#42;) FROM pgbench_accounts
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 629291
(1 row)

Time: 29030.738 ms

-- PG-Stromを利用
mytest=# SELECT count(&amp;#42;) FROM pgstrom_accounts
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 629291
(1 row)

Time: 2337.475 ms
&lt;/pre&gt;

&lt;p&gt;驚いた事に、1/10以下の応答時間でクエリを実行してしまったではないか。&lt;/p&gt;
&lt;p&gt;しかも利用しているGPUは100Euro程度のショボイものだけに、伸びしろもあるだろう。&lt;/p&gt;
&lt;p&gt;もう一回、今度はディスクIOの影響を除くため、テーブル全体がバッファに乗るサイズ（shared_buffer=960MBで、件数を500万件に削減）で試してみた。&lt;/p&gt;
&lt;pre&gt;
-- 従来のテーブル
mytest=# SELECT count(&amp;#42;) FROM t1
   WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 157800
(1 row)

Time: 4106.045 ms

mytest=# SELECT count(&amp;#42;) FROM t2
    WHERE (xval - 23.45) &amp;#42; (xval - 23.45) + (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
 count
--------
 157800
(1 row)

Time: 393.346 ms
&lt;/pre&gt;

&lt;p&gt;わお！&lt;/p&gt;
&lt;h4&gt; アイデア&lt;/h4&gt;
&lt;p&gt;PostgreSQLの場合、基本的に全件スキャン時の処理は (1) ディスク(or バッファ)からの読み出し (2) タプルの内容に基づいて WHERE 条件句を評価 の繰り返しとなる。&lt;/p&gt;
&lt;p&gt;そのため、(1)の処理中は(2)を実行できず、(2)の処理中は(1)を実行できない。CPUマルチスレッド化はひとつのアイデアだが、PostgreSQLはメモリ管理やI/O周りを含めて Thread-Safe な構造にはなっていないため、これは非常に難しい。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194226&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194226.png&quot; alt=&quot;f:id:kaigai:20120106194226p:image:w512&quot; title=&quot;f:id:kaigai:20120106194226p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PG-Stromでは、(2)のWHERE条件句の処理を GPU 側に任せる事で、CPUをI/Oに専念させる。&lt;/p&gt;
&lt;p&gt;計算処理はGPU側で非同期に実施してくれるので、CPUから見た場合『ここにあるデータを評価しておいて頂戴』と頼んでおくと、しばらくI/O処理をしている間に計算結果が出来上がっている、という算段である。&lt;/p&gt;
&lt;p&gt;ただ、GPUに処理をさせれば万事OKかというと、そうは問屋が卸さない。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194225&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194225.png&quot; alt=&quot;f:id:kaigai:20120106194225p:image:w512&quot; title=&quot;f:id:kaigai:20120106194225p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;GPUで計算させるには、GPU搭載のdevice memoryにデータを転送する必要があるが、これには PCI-Eを通して転送する必要があり、この箇所の帯域はCPU-Memory間に比べて非常に小さいのである。(x16のバスでもMAX片側2.5GB/s)&lt;/p&gt;
&lt;p&gt;したがって、GPUデバイスに転送するデータの量はできるだけ少なくした方がよい。&lt;/p&gt;
&lt;p&gt;通常、SQLのWHERE条件句がテーブルの全てのカラムを参照するという事は考えにくい。&lt;/p&gt;
&lt;p&gt;『○○の条件を満たすレコードを取り出す』というのがクエリの目的だからだ。&lt;/p&gt;
&lt;p&gt;PG-StromではWHERE条件句の処理をGPU側で実行するが、その際、GPUデバイス側に転送されるのは計算に必要なカラムだけである。普通は数値データの方が文字列よりも短いため、PCI-Eを介してGPUデバイスに転送の必要があるのは、テーブル全体の10%-20%程度ではなかろうか。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194224&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194224.png&quot; alt=&quot;f:id:kaigai:20120106194224p:image:w512&quot; title=&quot;f:id:kaigai:20120106194224p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt; データ構造と非同期処理&lt;/h4&gt;
&lt;p&gt;PG-Stromの内部データ構造も、上記の方針に従って編成されている。&lt;/p&gt;
&lt;p&gt;例えば、a、b、c、dの4つのカラムを持つFOREIGN TABLEを定義したとき、PG-Stromは各々のカラムに対応するテーブルを&quot;pg_strom&quot;スキーマ内に作成する。これらのテーブルは、行を一意に識別する rowid (int64) と、元々のデータを配列化したデータ型を持つ事になる。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194223&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194223.png&quot; alt=&quot;f:id:kaigai:20120106194223p:image:w512&quot; title=&quot;f:id:kaigai:20120106194223p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;最近流行のカラム指向DB的なデータ構造という訳だが、あくまでも PostgreSQL のトランザクション管理の枠内でデータ構造を規定しているので、その辺の厄介な処理は PG-Strom の側では一切ノータッチで済ませている。&lt;/p&gt;
&lt;p&gt;この様なデータ構造を持つ事により、PG-StromではPCI-Eを介してGPUデバイスに送り込むデータを高速にDBから読み込めるようになっている。読み込んだデータはチャンクと呼ぶ固定長のバッファに蓄えられ、順次GPUデバイスに送出、GPUでの演算処理を行い、結果の書き戻しが行われる。&lt;/p&gt;
&lt;p&gt;実際にはこれらの一連の処理は全て非同期に実施されるため、CPUはその間もDBからデータを読み込み、次のチャンクのセットアップが可能であるため、CPU/GPUを効率的に利用する事ができる。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194222&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194222.png&quot; alt=&quot;f:id:kaigai:20120106194222p:image:w512&quot; title=&quot;f:id:kaigai:20120106194222p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt; Just-in-time compile と native code 実行&lt;/h4&gt;
&lt;p&gt;CPUとGPUにはそれぞれ得意不得意の分野があり、GPUは非常に多くの並列演算ユニットを協調して動作させる事により高い計算能力を発揮するが、不得意な分野もある。その一つが条件分岐である。&lt;/p&gt;
&lt;p&gt;NVidiaのGPUでは32個の実行ユニットを含むStreaming Multiprocessorという単位で、SIMDライクな処理が行われる。GPU内の処理が条件分岐を含み、特定のスレッドでは IF 条件が真に、別のスレッドでは偽になるような場合、全てのスレッドがIF文の真ブロック/偽ブロックを処理し、IF条件に合致しないケースを破棄するという処理が行われる。そのため、特にIFブロックのサイズが大きくなるに従って、GPU内で条件句を処理する際のコストが無視できないものとなる。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194221&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194221.png&quot; alt=&quot;f:id:kaigai:20120106194221p:image:w512&quot; title=&quot;f:id:kaigai:20120106194221p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PostgreSQL内部ではWHERE条件句をツリー状のデータ構造によって保持しているが、ツリーを順にスキャンして『次は '+' 演算子だから…』と switch() 文で分岐させるような処理は、最悪の効率、という事になる。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;※ ただ、並列に実行する全てのスレッドでIF条件の評価結果が同じ場合にどうなるか？という点は、調べた限りではよく分からなかった。この場合にペナルティが避けられるのであれば、GPU側でコントロール処理を行うのも一つのアイデア。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;そのため、PG-StromではJust-in-time compileの技術を使って動的にネイティブのGPUコードを生成して実行するという方針を採用している。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120106194219&quot; class=&quot;hatena-fotolife&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120106/20120106194219.png&quot; alt=&quot;f:id:kaigai:20120106194219p:image:w512&quot; title=&quot;f:id:kaigai:20120106194219p:image:w512&quot; class=&quot;hatena-fotolife&quot; width=&quot;512&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;利用者のクエリがPG-Strom管理下の外部テーブルを参照する場合、Query PlannerはPG-Stromに対してクエリ実行プランを作成するよう要求する。その時、PG-Strom PlannerはWHERE条件句に従って動的にGPUデバイス用のコードを生成し、nvcc（NVidia の GPU向けコンパイラ）を実行してGPU向けのネイティブコードを生成する。もちろん、毎回コンパイラを起動していては時間の無駄なので、生成したバイナリは共有メモリ上にキャッシュされる。&lt;/p&gt;
&lt;p&gt;次いで、Query-ExecutorがPG-Strom Executorを呼び出すと、前述の通り、pg_stromスキーマ内から読み出したデータと共に、GPU向けのネイティブコードがデバイス側に送出され、非同期に実行される。&lt;/p&gt;
&lt;p&gt;WHERE条件句は既にPlanner段階で展開されているので、改めて巨大な switch 文を処理する必要は…ない。&lt;/p&gt;
&lt;p&gt;ちなみに、EXPLAIN文でどのようなGPU向けのコードが生成されているかを見る事ができる。&lt;/p&gt;
&lt;pre&gt;
mytest=# EXPLAIN SELECT &amp;#42; FROM pgstrom_accounts
         WHERE (xval - 23.45) &amp;#42; (xval - 23.45) +
               (yval - 54.32) &amp;#42; (yval - 54.32) &amp;#60; 100;
                        QUERY PLAN
--------------------------------------------------------------
 Foreign Scan on pgstrom_accounts  (cost=2.00..0.00 rows=1000 width=368)
    Required Cols : aid, bid, abalance, filler, xval, yval
   Used in clause : xval, yval
      1: typedef unsigned long size_t;
      2: typedef long __clock_t;
      3: typedef __clock_t clock_t;
      4: #include &quot;crt/device_runtime.h&quot;
      5:
      6: typedef char  bool_t;
      7:
      8: __global__ void
      9: pgstrom_qual(unsigned char rowmap&amp;#91;],
     10:              double c5_values&amp;#91;],
     11:              unsigned char c5_nulls&amp;#91;],
     12:              double c6_values&amp;#91;],
     13:              unsigned char c6_nulls&amp;#91;])
     14: {
     15:     int offset_base = blockIdx.x &amp;#42; blockDim.x + threadIdx.x;
     16:     int offset = offset_base &amp;#42; 8;
     17:     unsigned char result = rowmap&amp;#91;offset_base];
     18:     unsigned char errors = 0;
     19:     unsigned char cn5 = c5_nulls&amp;#91;offset_base];
     20:     unsigned char cn6 = c6_nulls&amp;#91;offset_base];
     21:     int bitmask;
     22:
     23:     for (bitmask=1; bitmask &amp;#60; 256; bitmask &amp;#60;&amp;#60;= 1)
     24:     {
     25:         double cv5 = c5_values&amp;#91;offset];
     26:         double cv6 = c6_values&amp;#91;offset];
     27:
     28:         if ((result &amp;#38; bitmask) &amp;#38;&amp;#38;
                    !((((cv5 - 23.45) &amp;#42; (cv5 - 23.45)) +
                       ((cv6 - 54.32) &amp;#42; (cv6 - 54.32))) &amp;#60; 100))
     29:             result &amp;#38;= ~bitmask;
     30:         offset++;
     31:     }
     32:     rowmap&amp;#91;offset_base] = (result &amp;#38; ~errors);
     33: }
(36 rows)
&lt;/pre&gt;

&lt;h4&gt; 公開先&lt;/h4&gt;
&lt;p&gt;今のところGitHUBで公開中。ライセンスはGPLv3です。&lt;/p&gt;
&lt;p&gt;  &lt;a href=&quot;https://github.com/kaigai/pg_strom&quot; target=&quot;_blank&quot;&gt;https://github.com/kaigai/pg_strom&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;まだプロトタイプ段階なので、私の気分次第で仕様は変わりますし、当面はドキュメントも期待できません。それでも使ってみようという奇特な方がいらっしゃいましたら、Twitter (@kkaigai) などで呼びかけてもらえれば。&lt;/p&gt;
&lt;/div&gt;</description>
	<pubDate>Fri, 06 Jan 2012 12:15:00 +0000</pubDate>
	<dc:creator>kaigai</dc:creator>
</item>
<item>
	<title>Russell Coker (security): My Blog Server was Cracked</title>
	<guid>http://etbe.coker.com.au/?p=2987</guid>
	<link>http://etbe.coker.com.au/2011/12/31/server-cracked/</link>
	<description>&lt;p&gt;On the 1st of August I noticed that the server which runs my blog among other things was having an occasional SEGV from a sshd process. Unfortunately I was busy and didn&amp;#8217;t pay much attention to this, which turned out to be a big mistake.&lt;/p&gt;
&lt;p&gt;On the 12th of September I started investigating this properly and noticed that when someone tried to connect to ssh with password authentication sshd would SEGV after it was denied access to a shared memory region or a semaphore which had a SE Linux type of unconfined_t. I added some SE Linux &lt;b&gt;auditallow&lt;/b&gt; rules and discovered that the memory region in question was created by the ssh client. Shortly after that I came to the conclusion that this wasn&amp;#8217;t some strange feature of ssh (or one of the many shared objects it uses) but hostile activity. The ssh client appeared to be storing passwords that it used in a shared memory region and sshd was also collecting passwords in the same region and presumably offering them to a ssh client which uses some extension to the ssh protocol.&lt;/p&gt;
&lt;p&gt;The sshd process was crashing because it couldn&amp;#8217;t handle EPERM on access to shared memory or semaphores. Presumably if the system in question wasn&amp;#8217;t running SE Linux then the exploit would have remained undetected for a lot longer.&lt;/p&gt;
&lt;p&gt;At this stage we don&amp;#8217;t know how the attacker got in. Presumably one of the people with root access ran a ssh client on a compromised system and had their password sniffed. One such client system was mysteriously reinstalled at about that time, the sysadmin of the system in question claimed to have no backups which made it impossible to determine if that system had been compromised. I believe that the sysadmin of the client system knew that their system was compromised, kept that information secret, and allowed other systems to become and remain compromised.&lt;/p&gt;
&lt;p&gt;The attacker made no good effort to conceal their presence, they replaced &lt;b&gt;ssh&lt;/b&gt;, &lt;b&gt;sshd&lt;/b&gt;, and &lt;b&gt;ssh-add&lt;/b&gt; and didn&amp;#8217;t bother changing the Debian checksums so the &lt;b&gt;debsums&lt;/b&gt; program flagged the files as modified. Note that I have kept copies of the files in question and am willing to share them with anyone who wants to analyse them.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://be-geek.com/linux/2011/11/15/steinar-h-gunderson-ebury-a-new-ssh-trojan&quot;&gt;Steinar H. Gunderson has named this trojan Ebury [1]&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Recovery&lt;/h3&gt;
&lt;p&gt;By the evening of the 13th of September I had the system mostly working again. Jabber still isn&amp;#8217;t working because ejabberd is difficult to get working at the best of times, I am now investigating whether there is a better Jabber server to use, but as I don&amp;#8217;t use Jabber often this hasn&amp;#8217;t been a priority for me.&lt;/p&gt;
&lt;p&gt;Some of the WordPress plugins I use and all of the WordPress themes that are installed were outside the Debian packaging system, as I couldn&amp;#8217;t be sure that they hadn&amp;#8217;t been altered (because the people who wrote WordPress plugins don&amp;#8217;t keep old versions online) I had to upgrade to the newer versions. Of course the newer versions weren&amp;#8217;t entirely compatible so I had to use a different theme and I couldn&amp;#8217;t get all plugins working. &lt;a href=&quot;http://etbe.coker.com.au/2010/04/30/link-within/&quot;&gt;Link Within no longer works, not that it ever worked properly [2]&lt;/a&gt;, I wanted to try Outbrain again but their web site won&amp;#8217;t let me login (and they haven&amp;#8217;t responded to my support request). Does anyone know of a good WordPress plugin to provide links to related content? Either related content on my blog or on the Internet in general will be OK.&lt;/p&gt;
&lt;p&gt;Some people have asked me about the change in appearance of my blog. It was simply impossible (for someone with my PHP skills) to get my blog looking the same way as it did before the server was cracked. I think that the new look is OK and don&amp;#8217;t mind if people think it looks likw a VW advert &amp;#8211; VW make great cars, I was very satisfied with the VW Passat I used to drive.&lt;/p&gt;
&lt;h3&gt;Future Plans&lt;/h3&gt;
&lt;p&gt;I had bought some &lt;a href=&quot;http://www.yubico.com/&quot;&gt;Yubikeys (USB devices that generate one-time passwords) [3]&lt;/a&gt; to control access to that server, if I had configured the software to use them then this might not have happened. The use of one-time password devices can prevent passive password-sniffing attacks. It would still allow active attacks (such as using ControlPath/ControlMaster options on the ssh client to allow a hostile party to connect later (EG the &lt;b&gt;-M&lt;/b&gt;, &lt;b&gt;-S&lt;/b&gt;, and &amp;#8220;&lt;b&gt;-o ControlPersist&lt;/b&gt;&amp;#8221; options for the ssh client). It&amp;#8217;s a pity that there doesn&amp;#8217;t seem to be a way to configure the ssh server to disable ControlMaster.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;It would be good to have some changes to sshd to allow more restrictions on what a client can request, as ControlMaster functionality isn&amp;#8217;t needed by most users it should be possible to disable it.&lt;/p&gt;
&lt;p&gt;SE Linux doesn&amp;#8217;t protect against a compromised client system or any other way of stealing passwords. It did do a good job of stopping Ebury from doing all the things it wanted to do and thus making me aware of the problem. So I count this as a win for SE Linux.&lt;/p&gt;
&lt;p&gt;Yubikeys are the cheapest and easiest way of managine one-time passwords. I had already bought some for use on the system in question but hadn&amp;#8217;t got around to configuring them. I have to make that a priority.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://be-geek.com/linux/2011/11/15/steinar-h-gunderson-ebury-a-new-ssh-trojan&quot;&gt; http://be-geek.com/linux/2011/11/15/steinar-h-gunderson-ebury-a-new-ssh-trojan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[2]&lt;a href=&quot;http://etbe.coker.com.au/2010/04/30/link-within/&quot;&gt; http://etbe.coker.com.au/2010/04/30/link-within/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[3]&lt;a href=&quot;http://www.yubico.com/&quot;&gt; http://www.yubico.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/04/27/email-passwords/&quot; rel=&quot;bookmark&quot; title=&quot;Email Passwords&quot;&gt;Email Passwords&lt;/a&gt; &lt;small&gt;I was doing some routine sysadmin work for a client...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/03/06/case-sensitivity-published-passwords/&quot; rel=&quot;bookmark&quot; title=&quot;Case Sensitivity and Published Passwords&quot;&gt;Case Sensitivity and Published Passwords&lt;/a&gt; &lt;small&gt;When I first started running a SE Linux Play Machine...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2006/09/10/whats-a-good-blog-server-for-serious-blogging/&quot; rel=&quot;bookmark&quot; title=&quot;what&amp;#8217;s a good blog server for serious blogging?&quot;&gt;what&amp;#8217;s a good blog server for serious blogging?&lt;/a&gt; &lt;small&gt;I&amp;#8217;m getting sick of blogger. The main thing is that...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Sat, 31 Dec 2011 00:01:06 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Russell Coker (security): Secure Boot and Protecting Against Root</title>
	<guid>http://etbe.coker.com.au/?p=3084</guid>
	<link>http://etbe.coker.com.au/2011/12/28/secure-boot-protecting-against-root/</link>
	<description>&lt;p&gt;There has been a lot of discussion recently about the recent Microsoft ideas regarding secure boot, in case you have missed it &lt;a href=&quot;http://ncommander.blogspot.com/2011/11/secure-boot-its-here-and-been-here-for.html&quot;&gt;Michael Casadevall has written a good summary of the issue [1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Recently I&amp;#8217;ve seen a couple of people advocate the concept of secure boot with the stated idea that &amp;#8220;root&amp;#8221; should be unable to damage the system, as Microsoft Software is something that doesn&amp;#8217;t matter to me I&amp;#8217;ll restrict my comments to how this might work on Linux.&lt;/p&gt;
&lt;p&gt;Restricting the &amp;#8220;root&amp;#8221; account is something that is technically possible, for much of the past 9 years I have been running &lt;a href=&quot;http://www.coker.com.au/selinux/play.html&quot;&gt;SE Linux &amp;#8220;Play Machines&amp;#8221; which have UID 0 (root) restricted by SE Linux such that they can&amp;#8217;t damage the system [2]&lt;/a&gt; &amp;#8211; there are other ways of achieving similar goals. But having an account with UID 0 that can&amp;#8217;t change anything on the system doesn&amp;#8217;t really match what most people think of as &amp;#8220;root&amp;#8221;, I just do it as a way of demonstrating that SE Linux controls all access such that cracking a daemon which runs as root won&amp;#8217;t result in immediately controlling the entire system.&lt;/p&gt;
&lt;p&gt;As an aside my Play Machine is not online at the moment, I hope to have it running again soon.&lt;/p&gt;
&lt;h3&gt;Root Can&amp;#8217;t Damage the System&lt;/h3&gt;
&lt;p&gt;One specific claim was that &amp;#8220;root&amp;#8221; should be unable to damage the system. While a secure boot system can theoretically result in a boot to single user mode without any compromise that doesn&amp;#8217;t apply to fully operational systems. For a file owned by root to be replaced the system security has to be compromised in some way. The same compromise will usually work every time until the bug is fixed and the software is upgraded. So the process of cracking root that might be used to install hostile files can also be used at runtime to exploit running processes via ptrace and do other bad stuff.&lt;/p&gt;
&lt;p&gt;Even if the attacker is forced to compromise the system at every boot this isn&amp;#8217;t a great win for the case of servers with months of uptime or for the case of workstations that have confidential data that can be rapidly copied over the Internet. There are also many workstations that are live on the Internet for months nowadays.&lt;/p&gt;
&lt;p&gt;Also the general claim doesn&amp;#8217;t really make sense on it&amp;#8217;s own. &amp;#8220;root&amp;#8221; usually means the account that is used for configuring the system. If a system can be configured then the account which is used to configure it will be able to do unwanted things. It is theoretically possible to run workstations without external root access (EG have them automatically update to the latest security fixes). Such a workstation configuration MIGHT be able to survive a compromise by having a reboot trigger an automatic update. But a workstation that is used in such a manner could be just re-imaged as it would probably be used in an environment where data-less operation makes sense.&lt;/p&gt;
&lt;p&gt;An Android phone could be considered as an example of a Linux system for which the &amp;#8220;root&amp;#8221; user can&amp;#8217;t damage the system if you consider &amp;#8220;root&amp;#8221; to mean &amp;#8220;person accessing the GUI configuration system&amp;#8221;. But then it wouldn&amp;#8217;t be difficult to create a configuration program for a regular Linux system that allows the user to change some parts of the system configuration while making others unavailable. Besides there are many ways in which the Android configuration GUI permits the user to make the system mostly unusable (EG by disabling data access) or extremely expensive to operate (EG by forcing data roaming). So I don&amp;#8217;t think that Android is a good example of &amp;#8220;root&amp;#8221; being prevented from doing damage.&lt;/p&gt;
&lt;h3&gt;Signing All Files&lt;/h3&gt;
&lt;p&gt;Another idea that I saw advocated was to have the &amp;#8220;secure boot&amp;#8221; concept extended to all files. So you have a boot loader that loads a signed kernel which then loads only signed executables and then every interpreter (Perl, Python, etc) will also check for signatures on files that they run. This would be tricky with interpreters that are designed to run from standard input (most notably /bin/sh but also many other interpreters).&lt;/p&gt;
&lt;p&gt;Doing this would require changing many programs, I guess you would even have to change mount to check the signature on /etc/fstab etc. This would be an unreasonably large amount of work.&lt;/p&gt;
&lt;p&gt;Another possibility would be to change the kernel such that it checks file signatures and has restrictions on system calls such as open() and the exec() family of calls. In concept it would be possible to extend SE Linux or any other access control system to include access checks on which files need to be signed (some types such as etc_t and bin_t would need to be signed but others such as var_t wouldn&amp;#8217;t).&lt;/p&gt;
&lt;p&gt;Of course this would mean that no sysadmin work could be performed locally as all file changes would have to come from the signing system. I can imagine all sorts of theoretically interesting but practically useless ways of implementing this such as having the signing system disconnected from the Internet with USB flash devices used for one-way file transfer &amp;#8211; because you can&amp;#8217;t have the signing system available to the same attacks as the host system.&lt;/p&gt;
&lt;p&gt;The requirement to sign all files would reduce the use of such a system to a tiny fraction of the user-base. Which would then raise the question of why anyone would spend the effort on that task when there are so many other ways of improving security that involve less work and can be used by more people.&lt;/p&gt;
&lt;h3&gt;Encrypted Root Filesystem&lt;/h3&gt;
&lt;p&gt;One real benefit of a secure boot system is for systems using encrypted filesystems. It would be good to know that a hostile party hasn&amp;#8217;t replaced the kernel and initrd when you are asked for the password to unlock the root filesystem. This would be good for the case where a laptop is left in a hotel room or other place where a hostile party could access it.&lt;/p&gt;
&lt;p&gt;Another way of addressing the same problem is to boot from a USB device so that you can keep a small USB boot device with you when it&amp;#8217;s inconvenient to carry a large laptop (which works for me). Of course it&amp;#8217;s theoretically possible for the system BIOS to be replaced with something that trojans the boot process (EG runs the kernel in a virtual machine). But I expect that if someone who is capable of doing that gets access to my laptop then I&amp;#8217;m going to lose anyway.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;The secure boot concept does seem to have some useful potential when the aim is to reboot the system and have it automatically apply security fixes in the early stages of the boot process. This could be used for Netbooks and phones. Of course such a process would have to reset some configuration settings to safe defaults, this means replacing files in /etc and some configuration files in the user&amp;#8217;s home directory. So such a reboot and upgrade procedure would either leave the possibility that files in /etc were still compromised or it would remove some configuration work and thus give the user an incentive to avoid applying the patch.&lt;/p&gt;
&lt;p&gt;Any system that tries to extend signature checks all the way would either be vulnerable to valid but hostile changes to system configuration (such as authenticating to a server run by a hostile party) or have extreme ease of use issues due to signing everything.&lt;/p&gt;
&lt;p&gt;Also a secure boot will only protect a vulnerable system between the time it is rebooted and the time it returns to full operation after the reboot. If the security flaw hasn&amp;#8217;t been fixed (which could be due to a 0-day exploit or an exploit for which the patch hasn&amp;#8217;t been applied) then the system could be cracked again.&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t think that a secure boot process offers real benefits to many users.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://ncommander.blogspot.com/2011/11/secure-boot-its-here-and-been-here-for.html&quot;&gt; http://ncommander.blogspot.com/2011/11/secure-boot-its-here-and-been-here-for.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[2]&lt;a href=&quot;http://www.coker.com.au/selinux/play.html&quot;&gt; http://www.coker.com.au/selinux/play.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/03/16/question-about-a-secure-filesystem/&quot; rel=&quot;bookmark&quot; title=&quot;Question about a &amp;#8220;Secure Filesystem&amp;#8221;&quot;&gt;Question about a &amp;#8220;Secure Filesystem&amp;#8221;&lt;/a&gt; &lt;small&gt;I have just been asked for advice about &amp;#8220;secure filesystem&amp;#8221;...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/10/10/how-se-linux-prevents-local-root-exploits/&quot; rel=&quot;bookmark&quot; title=&quot;How SE Linux Prevents Local Root Exploits&quot;&gt;How SE Linux Prevents Local Root Exploits&lt;/a&gt; &lt;small&gt;In a comment on my previous post about SE Linux...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2010/05/29/logging-in-as-root/&quot; rel=&quot;bookmark&quot; title=&quot;Logging in as Root&quot;&gt;Logging in as Root&lt;/a&gt; &lt;small&gt;Martin Meredith wrote a blog post about logging in as...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Wed, 28 Dec 2011 04:16:22 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux #9 Backing up and Restoring Labels.</title>
	<guid>http://danwalsh.livejournal.com/48936.html</guid>
	<link>http://danwalsh.livejournal.com/48936.html</link>
	<description>It has been a few years since I discusses backing up and restoring labels with SELinux.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I was asked at the Lisa 11 conference by a backup utility developer, &amp;quot;How should he save and restore SELinux security contexts?&amp;quot;&amp;nbsp; He also asked whether or not his tool should always maintain these context?&amp;nbsp; Finally how should the tool react if the system would not allow the context to be restored?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Interesting topic.&amp;nbsp; Lets first take a look at a few tools for backing up content with SELinux labels.&lt;br /&gt;&lt;br /&gt;SELinux stores SELinux security labels (contexts) as extended attributes with the inode on the file system.&amp;nbsp; If an administrate wants to backup/restore files with the SELinux labels,&amp;nbsp; you need to use a utility that supports this.&lt;br /&gt;&lt;br /&gt;When SELinux first shipped the only utility to do this was &lt;span&gt;star&lt;/span&gt; (RHEL4) , GNU &lt;span&gt;tar&lt;/span&gt; at that time did not support extended attributes.&amp;nbsp; Later extended attribute support was added to GNU tar.&amp;nbsp; (&lt;span&gt; tar --selinux -cvf /tmp/etc.tgz /etc&lt;/span&gt; ) Rsync also has support for maintaining extended attributes.&amp;nbsp; Even Dump/Restore can now support maintaining the extended attributes.&lt;br /&gt;&lt;br /&gt;I often question is whether this is a good idea to maintain the labels.&amp;nbsp; In some cases your security goals require it.&amp;nbsp; For example backing up sensitivity labelled data (MLS) requires this.&amp;nbsp; If you have a file labelled TopSecret, you would definitely want to maintain this within the archive.&lt;br /&gt;&lt;br /&gt;But most of us do not deal with sensitivity labelled data, and we would want to make sure the data on our system is labelled correctly based on the current security definition on our system.&amp;nbsp; Trying to maintain the SELinux labels and restore them can be a mistake in several cases.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Target file system does not support extended attributes.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you attempted to restore files to a file system that does not support extended attributes.&amp;nbsp; Does the administrator have a way to allow this?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Updating a machine for one version of the OS to another.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you backed up your /home directory before updating from Fedora 15 to Fedora 16 and then restored the content of the archive, certain directories in you home directory will be mislabeled and potentially tools like googlechrome or colord will fail.&amp;nbsp; You would have been better off having the content restored the archive and then running &lt;span&gt;restorecon -R - v /home&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Copying an archive from one machine to another machine with an older OS.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Attempting to maintain the labels would be wrong if you created an archive on a RHEL6 box and then attempting to restore the archive on a RHEL5 box.&amp;nbsp; If the RHEL5 kernel does not understand a label from a RHEL6 box, then the label will not be allowed to be placed on the disk.&amp;nbsp;&amp;nbsp; In this case, again you would want to put the files down and then restore the labels.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In this case it would be nice if the tools used to restore the content had the ability to label the content &amp;quot;correctly&amp;quot; based on the file_contexts definitions on the target system.&amp;nbsp; That way we would not have a race condition where the labels on the files are incorrect for a period of time.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In conclusion the backup/restore utility should:&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;allow the administrator to decide whether or not to save the SELinux labels and restore them.&lt;/li&gt;&lt;li&gt;Allow the administrator to specify the tool to restore the files using the default labels as specified on the target system (matchpathcon/setfscreatecon)&lt;/li&gt;&lt;li&gt;If the utility does not allow have the second option, in most cases the administrator should run restorecon on the restored files.&lt;/li&gt;&lt;/ul&gt;</description>
	<pubDate>Mon, 12 Dec 2011 19:38:21 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Why isn't setroubleshoot working in Fedora 16?</title>
	<guid>http://danwalsh.livejournal.com/48886.html</guid>
	<link>http://danwalsh.livejournal.com/48886.html</link>
	<description>Well if you did a fresh install it does work.&amp;nbsp; But if you did an upgrade install from an older Fedora you have a problem.&lt;br /&gt;&lt;br /&gt;setroubleshootd is a dbus service launched by the audit daemon.&amp;nbsp; &amp;nbsp; In Fedora 16 all daemons that were running under as System V init scripts and were converted to systemd, no longer are started by &lt;a href=&quot;http://fedoraproject.org/wiki/Common_F16_bugs#enablement-status&quot; rel=&quot;nofollow&quot;&gt;default&lt;/a&gt;.&amp;nbsp; Meaning the auditd daemon is probably no longer running on your machines.&amp;nbsp; You might notice AVC messages showing up in /var/log/messages, rather then /var/log/audit/audit.log.&lt;br /&gt;&lt;br /&gt;It is simple to fix this problem by executing&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# systemctl enable auditd.service&lt;br /&gt;# systemctl start auditd.service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will re-enable the auditd daemon and your setroubleshoot daemon should start working again.&amp;nbsp; If you get any AVC messages, they will start showing up in the /var/log/audit/audit.log.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Thu, 08 Dec 2011 18:13:21 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>KaiGai Kohei: [OSS/Linux]Leaky Views と Security Barrier : PostgreSQL Advent Calendar #4</title>
	<guid>http://d.hatena.ne.jp/kaigai/20111204/1322926643</guid>
	<link>http://d.hatena.ne.jp/kaigai/20111204/1322926643</link>
	<description>&lt;div class=&quot;section&quot;&gt;
&lt;p&gt;このエントリは&lt;a href=&quot;http://atnd.org/events/21994&quot; target=&quot;_blank&quot;&gt;PostgreSQL Advent Calendar&lt;/a&gt;に参加しています。12/4(日)担当也。ヨーロッパ中部時間ではまだ12/3(土)ですが。&lt;/p&gt;
&lt;p&gt;&lt;hr /&gt;&lt;/p&gt;
&lt;p&gt;RDBMSで行レベルのアクセス制御を実現する方法として、利用者に対して直接のアクセス権を付与せずに、特定のビューを通してだけアクセスを許可するのはしばしば使われるテクニックです。&lt;/p&gt;
&lt;p&gt;ですが、場合によっては不可視な行の中身を参照できてしまうというのは、あまり広く認知されている訳ではないようです。&lt;/p&gt;
&lt;p&gt;ので、問題のポイントと、現在開発中の PostgreSQL v9.2 に提案しているアイデアをご紹介します。&lt;/p&gt;
&lt;h4&gt; ユーザ定義関数のCOST値による問題&lt;/h4&gt;
&lt;p&gt;ここでは、以下の表を例に考えてみます。&lt;/p&gt;
&lt;p&gt;customerテーブル&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;列名&lt;/th&gt;&lt;th&gt;型&lt;/th&gt;&lt;th&gt;制約&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cid&lt;/td&gt;&lt;td&gt;int&lt;/td&gt;&lt;td&gt;primary key&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cname&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;td&gt;not null&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cmail&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cpasswd&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;/tr&gt;

&lt;/table&gt;
&lt;p&gt;customerテーブルには全顧客の情報が格納されているため、利用者は自分自身の情報しか見る事ができないよう設定しましょう。&lt;/p&gt;
&lt;p&gt;（便宜上 PostgreSQL ユーザ名が cname に対応するものとします）&lt;/p&gt;
&lt;pre&gt;
postgres=# CREATE VIEW my_account AS SELECT &amp;#42; FROM customer
                  WHERE cname = getpgusername();
CREATE VIEW
postgres=# GRANT SELECT ON my_account TO public;
GRANT
&lt;/pre&gt;

&lt;p&gt;本来、このテーブルには 3ユーザ分の情報が格納されているのですが、&lt;/p&gt;
&lt;pre&gt;
postgres=# SELECT * FROM customer;
 cid | cname |       cmail       | cpasswd
-----+-------+-------------------+----------
 101 | alice | alice@example.com | abcdef
 102 | bob   | bob@example.com   | xyz123
 103 | eve   | eve@example.com   | deadbeaf
(3 rows)
&lt;/pre&gt;
&lt;p&gt;確かに、自分自身の情報しか参照できないように見えます。&lt;/p&gt;
&lt;pre&gt;
postgres=# SET SESSION AUTHORIZATION alice;
SET
postgres=&amp;#62; SELECT * FROM customer;
ERROR:  permission denied for relation customer
postgres=&amp;#62; SELECT * FROM my_account;
 cid | cname |       cmail       | cpasswd
-----+-------+-------------------+---------
 101 | alice | alice@example.com | abcdef
(1 row)
&lt;/pre&gt;
&lt;p&gt;しかし、利用者がSQL関数を定義できる場合、面白い事が起こります。&lt;/p&gt;
&lt;p&gt;（&lt;span class=&quot;deco&quot;&gt;public&lt;/span&gt;スキーマはデフォルトでCREATE権限を全体に与えている事に注意！）&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; CREATE FUNCTION f_leak(text) RETURNS bool LANGUAGE plpgsql
           &lt;span class=&quot;deco&quot;&gt;COST 0.00000001&lt;/span&gt;
           AS 'BEGIN RAISE NOTICE ''f_leak =&amp;#62; %'', $1; RETURN true; END';
CREATE FUNCTION

postgres=&amp;#62; SELECT * FROM my_account WHERE f_leak(cmail);
&lt;span class=&quot;deco&quot;&gt;NOTICE:  f_leak =&amp;#62; alice@example.com
NOTICE:  f_leak =&amp;#62; bob@example.com
NOTICE:  f_leak =&amp;#62; eve@example.com
&lt;/span&gt; cid | cname |       cmail       | cpasswd
-----+-------+-------------------+---------
 101 | alice | alice@example.com | abcdef
(1 row)
&lt;/pre&gt;
&lt;p&gt;おっと、何か見えてはならないモノが見えたようです。&lt;/p&gt;
&lt;p&gt;どういう事なのでしょうか、ちょっと EXPLAIN で調べてみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM my_account WHERE f_leak(cmail);
                           QUERY PLAN
-----------------------------------------------------------------
 Seq Scan on customer  (cost=0.00..20.85 rows=1 width=100)
   Filter: (f_leak(cmail) AND (cname = (getpgusername())::text))
(2 rows)
&lt;/pre&gt;
&lt;p&gt;この実行計画はVIEWの本体である customer テーブルをスキャンしていますが、利用者が付与した f_leak() とVIEWの条件を順にチェックしています。&lt;/p&gt;
&lt;p&gt;問題は、副作用を持つ f_leak() の実行コストが非常に小さな値に設定されているため、オプティマイザは cname = getpgusername() より先にf_leak()を実行して不必要な条件の判断を省略した方が得策であると判断して、関数の実行順序を並べ替えている事です。その結果、不可視であるべき行の内容が引数としてf_leak()に渡され、それが利用者に漏えいしている訳です。&lt;/p&gt;
&lt;h4&gt; JOINと条件句の分配に伴う問題&lt;/h4&gt;
&lt;p&gt;同様に、VIEWによる行レベルアクセス制御を破るシナリオはもう一つ知られています。&lt;/p&gt;
&lt;p&gt;先ほどの customer テーブルに加えて、もう一つテーブルを追加して考察を進めてみましょう。&lt;/p&gt;
&lt;p&gt;creditテーブル&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;列名&lt;/th&gt;&lt;th&gt;型&lt;/th&gt;&lt;th&gt;制約&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cid&lt;/td&gt;&lt;td&gt;int&lt;/td&gt;&lt;td&gt;references customer(cid)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;number&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;expired&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;/tr&gt;

&lt;/table&gt;
&lt;p&gt;この credit テーブルは顧客のクレジットカード番号を保持しています。先ほどの my_account ビューと同様に、自分自身のレコードだけを参照できるようなVIEWを定義してみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=# SELECT * FROM customer;
 cid | cname |       cmail       | cpasswd
-----+-------+-------------------+----------
 101 | alice | alice@example.com | abcdef
 102 | bob   | bob@example.com   | xyz123
 103 | eve   | eve@example.com   | deadbeaf
(3 rows)

postgres=# SELECT * FROM credit;
 cid |       number        |  expired
-----+---------------------+------------
 101 | 1111-2222-3333-4444 | 2014-02-28
 102 | 5555-6666-7777-8888 | 2013-10-30
 102 | 1234-5678-1234-5678 | 2015-06-30
 103 | 0987-6543-2109-8765 | 2014-08-31
(4 rows)

postgres=# CREATE VIEW my_credit AS SELECT cname, cmail, credit.*
           FROM customer NATURAL JOIN credit WHERE cname = getpgusername();
CREATE VIEW
postgres=# GRANT SELECT ON my_credit TO public;
GRANT
&lt;/pre&gt;
&lt;p&gt;おや、やっぱり何かおかしいようです。&lt;/p&gt;
&lt;pre&gt;
postgres=# SET SESSION AUTHORIZATION alice;
SET
postgres=&amp;#62; SELECT * FROM my_credit;
 cname |       cmail       | cid |       number        |  expired
-------+-------------------+-----+---------------------+------------
 alice | alice@example.com | 101 | 1111-2222-3333-4444 | 2014-02-28
(1 row)

postgres=&amp;#62; SELECT * FROM my_credit WHERE f_leak(number);
&lt;span class=&quot;deco&quot;&gt;NOTICE:  f_leak =&amp;#62; 1111-2222-3333-4444
NOTICE:  f_leak =&amp;#62; 5555-6666-7777-8888
NOTICE:  f_leak =&amp;#62; 1234-5678-1234-5678
NOTICE:  f_leak =&amp;#62; 0987-6543-2109-8765&lt;/span&gt;
 cname |       cmail       | cid |       number        |  expired
-------+-------------------+-----+---------------------+------------
 alice | alice@example.com | 101 | 1111-2222-3333-4444 | 2014-02-28
(1 row)
&lt;/pre&gt;
&lt;p&gt;もう一度 EXPLAIN で実行計画を眺めてみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM my_credit WHERE f_leak(number);
                              QUERY PLAN
----------------------------------------------------------------------
 Hash Join  (cost=20.89..43.96 rows=2 width=104)
   Hash Cond: (credit.cid = customer.cid)
   -&amp;#62;  Seq Scan on credit  (cost=0.00..21.60 rows=387 width=40)
         Filter: &lt;span class=&quot;deco&quot;&gt;f_leak(number)&lt;/span&gt;
   -&amp;#62;  Hash  (cost=20.85..20.85 rows=3 width=68)
         -&amp;#62;  Seq Scan on customer  (cost=0.00..20.85 rows=3 width=68)
               Filter: (cname = (getpgusername())::text)
(7 rows)
&lt;/pre&gt;
&lt;p&gt;困ったことに、『creditテーブルをf_leak()条件でスキャンした結果』と『customerテーブルをcname = getpgusername()条件でスキャンした結果』がJOINされています。&lt;/p&gt;
&lt;p&gt;オプティマイザはJOINすべき行を最小化するよう条件句を分配するのですが、f_leak()関数は credit テーブルの number 列のみ、cname = getpgusername() 条件は customer テーブルの cname 列のみに依存しています。そのため、JOINの完了を待つ事なく個々のテーブルをスキャンする時点で条件句を実行した方が、JOINすべき行数を減らす事ができます。&lt;/p&gt;
&lt;p&gt;その結果、副作用を持つf_leak()がcreditテーブルのスキャン計画に push-down され、最初の例と同様に、不可視であるべき行の内容がf_leak()に渡され、それが利用者に漏えいしてしまっています。&lt;/p&gt;
&lt;p&gt;この２つの問題は共に、オプティマイザがVIEWの境界を越えて関数の実行順序を入れ替えている事が原因です。これは性能観点からは優れた実装ですが、セキュリティを目的としたVIEW定義という観点では問題です。&lt;/p&gt;
&lt;p&gt;一方で、VIEW内部で使われている関数を全て評価してから、その外部から与えられた関数を評価するという実装は、安全ですが、性能上無視できない性能劣化をもたらします。例えば、1万行 x 1万行のテーブルをJOINする場合、外部から与えられた関数をテーブルスキャンの時点で評価する事で片方の行数を1万行から100行に絞り込めるとしたら、9900万行分のJOIN処理を省略する事ができます。&lt;/p&gt;
&lt;p&gt;次に、PostgreSQL v9.2に向けて提案されている Leaky View 問題への対策を紹介しましょう。&lt;/p&gt;
&lt;h4&gt; VIEW の security_barrier 属性と最適化の抑制&lt;/h4&gt;
&lt;p&gt;ここからは、私の提案している「&lt;a href=&quot;http://archives.postgresql.org/message-id/CADyhKSUGwN68i7tewO0P1Jfrz8gZ=PH_+TWS0H+5vHaoc0QkWA@mail.gmail.com&quot; target=&quot;_blank&quot;&gt;Fix Leaky View Problemパッチ&lt;/a&gt;」の解説です。&lt;/p&gt;
&lt;p&gt;前節で考察したように、VIEWを行レベルアクセス制御の目的で利用する場合には、パフォーマンスとセキュリティのトレードオフが存在します。安全側に倒せば許容できない程の性能劣化を招く可能性があり、一方、性能最適であれば情報漏えいの危険があります。&lt;/p&gt;
&lt;p&gt;Fix Leaky Views Problem パッチは、CREATE VIEW構文でWITH(...)句を用いてオプション値を指定することを許容します。構文は以下の通りです。&lt;/p&gt;
&lt;pre&gt;
CREATE VIEW &lt;span class=&quot;deco&quot;&gt;view_name&lt;/span&gt; [WITH (&lt;span class=&quot;deco&quot;&gt;options&lt;/span&gt;[,...])] AS &lt;span class=&quot;deco&quot;&gt;select_statement&lt;/span&gt;;
options:
  security_barrier[= true|false]
&lt;/pre&gt;
&lt;p&gt;security_barrier オプションは、VIEWが行レベルアクセス制御を目的として定義されていることを示す属性です。これを指定することで、一部のクエリ最適化を抑制する事が可能になります。&lt;/p&gt;
&lt;p&gt;この設計に至るまでには長い議論があったのですが、結局、パフォーマンスとセキュリティのどちらが重要であるのかを判断できるのはVIEWを定義する人のみである、というシンプルな結論にたどり着いたのでした。&lt;/p&gt;
&lt;p&gt;VIEWにsecurity_barrier属性が付与されている時、VIEWの内側で使用されている全ての関数・条件句は、VIEWの外側から与えられた関数・条件句よりも先に実行される事が保証されます。&lt;/p&gt;
&lt;p&gt;では、実際に試してみましょう。以下で定義する my_account_secure と my_credit_secure は、先ほどの2つの例で使用したVIEWにsecurity_barrier属性を付加したものです。&lt;/p&gt;
&lt;pre&gt;
postgres=# CREATE VIEW my_credit_secure WITH (security_barrier) AS
           SELECT cname, cmail, credit.* FROM customer NATURAL JOIN credit
           WHERE cname = getpgusername();
CREATE VIEW
postgres=# GRANT SELECT ON my_account_secure TO public;
GRANT
postgres=# CREATE VIEW my_account_secure WITH (security_barrier) AS
           SELECT * FROM customer WHERE cname = getpgusername();
CREATE VIEW
postgres=# GRANT SELECT ON my_credit_secure TO public;
GRANT
&lt;/pre&gt;
&lt;p&gt;動作結果は以下のようになりました。&quot;f_leak =&amp;#62; ...&quot; と表示されている内容は、クエリによって本来参照可能なデータの範囲内に収まっている事が分かります。&lt;/p&gt;
&lt;pre&gt;
postgres=# SET SESSION AUTHORIZATION alice;
SET
postgres=&amp;#62; SELECT * FROM my_account_secure WHERE f_leak(cmail);
NOTICE:  f_leak =&amp;#62; alice@example.com
 cid | cname |       cmail       | cpasswd
-----+-------+-------------------+---------
 101 | alice | alice@example.com | abcdef
(1 row)

postgres=&amp;#62; SELECT * FROM my_credit_secure WHERE f_leak(number);
NOTICE:  f_leak =&amp;#62; 1111-2222-3333-4444
 cname |       cmail       | cid |       number        |  expired
-------+-------------------+-----+---------------------+------------
 alice | alice@example.com | 101 | 1111-2222-3333-4444 | 2014-02-28
(1 row)
&lt;/pre&gt;
&lt;p&gt;では、VIEWにsecurity_barrier属性を付加することで、クエリ実行計画にどのように変化しているのでしょうか？先ほどと同じように、EXPLAIN構文で調べてみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM my_account_secure WHERE f_leak(cmail);
                               QUERY PLAN
-------------------------------------------------------------------------
 Subquery Scan on my_account_secure  (cost=0.00..20.88 rows=1 width=100)
   Filter: &lt;span class=&quot;deco&quot;&gt;f_leak(my_account_secure.cmail)&lt;/span&gt;
   -&amp;#62;  Seq Scan on customer  (cost=0.00..20.85 rows=3 width=100)
         Filter: (cname = (getpgusername())::text)
(4 rows)
&lt;/pre&gt;
&lt;p&gt;f_leak()関数の評価は cname = getpgusername() 条件で customer テーブルをスキャンした後に行われる事が分かります。オプティマイザは security_viwe 属性を持ったVIEWの内側に条件句を push-down しなくなりました。&lt;/p&gt;
&lt;p&gt;もう一つの例も同様です。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM my_credit_secure WHERE f_leak(cmail);
                                 QUERY PLAN
----------------------------------------------------------------------------
 Subquery Scan on my_credit_secure  (cost=20.89..46.96 rows=2 width=104)
   Filter: &lt;span class=&quot;deco&quot;&gt;f_leak(my_credit_secure.cmail)&lt;/span&gt;
   -&amp;#62;  Hash Join  (cost=20.89..46.90 rows=6 width=104)
         Hash Cond: (credit.cid = customer.cid)
         -&amp;#62;  Seq Scan on credit  (cost=0.00..21.60 rows=1160 width=40)
         -&amp;#62;  Hash  (cost=20.85..20.85 rows=3 width=68)
               -&amp;#62;  Seq Scan on customer  (cost=0.00..20.85 rows=3 width=68)
                     Filter: (cname = (getpgusername())::text)
(8 rows)
&lt;/pre&gt;
&lt;p&gt;パッチ自体の動作原理は極めて単純です。&lt;/p&gt;
&lt;p&gt;PostgreSQLは、一旦、VIEWに対するクエリを内部的にサブクエリに書き換えます。その後、オプティマイザがクエリ実行計画を作成する際に、&quot;シンプル&quot;なサブクエリ（OFFSET/LIMIT句を含まない…など）であれば、性能最適の観点からサブクエリをJOINを用いてフラット化(Pull-Up)します。&lt;/p&gt;
&lt;p&gt;その後で、条件句はオプティマイザによって性能上最適な位置に振り分けられるため、VIEWの内側/外側といった区別はもはや意味を持たなくなります。&lt;/p&gt;
&lt;p&gt;VIEWのsecurity_barrier属性は、この際の条件に作用します。RangeTblEntry構造体のsecurity_barrierは、関連するサブクエリがVIEWに由来し、かつ、VIEWのsecurity_barrier属性がtrueである場合にセットされます。&lt;/p&gt;
&lt;p&gt;以下の処理では、security_barrier属性が false だとpull_up_simple_subquery()は呼ばれないため、サブクエリのフラット化は抑制されます。&lt;/p&gt;
&lt;pre&gt;
--- a/src/backend/optimizer/prep/prepjointree.c
+++ b/src/backend/optimizer/prep/prepjointree.c
@@ -543,6 +543,7 @@ pull_up_subqueries(PlannerInfo &amp;#42;root, Node &amp;#42;jtnode,
         &amp;#42;/
        if (rte-&amp;#62;rtekind == RTE_SUBQUERY &amp;#38;&amp;#38;
            is_simple_subquery(rte-&amp;#62;subquery) &amp;#38;&amp;#38;
+           !rte-&amp;#62;security_barrier &amp;#38;&amp;#38;
            (containing_appendrel == NULL ||
             is_safe_append_member(rte-&amp;#62;subquery)))
            return pull_up_simple_subquery(root, jtnode, rte,
&lt;/pre&gt;

&lt;p&gt;さらにもう一ヶ所。条件句に与える引数が特定のサブクエリにだけ依存している場合、オプティマイザはこの条件句の実行をサブクエリ処理の中に移動(Push-Down)しようとしますが、同様にサブクエリが security_view 属性つきのVIEWに由来する時は、これをスキップします。&lt;/p&gt;
&lt;pre&gt;
@@ -763,6 +769,7 @@ set_subquery_pathlist(PlannerInfo &amp;#42;root, RelOptInfo &amp;#42;rel,
      Node       &amp;#42;clause = (Node &amp;#42;) rinfo-&amp;#62;clause;

      if (!rinfo-&amp;#62;pseudoconstant &amp;#38;&amp;#38;
+         !rte-&amp;#62;security_barrier &amp;#38;&amp;#38;
          qual_is_pushdown_safe(subquery, rti, clause, differentTypes))
      {
          /&amp;#42; Push it down &amp;#42;/
&lt;/pre&gt;

&lt;p&gt;この２ヶ所の処理を追加することによって、これまで見たような、VIEWを行レベルアクセス制御の目的に使用する場合の問題を回避する事ができます。&lt;/p&gt;
&lt;h4&gt; FUNCTION の leakproof 属性&lt;/h4&gt;
&lt;p&gt;Leaky View問題はVIEWのsecurity_barrier属性によって解決する事ができるのですが、これは一部のクエリ最適化を無効化するために、場合によっては、そのためのコストが看過できないほど大きい事もあります。&lt;/p&gt;
&lt;p&gt;例えば、アプリケーションの設計上、以下のようなVIEWを定義し、VIEWの外側から条件句（主キーによる絞込みなど）を与えて使いたいというケースを考えてみましょう。&lt;/p&gt;
&lt;pre&gt;
CREATE VIEW valid_credit WITH (security_barrier) AS
    SELECT * FROM credit WHERE card_is_valid(number, expired);

SELECT * FROM valid_credit WHERE cid = &lt;span class=&quot;deco&quot;&gt;&amp;#60;customer-id&amp;#62;&lt;/span&gt;;
&lt;/pre&gt;
&lt;p&gt;この場合、card_is_valid関数と、VIEWの外部から与えた cid = &lt;span class=&quot;deco&quot;&gt;&amp;#60;customer-id&amp;#62;&lt;/span&gt; を用いて credit テーブルをスキャンした結果が利用者には返されます。ですが、VIEWにはsecurity_barrier属性が設定されているため、常にcard_is_valid関数が先に実行されます。&lt;/p&gt;
&lt;p&gt;この制限は cid 列にインデックスが設定されていても同様です。したがってインデックス・スキャンが選択されるべき状況でも全件スキャンが選択されてしまいます。ああ困った、困った。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://archives.postgresql.org/message-id/CADyhKSUGwN68i7tewO0P1Jfrz8gZ=PH_+TWS0H+5vHaoc0QkWA@mail.gmail.com&quot; target=&quot;_blank&quot;&gt;Fix Leaky View Problemパッチ&lt;/a&gt;はPart-1とPart-2から構成されており、Part-1は前述の security_barrier 属性の実装を、Part-2ではその例外を設定する機能を実装しています。&lt;/p&gt;
&lt;p&gt;Part-2によって、先ほどのオプティマイザへの変更は一部修正されます。&lt;/p&gt;
&lt;pre&gt;
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -769,7 +769,8 @@ set_subquery_pathlist(PlannerInfo &amp;#42;root, RelOptInfo &amp;#42;rel,
        Node       &amp;#42;clause = (Node &amp;#42;) rinfo-&amp;#62;clause;

        if (!rinfo-&amp;#62;pseudoconstant &amp;#38;&amp;#38;
-           !rte-&amp;#62;security_barrier &amp;#38;&amp;#38;
+           (!rte-&amp;#62;security_barrier ||
+            !contain_leakable_functions(clause)) &amp;#38;&amp;#38;
            qual_is_pushdown_safe(subquery, rti, clause, differentTypes))
        {
            /&amp;#42; Push it down &amp;#42;/
&lt;/pre&gt;

&lt;p&gt;サブクエリがsecurity_barrier属性付きのVIEWに由来するとき、このif文は条件句のPush-Downを抑止しますが、Part-2パッチは条件句(clause)が leakable-functions （つまり情報を漏えいする可能性のある関数）を含んでいなければ、サブクエリへの条件句のPush-Downを許可するように修正します。&lt;/p&gt;
&lt;p&gt;では、関数が情報を漏えいする可能性の有無をどのように設定するか。&lt;/p&gt;
&lt;p&gt;それには、CREATE FUNCTION構文に新たに追加されるLEAKPROOF属性を使用します。&lt;/p&gt;
&lt;p&gt;例えば、以下のように使用します。LEAKPROOFを指定することで、この関数に情報漏えいの恐れがないという事を明示的に指定できますが、これは同時に、潜在的に不可視の行の内容を参照することを可能にするため、関数のLEAKPROOF属性をセットするには特権ユーザの権限が必要です。&lt;/p&gt;
&lt;p&gt;（SE-PostgreSQLでも db_procedure:{install}権限をチェックする予定です）&lt;/p&gt;
&lt;pre&gt;
CREATE FUNCTION is_positive(int) RETURNS bool LANGUAGE plpgsql
    &lt;span class=&quot;deco&quot;&gt;LEAKPROOF&lt;/span&gt;
    AS 'BEGIN RETURN $1 &amp;#62; 0; END';
&lt;/pre&gt;
&lt;p&gt;一部のビルトイン関数の中でも、明らかに情報漏えいのリスクがない関数については、デフォルトでLEAKPROOF属性がセットされています。&lt;/p&gt;
&lt;p&gt;（全部で2400個程あるため、網羅的なチェックはこれからですが…。）&lt;/p&gt;
&lt;p&gt;例えば、32bit Integer同士の大小比較を行う int4gt 関数は、以下のように実装されています。&lt;/p&gt;
&lt;pre&gt;
Datum
int4gt(PG_FUNCTION_ARGS)
{
    int32       arg1 = PG_GETARG_INT32(0);
    int32       arg2 = PG_GETARG_INT32(1);

    PG_RETURN_BOOL(arg1 &amp;#62; arg2);
}
&lt;/pre&gt;
&lt;p&gt;この実装に情報漏えいの危険はありませんので、DB初期化時にLEAKPROOF属性はセットされています。&lt;/p&gt;
&lt;p&gt;その他にも、現在のパッチでは各種ビルトインタイプの等価・大小比較演算子の実装として利用されている関数にLEAKPROOF属性がついています。実際に試してみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=# SET SESSION AUTHORIZATION bob;
SET
postgres=&amp;#62; SELECT * FROM my_credit;
 cname |      cmail      | cid |       number        |  expired
-------+-----------------+-----+---------------------+------------
 bob   | bob@example.com | 102 | 5555-6666-7777-8888 | 2013-10-30
 bob   | bob@example.com | 102 | 1234-5678-1234-5678 | 2015-06-30
(2 rows)
&lt;/pre&gt;
&lt;p&gt;ユーザ bob は2枚のクレジットカードを持っています。リッチメンですね。&lt;/p&gt;
&lt;p&gt;では、２つの条件句を付加してみます。一つは先ほどのf_leak()関数、もう一つは expired &amp;#60; '2014-01-01' という Date 型の大小比較演算です。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; SELECT * FROM my_credit_secure WHERE f_leak(number) AND expired &amp;#60; '2014-01-01';
NOTICE:  f_leak =&amp;#62; 5555-6666-7777-8888
 cname |      cmail      | cid |       number        |  expired
-------+-----------------+-----+---------------------+------------
 bob   | bob@example.com | 102 | 5555-6666-7777-8888 | 2013-10-30
(1 row)
&lt;/pre&gt;
&lt;p&gt;NOTICEメッセージが一行だけ表示されているという事は、大小比較演算はf_leak()関数よりも先に実行されたようです。EXPLAINで実行計画を見てみましょう。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM my_credit_secure WHERE f_leak(number) AND expired &amp;#60; '2014-01-01';
                                QUERY PLAN
---------------------------------------------------------------------------
 Subquery Scan on my_credit_secure  (cost=1.06..27.06 rows=1 width=104)
   Filter: &lt;span class=&quot;deco&quot;&gt;f_leak(my_credit_secure.number)&lt;/span&gt;
   -&amp;#62;  Hash Join  (cost=1.06..27.04 rows=2 width=104)
         Hash Cond: (credit.cid = customer.cid)
         -&amp;#62;  Seq Scan on credit  (cost=0.00..24.50 rows=387 width=40)
               Filter: &lt;span class=&quot;deco&quot;&gt;(expired &amp;#60; '2014-01-01'::date)&lt;/span&gt;
         -&amp;#62;  Hash  (cost=1.05..1.05 rows=1 width=68)
               -&amp;#62;  Seq Scan on customer  (cost=0.00..1.05 rows=1 width=68)
                     Filter: (cname = (getpgusername())::text)
(9 rows)
&lt;/pre&gt;
&lt;p&gt;見ての通り、expired &amp;#60; '2014-01-01' 条件句が credit テーブルのスキャンに結びついているのと比較して、f_leak()関数はmy_credit_secureビューの内側にPush-Downされていません。これが LEAKPROOF 属性の有無による違いです。もし credit テーブルにインデックスが設定されていれば、Push-Downされた条件句により、全件スキャンの代わりにインデックス・スキャンが選択されるかもしれません。&lt;/p&gt;
&lt;h4&gt; まとめ&lt;/h4&gt;
&lt;p&gt;確かこの問題は、かれこれ2年以上議論を続けてきた息の長い問題です。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;2009年9月4日のセキュアOS塾『SE-PostgreSQL vs Oracle Label Security』の資料の中で言及があります。（p.34）&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://sepgsql.googlecode.com/files/090904-jsosjk04-sepgsql-vs-ols.pdf&quot; target=&quot;_blank&quot;&gt;http://sepgsql.googlecode.com/files/090904-jsosjk04-sepgsql-vs-ols.pdf&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;開発コミュニティとしての方向性は、概ね上で紹介した形で収束しつつありますが、まだ v9.2 の新機能として紹介できるかどうか、は分からない状況です。が、SE-PostgreSQLの行レベルアクセス制御機能を実現するためにもマージしておきたい機能ですので、なんとかcommitできるよう頑張りたいところです。&lt;/p&gt;
&lt;p&gt;最後に『じゃあ、既存のシステムではどうやって対策したら良いのよ？』という質問に対して一つTIPSを紹介しておきたいと思います。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Q. PostgreSQL v9.1以前のバージョンでLeaky View問題を防ぐにはどうしたらよいか？&lt;/p&gt;
&lt;p&gt;A. クエリに OFFSET 0 を付ける&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;オプティマイザがサブクエリをフラット化、または、条件句をPush-Downする時、サブクエリにOFFSET/LIMIT句が含まれている場合はそれを断念する、という事を思い出してください。&lt;/p&gt;
&lt;p&gt;OFFSET 0は結果セットの先頭から値を読むという意味ですので、本来は何の意味もありません。ですが、ここまで説明した条件句の実行順序に起因する問題を防ぐには簡便な方法です。&lt;/p&gt;
&lt;p&gt;ただし、関数のLEAKPROOF属性に相当する機能はありませんので、その点でトレードオフは必要になります。&lt;/p&gt;
&lt;p&gt;&lt;hr /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://atnd.org/events/21994&quot; target=&quot;_blank&quot;&gt;PostgreSQL Advent Calendar&lt;/a&gt;向けに記事を書くにあたり、MySQL、MS SQL Server、Oracle Databaseなど他のRDBMSの挙動はどうなっているのか調べたかったのですが、時間がありませんでした。特に Oracle は勝手にWHERE句に条件をくっつけるVirtual Private Databaseという機能を持っていますので気になります。&lt;/p&gt;
&lt;p&gt;これらは、追って調査したいと思います。きっと。いつの日か。アディオス、アミーゴ。&lt;/p&gt;
&lt;br /&gt;

&lt;p&gt;さて、翌 12/5(月) は笠原さんです。よろしく〜&lt;/p&gt;
&lt;/div&gt;</description>
	<pubDate>Sat, 03 Dec 2011 15:37:23 +0000</pubDate>
	<dc:creator>kaigai</dc:creator>
</item>
<item>
	<title>Dan Walsh: SELinux versus pam_securid.so</title>
	<guid>http://danwalsh.livejournal.com/48571.html</guid>
	<link>http://danwalsh.livejournal.com/48571.html</link>
	<description>Seems to be my month for fighting pam modules from third parties.&amp;nbsp;&amp;nbsp; I have heard that RSA corporation is recommending SELinux be turned off to run their products.&amp;nbsp; I just love it when a &lt;i&gt;supposed&lt;/i&gt; security company recommends that customers turn on a key security component of the Operating System.&amp;nbsp; Now did RSA ever contact me to work through the problems,? No.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Come on RSA you can do better then this.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;I am trying to avoid underhanded security comment about using SELinux to protect key assets of the company...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I worked with Joe Lucchesi, to get this pam module to work with SELinux.&amp;nbsp; Joe was having problems with sshd working with the pam module.&amp;nbsp; He was getting execstack errors.&amp;nbsp; Turns out the pam_securid.so file was shipped with the execstack flag turned on.&amp;nbsp; Execstack is a dangerous protection to allow a domain, since it turns off protection against buffer overflow attacks.&amp;nbsp; Most app never need this access.&lt;br /&gt;&lt;br /&gt;Executing&lt;br /&gt;&lt;br /&gt;&lt;span&gt;execstack -c /lib64/security/pam_securid.so&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Cleared the flag.&amp;nbsp; And allowed sshd to get past this AVC.&amp;nbsp; Whatever is causing this flag to be set, the build procedure or installation needs to be fixed.&lt;br /&gt;&lt;br /&gt;The next problems we hit was pam_securid seems to be running netstat under the covers.&amp;nbsp; I recall we had this problem with the Netscape Certificate libraries. They used to execute netstat in order to generate entropy when using certificates, so I figure this is what is going on here.&amp;nbsp; I also see the sshd executing ps?&amp;nbsp; Probably&amp;nbsp; for the same reason.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;RSA guys please use /dev/urandom and /dev/random.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;We turned off the use of netstat in our libraries years ago.&amp;nbsp; Using netstat and ps causes me to have to allow login programs to search /sys/net and because of bugs in our kernel add a dontaudit for sys_ptrace.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Finally secureid uses /var/ace to store its authorization content.&amp;nbsp; This should probably be under /var/lib/ace, I have added a label for this directory&lt;br /&gt;&lt;br /&gt;&lt;span&gt;/var/ace(/.*)?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gen_context(system_u:object_r:var_auth_t,s0)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This should allow the pam_securid module to use the content in this directory.&lt;br /&gt;&lt;br /&gt;Now Joe can run his pam_securid.so on his machine in enforcing mode with a small custom module until we push updates to fix the problem.&lt;br /&gt;&lt;br /&gt;Bottom line.&amp;nbsp; If you are a third party and you are having problems running your tools with SELinux, please, please contact me or Red Hat and lets work through the problems, and give our users a better experience.</description>
	<pubDate>Fri, 02 Dec 2011 12:55:03 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: SELinux versus pam_google_authenticator...</title>
	<guid>http://danwalsh.livejournal.com/48161.html</guid>
	<link>http://danwalsh.livejournal.com/48161.html</link>
	<description>I just became aware of a new PAM, &lt;a href=&quot;http://code.google.com/p/google-authenticator/&quot; rel=&quot;nofollow&quot;&gt;pam_google_authenticator.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is some kind of One TIme Password tool to allow you to add One Time Passwords to you Linux Login and I guess use your Android phone.&lt;br /&gt;&lt;br /&gt;pam_google_authenticator causes login programs to&amp;nbsp; try and&amp;nbsp; write to ~/.google_authenticator by default.&amp;nbsp; SELinux does not like this.&amp;nbsp; SELinux prevents login programs from writing to random locations in the home directory.&amp;nbsp; It is usually not a good idea to rely on stuff in the home dir for authorization because the homedir may require authorization to be able to be mounted or decrypted. (kNFS for example).&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I got a bugzilla on sshd not being able to write to ~/.google_authenticator.&amp;nbsp; One option would be to set the label on the .google_authenticator as ssh_home_t.&amp;nbsp; I also did some &amp;quot;googling&amp;quot; and found the following entry:&lt;br /&gt;&lt;a href=&quot;http://code.google.com/p/google-authenticator/wiki/PamModuleInstructions&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/google-authenticator/wiki/PamModuleInstructions&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;Comment by&lt;/span&gt;&lt;a href=&quot;http://code.google.com/u/108719985377468594203/&quot; rel=&quot;nofollow&quot;&gt;&lt;span&gt; phil.may &amp;lt;snip&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span title=&quot;Thu Jul  7 10:12:53 2011&quot;&gt; Jul 7, 2011&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;span&gt;If you are using Fedora and SELinux, you will need to use the right config. The default SELinux policy does not allow the SSH daemon to update the ~/.google_authenticator file.&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span&gt;In Fedora 14 (and possibly other versions) sshd runs under &amp;quot;sshd_t&amp;quot; and can only writelocations with certain SELinux labels. One such label is &amp;quot;var_auth_t&amp;quot; and the default policy sets this label on &amp;quot;/var/run/user/&lt;strong&gt;&amp;quot; &lt;/strong&gt;Therefore, the following config works:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;# If the user is NOT in group &amp;quot;otp_users&amp;quot;, skip next module&lt;/span&gt;
&lt;span&gt;auth &lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;success&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;default&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;ignore&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt; pam_succeed_if&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;so user notingroup otp_users
auth &amp;nbsp; &amp;nbsp; &amp;nbsp; required &amp;nbsp; &amp;nbsp; pam_google_authenticator&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;so secret&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;/var/&lt;/span&gt;&lt;span&gt;run&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;&lt;span&gt;user&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;USER&lt;/span&gt;&lt;span&gt;}/.&lt;/span&gt;&lt;span&gt;google_authenticator
auth &amp;nbsp; &amp;nbsp; &amp;nbsp; include &amp;nbsp; &amp;nbsp; &amp;nbsp;password&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;auth

&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;BTW I have not tried this out on Fedora 16, and am curious if this will work, or does pam_google_authenticator expect the contents of .google_authenticator to survive a reboot.&lt;br /&gt;</description>
	<pubDate>Fri, 18 Nov 2011 15:45:17 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Customizing the Kiosk OS.</title>
	<guid>http://danwalsh.livejournal.com/48006.html</guid>
	<link>http://danwalsh.livejournal.com/48006.html</link>
	<description>I receve a decent amount of interest about the &lt;a href=&quot;http://danwalsh.livejournal.com/44398.html&quot;&gt;kiosk spin&lt;/a&gt;, but I have never formalized it as a fedora spin.&amp;nbsp; The reason for this is almost everyone who looks at it, likes the idea but they need to customize it, in one way or another. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;My vision of the Kiosk Operating system was that it was readonly and periodically an admin would recut/rebuild a newer version and then redestribute it to his machines.&amp;nbsp; It is fairly easy to build your own image.&amp;nbsp; Just download the kiosk kickstart file (kiosk.ks), make some customization and rebuild your ISO file using the livecd-tools.&amp;nbsp; The last step would be to install it to your favorite medium, USB Sticks or DVD.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I recently received an email that requested:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&amp;quot;I have downloaded kiosk just this afternoon and tried on my laptop: as I have been requested for such a spin in our city library for eight computers, how can I build a spin with language/keyboard set as Italian??? (the standard procedure to change settings/Logout/login seems not to be working..) &amp;quot;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Here is how I would go about building the Italian version of the Kiosk Operating System.&lt;br /&gt;&lt;br /&gt;On the currently released version of Fedora.&amp;nbsp; As I write this blog, we are at Fedora 16.&amp;nbsp; Login as root and and follow this procedure.&lt;br /&gt;&lt;br /&gt;You are going to build the Kiosk Operating System using the spin-kickstarts, so we need to install the sortware.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# yum install spin-kickstarts livecd-tools&lt;br /&gt;# cd /usr/share/spin-kickstarts&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make sure you have the latest kiosk.ks file from my people page. &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/kiosk/kiosk.ks&quot; rel=&quot;nofollow&quot;&gt;&lt;span&gt;http://people.fedoraproject.org/~dwalsh/SELinux/kiosk/kiosk.ks&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# rm -f kiosk.ks*&lt;br /&gt;# wget http://people.fedoraproject.org/~dwalsh/SELinux/kiosk/kiosk.ks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Change the default language within the kickstart file. &amp;nbsp; You can use your favorite editor to do this, and modify &amp;quot;lang&amp;quot; line.&amp;nbsp; I will just use a sed command.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sed -i 's/en_US.UTF8/it_IT.UTF-8/g' kiosk.ks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now you can build a new kiosk image.&amp;nbsp; Replacing the name of the livecd with your own content.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# livecd-creator -t MYLIBRARY -f MYLIBRARY -c kiosk.ks --cache=/var/cache/kiosk&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now go get a cup of coffee since this will take a long while, maybe a half hour.&amp;nbsp;&lt;br /&gt;When it finishes, you will have an ISO image named MYLIBRARY.iso.&amp;nbsp; You need to install the iso ont a dvd or to a usb stick using livecd-iso-to-disk.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# livecd-iso-to-disk --totaltimeout 1&amp;nbsp; ./MYLIBRARY.iso /dev/sdb1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Remove your USB stick and attempt a boot a machine using it.&lt;br /&gt;&lt;br /&gt;Of course if you want to add some less then free packages to your kiosk operating system, you would edit the kickstart file and add your alternative repositories.&lt;br /&gt;&lt;br /&gt;For additional information on building livecd please use:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://fedoraproject.org/wiki/How_to_create_and_use_Live_USB&quot; rel=&quot;nofollow&quot;&gt;http://fedoraproject.org/wiki/How_to_create_and_use_Live_USB&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And on using kickstart files.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://fedoraproject.org/wiki/Anaconda/Kickstart&quot; rel=&quot;nofollow&quot;&gt;http://fedoraproject.org/wiki/Anaconda/Kickstart&lt;/a&gt;</description>
	<pubDate>Thu, 17 Nov 2011 20:54:01 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Russell Coker (security): SE Linux Status in Debian 2011-10</title>
	<guid>http://etbe.coker.com.au/?p=3038</guid>
	<link>http://etbe.coker.com.au/2011/10/31/selinux-status-2011-10/</link>
	<description>&lt;h3&gt;Debian/Unstable Development&lt;/h3&gt;
&lt;p&gt;&lt;b&gt;deb http://www.coker.com.au wheezy selinux&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The above APT sources.list line has my repository for SE Linux packages that have been uploaded to Unstable and which will eventually go to testing and then the Wheezy release (if they aren&amp;#8217;t obsoleted first). I have created that repository for people who want to track SE Linux development without waiting for an Unstable mirror to update.&lt;/p&gt;
&lt;p&gt;In that repository I&amp;#8217;ve included a new version of &lt;b&gt;policycoreutils&lt;/b&gt; that now includes &lt;b&gt;mcstrans&lt;/b&gt; and also has support for newer policy such that the latest &lt;b&gt;selinux-policy-default&lt;/b&gt; package can be installed. The version that is currently in Testing supports upgrading policy on a running system but doesn&amp;#8217;t support installing the policy on a system that previously didn&amp;#8217;t run SE Linux.&lt;/p&gt;
&lt;p&gt;I have also uploaded SE Linux Policy packages from upstream release 20110726 compared to the previous packages which were from upstream release 20100524. As the numbers imply there is 14 months of upstream policy development which changes many things. Many of the patches from my Squeeze policy packages are not yet incorporated in the policy I have uploaded to Unstable. I won&amp;#8217;t guarantee that an Unstable system in Enforcing mode will do anything other than boot up and allow you to login via ssh. It&amp;#8217;s definitely not ready for production but it&amp;#8217;s also very suitable for development (10 years ago I did a lot of development on SE Linux systems that often denied login access, it wasn&amp;#8217;t fun).&lt;/p&gt;
&lt;p&gt;Kyle Moffett submitted a patch for libselinux which dramatically changed the build process. As Manoj (who wrote the previous build scripts) was not contactable I accepted Kyle&amp;#8217;s patch as provided. Thanks for the patch Kyle, and thanks for all your work over the years Manoj. Anyway the result of these changes should mean that it&amp;#8217;s easier to bootstrap Debian on a new architecture and easier to support multi-arch &amp;#8211; but I haven&amp;#8217;t tested either of these.&lt;/p&gt;
&lt;h3&gt;Squeeze&lt;/h3&gt;
&lt;p&gt;The policy packages from Squeeze can&amp;#8217;t be compiled on Unstable. The newer policy compilation tool chain is more strict about how some things can be declared and used, thus some policy which was fairly dubious but usable is now invalid. While it wouldn&amp;#8217;t be difficult to fix those problems I don&amp;#8217;t plan to do so. There is no good reason for compiling Squeeze policy on Unstable now that I&amp;#8217;ve uploaded a new upstream release.&lt;/p&gt;
&lt;h3&gt;deb http://www.coker.com.au squeeze selinux&lt;/h3&gt;
&lt;p&gt;I am still developing Squeeze policy and releasing it in the above APT repository. I will also get another policy release in a Squeeze update if possible to smooth the transition to Wheezy &amp;#8211; the goal is that Squeeze policy will be usable on Wheezy even if it can&amp;#8217;t be compiled. Also note that the compilation failures only affect the Debian package, it should still be possible to make modules for local use on a Wheezy system with Squeeze policy.&lt;/p&gt;
&lt;h3&gt;MLS&lt;/h3&gt;
&lt;p&gt;On Wednesday I&amp;#8217;m giving a lecture at my local LUG about &lt;a href=&quot;http://en.wikipedia.org/wiki/Multilevel_security&quot;&gt;MLS&lt;/a&gt; on SE Linux. I hope to have a MLS demonstration system available to LUG members by then. Ideally I will have a MLS system running on a virtual server somewhere that&amp;#8217;s accessible as well as a Xen/KVM image on a USB stick that can be copied by anyone at the meeting.&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t expect to spend much time on any aspect of SE Linux unrelated to MLS for the rest of the week.&lt;/p&gt;
&lt;h3&gt;Version Control&lt;/h3&gt;
&lt;p&gt;I need to change the way that I develop SE Linux packages, particularly the &lt;b&gt;refpolicy&lt;/b&gt; source package (source of &lt;b&gt;selinux-policy-default&lt;/b&gt; among others). A 20,000 line single patch is difficult to work with! I will have to switch to using &lt;b&gt;quilt&lt;/b&gt;, once I get it working well it should save me time on my own development as well as making it easier to send patches upstream. Also I need to setup a public version control system so I can access the source from my workstation, laptop, and netbook. While doing that I might as well make it public so any interested people can help out. Suggestions on what type of VCS to use are welcome.&lt;/p&gt;
&lt;h3&gt;How You Can Help&lt;/h3&gt;
&lt;p&gt;Sorting out the mess that is the &lt;b&gt;refpolicy&lt;/b&gt; package, sending patches upstream and migrating to a VCS is a fair bit of work. But there are lots of small parts. Sending patches upstream is a job that could be done in small pieces.&lt;/p&gt;
&lt;p&gt;Writing new policy is not something to do yet. There&amp;#8217;s not much point in doing that while I still haven&amp;#8217;t merged all the patches from Squeeze &amp;#8211; maybe next week. However I can provide the missing patches to anyone who wants to review them and assist with the merging.&lt;/p&gt;
&lt;p&gt;I have a virtual server that has some spare capacity. One thing I would like to do is to have some virtual machines running Unstable with various configurations of server software. Then we could track Unstable on those images and use automated testing to ensure that nothing breaks. If anyone wants root access on a virtual server to install their favorite software then let me know. But such software needs to be maintained and tested!&lt;/p&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/11/17/debian-ssh-se-linux/&quot; rel=&quot;bookmark&quot; title=&quot;Debian SSH and SE Linux&quot;&gt;Debian SSH and SE Linux&lt;/a&gt; &lt;small&gt;I have just filed Debian bug report #556644 against the...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/&quot; rel=&quot;bookmark&quot; title=&quot;/run and SE Linux Policy&quot;&gt;/run and SE Linux Policy&lt;/a&gt; &lt;small&gt;Currently Debian/Unstable is going through a transition to using /run...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2010/07/25/se-linux-status-squeeze/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux status in Debian/Squeeze&quot;&gt;SE Linux status in Debian/Squeeze&lt;/a&gt; &lt;small&gt;ffmpeg I&amp;#8217;ve updated my SE Linux repository for Squeeze to...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Mon, 31 Oct 2011 12:22:43 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Russell Coker (security): Capabilities vs SE Linux</title>
	<guid>http://etbe.coker.com.au/?p=2994</guid>
	<link>http://etbe.coker.com.au/2011/10/28/capabilities-vs-se-linux/</link>
	<description>&lt;p&gt;&lt;a href=&quot;http://www.cl.cam.ac.uk/research/security/capsicum/papers/2010usenix-login-capsicum.pdf&quot;&gt;In December 2010 a paper was published by Robert N.M. Watson and Jonathan Anderson from the Cambridge University and Ben Laurie and Kris Kennaway of Google about the Capsicum capabilities system [1]&lt;/a&gt;. It seems that the aim of the project is to allow systems that need privileges briefly when they start (such as tcpdump) a safe method of dropping privs. &lt;a href=&quot;http://www.cl.cam.ac.uk/research/security/capsicum/&quot;&gt;The main project page is here [2]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The focus of the paper is on the Chromium web browser and six different ways of constraining the Chromium sandbox are compared. For the SE Linux comparison they claim 200 lines of code changes as of Fedora 15, in Fedora 16 I couldn&amp;#8217;t find a Chromium package, so I presume that they mean 200 lines of SE Linux policy (I am not aware of anyone modifying the Chromium source for SE Linux). They note that SE Linux doesn&amp;#8217;t support separating different sandboxes, while it would be possible to have each sandbox be assigned a different MCS sensitivity label to separate them that option would be unwieldy enough that they are essentially correct in this regard. For SE Linux systems running the MLS policy the correct thing to do would be to run multiple copies of Chromium at different levels to access different sensitivity levels of data, this would normally be done by polyinstantiating the home directory.&lt;/p&gt;
&lt;p&gt;One thing to note however is that there is no requirement that only one security method be implemented. I can&amp;#8217;t think of any technical reason why it would be impossible to run SE Linux and Capsicum on the same system. SE Linux could constrain daemons and restrict the access to Capsicum services while Capsicum could be used to give minimum privileges to parts of Chromium. I&amp;#8217;m not sure that such a combination would offer anything that the MLS users would desire, but it seems that everyone else (the vast majority of computer users) would be served well by a combination of SE Linux and Capsicum.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s disappointing that the paper didn&amp;#8217;t mention Posix 1003.1e capabilities, but given the lack of use that Posix capabilities get that&amp;#8217;s understandable.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s also disappointing when someone develops something new and different nowadays and doesn&amp;#8217;t provide a virtual machine image for it. Installing and configuring something that requires application and kernel changes is a lot of work and most people who are idly curious about the technology won&amp;#8217;t go to the effort. By today&amp;#8217;s standards it&amp;#8217;s not that difficult to share a 1GB filesystem image via Bittorrent.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://www.cl.cam.ac.uk/research/security/capsicum/papers/2010usenix-login-capsicum.pdf&quot;&gt; http://www.cl.cam.ac.uk/research/security/capsicum/papers/2010usenix-login-capsicum.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[2]&lt;a href=&quot;http://www.cl.cam.ac.uk/research/security/capsicum/&quot;&gt; http://www.cl.cam.ac.uk/research/security/capsicum/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/08/22/se-linux-vs-chroot/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux vs chroot&quot;&gt;SE Linux vs chroot&lt;/a&gt; &lt;small&gt;A question that is often asked is whether to use...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2010/07/26/se-linux-chroot-environment/&quot; rel=&quot;bookmark&quot; title=&quot;Creating a SE Linux Chroot environment&quot;&gt;Creating a SE Linux Chroot environment&lt;/a&gt; &lt;small&gt;Why use a Chroot environment? A large part of the...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/09/23/context-of-devxvc0/&quot; rel=&quot;bookmark&quot; title=&quot;Context of /dev/xvc0&quot;&gt;Context of /dev/xvc0&lt;/a&gt; &lt;small&gt;I have just converted a Fedora Core 5 server to...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Fri, 28 Oct 2011 02:47:57 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: Open Source how do I love thee, let me count the ways.</title>
	<guid>http://danwalsh.livejournal.com/47738.html</guid>
	<link>http://danwalsh.livejournal.com/47738.html</link>
	<description>Yesterday I got contacted by Red Hat Support about a problem we had in libselinux.&amp;nbsp; If you are setting up confined users you can use the &lt;span&gt;semanage login&lt;/span&gt; command to setup a group of linux users to be assigned to a confined user type.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage login -a -s staff_u -r s0-s0:c0.c1023 %wheel&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This command would cause all linux users in the wheel group to login as the staff_u SELinux user.&amp;nbsp; Well we had a bug in getseuserbyname function in libseliunux.&amp;nbsp; When you login to a system the pam_selinux module uses this function to figure out which SELinux user should be used for your UID.&amp;nbsp; There was a bug where we were not allocating enough memory for reading the entire group file contents.&amp;nbsp; Basically if the number of users within a group was too large, the library would stop reading.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;A customer of ours found the problem and reported it.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Now the reason I love Open Source...&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The customer did not stop there.&amp;nbsp; They downloaded our source, found the problem, built a patch and attached it to the bug report.&amp;nbsp; So all I had to do was apply the patch and start the errata process.&amp;nbsp;&amp;nbsp; This is the type of stuff that can't happen in a closed source system, and is why Open Source is better...&lt;br /&gt;&lt;br /&gt;Open source is like &lt;a href=&quot;http://www.authorama.com/grimms-fairy-tales-39.html&quot; rel=&quot;nofollow&quot;&gt;The Elves and the Shoemaker&lt;/a&gt;, just don't tell my boss.&amp;nbsp; :^)</description>
	<pubDate>Tue, 25 Oct 2011 12:37:05 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>James Morris: New GPG Key</title>
	<guid>http://blog.namei.org/?p=508</guid>
	<link>http://blog.namei.org/2011/10/23/new-gpg-key/</link>
	<description>&lt;p&gt;In support of the new &lt;a href=&quot;http://article.gmane.org/gmane.linux.kernel/1197920&quot;&gt;kernel.org security scheme&lt;/a&gt;, I&amp;#8217;ve created a new 4096 bit RSA key:&lt;/p&gt;
&lt;pre&gt;pub   4096R/FA118320 2011-10-23
      Key fingerprint = 4ED7 50E6 F7F9 ACED 29DD  B750 EB75 1458 FA11 8320
uid   James Morris &amp;lt;jmorris@namei.org&amp;gt;&lt;/pre&gt;
&lt;p&gt;I&amp;#8217;ve published the key via the &lt;a href=&quot;http://pgp.mit.edu/&quot;&gt;MIT key server&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll continue to host the security subsystem tree on selinuxproject.org until things are fully set up on kernel.org.&lt;/p&gt;</description>
	<pubDate>Sun, 23 Oct 2011 13:02:34 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #8 How to remove a port from a port type?</title>
	<guid>http://danwalsh.livejournal.com/47533.html</guid>
	<link>http://danwalsh.livejournal.com/47533.html</link>
	<description>&lt;span&gt;How do you remove a network port from a network port type?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First a little explanation.&amp;nbsp; Linux contains 65536 network ports for both UDP and TCP.&lt;br /&gt;SELinux uses types to group network ports together.&amp;nbsp; If you want to see a listing of the port types on the system you can execute:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;semanage&amp;nbsp; port -l&lt;br /&gt;SELinux Port Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Proto&amp;nbsp;&amp;nbsp;&amp;nbsp; Port Number&lt;br /&gt;&lt;br /&gt;afs_bos_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7007&lt;br /&gt;afs_client_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7001&lt;br /&gt;afs_fs_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2040&lt;br /&gt;afs_fs_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7000, 7005&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we write rules in SELinux like&lt;br /&gt;&lt;br /&gt;&lt;b&gt;allow httpd_t http_port_t : tcp_socket name_bind ; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This rules says the apache process can execute the bind command using any port that is currently labeled http_port_t.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage&amp;nbsp; port -l | grep http_port_t&lt;br /&gt;http_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 80, 443, 488, 8008, 8009, 8443&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now a fairly common question that gets asked is, can I remove these ports.&amp;nbsp;&amp;nbsp; IE I do not want to allow apache to bind to port 8008.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How would I do this?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The simplest thing to do is to redefine port 8008 as a different port type that httpd can not bind to.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The default port type for all unassigned ports&amp;nbsp; &amp;gt; 1024 is unreserved_port_t or ephemeral_port_t (Fedora 16)&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage&amp;nbsp; port -l | grep ^unreserved_port_t&lt;br /&gt;unreserved_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1024-32767, 61001-65535&lt;br /&gt;unreserved_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1024-32767, 61001-65535&lt;br /&gt;# semanage&amp;nbsp; port -l | grep ^ephemeral_port_t&lt;br /&gt;ephemeral_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32768-61000&lt;br /&gt;ephemeral_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32768-61000&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note SELinux will use a more specific port type if the port has been defined, for example when the kernel sees tcp port 8008, it will use http_port_t rather then unreserved_port_t.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But the admin can override this by adding his own port definition.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage port -m -t unreserved_port_t -p tcp 8008&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To prove this worked, I tested using apache.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sed -i 's/Listen 80/Listen 8008/g' /etc/httpd/conf/httpd.conf&lt;br /&gt;# semanage&amp;nbsp; port -m -t unreserved_port_t -p tcp 8008&lt;br /&gt;# service httpd restart&lt;br /&gt;Restarting httpd (via systemctl):&amp;nbsp; Job failed. See system logs and 'systemctl status' for details.&amp;nbsp; [FAILED]&lt;br /&gt;# semanage port -d -p tcp 8008&lt;br /&gt;# service httpd restart&lt;br /&gt;Restarting httpd (via systemctl):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Be careful doing this, because you have just changed the definition of http_port_t for ALL domains, not just the httpd_t domain.&amp;nbsp;&amp;nbsp; Meaning if you were running firefox with a sandbox_web_t sandbox on the same machine, the firefox would no longer be able to connect to port 8008, because sandbox_web_t is only allowed to connect to http_port_t and 8008 is no longer defined as 8008.</description>
	<pubDate>Fri, 21 Oct 2011 15:01:11 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: How should you disable IPV6?</title>
	<guid>http://danwalsh.livejournal.com/47118.html</guid>
	<link>http://danwalsh.livejournal.com/47118.html</link>
	<description>&lt;span&gt;Blogging twice in the same day, a new record...&lt;br /&gt;&lt;br /&gt;Lots of people are out there disabling IPV6, and when you do invariably you get a flood of AVC messages about different confined domains asking the kernel to load the kernel module net-pf-10.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;type=AVC msg=audit(10/18/11 23:40:10.233:978087) : avc:&amp;nbsp; denied&amp;nbsp; { &lt;span&gt;module_request &lt;/span&gt;} for&amp;nbsp; pid=32265 comm=pickup kmod=&amp;quot;&lt;span&gt;net-pf-10&lt;/span&gt;&amp;quot; scontext=system_u:system_r:postfix_pickup_t:s0 tcontext=system_u:system_r:&lt;span&gt;kernel_t&lt;/span&gt;:s0 tclass=&lt;span&gt;system &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now I am not recommending that you enable or disable IPV6, but if you do want to disable it and run with SELinux turned on, please read the following:&lt;br /&gt;&lt;br /&gt;Eric Paris reports&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&amp;quot;I believe the networking kernel community recommends (and it will shut up these AVCs) that IPv6 be disabled by:&lt;br /&gt;&lt;br /&gt;echo 1 &amp;gt; /proc/sys/net/ipv6/conf/all/disable_ipv6&lt;br /&gt;&lt;br /&gt;It still loads the module but unhooks almost all of the calls into the module. (apparently the IPv6 module has become so ingrained in the kernel that a number of other things, like certain firewall modules, require it. I didn't design it, I'm just telling it how it is) &amp;quot;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;We recommend that you do not disable the ipv6 module but add&lt;br /&gt;&lt;br /&gt;&lt;span&gt;net.ipv6.conf.all.disable_ipv6 = 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;to &lt;span&gt;/etc/sysctl.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And the AVC messages should go away.&lt;br /&gt;&lt;br /&gt;The setroubleshoot plugin in Fedora reflects this info.&lt;/span&gt;&lt;br /&gt;</description>
	<pubDate>Wed, 19 Oct 2011 13:34:07 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Making a domain &quot;unconfined&quot;</title>
	<guid>http://danwalsh.livejournal.com/47066.html</guid>
	<link>http://danwalsh.livejournal.com/47066.html</link>
	<description>In a couple of previous blogs I talked about permissive and unconfined domains.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/24537.html?thread=176857&quot;&gt;http://danwalsh.livejournal.com/24537.html?thread=176857&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt;http://danwalsh.livejournal.com/42394.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Today we had a question about how to I disable_trans on pam_console_t in Red Hat Enterprise Linux 6.&lt;br /&gt;If you have used RHEL5 or have read one of the blogs above you will realize in RHEL5 we had a lot of booleans DOMAIN_disable_trans.&amp;nbsp; The idea was to run these domains without SELinux protection.&amp;nbsp; We quickly figured out that this was a bad idea.&amp;nbsp; Other confined domains would start failing because the process they were supposed to communicate with would be running with a different label.&amp;nbsp; Or files created by the disabled_trans DOMAIN would now get created with the wrong labels.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In RHEL6 we introduced permissive domains, so that you could run the entire system locked down but pick a few process domains to run in permissive mode.&amp;nbsp; The nice thing about this is we can figure out what the domain wants to do and improve the policy.&lt;br /&gt;&lt;br /&gt;Miroslav Grepl came up with a third solution to the problem today.&amp;nbsp; Basically if a administrator wants to just allow a domain to do what it wants, he can add a policy module that turns the domain into an unconfined domain.&amp;nbsp; This will work on all Fedora releases and RHEL5 as well as RHEL6.&amp;nbsp; And is a much better solution then the disable_trans boolean.&lt;br /&gt;&lt;br /&gt;If you wanted to run pam_console_t as an unconfined domain, you would first create a file call mypam.te.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# cat mypam.te&lt;br /&gt;policy_module(mypam, 1.0)&lt;br /&gt;gen_requires(`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type pam_console_t;&lt;br /&gt;')&lt;br /&gt;unconfined_domain(pam_console_t)&lt;br /&gt;# make -f /usr/share/selinux/devel/Makefile&lt;br /&gt;# semodule -i mypam.pp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now pam_console_t will be an unconfined domain, but any confined domain that needs to interact with it will still work.&amp;nbsp; All of the file transition rules will still happen, so the system should stay labelled properly.&amp;nbsp; And no AVC messages will be generated about this domain.&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Wed, 19 Oct 2011 13:01:03 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: setrans is a handy little tool to analyze policy transitions</title>
	<guid>http://danwalsh.livejournal.com/46653.html</guid>
	<link>http://danwalsh.livejournal.com/46653.html</link>
	<description>For several years we have had a SELinux tool set called setools that allows you to analyse policy.&amp;nbsp; I use sesearch and seinfo all the time for looking at policy.&amp;nbsp; setools includes a tcl/tk interface, called apol,&amp;nbsp; that allows you to ask really complicated questions in policy about whether one process and read/write a file, even through process transitions.&amp;nbsp; The problem is the GUI is a little clunky, and I don't like GUIs.&lt;br /&gt;&lt;br /&gt;A few years ago I added python bindings for sesearch and seinfo to the setools/apol libraries.&amp;nbsp; These python interfaces are used within some of the semanage tool chain.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I often see an AVC about one domain not being able to write to another domains files.&amp;nbsp; Usually these types of avc's are caused by passing an open file descriptor, like stdout, from one process to another process.&amp;nbsp; &amp;nbsp; Sometimes I am puzzled by the relationship between the two domains.&amp;nbsp; I recently got an AVC about ldconfig_t not being able to write to a chr_file labeled mock_var_lib_t.&amp;nbsp;&amp;nbsp; How does the ldconfig program even know about a chr_file labeled mock_var_lib_t?&amp;nbsp; How did did mock transition to the ldconfig domain?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Well I wrote a tool, &lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/setrans&quot; rel=&quot;nofollow&quot;&gt;setrans&lt;/a&gt;, that helps answer these question.&amp;nbsp; The tool takes two domain/process types and attempts to see if the first&lt;br /&gt;type can transition to the second type, and then print all of the intermediary types that it used to get from one domain to the other.&lt;br /&gt;&lt;br /&gt;./setrans init_t httpd_t&lt;br /&gt;init_t --&amp;gt; httpd_t&lt;br /&gt;&lt;br /&gt;./setrans mock_t ldconfig_t&lt;br /&gt;mock_t --&amp;gt; mount_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; ldconfig_t&lt;br /&gt;&lt;br /&gt;./setrans mock_t user_t&lt;br /&gt;mock_t --&amp;gt; mount_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; stunnel_t --&amp;gt; rlogind_t --&amp;gt; remote_login_t --&amp;gt; unpriv_userdomain --&amp;gt; user_t&lt;br /&gt;mock_t --&amp;gt; mount_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; crond_t --&amp;gt; user_t&lt;br /&gt;mock_t --&amp;gt; mount_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; getty_t --&amp;gt; local_login_t --&amp;gt; userdomain --&amp;gt; user_t&lt;br /&gt;mock_t --&amp;gt; mount_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; xdm_t --&amp;gt; gkeyringd_domain --&amp;gt; user_t&lt;br /&gt;&lt;br /&gt;I know that it is not complete and will not show all paths, but it is pretty useful for quick analyses of the policy.&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Wed, 12 Oct 2011 16:09:47 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 16 New SELinux Feature part IV - Shrinking policy</title>
	<guid>http://danwalsh.livejournal.com/46388.html</guid>
	<link>http://danwalsh.livejournal.com/46388.html</link>
	<description>Back in July the systemd team was trying to decrease the boot time on early versions of Fedora 16.&amp;nbsp; They found that with a Solid State disk, SELinux policy load and relabel was quickly becoming the biggest pig as far as boot time.&amp;nbsp; So they added some log messages that showed how long it was taking to just read the selinux policy off of disk and load it into the kernel.&lt;br /&gt;&lt;br /&gt;Lennart Poettering announced systemd 32 with the following message.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span&gt;Primarily bugfixes, and one really cool improvement: we can now load the SELinux policy without having to reexecute ourselves. This is much
prettier and saves up to 70ms or so. I also added some basic profiling output for SELinux which unfortunately shows that SELinux costs around
5s on every boot on f16 (and that on my really fast machine!). Sad. 

Look for output like this:

[   10.727004] systemd[1]: Successfully loaded SELinux policy in 3s 270ms 896us.
[   10.769204] systemd[1]: Successfully loaded SELinux database in 41ms 700us, size on heap is 460K.
[   11.943903] systemd[1]: Relabelled /dev and /run in 1s 125ms 738us.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;He even added these lines to every boot, so everyone would know how much time SELinux was costing them on boot.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Nothing like public embarrassment to make you take action.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Shame is a great motivator. :^(&lt;br /&gt;&lt;br /&gt;I decided to take a look at the policy using the sesearch tools.&amp;nbsp; I wanted to figure out where all the rules were coming from, and whether we had some duplicates we could remove.&amp;nbsp; The first thing I noticed was there were thousands of rules related to network ports.&amp;nbsp; To me there seemed to be way to many.&amp;nbsp; I began to investigate and found that M4 macro expansion was the problem.&lt;br /&gt;&lt;br /&gt;SELinux policy is written using m4.&amp;nbsp; Over the years we have written lots of macros which policy writers take advantage. &amp;nbsp; We call these macros interfaces.&amp;nbsp; Another feature of SELinux policy is the use of attributes.&amp;nbsp; Attrinbutes are a way of grouping lots of types (init_t, httpd_t) together.&amp;nbsp; You can create a new user type say staff_t and add an attribute say usertype.&amp;nbsp; Now you write rules regarding the usertype that affect all users.&lt;br /&gt;&lt;br /&gt;allow usertype etc_t:file read;&lt;br /&gt;&lt;br /&gt;SELinux also defines network port attributes like port_type and reserved_port_type.&amp;nbsp; All network ports get the attribute port_type and all ports &amp;lt; 1024 get the attribute reserved port type.&amp;nbsp; Well M4 has a cool feature &amp;quot;negation&amp;quot;.&amp;nbsp;&amp;nbsp; SELinux policy was using negation in many places including defineing unreserved_ports.&amp;nbsp; For example in Fedora 15 we have an interface that says.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;interface(`corenet_tcp_bind_all_unreserved_ports',`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gen_require(`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; attribute port_type, reserved_port_type;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ')&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 { port_type -reserved_port_type }:tcp_socket name_bind;&lt;br /&gt;')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All types that need to bind to ports &amp;gt; 1023 would then using this interface.&lt;br /&gt;&lt;br /&gt;/usr/bin/ssh (ssh_t) needs to be able to setup alternate ports to allow a tunnel connection between a remote sshd service and the local machine, so we allow it to bind to any port &amp;gt; 1023 using the following line:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;corenet_tcp_bind_all_unreserved_ports(ssh_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Seems like a simple rule to add, until you understand how m4 works with negation.&amp;nbsp; M4 expands out all the attributes into their types and then writes a rule for each type that matches.&amp;nbsp; A rule like this could end up adding 100s of allow rules.&amp;nbsp; For every type that is a port_type and not a reserved_port_type, a rule would be written allowing ssh_t to bind to the port.&lt;br /&gt;&lt;br /&gt;allow ssh_t amqp_port_t:tcp_socket name_bind;&lt;br /&gt;allow ssh_t asterisk_port_t:tcp_socket name_bind;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;I found that if I defined a new attribute &amp;quot;unreserved_port_type&amp;quot;, and rewrote the interface to something like.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;interface(`corenet_tcp_bind_all_unreserved_ports',`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gen_require(`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; attribute port_type, reserved_port_type;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ')&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow $1 unreserved_port_type:tcp_socket name_bind;&lt;br /&gt;')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I ended up with only one rule generated by&lt;br /&gt;&lt;br /&gt;&lt;span&gt;corenet_tcp_bind_all_unreserved_ports(ssh_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;allow ssh_t unreserved_port_type:tcp_socket name_bind;&lt;br /&gt;&lt;br /&gt;Turns out we had lots and lots of interfaces where we used the negation.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dontaudit $1 { port_type -port_t }:dccp_socket name_bind;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; files_read_all_dirs_except($1, $2 -shadow_t)&lt;br /&gt;&lt;br /&gt;I went through the entire policy and switched to using only attributes like unreserved_port_type attributes and shrunk the size of policy by about 80 %.&lt;br /&gt;&lt;br /&gt;What is really nice, you can check the size of policy using seinfo.&lt;br /&gt;----------------------------&lt;br /&gt;As time went on F15 machine:&lt;br /&gt;&lt;span&gt;$ seinfo&lt;br /&gt;Statistics for policy file: /etc/selinux/targeted/policy/policy.24&lt;br /&gt;Policy Version &amp;amp; Type: v.24 (binary, mls)&lt;br /&gt;Allow:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;282444&lt;/b&gt;&lt;br /&gt;Dontaudit:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;184516&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and on F16 machine:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;$ seinfo&lt;br /&gt;Statistics for policy file: /etc/selinux/targeted/policy/policy.26&lt;br /&gt;Policy Version &amp;amp; Type: v.26 (binary, mls)&lt;br /&gt;Allow:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;88242&lt;/b&gt;&lt;br /&gt;Dontaudit:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;11302&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Tools used to load the policy run about 3 times as fast.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Tom London looked at the change on his machine and found&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;And comparing 'old vs. new' boot times, first the old:

Jul 28 06:39:29 tlondon systemd[1]: Startup finished in 3s 336ms 755us (kernel) + 11s 625ms 240us (initrd) + 28s 189ms 914us (userspace) = 43s 151ms 909us.

And now the 'new':

Jul 29 06:00:41 tlondon systemd[1]: Startup finished in 1s 844ms 542us (kernel) + 4s 999ms 977us (initrd) + 29s 239ms 766us (userspace) = 36s 84ms 285us.

6.5 seconds less in initrd.&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;A second feature of this change is we are now taking up probably 80% less kernel memory...&lt;br /&gt;&lt;br /&gt;RHEL 6&lt;br /&gt;# du -s /etc/selinux/targeted/policy/policy.24&lt;br /&gt;6004&amp;nbsp;&amp;nbsp;&amp;nbsp; /etc/selinux/targeted/policy/policy.24&lt;br /&gt;&lt;br /&gt;Fedora 16:&lt;/p&gt;&lt;p&gt;# du -s /etc/selinux/targeted/policy/policy.26&lt;br /&gt;2156&amp;nbsp;&amp;nbsp;&amp;nbsp; /etc/selinux/targeted/policy/policy.26&lt;br /&gt;&lt;br /&gt;And Fedora 16 has more domains, types and rules...&lt;br /&gt;&lt;br /&gt;At some point I should probably back port these changes to RHEL6.&lt;/p&gt;</description>
	<pubDate>Fri, 30 Sep 2011 18:30:05 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 16 New SELinux Feature part III - permissivedomains module</title>
	<guid>http://danwalsh.livejournal.com/46245.html</guid>
	<link>http://danwalsh.livejournal.com/46245.html</link>
	<description>As has been stated in&lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt; previous blogs&lt;/a&gt; we have three types of unconfined processes on Fedora.&amp;nbsp;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;We have unconfined_domain() system processes.&amp;nbsp; initrc_t, init_t, kernel_t, ...&lt;/li&gt;&lt;li&gt;We have unconfined_domain() user processes. unconfined_t,&lt;/li&gt;&lt;li&gt;We have permissivedomains&lt;/li&gt;&lt;/ol&gt;Up until now you can remove unoconfined system processes by disabling the unconfined.pp module.&lt;br /&gt;&lt;br /&gt;semodule -d unconfined&lt;br /&gt;&lt;br /&gt;You can disable the unconfined users by removing unconfined user mappings and then disabling unconfineduser.pp&lt;br /&gt;&lt;br /&gt;# semanage login -m -a staff_u __default__&lt;br /&gt;# semanage login -m -a staff_u root&lt;br /&gt;You might need to log out and back in now as sysadm_t and make sure there are no unconfined_u/unconfined_t processes running. Also make sure that you do not have any entries in /etc/sudoers for unconfined_t or files left over in /tmp or /var/db/sudo.&lt;br /&gt;# semanage user -d unconfined_u&lt;br /&gt;# semode -d unconfineduser&lt;br /&gt;&lt;br /&gt;But you could not get rid of permissive domains, since the permissive flag was in individual policy modules.&amp;nbsp; In F16 we re-factored all of the permissive domain declarations into a new module called permissivedomains.pp.&amp;nbsp; If you want to remove all permissive domains from your system&lt;br /&gt;you can execute&lt;br /&gt;&lt;br /&gt;semodule -d permissivedomains&lt;br /&gt;&lt;br /&gt;# semanage permissive -l&lt;br /&gt;Builtin Permissive Types&lt;br /&gt;&lt;br /&gt;Customized Permissive Types&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will give you a fully locked down machine.&lt;br /&gt;</description>
	<pubDate>Thu, 29 Sep 2011 13:17:50 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): 4th German OWASP Security Day</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-3289137103999606727</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/09/4th-german-owasp-security-day.html</link>
	<description>My submission to the &lt;a href=&quot;https://www.owasp.org/index.php/German_OWASP_Day_2011&quot;&gt;4th German OWASP Security Day&lt;/a&gt; was accepted. Now let's see if we can accept their OWASP license that needs to be signed...&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-3289137103999606727?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Thu, 22 Sep 2011 01:09:14 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): I am leaving the SUSE Security Team...</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-6192655919467253952</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/09/i-am-leaving-suse-security-team.html</link>
	<description>After 12 years I am leaving the SUSE Security-Team... just to support them! :-)&lt;br /&gt;&lt;br /&gt;Like a satellite I was spun-off from mother earth. Flying around the SUSE Security Team as project-manager to take care of our products before they get released working hand-in-hand with Marcus and his team that (mostly but not exclusively) takes care of the security of already released products.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-6192655919467253952?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Wed, 21 Sep 2011 03:25:20 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>James Morris: Linux Security Summit 2011 – Presentation Slides</title>
	<guid>http://blog.namei.org/?p=503</guid>
	<link>http://blog.namei.org/2011/09/20/linux-security-summit-2011-presentation-slides/</link>
	<description>&lt;p&gt;Just over a week ago, the 2011 Linux Security Summit was held in Santa Rosa CA, co-located with &lt;a href=&quot;http://www.linuxplumbersconf.org/2011/&quot;&gt;Linux Plumbers&lt;/a&gt;.  It ran for a day, starting with refereed presentations, and then round-table discussions.&lt;/p&gt;
&lt;p&gt;The home page for the summit is on the kernel.org wiki, and is currently unavailable, so I&amp;#8217;m posting links to the slides here:&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/SmackIntelPlumbers2011.pdf&quot;&gt;Smack is Alive and Well&lt;/a&gt;&lt;br /&gt;
Casey Schaufler, Intel&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/Integrity_overview_lss.pdf&quot;&gt;An Overview of the Linux Integrity Subsystem: Use Cases and Demonstration&lt;/a&gt;&lt;br /&gt;
David Safford and Mimi Zohar, IBM&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/IMA_EVM_Digital_Signature_Support.pdf&quot;&gt;Digital Signature support for IMA/EVM&lt;/a&gt;&lt;br /&gt;
Dmitry Kasatkin and Ryan Ware, Intel  (presented by Casey)&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/kruus_ima_lss_2011.pdf&quot;&gt;Protecting the Filesystem Integrity of a Fedora 15 Virtual Machine from Offline Attacks using IMA/EVM&lt;/a&gt;&lt;br /&gt;
Peter Kruus, The Johns Hopkins University Applied Physics Laboratory&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/LSS_11_Integrity_checked_block_devices.pdf&quot;&gt;Efficient, TPM-free system integrity checking with device mapper: dm-verity&lt;/a&gt;&lt;br /&gt;
Will Drewry and Mandeep Baines, Google&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/caseforseandroid.pdf&quot;&gt;The Case for SE Android&lt;/a&gt;&lt;br /&gt;
Stephen Smalley, NSA&lt;/p&gt;
&lt;p&gt;Roundtable discussions:&lt;/p&gt;
&lt;p&gt;* Kernel Hardening  [no slides]&lt;br /&gt;
Lead by Kees Cook, Canonical and Will Drewry, Google&lt;/p&gt;
&lt;p&gt;* &lt;a href=&quot;http://selinuxproject.org/~jmorris/lss2011_slides/LSMsPlumbers.pdf&quot;&gt;LSM Architecture&lt;/a&gt;&lt;br /&gt;
Lead by Kees Cook, Canonical and Casey Schaufler&lt;/p&gt;
&lt;p&gt;The SE Android talk was a last minute replacement for Ryan Ware&amp;#8217;s talk on MeeGo (Ryan was unfortunately not able to make it).&lt;/p&gt;
&lt;p&gt;See the write-ups by by &lt;a href=&quot;http://paulmoore.livejournal.com/6886.html&quot;&gt;Paul Moore&lt;/a&gt; and &lt;a href=&quot;http://lwn.net/SubscriberLink/458805/55b62ac6b3ec112f/&quot;&gt;LWN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Feedback so far has been positive.  I think it&amp;#8217;s valuable for the security developers to get together like this, after spending the rest of the year working remotely with each other.  Next year, we&amp;#8217;ll likely be looking at co-locating with LPC/KS/LinuxCon in San Diego.  It may be worth thinking about expanding to a two-day event, with the first day following the same format, but then splitting into project groups on day two for BoFs/hack sessions.&lt;/p&gt;
&lt;p&gt;Contact the &lt;a href=&quot;mailto:lss-pc AT ext.namei.org&quot;&gt;program committee&lt;/a&gt; if you have any suggestions.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d like to thank the LPC folk, and especially Jesse Barnes, for allowing us to co-locate and taking care of all of the logistics &amp;#8212; all we had to do was organize the talks and turn up.  Also thanks to the speakers, discussion leaders and attendees.  See you next year!&lt;/p&gt;</description>
	<pubDate>Tue, 20 Sep 2011 05:41:52 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Paul Moore: Wrapping Up The 2011 Linux Security Summit</title>
	<guid>urn:lj:livejournal.com:atom1:paulmoore:6886</guid>
	<link>http://paulmoore.livejournal.com/6886.html</link>
	<description>We just closed the doors on the 2011 Linux Security Summit a few hours ago and I wanted to jot down a few notes while everything was still fresh in my mind. Once again, a big thanks to all of our presenters, James Morris and the rest of the organizing committee; my personal opinion is that the summit was a success this year and I look forward to doing this again in 2012.&lt;br /&gt;&lt;br /&gt;Just as in the past, presentations will be posted at the wiki below once kernel.org comes back online.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&quot; rel=&quot;nofollow&quot;&gt;http://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Smack is Alive and Well, Casey Schaufler&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This presentation started with a brief introduction to Smack and then moved on to presenting the recent users, motivations and focus. While Smack has been incorporated into at least one general purpose Linux Distribution, Ubuntu, over the past year or two Smack has grown increasingly focused on small and embedded devices. Functionality wise, Smack has gained several new additions including process labels and transmutable directories. Process labels allow an executable file to be started with a label specified in the file's xattrs and not the parent process's attributes. Transmutable directories allow two differently labeled processes to write into each other's directories without&amp;nbsp;requiring full write access to the other label; this should make it much easier&amp;nbsp;to share files and data between labels. Beyond the new functionality,&amp;nbsp;performance improvements, increased Linux Test Project coverage and improved&amp;nbsp;consistency between AF_UNIX and AF_INET sockets have seen their way, or will&amp;nbsp;soon see their way into Smack.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;MeeGo platform security, including Smack userspace: &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://meego.gitorious.org/meego-platform-security/&quot; rel=&quot;nofollow&quot;&gt;&lt;span&gt;http://meego.gitorious.org/meego-platform-security&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;The Case for SE Android, Stephen Smalley&lt;/u&gt;&lt;div&gt; &lt;br /&gt;This presentation discussed a recent effort to prototype a SELinux&amp;nbsp;implementation for Android. While SELinux is well known in desktop and server&amp;nbsp;Linux environments, it is still rare in mobile and embedded systems due to&amp;nbsp;concerns around resource usage and differences in both the kernels and&amp;nbsp;userspace. This talk explained the basic Linux/Android differences and what&amp;nbsp;was needed to enable SELinux on the Android platform. Resource issues around&amp;nbsp;policy size were addressed through a greatly simplified SELinux policy which&amp;nbsp;avoided per-application policy and relied on a relatively simple rule set.&amp;nbsp;Finally, the effectiveness of the prototype was evaluated by examining&amp;nbsp;a recent Android vulnerability with a known exploit and determining the&amp;nbsp;effectiveness of the SELinux Android port in preventing the exploit. In the&amp;nbsp;end, this remains a prototype at present, designed to investigate Android's&amp;nbsp;security capabilities, but it shows quite a bit of promise and has a lot to&amp;nbsp;offer beyond the current Android security functionality.&lt;/div&gt;&lt;br /&gt;&lt;u&gt;Overview of the Linux Integrity Architecture, David Safford and Mimi Zohar&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;The Linux Integrity Architecture project has seen a lot of activity over the&amp;nbsp;past few years and the presentation started off with an overview of project,&amp;nbsp;including a status update on where each piece of functionality stood with&amp;nbsp;respect to upstream and established distributions. The good news is that&amp;nbsp;almost all of the IMA project is either currently upstream or patches have been&amp;nbsp;submitted and are being discussed on the related mailing lists. One of the&amp;nbsp;presentation highlights was a demo tying together the IMA principals and&amp;nbsp;virtualization to demonstrate a &amp;quot;Trusted Cloud&amp;quot;. While there is work to be&amp;nbsp;done, the IMA project has made great strides and already offers some impressive&amp;nbsp;functionality.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;IMA project website:&amp;nbsp;&lt;a href=&quot;http://linux-ima.sf.net&quot; rel=&quot;nofollow&quot;&gt;http://linux-ima.sf.net&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Digital Signature Support for IMA/EVM, Dmitry Kasatkin and Casey Schaufler&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This presentation addressed a problem common to system and device manufacturers&amp;nbsp;who install a single &amp;quot;golden image&amp;quot; on each system they ship: how do you&amp;nbsp;reconcile the business need of a single install image with a TPM based EVM HMAC&amp;nbsp;which uses a per-device key stored in the TPM? One potential answer is to&amp;nbsp;expand on the EVM mechanism to support public key digital signatures in&amp;nbsp;addition to the TPM based HMAC. When the devices are initially installed, a&amp;nbsp;public key certificate is installed into the Linux Kernel keyring via an initrd&amp;nbsp;with the filesystem using digital signatures for the EVM xattr in place of the&amp;nbsp;traditional HMAC. As the files are accessed, the EVM digital signature is&amp;nbsp;verified, and if correct, it is replaced by a TPM generated HMAC. If the EVM&amp;nbsp;digital signature verification fails, access is denied in the same way as if&amp;nbsp;the EVM HMAC verification had failed.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Protecting the Filesystem Integrity of a Fedora 15 Virtual Machine from&amp;nbsp;Offline Attacks using IMA/EVM, Peter Kruus&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This presentation covered some work being done to better secure Fedora 15&amp;nbsp;guests running on VMWare ESXi while the guests were both running and offline. &amp;nbsp;All systems are vulnerable to offline attacks, but in the case of virtual&amp;nbsp;systems, offline vulnerabilities can sometimes be much easier to exploit due to&amp;nbsp;the availability of the host system and guest storage volumes. In order to&amp;nbsp;help mitigate this problem, the presenter leveraged the existing IMA/EVM&amp;nbsp;support in Fedora 15 to verify the integrity of critical system files, but&amp;nbsp;unfortunately due to missing vTPM support in VMWare ESXi the presenter was&amp;nbsp;unable to leverage TPM based HMACs in the EVM attributes. The solution was to&amp;nbsp;use a passphrase protected key which was loaded at boot through a combination&amp;nbsp;of the system's initrd and dracut. While this solution does provide an&amp;nbsp;increased level of protection against attack, for this approach to be truly&amp;nbsp;successful, full vTPM support is needed in the hypervisor to allow the guest to&amp;nbsp;utilize the TPM. While vTPM patches have been submitted for QEMU/KVM, the&amp;nbsp;state of the vTPM in VMWare ESXi is unknown.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Integrity-checked Block Devices with Device Mapper,&amp;nbsp;Will Drewry and Mandeep Baines&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This presentation dealt with an enhancement to the Linux Kernel Device Mapper&amp;nbsp;to perform block level integrity verification. This solution was designed&amp;nbsp;primarily for the Linux based Chromium OS running on modest netbook class&amp;nbsp;hardware where boot performance was a significant requirement. Helping to&amp;nbsp;simplify the solution was the fact that the system is very well defined and&amp;nbsp;operates in a read-only mode such that the integrity verification mechanism&amp;nbsp;does not need to worry about online updates to the storage volume. The&amp;nbsp;solution, dm-verity, uses a slightly modified hash tree, with the root hash&amp;nbsp;specified on the kernel command line to quickly verify the integrity of the&amp;nbsp;entire block device. Optimization is ongoing, but already the developers are&amp;nbsp;able to boot a ~800MB Chromium OS root partition in ~1.2s on an Atom CPU using&amp;nbsp;a SSD storage volume. While this integrity verification solution may not lend&amp;nbsp;itself quite as well to general purpose systems as the TPM/IMA based solutions,&amp;nbsp;it presents a novel solution that helps solve Chromium OS's needs in a a high&amp;nbsp;performance, low cost manner.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Kernel Hardening Roundtable, Kees Cook and Will Drewry&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This roundtable started with a discussion on the different kernel interfaces&amp;nbsp;where the kernel is exposed to user input, malicious or otherwise. From here&amp;nbsp;the focus shifted to how the existing security mechanisms, such as DAC, LSM and&amp;nbsp;capabilities, impact the kernel's exposed interfaces - for better or worse. At&amp;nbsp;this point it was clear, if it wasn't already, that the Linux Kernel remains&amp;nbsp;far too exposed to malicious users/applications and some additional hardening&amp;nbsp;techniques are needed.&lt;br /&gt;&lt;br /&gt;While many hardening ideas were discussed, the two main points of discussion&amp;nbsp;revolved around system call filtering/reduction and the hardening techniques&amp;nbsp;found in grsecurity. With respect to system call filtering, work has been&amp;nbsp;ongoing this year to expand the mainline seccomp functionality to be more&amp;nbsp;flexible and useful for a wider range of applications. Plenty of discussion&amp;nbsp;has already occurred on the mailing lists and more is expected as the enhanced&amp;nbsp;seccomp developer has promised a new round of patches soon. Similarly, work&amp;nbsp;has recently been ongoing to decompose the rejected grsecurity patch and&amp;nbsp;repackage it in a series of patches which will hopefully be acceptable to the&amp;nbsp;upstream kernel maintainers.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Sandbox powered by the current mainline seccomp:&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/seccompsandbox&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/seccompsandbox&lt;/a&gt;&lt;br /&gt;Ubuntu Linux Kernel hardening tasks:&amp;nbsp;&lt;a href=&quot;http://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#Upstream_Hardening&quot; rel=&quot;nofollow&quot;&gt;http://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#Upstream_Hardening&lt;/a&gt;&lt;br /&gt;Linux Kernel hardening mailing lists:&amp;nbsp;&lt;a href=&quot;http://www.openwall.com/lists&quot; rel=&quot;nofollow&quot;&gt;http://www.openwall.com/lists&lt;/a&gt; (see the kernel-hardening list)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;LSM Architecture Roundtable, Kees Cook and Casey Schaufler&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;This roundtable dealt primarily with the issues related to multiple LSMs, from&amp;nbsp;APIs and determining which LSM was enabled in the kernel to architectural issues&amp;nbsp;blocking multiple concurrent LSMs. With respect to determining the active LSM&amp;nbsp;and LSM APIs, the discussion was largely a group brainstorming session with&amp;nbsp;developers discussing the pros and cons of various solutions; while most agreed&amp;nbsp;the a general LSM userspace API was more problem than it was worth, there was&amp;nbsp;some general agreement on LSM conventions that should help unify some of the&amp;nbsp;most basic LSM API functionality in the future.&lt;br /&gt;&lt;br /&gt;This discussion around running multiple concurrent LSMs was much more focused,&amp;nbsp;with patches being proposed as recently as February, although everyone did&amp;nbsp;agree that the patches had serious limitations due to shortcomings with the LSM&amp;nbsp;hooks/blobs in the kernel. In the end, several inherent blockers to concurrent&amp;nbsp;LSM operation remained, but the &amp;quot;religious&amp;quot; arguments against the idea seemed&amp;nbsp;to be less than in past years.</description>
	<pubDate>Fri, 09 Sep 2011 06:55:34 +0000</pubDate>
</item>
<item>
	<title>Dan Walsh: Fedora 16 Alpha available part II, New SELinux Feature/File Name Transitions</title>
	<guid>http://danwalsh.livejournal.com/46018.html</guid>
	<link>http://danwalsh.livejournal.com/46018.html</link>
	<description>&lt;a href=&quot;https://fedoraproject.org/get-prerelease&quot; rel=&quot;nofollow&quot;&gt;Fedora 16 Alpha&lt;/a&gt; was just released: The announcement include the following:&lt;br /&gt;&lt;ul&gt; &lt;li&gt;SELinux Enhancements. SELinux policy package now includes a pre-built policy that will only rebuild policy if any customizations have been made. A sample test run shows 4 times speedup on installing the package from 48 Seconds to 12 Seconds and max memory usage from 38M to 6M. In addition to that, &lt;span&gt; SELinux file name transition allows better policy management. For instance, policy writers can take advantage of this and write a policy rule that states, if a SELinux unconfined process creates a file named resolv.conf in a directory labelled etc_t, the file should get labeled appropriately. This results is less chances of mislabeled files. &lt;/span&gt;Also, from this release onwards, selinuxfs is mounted at /sys/fs/selinux instead of in /selinux. All the affected components including anaconda, dracut, livecd-tools and policycoreutils have been modified to work with this change.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SELinuxFileNameTransition&quot; rel=&quot;nofollow&quot;&gt; Named File Transitions Feature&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This feature was added to F16 to make labelling files easier for users and administrators.&amp;nbsp; The goal is to prevent accidental mislabelling of file objects.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Accidental mislabelling&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Users or administrators often create files or directories that do not have the same label as the parent directory, and then forget to fix the label. An example of this would be the administrator going into the /root directory and creating the .ssh directory. In previous versions of Fedora, the directory would get created admin_home_t, even though the policy requires it to be labelled ssh_home_t.&amp;nbsp;&amp;nbsp; Later when he tries to use the content of the .ssh directory to login without a password, sshd (sshd_t) fails to read the directories contents because sshd is not allowed to read files labelled admin_home_t.&lt;br /&gt;&lt;br /&gt;Another example would be a user creating the public_html directory in his home directory.&amp;nbsp; The default label for content in the home directory is user_home_t, but SELinux requires the public_html directory to be labelled http_user_content_t or the apache process (httpd_t) will not be allowed to read it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;File Transitions Policy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Policy writers have always be able to write a file transition rule that includes the type of the processes creating the file object (NetworkManger_t), the type of the directory that will contain the file object (etc_t) and the class of the file object (file).&amp;nbsp; Then specify the type of the created object (net_conf_t).&lt;br /&gt;&lt;br /&gt;filetrans_pattern(NetworkManager_t, etc_t, file, net_conf_t)&lt;br /&gt;&lt;br /&gt;This policy line says that a process running as NetworkManager_t creating any file in a directory labelled etc_t will create it with the label net_conf_t.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Named File Transitions Policy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Eric Paris added a cool feature to the kernel that allows the kernel to label a file based on 4 characteristics instead of just three.&amp;nbsp; He added the base file name.&amp;nbsp; (Not the path).&lt;p&gt;Now we can write policy rules that state:&lt;/p&gt;&lt;ul&gt; &lt;li&gt;If the unconfined_t user process creates the &amp;quot;.ssh&amp;quot; directory in a directory labelled admin_home_t, then it will get created with the label ssh_home_t.&lt;br /&gt;  &lt;br /&gt;filetrans_pattern(unconfined_t, admin_home_t, dir, ssh_home_t, &amp;quot;.ssh&amp;quot;)&lt;br /&gt; &lt;/li&gt; &lt;li&gt;If the staff_t user process creates a directory named public_html in a directory labeled user_home_dir_t it will get labeled&lt;br /&gt;  &lt;br /&gt;http_user_content_t. filetrans_pattern(staff_t, user_home_dir_t, dir, http_user_content_t, &amp;quot;public_html&amp;quot;)&lt;/li&gt;&lt;/ul&gt;Additionally we have added rules to make sure if the kernel creates content in /dev it will label it correctly rather then waiting for udev to fix the label.&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;filetrans_pattern(kernel_t, device_t, chr_file, wireless_device_t, &amp;quot;rfkill&amp;quot;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bottom line.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There should be less occurrences of accidental mislabels by users and hopefully a more secure and better running SELinux system.</description>
	<pubDate>Tue, 30 Aug 2011 13:41:01 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 16 Alpha available, New SELinux Feature/Prebuilt Policy.</title>
	<guid>http://danwalsh.livejournal.com/45712.html</guid>
	<link>http://danwalsh.livejournal.com/45712.html</link>
	<description>&lt;a href=&quot;https://fedoraproject.org/get-prerelease&quot; rel=&quot;nofollow&quot;&gt;Fedora 16 Alpha&lt;/a&gt; was just released: The announcement include the following:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt; &lt;li&gt;SELinux Enhancements.&lt;br /&gt;  &lt;span&gt;SELinux policy package now includes a pre-built policy that will only rebuild policy if any customizations have been made. A sample test run shows 4 times speedup on installing the package from 48 Seconds to 12 Seconds and max memory usage from 38M to 6M. &lt;/span&gt;In addition to that, SELinux file name transition allows better policy management. For instance, policy writers can take advantage of this and write a policy rule that states, if a SELinux unconfined process creates a file named resolv.conf in a directory labelled etc_t, the file should get labeled appropriately. This results is less chances of mislabeled files. Also, from this release onwards, selinuxfs is mounted at /sys/fs/selinux instead of in /selinux. All the affected components including anaconda, dracut, livecd-tools and policycoreutils have been modified to work with this change.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;Pre-Built Policy&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We made major changes to the selinux-policy-TYPE rpm. (selinux-policy-targeted-3.10.0-21.fc16)&lt;div&gt; &lt;br /&gt;The rpm now includes a pre-built /etc/selinux/targeted/policy/policy.26.&amp;nbsp; This policy file can be loaded right away in a fresh install.&amp;nbsp; In all previous versions of SELinux for RHEL and Fedora, we rebuilt this file in the post install.&amp;nbsp; The reason for this is we&amp;nbsp; need to recompile in local customizations that the user/administrator might have made on your system.&amp;nbsp; Additionally if any package shipped&amp;nbsp; with a policy we would need to recompile in those policy packages.&amp;nbsp; But as the size of policy grew we were seeing Anaconda installation times&amp;nbsp; grow and memory requirements grow because of selinux-policy package.&amp;nbsp; We were even seeing virtual machine installations blow up on selinux-policy package installs because of limited memory.&amp;nbsp; When we looked at the problem, we realized that on initial install of policy, no user would have made local customizations and very few packages are shipping with their own policy.&amp;nbsp;&amp;nbsp;&lt;br /&gt; &lt;br /&gt;I reworked the tools to include the policy packages within the payload and now the package will check in the pre-install if there was any local customizations, if yes, the post install will recompile the policy, but if not the policy will just install.&lt;br /&gt; &lt;br /&gt;We also used to have to ship all of the policy modules, over 300, in the directory /usr/share/selinux/targeted and these would be copied into /etc/selinux/targeted/modules/active/, were we would never touch the files in /usr/share/selinux/targeted again.&amp;nbsp; Now we install directly into /etc/selinux/targeted/modules/active/.&lt;br /&gt; &lt;br /&gt;What you should see is faster initial installs and faster selinux-package updates.&amp;nbsp; In Fedora 15 a policy-package update would take around 45-50 seconds, in Fedora 16 on an unmodified selinux-policy system it should take &amp;lt; 15 seconds.&amp;nbsp; If you are updating from Fedora 15 the first time, it will still take a long time, but the next update should go quick.&amp;nbsp; If you have modified the SELinux system by adding pp&lt;br /&gt;files you will still see the recompile times that you always have.&amp;nbsp; :^(&lt;/div&gt;</description>
	<pubDate>Tue, 30 Aug 2011 13:37:13 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fedora 16 Alpha available part II, New SELinux Feature/File Name Transitions</title>
	<guid>http://danwalsh.livejournal.com/45414.html</guid>
	<link>http://danwalsh.livejournal.com/45414.html</link>
	<description>&lt;a href=&quot;https://fedoraproject.org/get-prerelease&quot; rel=&quot;nofollow&quot;&gt;Fedora 16 Alpha&lt;/a&gt; was just released:&lt;br /&gt;&lt;br /&gt;The announcement include the following:&lt;br /&gt;&lt;ul&gt; &lt;li&gt;SELinux Enhancements. SELinux policy package now includes a pre-built policy that will only rebuild policy if any customizations have been made. A sample test run shows 4 times speedup on installing the package from 48 Seconds to 12 Seconds and max memory usage from 38M to 6M. In addition to that, &lt;span&gt; SELinux file name transition allows better policy management. For instance, policy writers can take advantage of this and write a policy rule that states, if a SELinux unconfined process creates a file named resolv.conf in a directory labelled etc_t, the file should get labeled appropriately. This results is less chances of mislabeled files. &lt;/span&gt;Also, from this release onwards, selinuxfs is mounted at /sys/fs/selinux instead of in /selinux. All the affected components including anaconda, dracut, livecd-tools and policycoreutils have been modified to work with this change. &lt;span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SELinuxFileNameTransition&quot; rel=&quot;nofollow&quot;&gt;&lt;br /&gt;Named File Transitions Feature&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This feature was added to F16 to make labelling files easier for users and administrators.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The goal is to prevent accidental mislabelling of file objects.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Accidental mislabelling&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Users or administrators often create files or directories that do not have the same label as the parent directory, and then forget to fix the label. An example of this would be the administrator going into the /root directory and creating the .ssh directory.&lt;br /&gt;&lt;br /&gt;In previous versions of Fedora, the directory would get created admin_home_t, even though the policy requires it to be labelled ssh_home_t.&amp;nbsp;&amp;nbsp; Later when he tries to use the content of the .ssh directory to login without a password, sshd (sshd_t) fails to read the directories contents because sshd is not allowed to read files labelled admin_home_t.&lt;br /&gt;&lt;br /&gt;Another example would be a user creating the public_html directory in his home directory.&amp;nbsp; The default label for content in the home directory is user_home_t, but SELinux requires the public_html directory to be labelled http_user_content_t or the apache process (httpd_t) will not be allowed to read it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;File Transitions Policy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Policy writers have always be able to write a file transition rule that includes the type of the processes creating the file object (NetworkManger_t), the type of the directory that will contain the file object (etc_t) and the class of the file object (file).&amp;nbsp; Then specify the type of the created object (net_conf_t).&lt;br /&gt;&lt;br /&gt;filetrans_pattern(NetworkManager_t, etc_t, file, net_conf_t)&lt;br /&gt;&lt;br /&gt;This policy line says that a process running as NetworkManager_t creating any file in a directory labelled etc_t will create it with the label net_conf_t.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Named File Transitions Policy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Eric Paris added a cool feature to the kernel that allows the kernel to label a file based on 4 characteristics instead of just three.&amp;nbsp; He added the base file name.&amp;nbsp; (Not the path).&lt;p&gt;Now we can write policy rules that state:&lt;/p&gt;&lt;ul&gt; &lt;li&gt;If the unconfined_t user process creates the &amp;quot;.ssh&amp;quot; directory in a directory labelled admin_home_t, then it will get created with the label ssh_home_t.&lt;br /&gt;  &lt;br /&gt;filetrans_pattern(unconfined_t, admin_home_t, dir, ssh_home_t, &amp;quot;.ssh&amp;quot;)&lt;br /&gt; &lt;/li&gt; &lt;li&gt;If the staff_t user process creates a directory named public_html in a directory labeled user_home_dir_t it will get labeled http_user_content_t.&lt;br /&gt;  &lt;br /&gt;filetrans_pattern(staff_t, user_home_dir_t, dir, http_user_content_t, &amp;quot;public_html&amp;quot;)&lt;/li&gt;&lt;/ul&gt;Additionally we have added rules to make sure if the kernel creates content in /dev it will label it correctly rather then waiting for udev to fix the label.&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filetrans_pattern(kernel_t, device_t, chr_file, wireless_device_t, &amp;quot;rfkill&amp;quot;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bottom line.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There should be less occurrences of accidental mislabels by users and hopefully a more secure and better running SELinux system.</description>
	<pubDate>Fri, 26 Aug 2011 13:28:51 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: sVirt to the Rescue</title>
	<guid>http://danwalsh.livejournal.com/45194.html</guid>
	<link>http://danwalsh.livejournal.com/45194.html</link>
	<description>At the recent &lt;a href=&quot;http://www.blackhat.com/html/bh-us-11/bh-us-11-briefings.html&quot; rel=&quot;nofollow&quot;&gt;Black Hat conference&lt;/a&gt; Nelson Elhage presented:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;a href=&quot;https://media.blackhat.com/bh-us-11/Elhage/BH_US_11_Elhage_Virtunoid_Slides.pdf&quot; rel=&quot;nofollow&quot;&gt;Virtualization Under Attack: Breaking out of KVM&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The exploit, &lt;a href=&quot;http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1751&quot; rel=&quot;nofollow&quot;&gt;CVE-2011-1751&lt;/a&gt;, would allow a cracker to execute code in qemu-kvm process on the host.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span&gt;Note: Red Hat fixed this problem back in May 2011 prior to the publication of the paper and exploit. Customers who applied our security updates are not affected by this issue. So 0 days of exposure.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In the presentation there is this bullet point:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt; &lt;li&gt;&lt;br /&gt;  &lt;b&gt;qemu-kvm is often sandboxed using SELinux or similar, meaning that&lt;br /&gt;successful exploitation will often require a second privesc within the&lt;br /&gt;host.&lt;br /&gt;(Fortunately, Linux never has any of those)&lt;/b&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span&gt;This means that SELinux/sVirt on Red Hat Enterprise Linux and Fedora confines this outbreak!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In a previous blog, &lt;a href=&quot;http://danwalsh.livejournal.com/44090.html&quot;&gt;Fun with sVirt.&lt;/a&gt;, I showed how you can simulate this vulnerability to see what access was available. Not much...&lt;br /&gt;&lt;br /&gt;Nelson mentioned SELinux sandboxing could be bypassed by a theoretical second &amp;quot;privesc&amp;quot; vulnerability, meaning a bug in the kernel. SELinux or any kind of Mandatory Access Control is enforced by the Kernel.&amp;nbsp; Bugs in that Kernel, that a process is allowed to access, can subvirt SELinux. But SELinux is putting up a significant second barrier to the cracker.&lt;br /&gt;&lt;br /&gt;Security is all about Layers, making each layer as secure as possible and then fixing vulnerabilities as quickly as you know about them. &lt;br /&gt;&lt;br /&gt;This presentation exposes the risk associated with virtualization, but also shows the secondary security controls Linux KVM is using&amp;nbsp; to minimize the risk and giving us time to fix problems as soon as we know about them.&lt;br /&gt;&lt;br /&gt;Bottom line, this is why you leave SELinux enabled in enforcing mode. :^)</description>
	<pubDate>Thu, 25 Aug 2011 18:07:17 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dominick Grift: Git daemon and SELinux with RHEL6</title>
	<guid>tag:blogger.com,1999:blog-5024703430482213163.post-4238326997061638222</guid>
	<link>http://selinux-mac.blogspot.com/2011/08/git-daemon-and-selinux-with-rhel6.html</link>
	<description>RHEL6 does not ship with a manual page for configuring Git daemon SELinux policy, and so decided to publish a demonstration on youtube:
&lt;br /&gt;
&lt;br /&gt;Part 1. Git system daemon, shared repositories.
&lt;br /&gt;
&lt;br /&gt;http://www.youtube.com/watch?v=vgm89P5nbBQ
&lt;br /&gt;
&lt;br /&gt;Part 2. Git session daemon, personal repositories.
&lt;br /&gt;
&lt;br /&gt;http://www.youtube.com/watch?v=XHEPj80217o
&lt;br /&gt;
&lt;br /&gt;By the way you can look at the manual page (source) here:
&lt;br /&gt;
&lt;br /&gt;http://git.fedorahosted.org/git/?p=selinux-policy.git;a=blob;f=man/man8/git_selinux.8;h=e9c43b190c394f8ea7e68d9dd29f45c831340bf5;hb=ccadbe7d6ae709cdfd3b06d496477e069a2f13ee&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5024703430482213163-4238326997061638222?l=selinux-mac.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 23 Aug 2011 12:17:12 +0000</pubDate>
	<dc:creator>Dominick &quot;domg472&quot; Grift (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Paul Moore: Twitter Too</title>
	<guid>urn:lj:livejournal.com:atom1:paulmoore:6463</guid>
	<link>http://paulmoore.livejournal.com/6463.html</link>
	<description>To add to the recent email updates, I thought I would mention that I'm now on twitter too at &lt;a href=&quot;http://twitter.com/#!/paul_via_tweet&quot; rel=&quot;nofollow&quot;&gt;@paul_via_tweet&lt;/a&gt;.  Not much there right now, but since all the &quot;cool kids&quot; are on the twitter these days, how could I resist?</description>
	<pubDate>Mon, 15 Aug 2011 22:39:18 +0000</pubDate>
</item>
<item>
	<title>Dan Walsh: Fedora 16 is about to go to Alpha release, some SELinux changes.</title>
	<guid>http://danwalsh.livejournal.com/44836.html</guid>
	<link>http://danwalsh.livejournal.com/44836.html</link>
	<description>First with the move to systemd, we were asked to move the /selinux file system to a more standard location.&lt;br /&gt;&lt;br /&gt;From this point forward the selinuxfs will be mounted under /sys/fs/selinux.&lt;br /&gt;&lt;br /&gt;This seems to be the new location for kernel interface file systems, like cgroup&lt;br /&gt; &lt;br /&gt;# ls /sys/fs/&lt;br /&gt;cgroup&amp;nbsp;&amp;nbsp;&amp;nbsp; ext4&amp;nbsp; fuse&amp;nbsp; selinux&lt;br /&gt;&lt;br /&gt;libselinux has been modified to mount the selinuxfs file system on the /sys/fs/selinux directory if it exists, otherwise libselinux will fall back to mounting on the /selinux directory if it exists.&lt;br /&gt;&lt;br /&gt;One problem I foresee and we are beginning to fix is any application that hard coded &amp;quot;/selinux&amp;quot; in to the application. &amp;nbsp;So far we have had to fix anaconda, livecd-tools, policycoreutils, and dracut.&amp;nbsp; In most cases you should use the command line tools like setenforce or selinuxenabeled, or use the python bindings &lt;br /&gt;&lt;br /&gt;python&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; import selinux&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; print (selinux.is_selinux_enabled())&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;And not hard code the path.&lt;br /&gt;&lt;br /&gt;Another option is to grep /proc/self/mountinfo&lt;br /&gt;&lt;br /&gt; # grep selinuxfs /proc/self/mountinfo&amp;nbsp; | head -1 | awk '{ print $5 }'&lt;br /&gt;/sys/fs/selinux&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you know of any applications that hard code /selinux into them, please let me know and I can work with the maintainer or developer to fix the code.</description>
	<pubDate>Thu, 11 Aug 2011 13:24:44 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Paul Moore: New Email Address Part Two</title>
	<guid>urn:lj:livejournal.com:atom1:paulmoore:6360</guid>
	<link>http://paulmoore.livejournal.com/6360.html</link>
	<description>Hello again, last week I made a quick post to say that my @hp.com email address was going away; the reason for that, as many had guessed, was that I was leaving HP for a new employer.  As of this past Monday, August 8th, 2011, I'm happy to say that I am now working for Red Hat.  This should be good news for anyone interested in the Linux labeled networking bits and the assorted LSM network access controls as my new employer should allow me to spend more time maintaining and working on these things than I have over the past few years.&lt;br /&gt;&lt;br /&gt;So, with a new job comes a new email address; you can continue to send me email at paul@paul-moore.com, but now you can also reach me at pmoore@redhat.com.</description>
	<pubDate>Wed, 10 Aug 2011 18:08:11 +0000</pubDate>
</item>
<item>
	<title>Paul Moore: New Email Address</title>
	<guid>urn:lj:livejournal.com:atom1:paulmoore:6109</guid>
	<link>http://paulmoore.livejournal.com/6109.html</link>
	<description>Just a quick update to let everyone know that my @hp.com email address is going to stop working on Friday, August 5, 2011.  If you need to get in touch with me please send me email at paul@paul-moore.com.</description>
	<pubDate>Mon, 01 Aug 2011 21:16:45 +0000</pubDate>
</item>
<item>
	<title>Thomas Biege (Security): Scanny will replace the ror-sec-scanner</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-3790794325190251494</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/07/scanny-will-replace-ror-sec-scanner.html</link>
	<description>David and Flavio created a new &lt;a href=&quot;https://github.com/openSUSE/scanny&quot;&gt;github project&lt;/a&gt; to replace my ror-sec-scanner. &quot;&lt;a href=&quot;https://github.com/openSUSE/scanny&quot;&gt;Scanny&lt;/a&gt;&quot; doesn't uses regex but the AST and emits fewer false positives. So lets start adding rules/checks to it to become more powerful.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-3790794325190251494?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 26 Jul 2011 05:08:50 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Russell Coker (security): SE Linux File Context Precedence</title>
	<guid>http://etbe.coker.com.au/?p=2916</guid>
	<link>http://etbe.coker.com.au/2011/07/24/se-linux-file-context-precedence/</link>
	<description>&lt;p&gt;&lt;a href=&quot;http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/&quot;&gt;In my previous post I expressed a desire to use regular expressions for files that may appear in multiple places in the tree due to bind mounts for /run and /var/run etc [1]&lt;/a&gt;. However there is a problem with this idea.&lt;/p&gt;
&lt;p&gt;The SE Linux file labeling program &lt;b&gt;restorecon&lt;/b&gt; reads the file &lt;b&gt;/etc/selinux/$SELINUXTYPE/contexts/files/file_contexts&lt;/b&gt; which contains a set of regular expressions to assign labels to files. That file is ordered and the last entry which matches is the one that counts. When the file_contexts file is created the order is based on how many characters at the start of the file specification aren&amp;#8217;t regular expression meta-characters. For example the entry &amp;#8220;/.*&amp;#8221; is at the top of the file (and therefore has the lowest precedence), which makes it the catch-all entry for files that have no other match. So an entry for &amp;#8220;/var/run/REGEX&amp;#8221; will have a higher precedence than one for &amp;#8220;/var/REGEX&amp;#8221;, this means however that when I replaced the &amp;#8220;/var/run&amp;#8221; part with a regular expression then it had a lower precedence and it didn&amp;#8217;t work properly.&lt;/p&gt;
&lt;p&gt;I should have remembered this as I did a lot of work on setfiles (which became restorecon) in the early days. I have now developed a new way of solving this and this time I&amp;#8217;m testing it before blogging about it.&lt;/p&gt;
&lt;p&gt;I have written the following PERL program to fix the file contexts, this adds multiple lines and uses a &lt;b&gt;distro_debian&lt;/b&gt; conditional on them so that they don&amp;#8217;t slip into upstream use &amp;#8211; and so that if I lose track of where each patch came from I&amp;#8217;ll know that I can delete them in future because it only matters to Debian.&lt;/p&gt;
&lt;p&gt;#!/usr/bin/perl&lt;br /&gt;
use warnings;&lt;br /&gt;
use strict;&lt;/p&gt;
&lt;p&gt;open(LIST, &quot;find . -name \&quot;*.fc\&quot;|xargs egrep \&quot;^/(var.*run)|(var/lock)|(dev/shm)\&quot;|cut -f1 -d:|uniq|&quot;) or die &quot;Can't get file list\n&quot;;&lt;br /&gt;
while(&amp;lt;LIST&amp;gt;)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; my $filename = $_;&lt;br /&gt;
&amp;nbsp; chomp $filename;&lt;br /&gt;
&amp;nbsp; open(my $infile, &quot;&amp;lt;&quot;, $filename) or die &quot;Can't open file $filename&quot;;&lt;br /&gt;
&amp;nbsp; open(my $outfile, &quot;&amp;gt;&quot;, $filename . &quot;.new&quot;) or die &quot;Can't open file &quot;. $filename . &quot;.new&quot;;&lt;br /&gt;
&amp;nbsp; while(&amp;lt;$infile&amp;gt;)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; print $outfile $_;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; my $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if($_ =~ /^\/var\/run/)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;ifdef(&amp;#96;distro_debian', &amp;#96;\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline = $_;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline =~ s/^\/var//;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;')\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if($_ =~ /^\/var\/lock/)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;ifdef(&amp;#96;distro_debian', &amp;#96;\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline = $_;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline =~ s/^\/var/\/var\/run/;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline =~ s/^\/var//;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;')\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if($_ =~ /^\/dev\/shm/)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;ifdef(&amp;#96;distro_debian', &amp;#96;\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline = $_;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; $newline =~ s/^\/dev/\/run/;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;/var&quot; . $newline;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; print $outfile &quot;')\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; close($infile);&lt;br /&gt;
&amp;nbsp; close($outfile);&lt;br /&gt;
&amp;nbsp; rename $filename . &quot;.new&quot;, $filename or die &quot;Can't rename &quot; . $filename . &quot;.new to &quot; . $filename;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;The next policy thing that I have to work on is systemd. From a quick test it seems that systemd policy changes will be more invasive than is suitable for Squeeze. This means that someone who wants to upgrade from Squeeze to Wheezy+systemd will have to upgrade to Wheeze policy before installing systemd. I think that I will make 0.2.20100524-10 the last version in Unstable based on the 2010 release, I will now start work on packaging the latest upstream policy for Unstable.&lt;/p&gt;
&lt;p&gt;PS I&amp;#8217;m not much of a PERL programmer, so if anyone has suggestions for how to improve the above PERL code then please let me know. Please note however that I&amp;#8217;m not interested in making my code look like line-noise.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/&quot;&gt; http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/03/15/se-linux-on/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux on /.&quot;&gt;SE Linux on /.&lt;/a&gt; &lt;small&gt;The book SE Linux by Example has been reviewed on...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/&quot; rel=&quot;bookmark&quot; title=&quot;/run and SE Linux Policy&quot;&gt;/run and SE Linux Policy&lt;/a&gt; &lt;small&gt;Currently Debian/Unstable is going through a transition to using /run...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2007/09/23/context-of-devxvc0/&quot; rel=&quot;bookmark&quot; title=&quot;Context of /dev/xvc0&quot;&gt;Context of /dev/xvc0&lt;/a&gt; &lt;small&gt;I have just converted a Fedora Core 5 server to...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Sun, 24 Jul 2011 05:54:20 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Russell Coker (security): /run and SE Linux Policy</title>
	<guid>http://etbe.coker.com.au/?p=2913</guid>
	<link>http://etbe.coker.com.au/2011/07/22/run-se-linux-policy/</link>
	<description>&lt;p&gt;Currently Debian/Unstable is going through a transition to using /run instead of /var/run. Naturally any significant change to the filesystem layout requires matching changes to SE Linux policy. We currently have &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626720&quot;&gt;Debian bug #626720&lt;/a&gt; open about this. Currently the initscripts package breaks selinux-policy-default in Debian/Unstable so that you can&amp;#8217;t have initscripts using /run if the SE Linux policy doesn&amp;#8217;t support it.&lt;/p&gt;
&lt;p&gt;A patch has been suggested to the policy which uses a &lt;b&gt;subst&lt;/b&gt; file, basically that causes the SE Linux labeling programs to treat one directory tree the same way as another. The problem with this is that it depends on a libselinux patch that is not in any yet released version of libselinux (and certainly won&amp;#8217;t be in a Squeeze update). The upside of such a fix is that it would work for policy that I package as well as custom policy, so if someone wrote custom policy referring to /var/run it would automatically work with /run without any extra effort.&lt;/p&gt;
&lt;p&gt;I think that the only way to do this is to just have regular expressions that deal with this in the file contexts. It&amp;#8217;s a bit ugly and slows the relabel process down a little (probably no more than about 10%) but it will work &amp;#8211; and work on Squeeze as well. One thing I really like to do is to have the SE Linux policy for version X of Debian work with version X+1. This makes upgrades a lot easier for the users. Ideally upgrading a server could be a process that involves separate upgrades of the kernel, the SE Linux policy, and user-space in any particular order &amp;#8211; because upgrading everything at once almost guarantees that something will break and it may be difficult to determine the cause.&lt;/p&gt;
&lt;p&gt;At this time I&amp;#8217;m not sure whether I&amp;#8217;ll add a new policy using the subs file before the release of Wheezy (the next stable release of Debian) or just keep using regular expressions. I can have the Wheezy policy depend on a new enough libselinux so it won&amp;#8217;t be a problem in that regard (a new upstream version of libselinux with the subst feature should be released soon). In any case I need a back-port to Squeeze to use regular expressions to make an upgrade to Wheezy easier.&lt;/p&gt;
&lt;p&gt;for n in $(find . -name &quot;*.fc&quot;|xargs grep var/run|cut -f1 -d:|uniq) ; do&lt;br /&gt;
&amp;nbsp; sed -e &quot;s/\/var\/run/\/(var\/)?run/&quot; &amp;lt; $n &amp;gt; $n.new&lt;br /&gt;
&amp;nbsp; mv $n.new $n&lt;br /&gt;
done&lt;br /&gt;
for n in $(find . -name &quot;*.fc&quot;|xargs grep var/lock|cut -f1 -d:|uniq) ; do&lt;br /&gt;
&amp;nbsp; sed -e &quot;s/\/var\/lock/\/((var\/run)|(run)|(var))\/lock/&quot; &amp;lt; $n &amp;gt; $n.new&lt;br /&gt;
&amp;nbsp; mv $n.new $n&lt;br /&gt;
done&lt;br /&gt;
for n in $(find . -name &quot;*.fc&quot;|xargs grep dev/shm|cut -f1 -d:|uniq) ; do&lt;br /&gt;
&amp;nbsp; sed -e &quot;s/\/dev\/shm/\/((var\/run)|(run)|(dev))\/shm/&quot; &amp;lt; $n &amp;gt; $n.new&lt;br /&gt;
&amp;nbsp; mv $n.new $n&lt;br /&gt;
done&lt;/p&gt;
&lt;p&gt;I used the above fragment of shell code to change &amp;#8220;/var/run&amp;#8221; to &amp;#8220;/(var/)?run&amp;#8221;, &amp;#8220;/var/lock&amp;#8221; to &amp;#8220;/((var/run)|(run)|(var))/lock&amp;#8221;, and change &amp;#8220;/dev/shm&amp;#8221; to &amp;#8220;/(var/run)|(run)|(dev))/shm&amp;#8221;. It involves a reasonable number of changes to policy (mostly for /var/run), but hopefully this will be acceptable to the release team for inclusion in the next Squeeze update as the changes are relatively simple and obvious and the size of the patch is due to it being generated code.&lt;/p&gt;
&lt;p&gt;There is one final complication, Squeeze currently has selinux-policy-default version 2:0.2.20100524-7+squeeze1, but initscripts in Unstable breaks versions &amp;lt;= 2:0.2.20100524-9. So I guess I could submit a proposed version 2:0.2.20100524-9+squeeze1 to the release team to fix this. I would really like to have the Squeeze policy work with initscripts from Unstable or Wheezy.&lt;/p&gt;
&lt;p&gt;Any suggestions for how to deal with this?&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I wrote the above before testing the code, and it turned out to not work. &lt;a href=&quot;http://etbe.coker.com.au/2011/07/24/se-linux-file-context-precedence/&quot;&gt;I&amp;#8217;ve written another post describing a better solution that I have now uploaded to Unstable&lt;/a&gt;. I still have to sort something out with an update for Squeeze.&lt;/p&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2010/06/29/se-linux-policy-squeeze/&quot; rel=&quot;bookmark&quot; title=&quot;New SE Linux Policy for Squeeze&quot;&gt;New SE Linux Policy for Squeeze&lt;/a&gt; &lt;small&gt;I have just uploaded refpolicy version 0.2.20100524-1 to Unstable. This...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2008/09/21/dkim-signing-and-selinux-policy/&quot; rel=&quot;bookmark&quot; title=&quot;An Update on DKIM Signing and SE Linux Policy&quot;&gt;An Update on DKIM Signing and SE Linux Policy&lt;/a&gt; &lt;small&gt;In my previous post about DKIM [1] I forgot to...&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://etbe.coker.com.au/2009/11/17/debian-ssh-se-linux/&quot; rel=&quot;bookmark&quot; title=&quot;Debian SSH and SE Linux&quot;&gt;Debian SSH and SE Linux&lt;/a&gt; &lt;small&gt;I have just filed Debian bug report #556644 against the...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
	<pubDate>Fri, 22 Jul 2011 13:50:22 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: A new short video starring yours truly available to RHEL subscribers.</title>
	<guid>http://danwalsh.livejournal.com/44763.html</guid>
	<link>http://danwalsh.livejournal.com/44763.html</link>
	<description>&lt;a href=&quot;https://access.redhat.com/knowledge/videos/new-features-selinux-red-hat-enterprise-linux-6&quot; rel=&quot;nofollow&quot;&gt;&lt;br /&gt;New SELinux Features in Red Hat Enterprise Linux 6&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Red Hat Video Team did a great job in attempting to make this old guy look good.&amp;nbsp; :^)&lt;br /&gt;&lt;br /&gt;Check it out...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Wed, 13 Jul 2011 21:15:44 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: New Kiosk OS posted for Fedora 15</title>
	<guid>http://danwalsh.livejournal.com/44398.html</guid>
	<link>http://danwalsh.livejournal.com/44398.html</link>
	<description>Thanks to Miroslav Grepl, he has put together a working Kiosk OS&amp;nbsp;for Fedora 15.&lt;br /&gt;&lt;br /&gt;http://people.fedoraproject.org/~dwalsh/SELinux/kiosk/&lt;br /&gt;                     &lt;div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;pre&gt;&lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/kiosk/?C=N;O=D&quot; rel=&quot;nofollow&quot;&gt;Name&lt;/a&gt;                    &lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/kiosk/?C=M;O=A&quot; rel=&quot;nofollow&quot;&gt;Last modified&lt;/a&gt;      &lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/kiosk/?C=S;O=A&quot; rel=&quot;nofollow&quot;&gt;Size&lt;/a&gt;  
&lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/&quot; rel=&quot;nofollow&quot;&gt;Parent Directory&lt;/a&gt;                             -   
&lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/kiosk/kiosk.iso&quot; rel=&quot;nofollow&quot;&gt;kiosk.iso&lt;/a&gt;               12-Jul-2011 19:51  1.2G  
&lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/kiosk/kiosk.ks&quot; rel=&quot;nofollow&quot;&gt;kiosk.ks&lt;/a&gt;                12-Jul-2011 19:46   11K  
&lt;/pre&gt;&lt;/div&gt;As you can see the ISO is quite large since we added &lt;a href=&quot;http://www.libreoffice.org/&quot; rel=&quot;nofollow&quot;&gt;LibreOffice&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The Kiosk OS was originally written for Fedora 13 and explained in my Blog &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/35761.html?thread=231345&quot;&gt;http://danwalsh.livejournal.com/35761.html?thread=231345&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you want to make this into a uninterruptable boot you should create the USB or DVD with the &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; livecd-iso-to-disk&amp;nbsp; --totaltimeout 1 myiso /dev/sdb&lt;br /&gt;&lt;br /&gt;man livecd-iso-to-disk&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --totaltimeout&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Adds a bootloader totaltimeout, which indicates how long to wait&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; before booting automatically.&amp;nbsp; This is used to force an automatic&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boot.&amp;nbsp; This timeout cannot be canceled by the user.&amp;nbsp; Units are 1/10s.&lt;br /&gt;&lt;br /&gt;Meaning the livedvd or liveusb will boot automatically in .1 seconds and can not be stopped.&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Tue, 12 Jul 2011 20:24:55 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Russell Coker (security): Multiple Filesystems for Security</title>
	<guid>http://etbe.coker.com.au/?p=2904</guid>
	<link>http://etbe.coker.com.au/2011/07/08/multiple-filesystems-security/</link>
	<description>&lt;p&gt;There is always been an ongoing debate about how to assign disk space into multiple partitions. I think that nowadays the best thing to do is to assign about 10G for the root filesystem for every desktop and server system because 10G is a small fraction of the disk space available (even the smallest laptops seem to all have disks larger than 100G nowadays). Even if 10G turns out not to be enough using separate filesystems for /var or /usr provides little benefit now that it&amp;#8217;s easy to resize the root filesystem with LVM &amp;#8211; and &lt;a href=&quot;http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken&quot;&gt;a separate /usr is known to be broken [1]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In a discussion on a private mailing list there was a suggestion that multiple filesystems should be used for security.&lt;/p&gt;
&lt;h3&gt;DoS Attacks&lt;/h3&gt;
&lt;p&gt;There are some minor security benefits in having multiple filesystems. If a critical program will fail when there is no free disk space then allowing an unprivileged process to use up all the space on that filesystem is a minor security issue, so having unprivileged processes not being permitted to write to important filesystems is a benefit. But most failures of this type are merely DoS attacks which usually aren&amp;#8217;t a big deal &amp;#8211; if you can control a local process there are usually lots of other ways of DoSing a system.&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;p&gt;Links have been the cause of many security issues in Unix over the years. Using different filesystems for different tasks can prevent the use of hard links in attacks aimed at exploiting race conditions. But even if you prevent hard links there are similar issues with symbolic links. SE Linux is one of many security improvements for Linux which allow restrictions on the creation of hard links. SE Linux also allows restricting the ability of processes to follow symbolic links, so a privileged process can be denied access to follow a sym-link that was created by an unprivileged process.&lt;/p&gt;
&lt;h3&gt;NFS&lt;/h3&gt;
&lt;p&gt;The &lt;b&gt;subtree_check&lt;/b&gt; option in &lt;b&gt;/etc/exports&lt;/b&gt; causes the NFS server to verify that file access is in the correct subtree. So if you export only one subdirectory of a filesystem to a given server then hostile code on that server (or on a network device which impersonates that server) can&amp;#8217;t access other subdirectories. This option is documented as having performance implications and working best for filesystems that are mostly read-only, for this reason it&amp;#8217;s turned off by default in recent versions of the NFS utilities.&lt;/p&gt;
&lt;p&gt;So if you want to NFS export /home then it&amp;#8217;s probably a good idea to have /home be on a separate filesystem to prevent attacks on the root filesystem. But of the systems with significant use of /home (IE anything other than accounts used solely for &amp;#8220;&lt;b&gt;su -&lt;/b&gt;&amp;#8220;) most of them have a separate filesystem for /home anyway so this shouldn&amp;#8217;t be an issue.&lt;/p&gt;
&lt;h3&gt;SE Linux&lt;/h3&gt;
&lt;p&gt;When mounting filesystems with SE Linux there is a &amp;#8220;&lt;b&gt;context=&lt;/b&gt;&amp;#8221; mount option that allows specifying the context for all files on the filesystem. This can save a small amount of storage space for XATTRs and theoretically improve performance (although the difference is unlikely to show up on benchmarks for anything other than fsck). Generally the context mount option is only used for a filesystem that has a huge number of files with the same context, such as a mail spool that uses Maildir, Cyrus, or any of the other formats that involve one file per message. But again such data is generally stored on a separate filesystem for other reasons anyway.&lt;/p&gt;
&lt;p&gt;I found one interesting corner case in regard to SE Linux systems mounting files from an NFS server. When an NFS server exports multiple subdirectories of a filesystem mounted on /foo then if one NFS client running SE Linux is to mount two subdirectories of /foo with different contexts then the second mount attempt will give the error &amp;#8220;an incorrect mount option was specified&amp;#8221;. This is because as of kernel 2.6.18 by default it&amp;#8217;s not permitted to mount parts of the same filesystem with different mount options. The option &amp;#8220;&lt;b&gt;nosharecache&lt;/b&gt;&amp;#8221; allows you to use different mount options, but does apparently permit some undesirable behavior in the case of hard links that cross between the subtrees. Thanks to Eric Paris for the tip about nosharecache.&lt;/p&gt;
&lt;p&gt;The best example I can think of for which you might want context mount options that differ among files that are used for the same purpose on an NFS mount is a web server which has data files and CGI-BIN scripts. So it seems that a SE Linux web server that mounts it&amp;#8217;s data over NFS and is at risk of having hard links between the CGI-BIN directory and the data directory is a corner case in which multiple filesystems is required for security. This seems to be a very unlikely case.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Servers that are deployed in the real world are complex enough that there are always systems with some unusual corner cases demanding configuration choices that aren&amp;#8217;t expected. There are some real corner cases for SE Linux where multiple filesystems are compelled for security or for a combination of security and best performance.&lt;/p&gt;
&lt;p&gt;But I wouldn&amp;#8217;t make a generic recommendation of using lots of filesystems for security. I think that the people who encounter the strange corner cases can usually work out that they need to do something different. So a small number of filesystems seems like a good general aim that doesn&amp;#8217;t conflict with security.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken&quot;&gt; http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
	<pubDate>Fri, 08 Jul 2011 13:27:49 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: Fun with sVirt.</title>
	<guid>http://danwalsh.livejournal.com/44090.html</guid>
	<link>http://danwalsh.livejournal.com/44090.html</link>
	<description>I have been in Washington DC for the last few days talking about SELinux and sVirt, Secure Virtualization.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sVirt is the combining of SELinux with kvm/qemu virtualization.&amp;nbsp; The libvirt daemon launches virtual guests in Red Hat operating systems.&amp;nbsp; Before an virtual machine&amp;nbsp; is started libvirt picks a random MCS&amp;nbsp;label with two categories, like s0:c1,c2 and then labels all of the virtual machines content as svirt_image_t:s0:c1,c2.&amp;nbsp; Then it executes qemu with the label svirt_t:c0:c1,c2.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;One of the questions on sVirt I have been asked is how can I test out the sVirt policy, to make sure it works?&lt;br /&gt;&lt;br /&gt;I thought about it and I came up with an easy way that someone can play with it.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;One of the major goals of a hacker is to get a root shell on the host, lets see what you can do with the root shell running as svirt_t.&lt;br /&gt;&lt;br /&gt;Note: the unconfined_t user type is allowed to transition to svirt_t in Fedora 14-16 and RHEL6 I&amp;nbsp;believe.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;In order to test the svirt_t, we need a program to run, I&amp;nbsp;copied /bin/sh to /bin/svirt. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# cp /bin/sh /bin/svirt&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The policy requires that the entry point for svirt_t must be labeled qemu_exec_t.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# chcon -t qemu_exec_t /bin/svirt&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Now I&amp;nbsp;use the runcon command to force a transition from unconfined_t to svirt and pick out an MCS&amp;nbsp;label s0:c1,c2 to run with the svirt shell.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# runcon -t svirt_t -l s0:c1,c2 /bin/svirt &lt;/span&gt;&lt;br /&gt;&lt;span&gt;svirt: /root/.bashrc: Permission denied&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# id&lt;/span&gt;&lt;br /&gt;&lt;span&gt;svirt: child setpgid (6962 to 6962): Permission denied&lt;br /&gt;uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=unconfined_u:unconfined_r:svirt_t:s0:c1,c2&lt;/span&gt;&lt;br /&gt;First the shell tried to read /root/.bashrc and was denied. because svirt_t is not allowed to read the admin_home_t label.&amp;nbsp; The shell attempts to setpgid for every command that is executed which SELinux denies svirt_t and prints an error to the screen. &amp;nbsp;I have removed these errors from the blog just for clarity.&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;# ping 4.2.2.2&lt;br /&gt;svirt: ping: command not found&lt;br /&gt;# cat /etc/shadow&lt;br /&gt;cat: /etc/shadow: Permission denied&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# touch /tmp/svirt&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# ls -lZ /tmp/svirt&lt;br /&gt;-rw-r--r--. root root unconfined_u:object_r:svirt_tmp_t:s0:c1,c2 /tmp/svirt&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Note Notice the touch succeeded, allowing me to create a file in the /tmp directory labeled svirt_tmp_t:s0:c0,c2&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# ^D&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;Now I exit this shell and start another svirt shell with a slightly different MCS&amp;nbsp;label s0:c1,c3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# runcon -t svirt_t -l s0:c1,c3 /bin/svirt &lt;/span&gt;&lt;br /&gt;&lt;span&gt;svirt: /root/.bashrc: Permission denied&lt;br /&gt;# id&lt;br /&gt;uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=unconfined_u:unconfined_r:svirt_t:s0:c1,c3&lt;br /&gt;# touch /tmp/svirt&lt;br /&gt;touch: cannot touch `/tmp/svirt': Permission denied&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;Note: This svirt shell is denied the ability to use the previously created /tmp/svirt file since this file has a label s0:c1,c2 but this svirt shell is running as s0:c1,c3. This would simulate one svirt guest process attacking another svirt_t process.&lt;br /&gt;&lt;br /&gt;Have fun with this and see what svirt can do.&amp;nbsp; If you find what you believe to be a vulnerability please report it in bugzilla.&amp;nbsp; If you build a test script with this, we would love to use it.&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;You will fill your /var/log/audit/audit.log file with audit messages and setroubleshoot will not be happy, but it is pretty good test.</description>
	<pubDate>Thu, 07 Jul 2011 22:14:35 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: Follow up to #7 Does an SELinux Audit Log message always mean something was blocked?</title>
	<guid>http://danwalsh.livejournal.com/43816.html</guid>
	<link>http://danwalsh.livejournal.com/43816.html</link>
	<description>In my previous blog&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/43730.html&quot;&gt;10 things you probably did not know about SELinux.. #7&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I stated that one of the times you can get a syscall to succeed even though AVC's were generated was:&lt;br /&gt;&lt;br /&gt;3. An AVC was generated but the syscall still succeeded by going down a  different code path within the kernel.  This is not that common.&lt;br /&gt;&lt;br /&gt;Eric Paris pointed out to me in an email and example of this:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span&gt;(People have a) &amp;quot; fundemental misconception is the belief that there is a 1-1 mapping between a syscall and an selinux permissions check.  SELinux is NOT a syscall filter.  We check the security state between objects (aka between a task and a file, or a task and a socket, or a task and task) and the result of that check may or may not cause the intended purpose of the request syscall which triggered this check to fail.&lt;br /&gt;&lt;br /&gt;A great example of a syscall which is likely to generate AVCs but still give success=yes is execve().  On execve SELinux will check the permissions between the new task and any file descriptors passed from the parent to the child.  Notice the check is not about the syscall, execve(), but between the new task and the file descriptors.  If the new task is not allowed to access one of the passed file descriptors we will generate an AVC, and will close the fd and open /dev/null in it's place.  This is an example of an alternate code path.  The syscall is still going to succeed since we will have resolved the security violation that caused the AVC.  It's not common, but other such places exist in the kernel, place where we are able to resolve the security issue by doing some other operation and thus the syscall does not need to fail.&amp;quot;&lt;/span&gt;&lt;/em&gt;</description>
	<pubDate>Tue, 28 Jun 2011 11:43:39 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #7</title>
	<guid>http://danwalsh.livejournal.com/43730.html</guid>
	<link>http://danwalsh.livejournal.com/43730.html</link>
	<description>&lt;span&gt;&lt;strong&gt;#7 Does an SELinux Audit Log message always mean something was blocked?&amp;nbsp; &lt;/strong&gt;&lt;span&gt;&lt;strong&gt;NO&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First off lets get rid of a misconception.&amp;nbsp; An SELinux AVC&amp;nbsp;message consist of a single message in the audit log.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;This is false.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SELinux messages in the Audit log usually consist of more then one record, and they don't even need to contain an AVC&amp;nbsp;record.&lt;br /&gt;&lt;br /&gt;SELinux is all about preventing syscalls, so if something gets denied you will usually see an SELinux message describing the AVC, as well as the SYSCALL.&amp;nbsp; If you have full auditing turned on, or the kernel has gathered path information, you could also get a PATH record as part of the overall audit record.&lt;br /&gt;&lt;br /&gt;The way to view all the records within an AVC&amp;nbsp;message is to use the&lt;em&gt; ausearch -m avc&lt;/em&gt; command.&lt;br /&gt;&lt;br /&gt;If you look at the SYSCALL&amp;nbsp;record you will see a Name/Value pair with the name &amp;quot;&lt;em&gt;success&lt;/em&gt;&amp;quot;.&amp;nbsp; This field indicates whether they SYSCALL&amp;nbsp;record actually succeeded or failed. &amp;quot;&lt;em&gt;success=yes&lt;/em&gt;&amp;quot; indicates the syscall was successful.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I&amp;nbsp;can think of 4 different situations where a SELinux message is generated and the SYSCALL&amp;nbsp;record returns success=yes.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The system is in permissive, meaning AVC's are recorded but not enforced.&lt;/li&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;gt; getenforce&lt;br /&gt;Permissive&lt;/p&gt;&lt;li&gt;The process that caused the domain is a&lt;a href=&quot;http://danwalsh.livejournal.com/42394.html&quot;&gt; permissive domain&lt;/a&gt; (Latest Fedoras/RHEL6 only).&amp;nbsp; The AVC for this process type is not enforced.&amp;nbsp;&lt;/li&gt;&lt;p&gt;&amp;gt; seinfo --permissive |grep SOURCETYPE&lt;/p&gt;&lt;li&gt;An AVC was generated but the syscall still succeeded by going down a different code path within the kernel.  This is not that common.&lt;/li&gt;&lt;li&gt;An auditallow record was added to the policy.  auditallow says to the kernel, generate an audit SYSCALL message any time this access is granted.  Currently we do this with load_policy and setting booleans, setenforce.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span&gt;type=SYSCALL msg=audit(06/23/2011 13:33:58.044:280) : arch=x86_64 syscall=write &lt;span&gt;success=yes&lt;/span&gt; exit=1 a0=3 a1=7fff406c5ce0 a2=1 a3=0 items=0 ppid=4408 pid=4546 auid=dwalsh uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=4 &lt;span&gt;comm=setenforce &lt;/span&gt;exe=/usr/sbin/setenforce subj=staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 key=(null) type=MAC_STATUS msg=audit(06/23/2011 13:33:58.044:280) : &lt;span&gt;enforcing=1 old_enforcing=0 &lt;/span&gt;auid=dwalsh ses=4 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;</description>
	<pubDate>Fri, 24 Jun 2011 13:42:36 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): SUSE Manager Security Update</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-8319060620358119756</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/06/suse-manager-security-update.html</link>
	<description>Last Friday we released a security update for SUSE Manager. It eliminates four vulnerabilities which I will describe in detail here:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;CSRF (CVE-2009-4139): This is the most dangerous issue fixed by this update. It was found during a penetration-test executed by me before we released the SUSE Manager. You may wonder why we released the fix after the &quot;gold master&quot; (GM) and why it has a CVE-ID from 2009. Red Hat was informed about this issue in 2009 already (by another person) and after some back and forth we decided to release it together with Red Hat and not earlier. But not only the release date was coordinated, we also coordinate fixing and testing.&lt;/li&gt;&lt;li&gt;The default SSL ciphersuite configuration that comes with our apache2 package (this also affects the SM proxy) was made up to support as much and as old client as possible. This results in a config that is insecure because it support &quot;export ciphers&quot;, SSLv2, short keys, etc. If you install this update before you configured your SM you will have a up-to-date and secure config. Use &lt;span&gt;sslscan&lt;/span&gt; to verify your setup. If it is still insecure go to &lt;span&gt;/etc/apache2/ssl-global.conf&lt;/span&gt; and change it to something like:&lt;blockquote&gt;ssl_protocols TLSv1&lt;/blockquote&gt;&lt;blockquote&gt;ssl_ciphers ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!MD5:@STRENGTH&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;Open Redirect (CVE-2011-1594): A hidden field named &quot;url_bounce&quot; allows HTTP redirects and therefore phishing attacks. Found during penetration-test, released after GM because it was too minor to hold release.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;XML remote denial of service (CVE-2011-1755): jabber2 server can be dos'ed (&quot;billion laughs attack&quot;), not found by us.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-8319060620358119756?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 21 Jun 2011 01:38:04 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Dan Walsh: SELinux Policy RPM in Rawhide/F16 includes prebuilt policy file.</title>
	<guid>http://danwalsh.livejournal.com/43264.html</guid>
	<link>http://danwalsh.livejournal.com/43264.html</link>
	<description>The selinux-policy-TYPE&amp;nbsp;packages has always rebuilt the policy in their post install.&amp;nbsp; We do this in order to merge any customizations to the policy that an administrator might have made.&amp;nbsp; The selinux policy rpm package also needs to rebuild the policy if any policies were installed by other rpms or&amp;nbsp; by the administrator.&lt;br /&gt;&lt;br /&gt;Over time as the size of policy has grown and gotten more complex, the installation procedure has required more memory and more time.&amp;nbsp; We have seen stats stating during installations, one of the biggest memory hogs was the selinux-policy-targeted package.&lt;br /&gt;&lt;br /&gt;Over the last couple of weeks,&amp;nbsp; I decided to re-examine the situation.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The selinux-policy-TYPE&amp;nbsp;packages will now ship with a pre-built policy package and will only rebuild the policy iff the existing policy has been customized. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;The following test shows a 4 times speedup on installing the package 48 Seconds -&amp;gt; 12&amp;nbsp;Seconds.&amp;nbsp; And max Memory Usage from 38 M to 6 Meg.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;Modified:&lt;br /&gt;# time -v rpm -Uhv /home/devel/dwalsh/sources/RPMS/noarch/selinux-policy-targeted-3.9.16-29.1.fc16.noarch.rpm --force&lt;br /&gt;Preparing...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [100%]&lt;br /&gt;&amp;nbsp;&amp;nbsp; 1:selinux-policy-targeted########################################### [100%]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command being timed: &amp;quot;rpm -Uhv /home/devel/dwalsh/sources/RPMS/noarch/selinux-policy-targeted-3.9.16-29.1.fc16.noarch.rpm --force&amp;quot;&lt;br /&gt;&amp;lt;snip&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Elapsed (wall clock) time (h:mm:ss or m:ss): 0:48.11&lt;br /&gt;&amp;lt;snip&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Maximum resident set size (kbytes): 377608&lt;br /&gt;&amp;lt;snip&amp;gt; &amp;nbsp; &lt;br /&gt;&lt;br /&gt;Unmodified:&lt;br /&gt;# time -v rpm -Uhv /home/devel/dwalsh/sources/RPMS/noarch/selinux-policy-targeted-3.9.16-29.1.fc16.noarch.rpm --force&lt;br /&gt;Preparing...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [100%]&lt;br /&gt;&amp;nbsp;&amp;nbsp; 1:selinux-policy-targeted########################################### [100%]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command being timed: &amp;quot;rpm -Uhv /home/devel/dwalsh/sources/RPMS/noarch/selinux-policy-targeted-3.9.16-29.1.fc16.noarch.rpm --force&amp;quot;&lt;br /&gt;&amp;lt;snip&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Elapsed (wall clock) time (h:mm:ss or m:ss): 0:12.32&lt;br /&gt;&amp;lt;snip&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Maximum resident set size (kbytes): 60112&lt;br /&gt;&amp;lt;snip&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You will only see this improvement on a fresh install.&amp;nbsp; And should continue to see it on all updates, although updates can still do a partial relabel after install.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;If you are doing an update and would like to see the improvement, you can do the following.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;# setenforce 0&lt;br /&gt;# rm -rf /etc/selinux/targeted&lt;br /&gt;#&amp;nbsp;yum -y reinstall selinux-policy selinux-policy-targeted&lt;br /&gt;# restorecon -R -v /etc/selinux/targeted &lt;br /&gt;# setenforce 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then you would be seen as a fresh install.&lt;br /&gt;&lt;br /&gt;Try it out.</description>
	<pubDate>Thu, 16 Jun 2011 17:27:16 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>James Morris: Linux Security Summit 2011 – Schedule Published</title>
	<guid>http://blog.namei.org/?p=497</guid>
	<link>http://blog.namei.org/2011/06/16/linux-security-summit-2011-schedule-published/</link>
	<description>&lt;p&gt;For those that didn&amp;#8217;t catch the &lt;a href=&quot;http://lkml.indiana.edu/hypermail//linux/kernel/1106.1/03206.html&quot;&gt;email announcement&lt;/a&gt;, the schedule for the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&quot;&gt;2011 Linux Security Summit&lt;/a&gt; is now &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011/Schedule&quot;&gt;published&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The format of the conference is refereed talk sessions, followed by in-depth roundtable discussions.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s a summary of the programme:&lt;/p&gt;
&lt;p&gt;Refereed talks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;#8220;Smack is Alive and Well&amp;#8221;&lt;br /&gt;
Casey Schaufler&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;&amp;#8220;MeeGo Security Update&amp;#8221;&lt;br /&gt;
Ryan Ware, Intel&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;&amp;#8220;An Overview of the Linux Integrity Subsystem: Use Cases and Demonstration&amp;#8221;&lt;br /&gt;
David Safford and Mimi Zohar, IBM&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;&amp;#8220;Digital Signature support for IMA/EVM&amp;#8221;&lt;br /&gt;
Dmitry Kasatkin and Ryan Ware, Intel&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;&amp;#8220;Protecting the Filesystem Integrity of a Fedora 15 Virtual Machine from Offline Attacks using IMA/EVM&amp;#8221;&lt;br /&gt;
Peter Kruus, The Johns Hopkins University Applied Physics Laboratory&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;&amp;#8220;Efficient, TPM-free system integrity checking with device mapper: dm-verity&amp;#8221;&lt;br /&gt;
Will Drewry and Mandeep Baines, Google&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Roundtable discussions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Kernel Hardening&lt;br /&gt;
Lead by Kees Cook, Canonical and Will Drewry, Google&lt;/li&gt;
&lt;p&gt;&lt;/p&gt;
&lt;li&gt;LSM Architecture&lt;br /&gt;
Lead by Kees Cook, Canonical and Casey Schaufler&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011/Schedule&quot;&gt;full schedule&lt;/a&gt; for more detail.&lt;/p&gt;
&lt;p&gt;Attendance is open to all registered attendees of the &lt;a href=&quot;http://www.linuxplumbersconf.org/2011/&quot;&gt;Linux Plumbers Conference&lt;/a&gt;.  Early-bird registration is available for LPC until the end of today (US time).&lt;/p&gt;</description>
	<pubDate>Wed, 15 Jun 2011 15:33:02 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #6</title>
	<guid>http://danwalsh.livejournal.com/43170.html</guid>
	<link>http://danwalsh.livejournal.com/43170.html</link>
	<description>&lt;span&gt;&lt;strong&gt;#6 How did those SELinux labels get there?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELinux labels are placed on disk during the installation by a combination of Anaconda and rpm.&amp;nbsp; Anaconda actually includes the latest /etc/selinux/targeted/files/file_context and /etc/selinux/targeted/policy/policy.26 in its initrd.&amp;nbsp; When anaconda starts rpm, rpm reads this file and proceeds to place the labels on disk.&amp;nbsp; RPM has SELinux awareness built into it and asks the kernel to place the default label on the disk for every object that it creates from its payload.&amp;nbsp; If an rpm post install script runs during the install, the labels are created using the standard process labelling described below.&amp;nbsp;&amp;nbsp; Any file system objects created by Anaconda&amp;nbsp; before loading the policy into the kernel will be relabelled by Anaconda using restorecon.&lt;br /&gt;&lt;br /&gt;Any file system objects created by the post install scripts, or during boot, or by any process from then moving forward will create the file via one of the following three rules.&lt;ul&gt;&lt;li&gt;The object will get the label of the parent directory.&lt;ul&gt;&lt;li&gt;Files/Directories created in /etc, which is labelled etc_t, will get labelled etc_t by default.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;File transition rules can be written into policy.&amp;nbsp; File transition rules take into account the label of the process creating the file as well as the parent directory.&amp;nbsp; For example I can write a rule that says if NetworkManager_t creates a file in a directory labelled etc_t then this file will be labelled net_conf_t&lt;ul&gt;&lt;li&gt;&amp;nbsp;filetrans_pattern(NetworkManager_t, etc_t, net_conf_t, file)&lt;/li&gt;&lt;li&gt;When NetworkManager creates the /etc/resolv.conf file it gets labelled net_conf_f rather then etc_t.&lt;/li&gt;&lt;li&gt;Since you can only have one combination of ProcessLabel/DirectoryLabel/ObjectClass, you can not currently write a rule for a process to create two different labels within the same directory.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The last way is to build SELinux awareness within an application.&amp;nbsp; &lt;ul&gt;&lt;li&gt;Applications can be programmed to ask the kernel to create a file system object with a particular label.&lt;ul&gt;&lt;li&gt;rpm, udev, passwd are examples of applications that request the kernel to label the object at creation time.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Applications can attempt to change a label from one label to another.&lt;ul&gt;&lt;li&gt;restorecon, udev, restorecond, chcon are examples of applications that modify labels.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;In Fedora 16 we are introducing a new concept which we are calling File Name Transitions.&amp;nbsp;&amp;nbsp; These will allow policy writers to take into account the actual file name (Not path) at file creation time,&amp;nbsp; giving us the ability to clear up some common bugs users have seen with SELinux.&lt;br /&gt;&lt;br /&gt;Read about it here and if you are running Fedora 16/Rawhide try it out...&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SELinuxFileNameTransition&quot; rel=&quot;nofollow&quot;&gt;https://fedoraproject.org/wiki/Features/SELinuxFileNameTransition&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
	<pubDate>Fri, 10 Jun 2011 18:52:19 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): SAD 4: Security Day</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-5713951199572545408</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/05/sad-4-security-day.html</link>
	<description>Three weeks ago the SUSE Studio team had its first &quot;Security Day&quot; to fix the possible security vulnerabilities found by &lt;a href=&quot;https://gitorious.org/code-scanner/ror-sec-scanner&quot;&gt;ror-sec-scanner&lt;/a&gt;. (a Rails static code analyzer)&lt;br /&gt;The team eliminated:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;161 false positives&lt;br /&gt;&lt;/li&gt;&lt;li&gt;28 real bugs&lt;/li&gt;&lt;/ul&gt;Thank you folks! :-)&lt;br /&gt;&lt;br /&gt;Note:  Earlier this year another team consolidated its forces to fix potential  security problems in their code and reduced the number of bugs per KLOC  to 0.&lt;br /&gt;&lt;br /&gt;I hope we can have a &quot;Security Day&quot; prior every new release.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-5713951199572545408?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 24 May 2011 12:14:00 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>James Morris: Linux Security Summit 2011 – CFP closes in one week.</title>
	<guid>http://blog.namei.org/?p=493</guid>
	<link>http://blog.namei.org/2011/05/21/linux-security-summit-2011-cfp-closes-in-one-week/</link>
	<description>&lt;p&gt;We&amp;#8217;ve had a couple of queries about what to submit for the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&quot;&gt;Linux Security Summit&lt;/a&gt; CFP.&lt;/p&gt;
&lt;p&gt;Proposals should be plain text abstracts up to 150 words in length, and emailed to the program committee:  lss-pc (_at_) ext.namei.org&lt;/p&gt;
&lt;p&gt;Also see the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011#CFP_Details&quot;&gt;CFP&lt;/a&gt; section on the wiki.&lt;/p&gt;</description>
	<pubDate>Fri, 20 May 2011 22:48:01 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>KaiGai Kohei: [OSS/Linux] Leaky VIEW まとめ</title>
	<guid>http://d.hatena.ne.jp/kaigai/20110515/1305466803</guid>
	<link>http://d.hatena.ne.jp/kaigai/20110515/1305466803</link>
	<description>&lt;div class=&quot;section&quot;&gt;
&lt;p&gt;SELinuxとは関係のない、RDBMSでのセキュリティのお話。&lt;/p&gt;
&lt;p&gt;利用者に対して、テーブルに対する直接のアクセス権を与えず、特定のビューを通してだけアクセスを許可するのは、行レベルのアクセス制御でよく使われるテクニックである。&lt;/p&gt;
&lt;p&gt;つまり、ビューは不可視であるタプルをフィルタリングする役割を持つ。&lt;/p&gt;
&lt;p&gt;しかし、これで万全かというと、そうではない。&lt;/p&gt;
&lt;p&gt;クエリ最適化を上手く利用することで、利用者が見えないはずのタプルを参照する事は可能である。&lt;/p&gt;
&lt;p&gt;以下の例を見て頂きたい。&lt;/p&gt;
&lt;pre&gt;
postgres=# CREATE TABLE T1 (id int, name text);
CREATE TABLE
postgres=# CREATE TABLE T2 (id int, cred text);
CREATE TABLE
postgres=# INSERT INTO t1 VALUES (1, 'coke'), (2, 'soda'),
                                 (3, 'juice'), (4, 'fanta');
INSERT 0 4
postgres=# INSERT INTO t2 VALUES (1, 'public'), (2, 'hidden'),
                                 (3, 'hidden'), (4, 'public');
INSERT 0 4
postgres=# CREATE VIEW v1 AS SELECT &amp;#42; FROM t1 NATURAL JOIN t2
                                      WHERE t2.cred = 'public';
CREATE VIEW
postgres=# SELECT &amp;#42; FROM v1;
 id | name  |  cred
----+-------+--------
  1 | coke  | public
  4 | fanta | public
(2 rows)

postgres=# GRANT SELECT ON v1 TO alice;
GRANT
&lt;/pre&gt;

&lt;p&gt;ビュー v1 は、テーブル t1 と t2 を JOINし、ここでは t2.cred = 'public' が行レベルのセキュリティポリシー、すなわち、フィルタリング対象の行を定めるものとする。&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;ユーザ alice は t1 と t2 へのアクセス権を持っていないため、ビュー v1 を通してしか、これらの情報にアクセスできないはずである。&lt;/p&gt;
&lt;p&gt;だがしかし、以下のクエリの実行結果を見てもらいたい。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; SELECT getpgusername();
 getpgusername
---------------
 alice
(1 row)

postgres=&amp;#62; SELECT &amp;#42; FROM t1;
ERROR:  permission denied for relation t1
postgres=&amp;#62; SELECT &amp;#42; FROM t2;
ERROR:  permission denied for relation t2
postgres=&amp;#62; SELECT &amp;#42; FROM v1;
 id | name  |  cred
----+-------+--------
  1 | coke  | public
  4 | fanta | public
(2 rows)
&lt;/pre&gt;

&lt;p&gt;上記の結果は想定通りだろう。&lt;/p&gt;
&lt;p&gt;では、続いて、WHERE句にユーザ定義関数を付加する。&lt;/p&gt;
&lt;p&gt;この関数は、常に true を返すが、引数を利用者のコンソールに出力する。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; CREATE OR REPLACE FUNCTION f_leak(text)
               RETURNS bool LANGUAGE 'plpgsql'
               AS 'BEGIN
                       raise notice ''f_lead: (%)'', $1;
                       RETURN true;
                   END';
CREATE FUNCTION
postgres=&amp;#62; SELECT * FROM v1 WHERE f_leak(name);
&lt;span class=&quot;deco&quot;&gt;NOTICE:  f_lead: (coke)
NOTICE:  f_lead: (soda)
NOTICE:  f_lead: (juice)
NOTICE:  f_lead: (fanta)
&lt;/span&gt; id | name  |  cred
----+-------+--------
  1 | coke  | public
  4 | fanta | public
(2 rows)
&lt;/pre&gt;
&lt;p&gt;結果セットは２行だが、利用者コンソールには見えてはならないはずのタプルの内容が出力されている。&lt;/p&gt;
&lt;p&gt;その理由はEXPLAIN分の出力を見ると明らかである。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM v1 WHERE f_leak(name);
                           QUERY PLAN
----------------------------------------------------------------
 Hash Join  (cost=25.45..356.91 rows=12 width=68)
   Hash Cond: (t1.id = t2.id)
   -&amp;#62;  Seq Scan on t1  (cost=0.00..329.80 rows=410 width=36)
         Filter: &lt;span class=&quot;deco&quot;&gt;f_leak(name)&lt;/span&gt;
   -&amp;#62;  Hash  (cost=25.38..25.38 rows=6 width=36)
         -&amp;#62;  Seq Scan on t2  (cost=0.00..25.38 rows=6 width=36)
               Filter: (cred = 'public'::text)
(7 rows)
&lt;/pre&gt;
&lt;p&gt;f_leak()関数を探してみると、Join-Loopの内側で t1 テーブルを読み出す際のフィルタリング条件として実行されている事がわかる。&lt;/p&gt;
&lt;p&gt;これは、f_leak()の引数が t1 由来のデータだけを参照しているため、Joinすべき行数を減らすために、本来実行されるべき位置（t1.id = t2.id を評価した後）からオプティマイザによって移動させられた事による。&lt;/p&gt;
&lt;p&gt;とは言え、この手の最適化を行わなければビューを介したアクセスは極端に性能が悪くなるはずなので、問題は PostgreSQL に限った話ではないと思われる。&lt;/p&gt;
&lt;p&gt;例えば、100万件のタプルを持つテーブルでID列にインデックスが張られており、処理コストの比較的高い f_policy() 関数によってフィルタリングを行うビューを介してアクセスするとする。その場合、ビューの外から ID = 1234 という条件が来た場合に常に全件スキャンが走るようなら、泣ける。&lt;/p&gt;
&lt;p&gt;手元にOracleの環境がある友人に試してもらったところ、同様に、見えないはずのタプルの内容を出力できるそうな。&lt;/p&gt;&lt;p&gt;なお、PostgreSQLには、セキュリティポリシーの適用されている t2 の内容を見る方法もある。&lt;span class=&quot;footnote&quot;&gt;&lt;a href=&quot;http://d.hatena.ne.jp/kaigai/#f1&quot; name=&quot;fn1&quot; title=&quot;PostgreSQL固有というのは、他のRDBMSでユーザ定義関数のコストを指定する手段があるかどうか不明のため。&quot;&gt;*1&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;以下のような関数を定義する。ポイントは COST=0.0001 の部分。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; CREATE OR REPLACE FUNCTION f_leak(text)
               RETURNS bool LANGUAGE 'plpgsql'
               &lt;span class=&quot;deco&quot;&gt;COST 0.0001&lt;/span&gt;
               AS 'BEGIN
                       raise notice ''f_lead: (%)'', $1;
                       RETURN true;
                   END';
CREATE FUNCTION
&lt;/pre&gt;
&lt;p&gt;今度は f_leak() 関数で t2 の情報を参照するようにすると、同様にフィルタリングされているはずの行の内容が出力される。&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; SELECT * FROM v1 WHERE f_leak(cred);
NOTICE:  f_lead: (public)
NOTICE:  f_lead: (hidden)
NOTICE:  f_lead: (hidden)
NOTICE:  f_lead: (public)
 id | name  |  cred
----+-------+--------
  1 | coke  | public
  4 | fanta | public
(2 rows)
&lt;/pre&gt;
&lt;p&gt;EXPLAIN文の結果&lt;/p&gt;
&lt;pre&gt;
postgres=&amp;#62; EXPLAIN SELECT * FROM v1 WHERE f_leak(cred);
                            QUERY PLAN
------------------------------------------------------------------
 Hash Join  (cost=25.40..52.43 rows=12 width=68)
   Hash Cond: (t1.id = t2.id)
   -&amp;#62;  Seq Scan on t1  (cost=0.00..22.30 rows=1230 width=36)
   -&amp;#62;  Hash  (cost=25.38..25.38 rows=2 width=36)
         -&amp;#62;  Seq Scan on t2  (cost=0.00..25.38 rows=2 width=36)
               Filter: (&lt;span class=&quot;deco&quot;&gt;f_leak(cred)&lt;/span&gt; AND (cred = 'public'::text))
(6 rows)
&lt;/pre&gt;
&lt;p&gt;今度は、f_leak()がt2のScan-Loopに結合されているが、注目すべきはその順序。&lt;/p&gt;
&lt;p&gt;f_leak()のコスト値を低く設定したために、複数のフィルタリング条件がScan-Loopに結合している場合、f_leak()が cred = 'public' よりも優先されている。&lt;/p&gt;
&lt;p&gt;後者のシナリオは、何もJoinを伴わない場合でも実行可能である。&lt;/p&gt;
&lt;p&gt;この問題は、既に開発者の中では既知の問題で、利用者から特定のタプルを不可視にする目的でビューを使うべきでない事が明記されている。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.jp/document/current/html/rules-privileges.html&quot; target=&quot;_blank&quot;&gt;http://www.postgresql.jp/document/current/html/rules-privileges.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5/18にオタワで開催される PostgreSQL Developer Meeting では、この問題を議論するつもりである。&lt;/p&gt;
&lt;p&gt;一応、解決策の腹案は持っているが、そこまで踏み込まないにしても、先ずはこの辺のシナリオが『解決すべき課題である』というコンセンサス形成あたりを目標としたい。&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;footnote&quot;&gt;
&lt;p class=&quot;footnote&quot;&gt;&lt;a href=&quot;http://d.hatena.ne.jp/kaigai/#fn1&quot; name=&quot;f1&quot;&gt;*1&lt;/a&gt;：PostgreSQL固有というのは、他のRDBMSでユーザ定義関数のコストを指定する手段があるかどうか不明のため。&lt;/p&gt;
&lt;/div&gt;</description>
	<pubDate>Sun, 15 May 2011 13:40:03 +0000</pubDate>
	<dc:creator>kaigai</dc:creator>
</item>
<item>
	<title>James Morris: Linux Security Summit 2011 – CFP reminder: 2 weeks!</title>
	<guid>http://blog.namei.org/?p=480</guid>
	<link>http://blog.namei.org/2011/05/13/linux-security-summit-2011-cfp-reminder-2-weeks/</link>
	<description>&lt;p&gt;Calling all Linux security folk!&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;center&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Shadow_of_a_Doubt&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2354/5714374657_cd273c1085.jpg&quot; alt=&quot;the CFP closes in two weeks...&quot; title=&quot;the CFP closes in two weeks...&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/center&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Just a reminder that the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011#CFP_Details&quot;&gt;CFP&lt;/a&gt; for the &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&quot;&gt;2011 Linux Security Summit&lt;/a&gt; closes on the &lt;strong&gt;27th of May&lt;/strong&gt; &amp;#8212; two weeks away.  Please get your submissions in soon.&lt;/p&gt;
&lt;p&gt;Note again that we are co-located with the &lt;a href=&quot;http://www.linuxplumbersconf.org/2011/&quot;&gt;Linux Plumbers Conference&lt;/a&gt; in Santa Rosa, and that all Security Summit attendees, including speakers, will need to register for Plumbers.  Earlybird registration is available until 31st May.&lt;/p&gt;
&lt;p&gt;Trivia question: which Alfred Hitchcock film was shot on location in Santa Rosa in 1943?&lt;/p&gt;
&lt;p&gt;&lt;small&gt;&lt;i&gt;(Hint: click on the image)&lt;/i&gt;&lt;/small&gt;&lt;/p&gt;</description>
	<pubDate>Fri, 13 May 2011 02:29:13 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): SAD 3: At the Beginning there was a Thought</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-5263008056347626545</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/05/sad-3-at-beginning-there-was-thought.html</link>
	<description>Last night I stumbled over some old docs of the Security Review Board. More than 5 years ago T.G. puts much effort in enhancing the development processes to create more secure products. I never saw numbers about that project to compare pre and past states of the products. Unfortunately she left a few years later but AFAIK some of her work is still in use today.&lt;br /&gt;&lt;br /&gt;Today I browsed Google Docs and found a 2 year old presentation I wrote during a train journey from Nuremberg to my home town. I never want to show the slides to other people I just brainstormed about how we could integrate security into our products. Let me show you some slides here because they describe  where we were 2-3 years ago. As I said I forgot the slides but funnily various things from them are real now or are on my TODO list.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span&gt;Slide 1: Where we are.&lt;/span&gt;&lt;br /&gt;- We have four different sources of code&lt;br /&gt;-- 1.) Mainly FLOSS&lt;br /&gt;-- 2.) In-house development&lt;br /&gt;-- 3.) 3rd-party commercial free binary code (like RealPlayer, acroread, etc.)&lt;br /&gt;-- 4.) 3rd-party code developed by contractors&lt;br /&gt;- We review FLOSS code but there is too much and we have not much&lt;br /&gt;influence on the developers beside sending patches upstream&lt;br /&gt;- We have much influence on our own developers but we have to develop&lt;br /&gt;a better security awareness as well as technical knowledge&lt;br /&gt;- We have no influence on the 3rd-party free binary code and just need&lt;br /&gt;to trust it.&lt;br /&gt;- Code developed by contractors can be reviewed by us&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Today source 1. is still the main source for code contributions, the in-house development (2.) increases a lot over the past years, we try to reduce (openSUSE is completely free of them, see the &lt;span&gt;NonFree&lt;/span&gt; repo) the number of binary-only packages (3.), I am not aware of current contributions from source 4.&lt;br /&gt;In the past we provided workshops for secure programming (C, C++, Shell, Perl, Ruby on Rails, Web-security in general).&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;Slide 2: Where others are.&lt;/span&gt;&lt;br /&gt;- Microsoft&lt;br /&gt;-- founder of the Secure Software development Life Cycle (SDL)&lt;br /&gt;-- Separate, specialized teams&lt;br /&gt;-- Own and optimized tools for stress-testing (fuzzing) as well as code analysis&lt;br /&gt;-- See BSIMM study [&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=1592389&quot;&gt;1&lt;/a&gt;], [&lt;a href=&quot;http://www.cert.org/podcast/show/20090331mcgraw.html&quot;&gt;2&lt;/a&gt;]&lt;br /&gt;- Cisco&lt;br /&gt;-- &lt;a href=&quot;http://blogs.cisco.com/security/the_cisco_secure_development_lifecycle_an_overview/&quot;&gt;CMSDL&lt;/a&gt;&lt;br /&gt;- Adobe&lt;br /&gt;-- See BSIMM study [&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=1592389&quot;&gt;1&lt;/a&gt;], [&lt;a href=&quot;http://www.cert.org/podcast/show/20090331mcgraw.html&quot;&gt;2&lt;/a&gt;]&lt;br /&gt;- Google&lt;br /&gt;-- specialists/teams working on research topics and develop tools as well as guidelines&lt;br /&gt;-- See BSIMM study [&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=1592389&quot;&gt;1&lt;/a&gt;], [&lt;a href=&quot;http://www.cert.org/podcast/show/20090331mcgraw.html&quot;&gt;2&lt;/a&gt;]&lt;br /&gt;- Red Hat&lt;br /&gt;-- Specialized teams/persons&lt;br /&gt;-- Much more people working on security&lt;br /&gt;-- Better contact to developers?&lt;br /&gt;-- Only re-active not pro-active AFAIK&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Currently we are introducing secure SDLC techniques and testing tools for our in-house products. Teams are planned to grow.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span&gt;Slide 3: We need to catch up because...&lt;/span&gt;&lt;br /&gt;- Releasing patches for avoidable bugs is a big waste of money and time&lt;br /&gt;- Customers critically watch software vendor's product quality and security vulnerabilities&lt;br /&gt;- These observations play a big role in buying new products or continuing support contracts because installing patches costs the customer money (see study &quot;The Total Cost of Security Patch Management&quot;) and therefore increases the cost of the product.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;Slide 4: What we can do now!&lt;/span&gt;&lt;br /&gt;- Increase awareness by:&lt;br /&gt;-- Showing consequences by providing examples of security problems in our code&lt;br /&gt;- Increase code quality by:&lt;br /&gt;-- Online teaching of security best practice rules for common programming languages like C, C++, C# and Java (see CERT's SDI)&lt;br /&gt;-- Adopt secure SDLC processes for our in-house development&lt;br /&gt;-- Provide a standard development environment that includes easy-to-use code analysis tools for our programmers&lt;br /&gt;-- Teach how to use this tools.&lt;br /&gt;-- Do more sophisticated code analysis&lt;/blockquote&gt;&lt;br /&gt;We are on the right track.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span&gt;Slide 5: What we need to do in the future.&lt;/span&gt;&lt;br /&gt;- Develop/acquire better tools for code analysis, fuzzing, etc.&lt;br /&gt;- Incrementally refine our coding standards&lt;br /&gt;- Have separate teams for handling bugs (response team), create new tools and keep track of current software security development (research team), a team for shepherding code development (mentor team) and a pen-testing team to verify in-house, FLOSS code&lt;br /&gt;- Being part of secure development initiatives/groups/workshops&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Well different teams is a dream that will never become true, but we will try to reach our goals using another way.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span&gt;Slide 6: Where we should be.&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-K13_Izrznso/TcBvGGrqjrI/AAAAAAAAAfY/_SXtks2NLFY/s1600/Secure_Development_at_Novell.jpg&quot;&gt;&lt;img src=&quot;http://1.bp.blogspot.com/-K13_Izrznso/TcBvGGrqjrI/AAAAAAAAAfY/_SXtks2NLFY/s320/Secure_Development_at_Novell.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5602600087112552114&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-5263008056347626545?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Wed, 04 May 2011 02:43:04 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Russell Coker (security): What is Valid SE Linux Policy?</title>
	<guid>http://etbe.coker.com.au/?p=2747</guid>
	<link>http://etbe.coker.com.au/2011/04/29/valid-se-linux-policy/</link>
	<description>&lt;p&gt;&lt;a href=&quot;http://oss.tresys.com/pipermail/refpolicy/2011-March/004115.html&quot;&gt;Guido Trentalancia started an interesting discussion on the SE Linux policy development list about how to manage the evolution of the policy [1]&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;The Problem&lt;/h3&gt;
&lt;p&gt;The SE Linux policy is the set of rules that determine what access is granted. It assigns types to files and domains to processes and has a set of rules that specify all the permitted interactions between processes and files (among many other things). The policy evolves over time to match the requirements of programs (applications and daemons). As a program evolves the things that it does will change and the SE Linux policy will tend to evolve to permit the set of all operations that were requested by all versions because people only complain when things stop working not when excessive privilege is granted. So we need to periodically remove old allow rules from the policy.&lt;/p&gt;
&lt;p&gt;One difficulty in this regard is the fact that multiple versions of programs are often available for use at the same time. Debian in particular has a good history of providing separate packages for the old and new versions of programs such as Apache to meet the needs of users who want the tried and tested version and of users who want the newer version with better performance, more features, better documentation, or something else good. There is also a demand to have the same policy work with multiple versions of a distribution without excessive effort. Finally all the distributions that have SE Linux support have different people deciding when the new version of a daemon is ready for inclusion and therefore there is a need to support multiple versions for multiple distributions. So support for older versions of daemons can&amp;#8217;t be removed easily.&lt;/p&gt;
&lt;p&gt;One of the things I do to make these things a little easier to manage is to put &lt;b&gt;ifdef(&amp;#96;distro_debian', &amp;#96;&lt;/b&gt; before any Debian specific bits of policy. When policy is conditional and only used in Debian I can freely remove it at any future time if Debian works well without it. Also it doesn&amp;#8217;t matter if such Debian specific policy allows access that is not needed or desired in other distributions, the only down-side to this is that sometimes other distributions need to repeat work that I did, they determine what access is needed for their configuration and discover that it was already enabled for Debian.&lt;/p&gt;
&lt;h3&gt;What is Valid Policy?&lt;/h3&gt;
&lt;p&gt;We went to only have &amp;#8220;&lt;b&gt;Valid Policy&lt;/b&gt;&amp;#8221;  (as described by Christopher J. PeBenito), so the challenge is determining what is Valid Policy.&lt;/p&gt;
&lt;p&gt;It seems to me that there are three type of access granted by valid policy (it is debatable whether type #3 is valid):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Access that is needed for an application to perform it&amp;#8217;s minimal designed task.&lt;/li&gt;
&lt;li&gt;Access that is needed for the application to perform all the optional configurations, EG an ftpd running from inetd or as a daemon, and daemons like http server being granted access to ssl keys or not.&lt;/li&gt;
&lt;li&gt;Access that is needed to perform all the operations the application requests, but which the application doesn&amp;#8217;t require or shouldn&amp;#8217;t require if it worked correctly.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Some common operations that aren&amp;#8217;t required include opening utmp for write, searching /root, and many other relatively innocuous access attempts which don&amp;#8217;t affect the program operation if they are denied. There are also many things such as writing temporary files to /root that don&amp;#8217;t seem unusual if the application developer is not considering SE Linux (but which are often considered bad practice anyway). Some of these things (like using /root for stuff that belongs in /var/lib) have the potential to break things (for the daemon or for other system processes) even if you don&amp;#8217;t consider SE Linux.&lt;/p&gt;
&lt;p&gt;How to deal with those types:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In most cases this can be determined without too much effort. For example a web server needs to listen on port 80 and read files and directories that relate to data. When writing policy I can write a lot of the allow rules without even testing the application because I know from the design what it will do. A large part of the other access is obvious in a &amp;#8220;I can&amp;#8217;t believe I didn&amp;#8217;t realise it would need this&amp;#8221; sense.&lt;/li&gt;
&lt;li&gt;The main question here is whether we have booleans (settings which can be tuned at run-time by the sysadmin which determine how the policy works) to specify which optional tasks or whether we allow all access for optional configurations by default. The secondary question is when certain unusual corner cases should be not supported at all such that the people who do such unusual corner cases need to use &lt;b&gt;audit2allow&lt;/b&gt; to generate local policy to allow their operations.&lt;/li&gt;
&lt;li&gt;Sometimes we have to allow things that we really don&amp;#8217;t like. Even when we write policy to allow a daemon to do unusual things (such as using /root instead of /var/lib) it&amp;#8217;s still a lot better than running without SE Linux. Also SE Linux policy to allow such obviously broken things stands out and is a constant reminder that the daemon needs fixing, this is better than allowing symptoms of broken design to be forgotten.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;How to Improve the Situation&lt;/h3&gt;
&lt;p&gt;We could have comments in the policy source for everything that is in category 3. If the comments had a fixed format so that a recursive grep could find them all then it would allow us to more easily remove the gross things from the policy at a later date.&lt;/p&gt;
&lt;p&gt;But it seems to me that the main problem is a lack of people working on this. I am not aware of any people actively testing Debian policy for excessive privilege in regard to such issues.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://oss.tresys.com/pipermail/refpolicy/2011-March/004115.html&quot;&gt; http://oss.tresys.com/pipermail/refpolicy/2011-March/004115.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
	<pubDate>Thu, 28 Apr 2011 21:00:18 +0000</pubDate>
	<dc:creator>etbe</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #5</title>
	<guid>http://danwalsh.livejournal.com/42768.html</guid>
	<link>http://danwalsh.livejournal.com/42768.html</link>
	<description>&lt;span&gt;&lt;strong&gt;#5 How do I add new file systems/disks to an SELinux machine?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lets examine three use cases:&lt;br /&gt;&lt;br /&gt;1: You just got back from Best Buy with a brand new 100 Gig Disk that you want to mount on /home and store your homedirs.&amp;nbsp; You add the disk mount to /etc/fstab, mount it untar your entire backed up directory to the disk.&amp;nbsp; Now you attempt to login with a confined user. &amp;nbsp;Login fails, and the audit logs fill up with AVC&amp;nbsp;messages concerning &lt;span&gt;file_t&lt;/span&gt;.&amp;nbsp; Even without confined logins, applications like sshd can't read the ~/.ssh directory and Apache can no longer read the ~/public_html directory.&lt;br /&gt;&lt;br /&gt;SELinux reporting errors with the type &lt;span&gt;file_t&lt;/span&gt; indicates that the file/dir has no label.&amp;nbsp; SELinux has no idea what content is stored in a file without a label, therfore the kernel denies confined applications access to these files.&amp;nbsp; Ordinarily when I have seen random files all over the disk labelled file_t, I&amp;nbsp;have told the user to relabel the entire machine.&amp;nbsp; &lt;span&gt;touch /.autorelabel; reboot&lt;/span&gt;&amp;nbsp; In this case we know the user just added a disk, so all he needs to do is run restorecon on the disk.&amp;nbsp; &lt;span&gt;restorecon -R&amp;nbsp;-v /home&lt;/span&gt;.&amp;nbsp; The restorecon command will put the default labels on the entire disk. &amp;nbsp;This&amp;nbsp; also works on disks that you moved from one machine to another, especially important if the machine had SELinux disabled.&lt;br /&gt;&lt;br /&gt;2. You add a new lvm mount that you want to store all of your postgresql database directory on.&amp;nbsp; You create a new directory tree /data/postgresqldb and mount the disk here and mount the directory on /data/pgsql.&amp;nbsp;&amp;nbsp;&amp;nbsp; You are an advanced SELinux user so you know you need to put labels down,&amp;nbsp; you run &amp;quot;&lt;span&gt;restorecon -R&amp;nbsp;-v /data/pgsql&lt;/span&gt;&amp;quot;.&amp;nbsp; &amp;nbsp;Now you &lt;span&gt;service postgresql start&lt;/span&gt;, and POW it blows up.&amp;nbsp; The setroubleshoot star shows up and you read the analysys. &amp;nbsp;The analysys tells you that postgresql is trying to access a file in a directory labeled default_t.&amp;nbsp; Newly created directories in / are labelled &lt;span&gt;default_t.&amp;nbsp; &lt;/span&gt;Just like file_t, the SELinux kernel does not know what content is stored in a file/directory labeled default_t, so all confined applications are blocked from reading default_t files/directories.&amp;nbsp; The setroubleshoot analysis also tells you you need to put a label on the directory, and choose from a list of labels including &lt;span&gt;postgresql_db_t&lt;/span&gt;.&amp;nbsp; You figure that looks good and you follow the instructions, &lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -a -t postgresql_db_t '/data/pgsql(/.*)?'&lt;br /&gt;# restorecon -R&amp;nbsp;-v /data/pgsql&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The semanage command tells the SELinux system what the default label for this directory will be going forward.&amp;nbsp; The restorecon command actually puts the labels on the disk.&lt;br /&gt;&lt;br /&gt;Now you &lt;span&gt;service postgresql start&lt;/span&gt;, and POW it blows up again.&amp;nbsp; &amp;nbsp;At this point you are real unhappy with SELinux.&amp;nbsp; This time the AVC's indicate that &lt;span&gt;postgresql_t &lt;/span&gt;is not able to search through the /data directory which is labelled&lt;span&gt; default_t&lt;/span&gt;.&amp;nbsp; Your labelling was added at a directory a level below what you needed.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -d &lt;span&gt;'/data/pgsql(/.*)?'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt; &lt;span&gt;# semanage fcontext -a -t postgresql_db_t '/data(/.*)?'&lt;br /&gt;# restorecon -R&amp;nbsp;-v /data&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I am sorry we blew it on this, but hopefully this example will help you understand a little of what SELinux is doing.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# service postgresql start&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;strong&gt;It works!!!&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now you can take the pins out of the voodoo doll of me.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;NOTE:&amp;nbsp; If you were to store the postgresql database in a subdirectory of a normal file system directory, DO&amp;nbsp;NOT&amp;nbsp;change the label of that directory.&lt;br /&gt;For example /home/postgesql.&amp;nbsp; &lt;br /&gt;&lt;span&gt;&lt;br /&gt;# semanage fcontext -a -t postgresql_db_t '/home(/.*)?'&lt;br /&gt;# restorecon -R&amp;nbsp;-v /home&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Would thoroughly screw up your machine.&amp;nbsp; In this case it is better to do &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -a -t postgresql_db_t '/home/pgsql(/.*)?'&lt;br /&gt;# restorecon -R&amp;nbsp;-v /home&lt;/span&gt;/pgsql&lt;br /&gt;Then add allow rules for posqgresql_t to search through home_root_t using &lt;br /&gt;&lt;br /&gt;#grep postgresql_t /var/log/audit/audit.log |&amp;nbsp;audit2allow -M&amp;nbsp;mypostgresql&lt;br /&gt;# semodule -i mypostgresql.pp&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;3. You want to share Apache data on an NFS&amp;nbsp;share using multiple httpd hosts.&amp;nbsp;&amp;nbsp; You mount the remove nfs directory at /var/www/.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# service httpd start&lt;/span&gt;&lt;br /&gt;It blows up&amp;nbsp;permission denied.&amp;nbsp; This time setroubleshoot is complaining about &lt;span&gt;httpd_t &lt;/span&gt;trying to read &lt;span&gt;nfs_t&lt;/span&gt;.&amp;nbsp; The analysis tells you that you can allow &lt;span&gt;httpd_t&lt;/span&gt; to read all &lt;span&gt;nfs_t&lt;/span&gt; by setting a couple of different booleans.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;httpd_use_nfs&lt;/span&gt; or &lt;span&gt;use_nfs_home_dirs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since you are not using nfs for your&amp;nbsp; home directories, it would be a bad idea from a security point of view to turn this boolean on.&amp;nbsp;&amp;nbsp;The &lt;span&gt;use_nfs_home_dirs&lt;/span&gt; boolean allows any confined domains that need access to&amp;nbsp; home directory content to get access to all files labeled &lt;span&gt;nfs_t.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Turning on &lt;span&gt;httpd_use_nfs &lt;/span&gt;will solve your problem.&amp;nbsp; &lt;br /&gt;But what if you had other nfs shares mounted which you did not want to grant access to Apache?&lt;br /&gt;&lt;br /&gt;The third option would be to use a mount option.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;span&gt;# mount -o context=&amp;quot;system_u:object_r:httpd_sys_content_t:s0&amp;quot; REMOTEHOST:/var/www /var/www&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This command tells the SELinux kernel to treat all content in this file system as&lt;span&gt; httpd_sys_content_t.&lt;/span&gt;&amp;nbsp; &lt;span&gt;httpd_t &lt;/span&gt;will be allowed to access the content&amp;nbsp; mounted as &lt;span&gt;httpd_sys_content_t&lt;/span&gt;,&amp;nbsp; but the kernel will still deny httpd_t access to other NFS file systems mounted on the system.</description>
	<pubDate>Thu, 14 Apr 2011 15:10:55 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>James Morris: Linux Security Summit 2011 (Santa Rosa) – CFP Open</title>
	<guid>http://blog.namei.org/?p=474</guid>
	<link>http://blog.namei.org/2011/04/04/linux-security-summit-2011-santa-rosa-cfp-open/</link>
	<description>&lt;p&gt;The &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011&quot;&gt;2011 Linux Security Summit&lt;/a&gt; has been &lt;a href=&quot;http://marc.info/?l=linux-security-module&amp;#038;m=130190646900423&amp;#038;w=2&quot;&gt;announced&lt;/a&gt;, and the CFP is open until the &lt;b&gt;27th of May&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;Following &lt;a href=&quot;https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2010&quot;&gt;last year&amp;#8217;s successful event in Boston&lt;/a&gt;,  the 2011 Linux Security Summit (LSS2011) will be held on the 8th of September this year in conjunction with the &lt;a href=&quot;http://www.linuxplumbersconf.org/2011/&quot;&gt;Linux Plumbers Conference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The program committee is looking for submissions from developers, researchers, and implementors.&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;ve done anything interesting in Linux security over the last year, it&amp;#8217;s time to get a proposal ready and send it in!&lt;/p&gt;</description>
	<pubDate>Mon, 04 Apr 2011 09:07:19 +0000</pubDate>
	<dc:creator>jamesm</dc:creator>
</item>
<item>
	<title>Dan Walsh: I will be presenting SELinux at Boston Securty Meetup Tonight.</title>
	<guid>http://danwalsh.livejournal.com/42689.html</guid>
	<link>http://danwalsh.livejournal.com/42689.html</link>
	<description>&lt;a href=&quot;http://www.meetup.com/boston-security-meetup/events/16738054/&quot; rel=&quot;nofollow&quot;&gt;http://www.meetup.com/boston-security-meetup/events/16738054/&lt;/a&gt;</description>
	<pubDate>Thu, 31 Mar 2011 11:57:14 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #4</title>
	<guid>http://danwalsh.livejournal.com/42394.html</guid>
	<link>http://danwalsh.livejournal.com/42394.html</link>
	<description>&lt;span&gt;&lt;strong&gt;#4 How do I tell whether a domain is &lt;em&gt;confined&lt;/em&gt; on an SELinux System?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On SELinux targeted systems, we have confined domains and unconfined domains, and as of RHEL6 and all supported Fedoras we also have permissive domains.&amp;nbsp; SELinux does not block access on processes running in these domains, for the most part.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;strong&gt;Unconfined Domains&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An unconfined domain is supposed to be a process that has the same rights as it would if SELinux was disabled.&amp;nbsp; There are a few caveats to this though.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Process Transitions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A process transition says when process running as label a_t executes a file labeled b_exec_t it should execute the process as b_t&amp;nbsp; An example of this would be service httpd start.&amp;nbsp; In this case we have unconfined_t running an init script labeled initrc_exec_t and SELinux starts the process as initrc_t.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -T -s unconfined_t -t initrc_exec_t&lt;br /&gt;Found 1 semantic te rules:&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition unconfined_t initrc_exec_t : process initrc_t; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then the init script has a rule that says initrc_t executing httpd_exec_t will transition to httpd_t&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -T -s initrc_t -t httpd_exec_t&lt;br /&gt;Found 1 semantic te rules:&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition initrc_t httpd_exec_t : process httpd_t; &lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;This means that even though the process that started another process was unconfined, the new process can be confined.&amp;nbsp; We tend to discourage transitions from the unconfined_t user domain, since this can surprise the user.&amp;nbsp; &amp;quot;I thought I was unconfined, why when I start XYZ does SELinux block it?&amp;quot;&lt;br /&gt;&lt;br /&gt;Other then transitioning to initrc_t there are currently 55 executables that transition out of the unconfined_t domain.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;#&amp;nbsp; sesearch -T -s unconfined_t -c process -C| grep -v initrc_t| grep -v ^D | wc -l&lt;br /&gt;55&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;A lot of these domains are also unconfined.&amp;nbsp; unconfined_java_t for example is the same as unconfined_t except it has execstack and execmem privilege always.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Minor Denials&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In some cases I have been convinced to add minor confinement to even unconfined domains.&amp;nbsp; The most seen one of these was the executable memory checks.&amp;nbsp; execmem, execmod, execheap and execstack.&amp;nbsp; There are booleans to turn on and off the checks for the unconfined domains.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Listing unconfined domains &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can use seinfo to list the unconfined domains.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# seinfo -aunconfined_domain_type -x | wc -l&lt;br /&gt;54&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Disabling unconfined domains&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can easily disable lots of domains unconfined domains to make your machine more locked down.&amp;nbsp; In RHEL6 and Fedora their are two policy modules unconfined and unconfineduser.&amp;nbsp; If you disable unconfined it will lock down most of system space.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semodule -d unconfined&lt;br /&gt;# seinfo -aunconfined_domain_type -x | wc -l&lt;br /&gt;14&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is how I usually run.&amp;nbsp; In this mode, it will require you to have policy for all apps launched out of init system or xinetd.&lt;br /&gt;&lt;br /&gt;You can also disable the unconfined user, by executing the following commands.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;# semanage login -m -s staff_u root&lt;br /&gt;# semanage login -m -s staff_u __default__&lt;br /&gt;# semanage user -d unconfined_u&lt;br /&gt;# semanage user -m -R &amp;quot;staff_r system_r sysadm_r&amp;quot; staff_u&lt;/span&gt;&lt;span&gt;&lt;br /&gt;# semodule -d unconfineduser&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As long as unconfined is not defined in either the semanage user or semanage login database this should work and you pretty much get back to what used to be strict policy.&lt;br /&gt;&lt;br /&gt;I tend to leave unconfineduser enabled, but setup all my users as confined, and allow staff_t to transition to unconfined_t through sudo.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Adding unconfined domains to when building policy modules&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you were building your own policy module and you wanted to build an unconfined domain, you would write code like:&lt;br /&gt;&lt;span&gt;&lt;br /&gt;type mydomian_t;&lt;br /&gt;domain_type(mydomain_t)&lt;br /&gt;&lt;br /&gt;optional_policy(`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unconfined_domain(mydomain_t)&lt;/span&gt;&lt;br /&gt;')&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;strong&gt;Permissive Domains&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The other type of domain that SELinux does not block is the permissive domain.&amp;nbsp;&amp;nbsp;&amp;nbsp; These are usually domains under construction. &amp;nbsp;SELinux allows these domains to do any thing but reports AVC;s on them when they do something not allowed in policy.&amp;nbsp; When we develop policy for Fedora, we define all new domains as permissive and allow them to run permissive through an entire run of a release.&amp;nbsp; Then in the next release we turn them to enforcing.&amp;nbsp; One difference between F15 and F16 policy is we just removed the permissive flag from all domains in F15.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Listing Permissive Domains&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can see the permissive domains in two ways.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# seinfo&amp;nbsp; --permissive&amp;nbsp; | wc -l&lt;br /&gt;18&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Or you can use the semanage command to list them&lt;br /&gt;&lt;span&gt;&lt;br /&gt;# semanage permissive -l&lt;br /&gt;&lt;br /&gt;Builtin Permissive Types &lt;br /&gt;&lt;br /&gt;staff_gkeyringd_t&lt;br /&gt;staff_gkeyringd_t&lt;br /&gt;mock_t&lt;br /&gt;keyboardd_t&lt;br /&gt;matahari_serviced_t&lt;br /&gt;firewalld_t&lt;br /&gt;colord_t&lt;br /&gt;systemd_notify_t&lt;br /&gt;systemd_passwd_agent_t&lt;br /&gt;mozilla_plugin_t&lt;br /&gt;matahari_hostd_t&lt;br /&gt;matahari_netd_t&lt;br /&gt;passenger_t&lt;br /&gt;systemd_tmpfiles_t&lt;br /&gt;foghorn_t&lt;br /&gt;namespace_init_t&lt;br /&gt;&lt;br /&gt;Customized Permissive Types&lt;br /&gt;&lt;br /&gt;qpidd_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Adding Permissive Domains&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Notice that the semanage command differentiates between customized permissive domains and built-ins.&amp;nbsp; With the semanage command, the administrator can choose to make a domain permissive, by executing &lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage permissive -a httpd_t&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# seinfo&amp;nbsp; --permissive&amp;nbsp; |grep http&lt;br /&gt;&amp;nbsp;&amp;nbsp; httpd_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Removing Permissive Domains&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can remove a customized permissive domain by executing:&lt;br /&gt;&lt;span&gt;&lt;br /&gt;# semanage permissive -d httpd_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You &lt;strong&gt;&lt;em&gt;can not&lt;/em&gt;&lt;/strong&gt; currently remove permissive domains if they are the built-in into policy.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Adding permissive domains to when building policy modules&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you were building your own policy module and you wanted to build a permissive domain, you would write code like:&lt;br /&gt;&lt;span&gt;&lt;br /&gt;type mydomian_t;&lt;br /&gt;domain_type(mydomain_t)&lt;br /&gt;&lt;br /&gt;permissive mydomain_t;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;/div&gt;</description>
	<pubDate>Fri, 25 Mar 2011 12:59:24 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): SAD 2: Security Awareness or melting Realities together</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-2132013955084852516</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/02/sad-2-security-awareness-or-melting.html</link>
	<description>Most people know that smoking causes cancer, that eating too much and not doing sports increases the probability of a cardiovascular disease, that drinking too much is bad for your psyche and lever and so on.&lt;br /&gt;&lt;br /&gt;But does just knowing about it change their behavior? No, it does not!&lt;br /&gt;&lt;br /&gt;The reason is that these &quot;invisible&quot; negative effects do not influence their living, the integrity of their reality is intact until it is too late and the disease dramatically decrease the quality of their life.&lt;br /&gt;&lt;br /&gt;Only a few people are clever and strong enough to reflect about their bad behaviors and change them. I assume more people change their bad habits as soon as they &lt;span&gt;see&lt;/span&gt; what happens to their body. Seeing means measuring the cardiovascular levels, taking x-ray pictures of organs, making chemical analysis of body liquids and tissue and so on.&lt;br /&gt;&lt;br /&gt;I see a strong analogy here to software development and security.&lt;br /&gt;&lt;br /&gt;Developers and project-managers often do not have security in mind, or do not have the technical background and daily practice to make the resulting product a nightmare for penetration-testers and hackers. (How often do you read this already?)&lt;br /&gt;&lt;br /&gt;Let's not stress this doctor vs. patient analogy too far. This blog entry is not about good vs. bad or dumb vs. clever... it's about the experience I made and psychology.&lt;br /&gt;&lt;br /&gt;First of all, measurement (of the right things) is the key to success! You do not have to create a bulletproof plan, just some goals, continue measurement, and adapt your plan (Hello agile development/management!).&lt;br /&gt;&lt;br /&gt;I hold three talks/workshops in 2010, every talk has the same topic: &quot;secure design and development&quot; and I got the same result: &lt;span&gt;Code quality did not increase!&lt;/span&gt; The number of potential security bugs per 1000 &quot;physical&quot; LOC (Hits/KSLOC) stayed the same or even increased.&lt;br /&gt;Based on the responses from my audience I experimented with the content and with the methodology. The first workshop was very long and mostly theoretical with threat models, potential problems in Rails, risk assessment, showing some tools (which gets the most attention, because it potentially helped solving their problems).&lt;br /&gt;The second one was much more practical, I had shown real examples from the in-house software projects, real attacks and presenting some tools. The session was much shorter and caused more attention by the developers and a bit more attention by the technical managers (Still, tools caused the the most attention). And the last one... the last one was a wake-up call, less technical, analogies and examples, cost of security updates (Attention!) and I hit the target.&lt;br /&gt;&lt;br /&gt;Result: The first talk was a waste of time, my statistics had shown no decrease in the potential vulnerabilities, the second one also had no affect on quality but the awareness and communication (developers) increased, and the third talk... well the code quality did not increase but awareness and maybe acceptance in the upper food chain increased.&lt;br /&gt;&lt;br /&gt;Retrospectively I can say I should have done the talks/workshops in reverse order but when I started is was a &quot;fire-fighter job&quot; and I had no time for a real plan.&lt;br /&gt;&lt;br /&gt;Code quality is still a critical issue and therefore I took the next, more aggressive step by sending the (cleaned-up) results of my code scanner to the developers mailing list. And at least one team responded to it and we reduced the number of potential security problems and false positives to a minimum within just two weeks. In the meanwhile all teams responded in some way and I hope code fixing will start soon.&lt;br /&gt;&lt;br /&gt;On balance:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If you want to increase awareness, invite the right people and omit technical details, speak the language of the audience, use numbers (costs) and statistics, use analogies instead of theoretical information. Melt realities by creating feelings and concernment! (The last point is not easy to do of course.)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you want to increase code quality, use tools that directly show the problematic code with a description and help fixing it! Don't create too much confusion and don't steal the developer's time.&lt;/li&gt;&lt;/ul&gt;BTW, the increase of awareness or the expertise of the developers resulted in adding security features and fixing existing security features...&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-2132013955084852516?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 25 Mar 2011 06:36:23 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #3</title>
	<guid>http://danwalsh.livejournal.com/42186.html</guid>
	<link>http://danwalsh.livejournal.com/42186.html</link>
	<description>&lt;strong&gt;SELInux versus nsswitch.conf&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Many confined domains call getpwnam, getpwuid, getpwent functions.&amp;nbsp; Traditionally these function calls just read the the /etc/passwd file.&amp;nbsp; In a modern Linux system the glibc has added nsswitch.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;man nssswitch.conf&lt;br /&gt;...&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nsswitch.conf - System Databases and Name Service Switch configuration file&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Various functions in the C Library need to be configured to work correctly in the local environment.&amp;nbsp; Tra‐&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ditionally, this was done by using files (e.g., /etc/passwd), but other&amp;nbsp; nameservices&amp;nbsp; (like&amp;nbsp; the&amp;nbsp; Network&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Information&amp;nbsp; Service&amp;nbsp; (NIS)&amp;nbsp; and the Domain Name Service (DNS)) became popular, and were hacked &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into the C library, usually with a fixed search order.&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; nsswitch functionality allows multiple back-ends for the getpw*. These back-ends can change the access required by a process, and SELinux has to allow for these different back-ends. &lt;br /&gt;&lt;br /&gt;If you have setup your system with your passwd data in ldap, SELinux is forced to allow all confined domains that call getpw* to connect to the ldap_port_t ports in order to get passwd data.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;# semanage&amp;nbsp; port -l | grep ldap&lt;br /&gt;ldap_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 389, 636, 3268&lt;br /&gt;ldap_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 389, 636&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Also since the confined application needs to resolve the hostname of the ldap server, the confined application needs to be able to connect to dns_port_t.&lt;br /&gt;&lt;span&gt;&lt;br /&gt; # semanage&amp;nbsp; port -l | grep dns&lt;br /&gt;dns_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tcp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 53&lt;br /&gt;dns_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; udp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 53&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even worse if you are using NIS all of these applications have to be able to connect all ports and bind to all ports.&lt;br /&gt;&lt;br /&gt;We have had a boolean allow_ypbind since RHEL5, luckily this is turned off by default and eliminates a lot of access.&amp;nbsp; You only need to turn it on if you are using NIS.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sssd (System Security Services Daemon) to the rescue.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;sssd provides a new back end for nsswitch.&amp;nbsp; This backend causes all callers of getpw*&amp;nbsp;functions to used a named socket, /var/lib/sss/nss.&amp;nbsp; The beauty of the sssd backend is the sssd daemon does all of the ldap communications for the confined applications, rather then the confined applications needing to connect directly to the ldap server/port.&lt;br /&gt; &lt;br /&gt;In Fedora 15 we added a new boolean authlogin_nsswitch_use_ldap that allows you to turn off this access.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;NOTE:&amp;nbsp; You can turn off this boolean even if you are using ldap for passwd entry resolution if you are using sssd.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How many rules does this eliminate?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Using sesearch to look for rules tat allow a domain to connect to the ldap_port_t.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -t ldap_port_t -p name_connect -C | wc -l&lt;br /&gt;717&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we eliminate the allow_ypbind boolean&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -t ldap_port_t -p name_connect -C | grep -v allow_ypbind | wc&amp;nbsp; -l&lt;br /&gt;386&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now if we further eliminate authlogin_nsswitch_use_ldap&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -t ldap_port_t -p name_connect -C | grep -v allow_ypbind | grep -v authlogin_nsswitch_use_ldap | wc -l&lt;br /&gt;112&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Meaning we have eliminate over 600 rules that allow confined domains to connect to the ldap_port_t.&lt;br /&gt;&lt;br /&gt;You can turn &lt;strong&gt;off&lt;/strong&gt; both booleans by executing.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P&amp;nbsp;allow_ypbind=0 authlogin_nsswitch_use_ldap=0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I&amp;nbsp;plan on turning both booleans off by default in Fedora 16. &amp;nbsp;&lt;br /&gt;</description>
	<pubDate>Thu, 24 Mar 2011 16:04:06 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux.. #2</title>
	<guid>http://danwalsh.livejournal.com/41794.html</guid>
	<link>http://danwalsh.livejournal.com/41794.html</link>
	<description>&lt;strong&gt;#2&lt;/strong&gt; Outputting your semanage configuration&lt;br /&gt;&lt;br /&gt;You set up a machine with a bunch of SELinux customizations.&amp;nbsp; You want to take those customizations and make 5 other machines look the same.&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How would I do this?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;semanage -o /tmp/selinux.customizations&lt;br /&gt;&lt;br /&gt;man semanage &lt;br /&gt;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output local customizations&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; semanage [ -S store ] -o [ output_file | - ]&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output local customizations&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; semanage [ -S store ] -o [ output_file | - ]&lt;br /&gt;&lt;br /&gt;The semanage -o command will output all semanage customizations into a file that the semanage -i command can read.&amp;nbsp; &lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;span&gt;# semanage -i /tmp/selinux.customizations&lt;br /&gt;# scp /tmp/selinux.customizations root@otherhost.mycompany.com&lt;br /&gt;# ssh otherhost.mycompany.com root@otherhost.mycompany.com semanage -i selinux.customizations&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is the output of this command on my laptop.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;# semanage output -o -&lt;br /&gt;boolean -D&lt;br /&gt;boolean -1 allow_polyinstantiation&lt;br /&gt;boolean -0 authlogin_nsswitch_use_ldap&lt;br /&gt;boolean -1 httpd_can_sendmail&lt;br /&gt;boolean -1 xguest_connect_network&lt;br /&gt;boolean -1 xguest_mount_media&lt;br /&gt;boolean -1 xguest_use_bluetooth&lt;br /&gt;login -D&lt;br /&gt;login -a -s guest_u -r 's0' __default__&lt;br /&gt;login -a -s unconfined_u -r 's0-s0:c0.c1023' root&lt;br /&gt;login -a -s system_u -r 's0-s0:c0.c1023' system_u&lt;br /&gt;login -a -s xguest_u -r 's0' xguest&lt;br /&gt;user -D&lt;br /&gt;user -a -r s0-s0:c0.c1023 -R 'staff_r system_r webadm_r' webadm_u&lt;br /&gt;user -a -r s0 -R 'xguest_r' xguest_u&lt;br /&gt;port -D&lt;br /&gt;port -a -t http_port_t -p tcp 81&lt;br /&gt;interface -D&lt;br /&gt;interface -a -t netif_t eth*&lt;br /&gt;node -D&lt;br /&gt;node -a -M 0.0.0.0 -p ipv4 -t defaultif_t 0.0.0.0&lt;br /&gt;node -a -M 255.255.255.255 -p ipv4 -t internalif_t 127.0.0.1&lt;br /&gt;fcontext -D&lt;br /&gt;fcontext -a -f 'all files' -t httpd_sys_content_t '/myweb(/.*)?'&lt;br /&gt;fcontext -a -f 'all files' -t public_content_t '/shared(/.*)?'&lt;br /&gt;fcontext -a -f 'all files' -t samba_share_t '/shared/samba(/.*)?'&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Notice the -D commands, these are used to delete all local customizations.&amp;nbsp; If you were to install this selinux configuration on your machine, you would have the same configuration as my laptop.&lt;br /&gt;&lt;br /&gt;Note:&amp;nbsp;&amp;nbsp;You would also need to make sure the policy modules were the same on each machine.</description>
	<pubDate>Wed, 23 Mar 2011 12:13:28 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Dan Walsh: 10 things you probably did not know about SELinux..</title>
	<guid>http://danwalsh.livejournal.com/41593.html</guid>
	<link>http://danwalsh.livejournal.com/41593.html</link>
	<description>&lt;strong&gt;Over the next few days, I am going to blog about things you probably did not know about SELinux&lt;br /&gt;&lt;br /&gt;1:&lt;/strong&gt;&amp;nbsp; Multiple semanage commands:&lt;br /&gt;&lt;br /&gt;The semanage command is pretty slow.&amp;nbsp; It can take 10-20 seconds for a semanage command to complete.&amp;nbsp;  &amp;nbsp; semanage recompiles&amp;nbsp; a huge amount of policy.&amp;nbsp; In Fedora 15 we have almost 500,000 allow and dontaudit rules.&amp;nbsp; The compiler checking each type, user, role, etc to make sure they are valid.&amp;nbsp;&amp;nbsp; I&amp;nbsp;have seen people executing multiple semanage commands in post install of rpm spec files as well as people customizing lots of machines by executing setsebool, semodule and semanage commands.&amp;nbsp; Not too many people realize you can run them all within the same transaction.&lt;br /&gt;&lt;br /&gt;man semanage&lt;br /&gt;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Input local customizations&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; semanage [ -S store ] -i [ input_file | - ]&lt;br /&gt;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -i, --input&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Take a set of commands from a specified file and load them in&amp;nbsp; a&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; single transaction.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The xguest uses this in its post install.&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;semanage -S targeted -i - &amp;lt;&amp;lt; _EOF&lt;br /&gt;boolean -m --on allow_polyinstantiation &lt;br /&gt;boolean -m --on xguest_connect_network&lt;br /&gt;boolean -m --on xguest_mount_media&lt;br /&gt;boolean -m --on xguest_use_bluetooth&lt;br /&gt;_EOF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It sets a bunch of boolean values.&amp;nbsp; You can also manage different semanage commands within the same transaction.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;semanage -i - &amp;lt;&amp;lt; _EOF&lt;br /&gt;port -a -t http_port_t -p tcp 81&lt;br /&gt;fcontext -a -t httpd_sys_content_t &amp;quot;/myweb(/.*)?&amp;quot;&lt;br /&gt;boolean -m --on httpd_can_sendmail&lt;br /&gt;user -a -R &amp;quot;staff_r system_r webadm_r&amp;quot; -r s0-s0:c0.c1023 webadm_u &lt;br /&gt;login -m -s guest_u -r s0 __default__&lt;br /&gt;_EOF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;</description>
	<pubDate>Tue, 22 Mar 2011 18:33:58 +0000</pubDate>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item>
	<title>Thomas Biege (Security): Forgotten Password and Birthday Attacks</title>
	<guid>tag:blogger.com,1999:blog-5240359826706545510.post-2155535332855749669</guid>
	<link>http://thetoms-random-thoughts.blogspot.com/2011/03/forgotten-password-and-birthday-attacks.html</link>
	<description>I just stumbled over a piece of code that might be interesting for you as well. A web-app let's click you on a &quot;forgotten password&quot; link and will send a token to the (valid/known) email address you specified. When you return to the web-app and provide the token that was mailed to you, and the token was found by looking it up for ANY user, you are allowed to set a new password. So, theoretically (I didn't test it) this code is vulnerable to a &lt;span&gt;birthday attack&lt;/span&gt; (random pair collision), the impact depends on the number of users and the length of the token.&lt;br /&gt;&lt;br /&gt;For example, and I hope I get the math correct here, if the token is 8 bit long (8 bit of entropy, equally distributed) an attacker only needs to call the &quot;forgotten password&quot; functionality for 16 (birthday bound, 2^{n/2}) users and try 16 different tokens to have a probability of success  close to 50%.&lt;br /&gt;&lt;br /&gt;The solution is to look-up the user by email address or another unique identifier and verify if the token for this user matches or not.&lt;br /&gt;&lt;br /&gt;Here is an example diagram for a 16 bit token (DNS TRXID) to compare &lt;span&gt;brute force&lt;/span&gt; vs. &lt;span&gt;birthday attack&lt;/span&gt;.&lt;br /&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-un8k-4vIBTw/TYM16SXMdvI/AAAAAAAAAeY/7dhAdj5ed3Q/s1600/Birthday_vs_conventional_attack.jpg&quot;&gt;&lt;img src=&quot;http://3.bp.blogspot.com/-un8k-4vIBTw/TYM16SXMdvI/AAAAAAAAAeY/7dhAdj5ed3Q/s320/Birthday_vs_conventional_attack.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5585367238347355890&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;!-- BlogCounter Code START --&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot; id=&quot;bclink&quot; title=&quot;kostenloser Counter fuer Weblogs&quot;&gt;&lt;span id=&quot;bccount&quot;&gt;kostenloser Counter&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.blogcounter.de/&quot;&gt;&lt;img alt=&quot;Weblog counter&quot; src=&quot;http://track.blogcounter.de/log.php?id=thetom_blog&quot; /&gt;&lt;/a&gt; - &lt;/p&gt;&lt;!-- BlogCounter Code END --&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5240359826706545510-2155535332855749669?l=thetoms-random-thoughts.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 18 Mar 2011 08:42:28 +0000</pubDate>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>

</channel>
</rss>

