<?xml version="1.0"?>
<rdf:RDF
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://selinuxnews.org/planet/">
	<title>Planet SELinux</title>
	<link>http://selinuxnews.org/planet/</link>
	<description>Planet SELinux - http://selinuxnews.org/planet/</description>

	<items>
		<rdf:Seq>
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/64493.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/64142.html" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=563" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=561" />
			<rdf:li rdf:resource="http://securityblog.org/2013/04/30/se-android-and-the-motochopper-exploit" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/63915.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/63586.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/63472.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/63137.html" />
			<rdf:li rdf:resource="http://securityblog.org/2013/04/12/and-here-it-is-mrats-found-that-bypass-mdm" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/62737.html" />
			<rdf:li rdf:resource="http://securityblog.org/2013/04/11/security-anti-pattern-castles-on-sand" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/62711.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/62262.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/62070.html" />
			<rdf:li rdf:resource="hatenablog://entry/6435988827676747615" />
			<rdf:li rdf:resource="http://securityblog.org/2013/02/11/security-anti-pattern-mobile-hypervisors" />
			<rdf:li rdf:resource="http://securityblog.org/2013/02/06/big-changes" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=559" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3654" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3650" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/61710.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/61646.html" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3575" />
			<rdf:li rdf:resource="hatenablog://entry/12704830469096319076" />
			<rdf:li rdf:resource="tag:blogger.com,1999:blog-5024703430482213163.post-1671553651625097256" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/61349.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/61107.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/60801.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/60528.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/60366.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/60135.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/59788.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/59536.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/59144.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/59060.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/58647.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/58508.html" />
			<rdf:li rdf:resource="tag:blogger.com,1999:blog-5024703430482213163.post-599643298734095008" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/58178.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/58032.html" />
			<rdf:li rdf:resource="tag:blogger.com,1999:blog-5024703430482213163.post-1636918091957103071" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/57723.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/57377.html" />
			<rdf:li rdf:resource="urn:lj:livejournal.com:atom1:paulmoore:7947" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=553" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/57276.html" />
			<rdf:li rdf:resource="tag:blogger.com,1999:blog-5240359826706545510.post-3189813332154886746" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=550" />
			<rdf:li rdf:resource="hatenablog://entry/12704830469096319078" />
			<rdf:li rdf:resource="hatenablog://entry/12704830469096319080" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/56976.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/56760.html" />
			<rdf:li rdf:resource="urn:lj:livejournal.com:atom1:paulmoore:7832" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/56534.html" />
			<rdf:li rdf:resource="urn:lj:livejournal.com:atom1:paulmoore:7632" />
			<rdf:li rdf:resource="hatenablog://entry/12704830469096319082" />
			<rdf:li rdf:resource="urn:lj:livejournal.com:atom1:paulmoore:7234" />
			<rdf:li rdf:resource="tag:blogger.com,1999:blog-5024703430482213163.post-4035831456624635000" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=541" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3326" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3318" />
			<rdf:li rdf:resource="urn:lj:livejournal.com:atom1:paulmoore:7019" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=537" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=535" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=533" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/56179.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55837.html" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3263" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=529" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3232" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55588.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55324.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/55229.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54803.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54707.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54343.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/54092.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53878.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53603.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53378.html" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3189" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/53182.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52958.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52550.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52281.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/52156.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51942.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51459.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/51435.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50980.html" />
			<rdf:li rdf:resource="http://blog.namei.org/?p=520" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50790.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50526.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50380.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/50014.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/49762.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/49564.html" />
			<rdf:li rdf:resource="http://danwalsh.livejournal.com/49336.html" />
			<rdf:li rdf:resource="http://etbe.coker.com.au/?p=3133" />
		</rdf:Seq>
	</items>
</channel>

<item rdf:about="http://danwalsh.livejournal.com/64493.html">
	<title>Dan Walsh: New Security Feature in Fedora 19 Part 3: Hard Link/Soft Link Protection</title>
	<link>http://danwalsh.livejournal.com/64493.html</link>
	<content:encoded>It is surprising to most people who understand Linux and Unix that you are allowed to Hard Link to any file on the OS as long as it is on the same file system.&lt;br /&gt;Hard linking means that you can put the same Inode number into two different directories.&amp;nbsp; Prior to Fedora 19, a normal user would be allowed to do something like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; ln /etc/shadow ~/shadow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even though the /etc/shadow is owned by root.&amp;nbsp; Then if the user tricked an administrator into doing something like&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# chown -R&amp;nbsp; dwalsh:dwalsh ~&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This would cause the /etc/shadow file to be owned by dwalsh.&lt;br /&gt;&lt;br /&gt;Similarly in the past hackers have tricked privileged applications to follow hard and soft links, created in a user account to compromise the system.&lt;br /&gt;&lt;br /&gt;Kees Cook wrote some patches for the linux kernel that allows distributions to disable this behaviour.&lt;br /&gt;&lt;br /&gt;Here is Kees Description of the benefits of the patch:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&lt;span&gt;This patch adds symlink and hardlink restrictions to the Linux VFS.

Symlinks:

A long-standing class of security issues is the symlink-based time-of-check-time-of-use race, most commonly seen in world-writable
directories like /tmp. The common method of exploitation of this flaw is to cross privilege boundaries when following a given symlink (i.e. a
root process follows a symlink belonging to another user). For a likely incomplete list of hundreds of examples across the years, please see:
http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=/tmp

The solution is to permit symlinks to only be followed when outside a sticky world-writable directory, or when the uid of the symlink and
follower match, or when the directory owner matches the symlink's owner.

&amp;lt;snip&amp;gt;

Hardlinks:

On systems that have user-writable directories on the same partition as system files, a long-standing class of security issues is the
hardlink-based time-of-check-time-of-use race, most commonly seen in world-writable directories like /tmp. The common method of exploitation
of this flaw is to cross privilege boundaries when following a given hardlink (i.e. a root process follows a hardlink created by another
user). Additionally, an issue exists where users can &amp;quot;pin&amp;quot; a potentially vulnerable setuid/setgid file so that an administrator will not actually
upgrade a system fully.

The solution is to permit hardlinks to only be created when the user is already the existing file's owner, or if they already have read/write
access to the existing file.

Many Linux users are surprised when they learn they can link to files they have no access to, so this change appears to follow the doctrine
of &amp;quot;least surprise&amp;quot;. Additionally, this change does not violate POSIX, which states &amp;quot;the implementation may require that the calling process
has permission to access the existing file&amp;quot;[1].

This change is known to break some implementations of the &amp;quot;at&amp;quot; daemon, though the version used by Fedora and Ubuntu has been fixed[2] for
a while. Otherwise, the change has been undisruptive while in use in Ubuntu for the last 1.5 years.

&amp;lt;snip&amp;gt;&lt;/span&gt;

This feature is turned on by default in /usr/lib/sysctl.d/50-default.conf in F19.

grep fs /usr/lib/sysctl.d/50-default.conf 
fs.protected_hardlinks = 1
fs.protected_symlinks = 1

There was some concern that this could cause problems in applications that expect this behaviour, so it can be disabled.
But overall, I think it is a positive feature for Fedora.

&lt;/pre&gt;</content:encoded>
	<dc:date>2013-05-22T17:42:52+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/64142.html">
	<title>Dan Walsh: SELinux is a labeling system. First thought should be &quot;Is there a label that would make this work?&quot;</title>
	<link>http://danwalsh.livejournal.com/64142.html</link>
	<content:encoded>On the SELinux mail list today, someone asked:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;I want to store the logs from openswan into a different file ( /var/log/ipsec ) than the default. For this purpose I added &lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;plutostderrlog=/var/log/ipsec&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span&gt;to ipsec.conf.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; As long as I keep the server in permissive mode, openswan starts OK. If, however, I switch to enforcing, the daemon refuses to start with the following error message displayed in the console:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;ipsec_setup: Starting Openswan IPsec U2.6.32/K3.0.78-1.el6.elrepo.x86_64...&lt;br /&gt;ipsec_setup: Cannot write to &amp;quot;/var/log/ipsec&amp;quot;.&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span&gt; &amp;nbsp;&amp;nbsp; The audit log does not record anything useful so I tried to switch dontaudit to off and see if anything useful comes out. After running audit2allow and a bit of trial and error I came out with the following custom policy :&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span&gt;module myipsec 1.0;&lt;br /&gt;require {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type ipsec_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type var_log_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class file { write ioctl getattr append };&lt;br /&gt;}&lt;br /&gt;#============= ipsec_mgmt_t ==============&lt;br /&gt;allow ipsec_mgmt_t var_log_t:file write;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span&gt; &amp;nbsp;&amp;nbsp; The above policy worked for me but I am wondering if it is OK &lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;The problem is the administrator decided to add policy that allows ipsec_mgmt_t to write any file labeled var_log_t.&amp;nbsp; A hacked ipsec_mgmt could now overwrite any log file on the system labeled var_log_t, including /var/log/messages.&amp;nbsp; var_log_t is the default label for ANY file in /var/log directory that does not&amp;nbsp; have SELinux policy controlling it.&amp;nbsp; Also remember &amp;quot;write&amp;quot; access is always more dangerous then &amp;quot;append&amp;quot; access, since &amp;quot;write&amp;quot; allows you to truncate a file, destroying evidence, versus append to the end of a file.&lt;br /&gt;&lt;br /&gt;In the paper I wrote a few years ago,&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;a href=&quot;http://people.fedoraproject.org/%7Edwalsh/SELinux/Presentations/selinux_four_things.pdf&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;&lt;span&gt;&lt;strong&gt;What is SELinux trying to tell me?&lt;br /&gt;The 4 key causes of SELinux errors.&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I explain that adding policy should be your third option, not your first.&amp;nbsp; In this case Dominic Grift pointed out the admin, that changing the label of the target would fix the problem and not involve adding custom policy.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;semanage fcontext -a -t ipsec_log_t &amp;quot;/var/log/ipsec.*&amp;quot;&lt;br /&gt;restorecon -v /var/log/ipsec &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By telling SELinux that the content in the /var/log/ipsec log file was ipsec_log_t, you solve your problem and end up with the same security you had before the change.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Think Labels First...&lt;/b&gt;</content:encoded>
	<dc:date>2013-05-20T13:03:01+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=563">
	<title>James Morris: Slides from my Security Subsystem Overview at LinuxCon Japan 2012</title>
	<link>http://blog.namei.org/2013/05/13/slides-from-my-security-subsystem-overview-at-linuxcon-japan-2012/</link>
	<content:encoded>&lt;p&gt;Whoops.  Looks like I forgot to post my slides from last year&amp;#8217;s &lt;a href=&quot;http://events.linuxfoundation.org/archive/2012/linuxcon-japan&quot;&gt;LinuxCon Japan&lt;/a&gt; talk on the Linux kernel security subsystem.&lt;/p&gt;
&lt;p&gt;Here they are:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://namei.org/presentations/kernel-security-state-linuxconjp-2012b.pdf&quot;&gt;http://namei.org/presentations/kernel-security-state-linuxconjp-2012b.pdf&lt;br /&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll be giving an &lt;a href=&quot;http://linuxconcloudopenjapan2013.sched.org/event/296bcc789f3fe132dacafb624466c999?iframe=no&amp;#038;w=900&amp;#038;sidebar=yes&amp;#038;bg=no#.UZDKy4KaSxA&quot;&gt;update&lt;/a&gt; at the upcoming &lt;a href=&quot;http://events.linuxfoundation.org/events/linuxcon-japan&quot;&gt;LinuxCon Japan&lt;/a&gt; in Tokyo in a couple of weeks.&lt;/p&gt;</content:encoded>
	<dc:date>2013-05-13T11:14:29+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=561">
	<title>James Morris: Linux Security Summit 2013 (New Orleans) – Call for Participation</title>
	<link>http://blog.namei.org/2013/05/06/linux-security-summit-2013-new-orleans-call-for-participation/</link>
	<content:encoded>&lt;p&gt;The CFP for the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2013&quot;&gt;2013 Linux Security Summit&lt;/a&gt; has been &lt;a href=&quot;http://marc.info/?l=linux-security-module&amp;#038;m=136783173311478&amp;#038;w=2&quot;&gt;announced&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The summit will be held across the 19th and 20th of September in New Orleans, co-located again with &lt;a href=&quot;https://events.linuxfoundation.org/events/linuxcon&quot;&gt;LinuxCon&lt;/a&gt; and &lt;a href=&quot;http://www.linuxplumbersconf.org/2013/&quot;&gt;Linux Plumbers&lt;/a&gt;.   Note that presenters and attendees at LSS must be registered as LinuxCon attendees.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;ll be following a similar format to &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;last year&lt;/a&gt;, with a day of refereed presentations, followed by subsystem updates and break-out sessions on the second day.  We&amp;#8217;ll probably finish up around lunchtime on the Friday for people needing to head home that day, but check the final schedule for details once it&amp;#8217;s published.&lt;/p&gt;
&lt;p&gt;The CFP is open until &lt;strong&gt;14th June&lt;/strong&gt;, with speaker notifications to be posted by 21st June.&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;ve been doing cool and interesting work in Linux security, be sure to submit a proposal!&lt;/p&gt;</content:encoded>
	<dc:date>2013-05-06T09:59:59+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://securityblog.org/2013/04/30/se-android-and-the-motochopper-exploit">
	<title>Joshua Brindle: SE Android and the motochopper exploit</title>
	<link>http://securityblog.org/2013/04/30/SE-Android-and-the-motochopper-exploit</link>
	<content:encoded>&lt;h3&gt;SE Android prevents first exploit against commercial phone&lt;/h3&gt;

&lt;p&gt;That should have been the title of this post, but alas it is not.&lt;/p&gt;

&lt;p&gt;By now you may know that the Samsung Galaxy S4 is the first commercial device shipped with SE Android included.&lt;/p&gt;

&lt;p&gt;Included, but not enforcing. If you are familiar with SELinux you know that there is a developer mode (also called permissive) that audits access that would have been denied, but does not actually deny them. This is very useful for developing your policies without having to interate through accesses one at a time (this takes a very very long time with complex software).&lt;/p&gt;

&lt;p&gt;The standard way of writing policy is to use permissive mode to run an application, then look at the logs and figure out what the access patterns are, what should be labeled what, write the policy, then try again. Eventually you go into enforcing mode when you are ready to send your product to production.&lt;/p&gt;

&lt;p&gt;That is the theory, anyway.&lt;/p&gt;

&lt;h3&gt;History lesson&lt;/h3&gt;

&lt;p&gt;Back in the Fedora 2 days (that is 2004) SELinux shipped in enforcing, with a strict policy. It was a catastrophy. Linux users who were accustumed to cat'ing /dev/cdrom, for whatever reason, became angry that they couldn't do it all of a sudden. The targeted policy was then created which would resrtict only high-threat applications, like apache and ssh. Most recently Dan Walsh, over at Red Hat, introduces new application policies to the masses in permissive mode (note, SELinux supports permissive mode per-type, not just system wide) and collects denials from users for a few months, to figure out how people use the applications, since he can't be an expert at every single one. He then switches the policy to enforcing when the policy has been fleshed out.&lt;/p&gt;

&lt;h3&gt;Lost Opportunity&lt;/h3&gt;

&lt;p&gt;This is the first commercial phone with SE Android; there is a huge amount of risk to going into the wild in enforcing. I don't know if they were nervous that something like Fedora 2 would happen or it was carrier certification delays or perhaps they just don't think SE Android should be on unless explicitely requested. No matter what the reason, a huge opportunity to show the world the power of SE Android was lost. No worries, though, there will be another opportunity.&lt;/p&gt;

&lt;h3&gt;The Exploit&lt;/h3&gt;

&lt;p&gt;Ok, lets look at this exploit and see what would have happened. I don't happen to have a Galaxy S4 in front of me, but the stock recovery image has everything I need to look at this.&lt;/p&gt;

&lt;p&gt;First, the &lt;a href=&quot;http://forum.xda-developers.com/showthread.php?t=2252248&quot;&gt;exploit&lt;/a&gt; is motochopper and was originally written for a Motorola. The reason it works on the S4 is that the phones have similar chipsets. The chipset vendors provide kernel patches, drivers, userspace components, etc to the OEM's. The OEM's then integrate that into their version of Android, normally what Google gives them + their extras. In this case the vulnerability was in the code provided by the chipset, it had a world writable fb0 device node, that allowed an mmap() of kernel memory.&lt;/p&gt;

&lt;p&gt;Without a phone in front of me, how on earth could I know that the exploit wouldn't have worked, you ask?&lt;/p&gt;

&lt;p&gt;Edit: The above isn't quiet accurate. The vulnerability &lt;a href=&quot;http://forum.xda-developers.com/showthread.php?p=40873964&quot;&gt;was a bug in the mainline framebuffer&lt;/a&gt; rather than in a specific chipset, which means it may affect even more devices.&lt;/p&gt;

&lt;h3&gt;The Policy&lt;/h3&gt;

&lt;p&gt;On the recovery ROM are 2 files that I can use to mount this investigation. I know the exploit mmap()'s /dev/graphics/fb0 so first I want to know what that would be labeled:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ grep /dev/graphics file_contexts 
/dev/graphics(/.*)?     u:object_r:graphics_device:s0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So, /dev/graphics/fb0 (and indeed everything under the graphics directory) would be labeled graphics_device.&lt;/p&gt;

&lt;p&gt;On SE Android the type you get when you use adb shell is shell. So, next I need to look for accesses between shell and graphics_device:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sesearch --all -s shell -t graphics_device sepolicy       
Found 7 semantic av rules:
   allow appdomain dev_type : file getattr ; 
   allow appdomain dev_type : dir { ioctl read getattr search open } ; 
   allow appdomain dev_type : lnk_file { read getattr } ; 
   allow appdomain dev_type : chr_file getattr ; 
   allow appdomain dev_type : blk_file getattr ; 
   allow appdomain dev_type : sock_file getattr ; 
   allow appdomain dev_type : fifo_file getattr ; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Indeed there is no write permission so the mmap attempt to write to kernel memory would fail. This only covers the adb shell case though, and that is typically done by the owner of the device. Granted that this makes problems for BYOD but the more interesting question is, could malicious apps exploit this?&lt;/p&gt;

&lt;p&gt;In the seapp_contexts file it shows that third party apps will be labeled untrusted_app, so lets look at that:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sesearch --all -s untrusted_app -t graphics_device sepolicy      
Found 7 semantic av rules:
   allow appdomain dev_type : file getattr ; 
   allow appdomain dev_type : dir { ioctl read getattr search open } ; 
   allow appdomain dev_type : lnk_file { read getattr } ; 
   allow appdomain dev_type : chr_file getattr ; 
   allow appdomain dev_type : blk_file getattr ; 
   allow appdomain dev_type : sock_file getattr ; 
   allow appdomain dev_type : fifo_file getattr ; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, no dice. Apps can stat() the file but not read or write it. The same goes for the browser (browser_app) and even platform_app, which includes all of the apps included on the device from Samsung and Google.&lt;/p&gt;

&lt;p&gt;But which types &lt;em&gt;can&lt;/em&gt; write to the file? Good question, SE Android may be blocking all of this access but we know the vulnerability is there, we should find out what on the system is able to exploit it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sesearch -t graphics_device --allow -c chr_file -p write sepolicy 
Found 7 semantic av rules:
   allow system graphics_device : chr_file { ioctl read write getattr lock append open } ; 
   allow system_app graphics_device : chr_file { ioctl read write getattr lock append open } ; 
   allow mediaserver graphics_device : chr_file { ioctl read write getattr lock append open } ; 
   allow unconfineddomain dev_type : chr_file { ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton execute_no_trans entrypoint execmod open audit_access } ; 
   allow mm-pp-daemon graphics_device : chr_file { ioctl read write getattr lock append open } ; 
   allow surfaceflinger graphics_device : chr_file { ioctl read write getattr lock append open } ; 
   allow bintvoutservice graphics_device : chr_file { ioctl read write getattr lock append open } ; 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Well, system and system_app, which are pretty powerful either way, granted it is an escalation if you can compromise them. unconfineddomain (hrm.. whats that?), the seapp_contexts file doesn't have any entries for it, so presumably it is there for MDM/MAM vendors to run unconfined apps if they choose to. surfaceflinger obviously needs to be able to write to the graphics device, and possibly mediaserver. bintvoutservice probably does too, and I don't know what mm-pp-domain is, probably a Qualcomm specific thing.&lt;/p&gt;

&lt;p&gt;So, there are definitely vectors to get at this, but they involve compromising protected apps (in a real security analysis we'd keep backtracking to see what vectors there are to attack system and system_app, for example) but this exploit wouldn't have been pulled off nearly as easily as it was, if SE Android were enforcing.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Exploits like this are scary, not because of owners that want to root their phones but because, if an owner can do it, it is highly likely that an adversary can. These mobile devices are our lives, they have business data on them, they have private data, and they can be used to steal your money in various ways (such as premium SMS's). There will not be a shortage of vulnerabilities until OEM's and users alike start thinking from a security mindset. The tools are there, no OEM has an excuse not to use them.&lt;/p&gt;

&lt;p&gt;It may not be a bad idea to set SE Android into enforcing once you've rooted your phone, so that malicious apps don't take advantage of the same vulnerability, if I get my hands on a GS4 I'll blog about doing that.&lt;/p&gt;</content:encoded>
	<dc:date>2013-04-30T05:00:00+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/63915.html">
	<title>Dan Walsh: SELinux &amp;amp; PaaS: Deep Dive on Multi-tenancy, Containers &amp;amp; Security with Dan Walsh, Red Hat</title>
	<link>http://danwalsh.livejournal.com/63915.html</link>
	<content:encoded>&lt;h3&gt;&lt;a dir=&quot;ltr&quot; href=&quot;https://www.youtube.com/watch?v=VaxkrSpBr6M&quot; src=&quot;en&quot; title=&quot;SELinux &amp;amp; PaaS: Deep Dive on Multi-tenancy, Containers &amp;amp; Security with Dan Walsh, Red Hat&quot; rel=&quot;nofollow&quot;&gt;SELinux &amp;amp; PaaS: Deep Dive on Multi-tenancy, Containers &amp;amp; Security with Dan Walsh, Red Hat&lt;/a&gt;&lt;/h3&gt;Last week I went to Portland, OR for the &lt;a href=&quot;https://www.openshift.com/community&quot; rel=&quot;nofollow&quot;&gt;OpenShift Origin&lt;/a&gt; Day.&lt;br /&gt;I gave a talk about SELinux and &lt;a href=&quot;http://www.openshift.com&quot; rel=&quot;nofollow&quot;&gt;OpenShift&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The talk covered&amp;nbsp; the importance of MAC and container/namespaces when using a multi-tenant environment like OpenShift. &lt;br /&gt;&lt;br /&gt;The talk also covers enhancements I want to make to OpenShift gears (containers) and additional features that we will be adding.&lt;br /&gt;&lt;br /&gt;The &lt;a href=&quot;http:// https://www.youtube.com/watch?v=VaxkrSpBr6M&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;video&lt;/a&gt; has been posted to youtube.&lt;br /&gt;&lt;br /&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://danwalsh.livejournal.com/data/rss&quot; title=&quot;&quot; /&gt;</content:encoded>
	<dc:date>2013-04-23T20:52:39+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/63586.html">
	<title>Dan Walsh: What is the differences between user_home_dir_t  and user_home_t</title>
	<link>http://danwalsh.livejournal.com/63586.html</link>
	<content:encoded>I just saw this email on the SELinux Fedora Mailing list and figured I would try to answer it here.&lt;br /&gt;&lt;br /&gt;Lets look at the labels of content in my&amp;nbsp; home directory.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; ls -lZd / /home /home/dwalsh /home/dwalsh/.ssh /home/dwalsh/.emacs /home/dwalsh/public_html&lt;br /&gt;dr-xr-xr-x. root&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp; system_u:object_r:root_t:s0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;br /&gt;drwxr-xr-x. root&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp; system_u:object_r:home_root_t:s0 /home&lt;br /&gt;drwx------. dwalsh dwalsh unconfined_u:object_r:user_home_dir_t:s0 /home/dwalsh&lt;br /&gt;-rw-r--r--. dwalsh dwalsh unconfined_u:object_r:user_home_t:s0 /home/dwalsh/.emacs&lt;br /&gt;drwxr-xr-x. dwalsh dwalsh unconfined_u:object_r:httpd_user_content_t:s0 /home/dwalsh/public_html&lt;br /&gt;drwx------. dwalsh dwalsh unconfined_u:object_r:ssh_home_t:s0 /home/dwalsh/.ssh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As we go through the different files and directories that make up my home directory we see multiple SELinux labels.&amp;nbsp; Notice the files that are owned by me have an SELinux user of staff_u.&amp;nbsp; On most systems these would be labeled unconfined_u.&amp;nbsp; In SELinux every file that is created by a process running as unconfined_u will get the unconfined_u SELinux user placed on the file label.&amp;nbsp; Similarly staff_u will get staff_u, ...&lt;br /&gt;&lt;br /&gt;This component is ignored on most SELinux systems, system_u on /home here is the default label set by restorecon or at install time.&lt;br /&gt;&lt;br /&gt;object_r is just a place holder.&amp;nbsp; For all SELinux systems other then some experimental systems, every object on the file system gets labeled object_r.&lt;br /&gt;&lt;br /&gt;The last field is all s0.&amp;nbsp; This is the MCS or MLS label depending on your policy.&amp;nbsp; On most systems this will be s0 (SystemLow)&lt;br /&gt;&lt;br /&gt;SELinux is a type enforcement system, and the interesting parts is the types.&amp;nbsp; Lets look at each directory/file above and the types associated with them.&lt;ul&gt;&lt;br /&gt;&lt;li&gt;/ is labeled with the root_t type.&amp;nbsp; This should be the only object on the system with the root_t type, if you have other objects on the computer with this label, then you were probably running in permissive mode and a confined process created it, you need to fix the labels.&amp;nbsp; The main purpose of root_t is for policy writers to define transitions. for system applications that are going to create content in /.&amp;nbsp; For example boot flags will get created with etc_runtime_t.&amp;nbsp; Random directories created in / will get labeled default_t.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;span&gt;#&amp;nbsp; touch /.autorelabel; ls -lZ /.autorelabel&lt;br /&gt;-rw-r--r--. root root unconfined_u:object_r:etc_runtime_t:s0 /.autorelabel&lt;br /&gt;# mkdir /foobar; ls -ldZ /foobar&lt;br /&gt;drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /foobar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; One thing to note about default_t is that NO confined apps are allowed to read content labeled default_t, because we have no idea what kind of content would be in this directory.&amp;nbsp; Invariably when some one creates a new directory in / without setting the labels, SELinux will have issues.&amp;nbsp; If foobar above contained apache content you would need to execute the following in order to allow apache to read the content.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -a -t httpd_sys_content_t '/foobar(/.*)?'&lt;br /&gt;# restorecon -R -v /foobar&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;/home is labeled with the&lt;b&gt; home_root_t &lt;/b&gt;type.&amp;nbsp; home_root_t is basically used for the toplevel or root directory for homedirs. &amp;nbsp; It's main purpose is to be used by policy for applications that need to create home directories or file system quota files.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;span&gt;# sesearch -T -t home_root_t&lt;br /&gt;Found 10 semantic te rules:&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition quota_t home_root_t : file quota_db_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition sysadm_t home_root_t : dir user_home_dir_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition firstboot_t home_root_t : dir user_home_dir_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition useradd_t home_root_t : dir user_home_dir_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition lsassd_t home_root_t : dir user_home_dir_t;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition oddjob_mkhomedir_t home_root_t : dir user_home_dir_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition smbd_t home_root_t : dir user_home_dir_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; type_transition automount_t home_root_t : dir automount_tmp_t; &lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; /home/dwalsh is labeled with the user_home_dir_t type.&amp;nbsp; &amp;nbsp; Policy writers use this type to write transition rules to get content labeled correctly within the homedir.&amp;nbsp; Confined applications that create content in a users home directory need transition rules to create the content with the proper label. For example if you use ssh-copy-id on the remote machine, this triggers sshd to create the /home/dwalsh/.ssh directory, which we want labeled ssh_home_t, to protect the content.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;span&gt;# sesearch -T -s sshd_t -t user_home_dir_t | grep &amp;quot;\.ssh&amp;quot;&lt;br /&gt;type_transition sshd_t user_home_dir_t : dir ssh_home_t &amp;quot;.ssh&amp;quot;; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sesearch -T -s staff_t -t user_home_dir_t |wc -l&lt;br /&gt;118&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note there are over 118 transition rules for a confined user creating content in his home directory.&amp;nbsp; With the advent of file name transition rules, we have exploded the number of these transitions in order to get proper labeling in the users home dir.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;/home/dwalsh/.emacs is labeled user_home_t, which is the default label for all content in a users home directory.&amp;nbsp; This is the label that users are allowed to read/write and manage.&amp;nbsp; We try to prevent confined applications from being able to read and write this content, since this is where users store private content like credit card data, passwords shared secrets etc.&amp;nbsp; When we have a confined application that needs to access this content we usually wrap it in a boolean like ftp_home_dir.&amp;nbsp; Or we create a new type for this content, like mozilla_home_t or ssh_home_t. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;/home/dwalsh/.ssh is labeled ssh_home_t, and contains content that only user types and sshd is allowed to read. Most other confined domains are not allowed to view content in this directory since it contains content like your secret keys.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;/home/dwalsh/public_html is labeled httpd_user_content_t , which by default is the only place apache process is allowed to read in the home directory.&amp;nbsp; Allowing apache to read .ssh or say your .mozilla directory is just asking for trouble.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;Note:&amp;nbsp; In order for apache or sshd to read their content they need to be allowed to search and getattr on every directory in the path.&amp;nbsp; The httpd would need to search root_t, home_root_t, user_home_dir_t, httpd_user_content_t.&amp;nbsp; It is not allowed to do this by default and needs the httpd_enable_homedirs boolean turned on.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -b httpd_enable_homedirs -c dir -C | grep -v nfs | grep -v samba&lt;br /&gt;Found 20 semantic av rules:&lt;br /&gt;DT allow httpd_sys_script_t home_root_t : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_sys_script_t user_home_dir_t : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_user_script_t user_home_type : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_t user_home_type : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_user_script_t home_root_t : dir { ioctl read getattr lock search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_t home_root_t : dir { ioctl read getattr lock search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_user_script_t user_home_dir_t : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_t user_home_dir_t : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_suexec_t user_home_type : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_suexec_t home_root_t : dir { ioctl read getattr lock search open } ; [ httpd_enable_homedirs ]&lt;br /&gt;DT allow httpd_suexec_t user_home_dir_t : dir { getattr search open } ; [ httpd_enable_homedirs ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Getting back to the question that drove me to create this blog.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the differences between user_home_dir_t&amp;nbsp; and user_home_t?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;user_home_dir_t should only be the label of the users home directory but not of any content in the users home directory.&lt;br /&gt;user_home_t is the label for generic content in a users homedir.&lt;br /&gt;&lt;br /&gt;If you want to see all the labels that effect the users homedir, you can look at /etc/selinux/targeted/contexts/files/file_contexts.homedirs.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;grep /home /etc/selinux/targeted/contexts/files/file_contexts.homedirs |wc -l&lt;br /&gt;300&lt;/span&gt;</content:encoded>
	<dc:date>2013-04-23T14:56:21+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/63472.html">
	<title>Dan Walsh: Understanding MCS Separation.</title>
	<link>http://danwalsh.livejournal.com/63472.html</link>
	<content:encoded>We designed a new way of using MCS, Multi Category Security, when we developed sVirt (Secure Virtualization) a few years ago.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;To understand MCS it is helpful to understand something about MLS.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;When Red Hat Enterprise Linux 5 came out, we had a done a lot of work adding MLS, Multi Level Security.&amp;nbsp; MLS requires the Belle &amp;amp; La Padula model of security.&amp;nbsp; This model takes into account the &amp;quot;Level and Category&amp;quot; of the data, and adds rules like a higher level process (TopSecret) is not allowed to write down (Secret) and a lower level (Secret) process is not allowed to read a higher level data (TopSecret).&amp;nbsp; The simple description of categories would be in order to read or write your process must have all the categories of the target.&amp;nbsp;&amp;nbsp;&amp;nbsp; Levels can go from s0 (SystemLow) to s15 (SystemHigh).&amp;nbsp; Then you can have any combination of 1024 categories.&lt;br /&gt;&lt;br /&gt;In MCS we stole the idea of categories and dropped the concept of levels.&lt;br /&gt;&lt;br /&gt;As I mentioned above the process category most include ALL of the categories of the target, otherwise MCS separation would block the access.&amp;nbsp;&amp;nbsp; It is best to see an example of this.&lt;br /&gt;&lt;br /&gt;Say I have a process labeled system_u:system_r:svirt_t:s0:c1,c2 from MCS Separation point of view.&amp;nbsp; This process would be allowed to access any file with any of these 4 MCS labels.&lt;ul&gt;&lt;br /&gt;&lt;li&gt;s0&lt;/li&gt;&lt;br /&gt;&lt;li&gt;s0:c1&lt;/li&gt;&lt;br /&gt;&lt;li&gt;s0:c2&lt;/li&gt;&lt;br /&gt;&lt;li&gt;s0:c1,c2&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;Since most files on a targeted system have the MCS label s0.&amp;nbsp; MCS Labeling does not block much mcs constrained applications.&lt;br /&gt;&lt;br /&gt;By convention MCS confinement always uses two categories, and the categories can not be the same.&amp;nbsp; s0:c1,c1 == s0:c1.&amp;nbsp; Secondarily tools that launch MCS separate apps like libvirt and sandbox, make sure they never launch two processes with the same MCS label.&amp;nbsp; Which means we guarantee that two svirt_t always have two MCS labels that no other svirt_t or svirt_image_t would have.&amp;nbsp; Therefore a process running svirt_t:s0:c1,c2 would not be prevented by&amp;nbsp; MCS from access to any file with a MCS label of s0 or s0:c1,c2.&amp;nbsp; It would be denied from reading any file labeled s0:c1,c3 or s0:c2,c4 or s0:c4,c6.&lt;br /&gt;&lt;br /&gt;But looking at MCS separation as the only control, misses out on type enforcement controls.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;svirt_t access&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;We define our virtual machines as svirt_t type, and then we define rules about which types an svirt_t type is allowed access to.&amp;nbsp; If I wanted to see which types svirt_t is allowed to write, I could execute the following command.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# sesearch -A -s svirt_t -c file -p write -C | grep open | grep -v ^D&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain svirt_tmp_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow svirt_t xen_image_t : file { ioctl read write getattr lock append open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain svirt_image_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain svirt_tmpfs_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain virt_cache_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain qemu_var_run_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain anon_inodefs_t : file { ioctl read write getattr lock append open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow virt_domain svirt_home_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow svirt_t svirt_t : file { ioctl read write getattr lock append open } ;&lt;br /&gt;ET allow virt_domain dosfs_t : file { ioctl read write create getattr setattr lock append unlink link rename open } ; [ virt_use_usb ]&lt;br /&gt;ET allow virt_domain usbfs_t : file { ioctl read write getattr lock append open } ; [ virt_use_usb ]&lt;br /&gt;&lt;br /&gt;This means a confined virtual machine running as svirt_t:s0:c1,c2 would ONLY allowed to write to the following file types IFF they are MCS labeled s0 or s0:c1,c2&lt;br /&gt;&lt;br /&gt;svirt_tmp_t, svirt_image_t, svirt_tmpfs_t, virt_cache_t, qemu_var_run_t, svirt_home_t,&lt;br /&gt;&lt;br /&gt;dosfs_t and usbfs_t iff the virt_use_usb boolean is turned on, perhaps we should turn this off by default.&lt;br /&gt;&lt;br /&gt;anon_inodefs_t and svirt_t are not file types, svirt_t is a process types which would be in /proc.&lt;br /&gt;&lt;br /&gt;libvirt and the kernel need to ensure that non of these files get labeled with s0.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Openshift domains are allowed to write/open &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Kernel file systems anon_inodefs_t, openshift_t,hugetlbfs_t,&amp;nbsp; security_t&lt;br /&gt;&lt;br /&gt;openshift_tmp_t, openshift_rw_file_t, openshift_tmpfs_t&lt;br /&gt;&lt;br /&gt;&lt;b&gt;MCS Constrained Types&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Thee following types are MCS Constrained.&lt;br /&gt;&lt;br /&gt;seinfo&amp;nbsp; -amcs_constrained_type -x&lt;br /&gt;&amp;nbsp;&amp;nbsp; mcs_constrained_type&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; svirt_lxc_net_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_app_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_min_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_net_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_min_app_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_net_app_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; svirt_tcg_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netlabel_peer_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sandbox_x_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; svirt_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sandbox_min_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sandbox_net_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sandbox_web_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sandbox_t</content:encoded>
	<dc:date>2013-04-17T15:40:16+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/63137.html">
	<title>Dan Walsh: Audit2allow should be your third option not the first.</title>
	<link>http://danwalsh.livejournal.com/63137.html</link>
	<content:encoded>Whenever I talk about SELinux lately, I make everyone stand up and say.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span&gt;SELinux is a labeling system&lt;/span&gt;.&lt;/b&gt;&lt;br /&gt;&lt;span&gt;Every process has a label every object on the system has a label.&amp;nbsp; Files, Directories, network ports ...&lt;br /&gt;The SELinux policy controls how process labels interact with other labels on the system.&lt;br /&gt;The kernel enforces the policy rules.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The follow up to this is, if you get a denial the &lt;b&gt;First &lt;/b&gt;thing you should think is, perhaps one of the labels is &lt;b&gt;WRONG.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I wrote a paper&amp;nbsp; a while ago called the &lt;a href=&quot;http://danwalsh.livejournal.com/30837.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;SELinux Four Things.&lt;/a&gt;  In which I point out the four causes of SELinux denials.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;You have a labeling problem.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You have changed a process configuration, and you forgot to tell SELinux about it.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You have a bug in either an application or SELinux policy.&amp;nbsp; Either SELinux policy did not know an application could do something, or the application is broken.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You have been hacked.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;The solution to #3 is to report a bug and use audit2allow to generate a local policy module and install it until either the application is fixed or SELinux policy adds rules to allow it.&lt;br /&gt;&lt;br /&gt;The problem i see is that administrators seem to go to this option when ever they see a denial.&amp;nbsp;&amp;nbsp; Lets look at a recent example from email.&lt;br /&gt;&lt;br /&gt;In a recent email on selinux@lists.fedoraproject.org, Richard reported:&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;span&gt;I have a CGI application named &amp;quot;mapserv&amp;quot; that needs to write to a specific location: &amp;quot;/rwg/mapserver/tmp&amp;quot;&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;He figured out that Apache content was usually labeled httpd_sys_content_t, which was a step in the right direction, so I guess he labeled this rectory tree as&lt;br /&gt;httpd_sys_content_t.&lt;br /&gt;&lt;br /&gt;Then he asked about writing policy that looked like.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;module test 1.0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;require {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type httpd_sys_content_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type httpd_sys_script_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class dir add_name;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class file { write create };&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#============= httpd_sys_script_t ==============&lt;br /&gt;allow httpd_sys_script_t httpd_sys_content_t:dir add_name;&lt;br /&gt;allow httpd_sys_script_t httpd_sys_content_t:file { write create };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This policy obviously came from audit2allow, and would work, except for a couple of problems, the biggest being that all CGI Scripts would be able to read write all Apache content.&amp;nbsp; The policy is also fragile since you might get an AVC like httpd_sys_script_t is not allowed to append to httpd_sys_content_t.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;manage_files_pattern(httpd_sys_script_t, httpd_sys_content_t, httpd_sys_content_t) &lt;/span&gt; Would have been better.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is there a better label I could have used?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;But the main point of this blog would be that Richard should not have used a audit2allow module.&amp;nbsp; He could have used httpd_sys_rw_content_t for the tmp directory.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage fcontext -a -t httpd_sys_rw_content_t &amp;quot;/rwg/mapserver/tmp(/.*?)&amp;quot;&lt;br /&gt;# restorecon -R -v /rwg/mapserver/tmp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This would have been choice &amp;quot;1&amp;quot; above, one of the labels is wrong.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Could I change the process label?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Dominic Grift pointed out, in a mail reply, another solution. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&lt;span&gt;cat &amp;gt; mywebapp.te &amp;lt;&amp;lt; EOF
policy_module(mywebappp, 1.0.0)
apache_content_template(mywebapp)
EOF

make -f /usr/share/selinux/devel/Makefile mywebapp.pp
sudo semodule -i mywebapp&lt;/span&gt;

&lt;span&gt;Now you can use the following new types:

httpd_mywebapp_script_t (mywebapp process type)
httpd_mywebapp_script_exec_t (mywebapp cgi executable file type)
httpd_mywebapp_content_t (mywebapp readonly file type)
httpd_mywebapp_content_rw_t (mywebapp read/write file type)
httpd_mywebapp_content_ra_t (mywebapp read/append file type)
httpd_mywebapp_htaccess_t (mywebapp htaccess file types)

Basically you can just label the cgi script with the mywebapp script executable file type and then the mywebapp process will run with the mywebapp process type creating files with the mywebapp content file types.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;This solution satisfies &amp;quot;1&amp;quot;, changing both the process label and the target label.&amp;nbsp; This is probably the best solution, since if Richard used other CGI scripts on his machine, only the mapserver cgi script would be able to write the mapserver cgi content, and he would have better separation.&lt;br /&gt;&lt;br /&gt;Note:&amp;nbsp; I would have used &lt;span&gt;sepolicy generate --cgi PATHTO/mapserver.cgi&lt;/span&gt; to generate the policy.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Could I modify the SELinux configuration to allow this access?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A third option would be to turn on the httpd_unified boolean.&amp;nbsp; (This would an option of type &amp;quot;2&amp;quot;).&amp;nbsp; Although not the best solution for the problem.&lt;br /&gt;&lt;br /&gt;httpd_unified is described as &amp;quot;Unify HTTPD handling of all content files.&amp;quot; &lt;/p&gt;&lt;p&gt;&lt;span&gt;# setsebool -P httpd_unified 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This means it will allow the apache process and default apache scripts to read/write/execute all default labeled apache content. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bottom line, when you see an SELinux AVC, the way your decision tree should go something like the following.&lt;/b&gt;&lt;/p&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Is the process that is being denied running with the correct label?&amp;nbsp; Could I make it run with a better label? &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Does the target object have the correct label or could I assign it a label that would allow the access from the process label?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Is their an SELinux Boolean that would allow the access?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;If this is a network port being denied, did I modify the default settings and could I modify the labels on network packets using semanage port.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Do I believe this is a bug in an application?&amp;nbsp; If yes, I need to report a bug?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Is this a bug in SELinux policy and the access should be allowed by default?&amp;nbsp; I should install a local modification and report this as a bug.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Am I being hacked?&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;setroubleshoot attempts to help you walk through this process, and newer versions of audit2allow show you booleans and potential labels you can use.</content:encoded>
	<dc:date>2013-04-17T13:11:55+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://securityblog.org/2013/04/12/and-here-it-is-mrats-found-that-bypass-mdm">
	<title>Joshua Brindle: And here it is... mRAT's found that bypass MAM</title>
	<link>http://securityblog.org/2013/04/12/mrats-bypass-mam</link>
	<content:encoded>&lt;p&gt;As a follow-up to my &lt;a href=&quot;http://securityblog.org/2013/04/11/security-anti-pattern-mobile-castles-on-sand/&quot;&gt;last blog post&lt;/a&gt;, I just came across this article: &lt;a href=&quot;http://www.infosecurity-magazine.com/view/31801/mobile-malware-gets-serious-rats-can-bypass-sandboxes-and-encryption/&quot;&gt;Mobile malware gets serious – RATs can bypass sandboxes and encryption&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1 in 1000 devices, the tools are in the wild. There is no reason to believe this number will go down. Further, these mRAT's apparently know how to bypass MDM and MAM sandboxes and encryption.&lt;/p&gt;

&lt;p&gt;of course, &lt;a href=&quot;http://blogs.computerworld.com/19803/mobile_rat_attack_makes_android_the_ultimate_spy_tool&quot;&gt;mRAT's&lt;/a&gt; &lt;a href=&quot;http://365.rsaconference.com/community/connect/blog/2012/02/21/rsac2012-podcast-hot-203-hacking-exposed-mobile-rat-edition&quot;&gt;aren't&lt;/a&gt; &lt;a href=&quot;http://www.talkandroid.com/52495-malware-strain-nickispy-c-is-exploiting-the-rise-of-google/&quot;&gt;anything new&lt;/a&gt;, but this is the first I've heard about ones that specifically target/bypass MDM/MAM.&lt;/p&gt;

&lt;p&gt;Worse, the tools aren't just being used by experts; hackforums.net has tutorials on using them with commands like 'Hit Start then run, type &quot;CMD&quot; without quotations, hit OK, type &quot;IPCONFIG&quot; without quotations, etc'.&lt;/p&gt;

&lt;p&gt;The solution is integrating SE Android into your devices; but SE Android, like SELinux is no silver bullet. You need good policies. Mobile device manufacturers are notoriously bad at securing their devices. The fact that a device node directly exposing kernel memory was world readable/writeable on many Samsung devices is direct evidence of this. The same people writing that software could not possibly be trusted to write secure SELinux policies. Separate teams that do security analysis and testing must ensure the policies are reasonable, etc.&lt;/p&gt;

&lt;p&gt;This isn't rocket science, but it isn't standard operating procedure either. We've been doing independent verification and validation (IV&amp;amp;V) in government spaces forever. This needs to happen in mobile and there need to be security mechanisms that don't rely on discretionary access controls in place, which, of course, means mandatory access controls, which SE Android offers.&lt;/p&gt;</content:encoded>
	<dc:date>2013-04-12T05:00:00+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/62737.html">
	<title>Dan Walsh: New Security Feature in Fedora 19 Part 2: Shared System Certificates</title>
	<link>http://danwalsh.livejournal.com/62737.html</link>
	<content:encoded>One of the cool things about writing this series of blogs for each Fedora Release is finding out about the changes is different parts of the OS outside of SELinux.&amp;nbsp; I love getting suggestions of security topics to blog on.&amp;nbsp; If you know of security topics I should cover send them to me at dwalsh@redhat.com or tweet &lt;a href=&quot;https://twitter.com/rhatdan&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;@rhatdan&lt;/a&gt;&lt;br /&gt;&lt;h2&gt;Shared System Certificates&lt;/h2&gt;&lt;p&gt;Currently Tools like NSS (Mozilla products like Firefox/Thunderbird), GnuTLS, OpenSSL and Java on a Fedora box ship their own public key certificates and their own trust relationships. This means if an administrator wants to add/modify/delete trust to certain Certificates, he might have to modify several different stores in order to get the correct security.&lt;br /&gt; &lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/SharedSystemCertificates&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;A new feature in Fedora 19 is a system wide trust store of static data to be used by crypto toolkits as input for certificate trust decisions.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This feature the tools listed above a default source for retrieving system certificate anchors and black list information.&amp;nbsp; Fedora 19 will be the first step toward development of a comprehensive solution.&lt;br /&gt;&lt;br /&gt;Look at the feature for more information on the changes, but the following two sections explain the key benefits to this feature and how users will use it.&lt;/p&gt;&lt;h2&gt;&lt;span&gt;Benefit to Fedora &lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The goal is to empower administrators to configure additional trusted CAs, or to override the trust settings of CAs, on a system wide level, as required by local system environments or corporate deployments. Although this is theoretically possible today, it's extremely hard to get right.&lt;/p&gt;&lt;p&gt;Fedora will immediately gain a unified approach to system anchor certificates and black lists. This is then built on in the future to be a comprehensive solution.&lt;/p&gt;&lt;h2&gt;&lt;span&gt;User Experience &lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Administrators will be able to use a tool to add a certificate authority file to the system trust store and have it recognized by all relevant applications.&lt;/p&gt;&lt;p&gt;Users will stop being surprised by incoherent and unpredictable trust decisions when using different applications with websites/services which require custom trust policy.&lt;/p&gt;</content:encoded>
	<dc:date>2013-04-11T14:17:49+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://securityblog.org/2013/04/11/security-anti-pattern-castles-on-sand">
	<title>Joshua Brindle: Security Anti-Pattern - Mobile Castles on Sand (or why app wrapping is not a security model)</title>
	<link>http://securityblog.org/2013/04/11/security-anti-pattern-mobile-castles-on-sand</link>
	<content:encoded>&lt;h1&gt;Mobile Application Management (MAM)&lt;/h1&gt;

&lt;p&gt;Mobile Device Management (MDM) was all the hotness just a few years ago. It gave IT departments the ability to manage both corporate owned devices and devices owned by employees (BYOD) but it was dissatisfying. As BYOD became more prevalent and corporate owned devices less it made users feel like they were giving up all control of their device to their employer, mainly because they were. Most users at this point probably know the feeling of adding their corporate credentials into their phone and seeing the dreaded 'you are giving administrators the ability to wipe your phone, install apps, remove apps, and locate your phone' screen.&lt;/p&gt;

&lt;p&gt;Then there was the issue of having multiple administrators that wanted to do different things with your device.&lt;/p&gt;

&lt;p&gt;Even for the administrators, the solution was incomplete. It did not give them the ability to manage app configuration, app storage, app authentication, etc.&lt;/p&gt;

&lt;p&gt;That is where MAM comes in. For the administrators it means they can package apps with configuration, version it, push it out and wipe only corporate app data when an employee leaves. The nicer systems add single sign-on so that a user can authenticate once and get access to all corporate apps. They also store corporate data encrypted and can report usage statistics back to corporate IT. For users it means that they don't have to give up full control of their device.&lt;/p&gt;

&lt;p&gt;Sounds great, right?&lt;/p&gt;

&lt;h2&gt;How does it work?&lt;/h2&gt;

&lt;p&gt;Well, mobile devices don't typically have this kind of granular control built in. Further, off-the-shelf applications generally don't come configured or support single sign-on. The solution that MDM vendors started peddling is called app wrapping. Basically it means that the IT department takes the apps they want to manage (whether they are internally developed or 3rd party) and runs a tool from the MAM vendor that packages the app within another app, the wrapper (or the castle).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://securityblog.org/images/castle.png&quot; title=&quot;Icons from http://wwalczyszyn.deviantart.com/&quot; alt=&quot;Apps in a castle&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The outside package interacts with the real device, including storing data to disk encrypted, verifying credentials with corporate authentication servers, etc. The fancier ones even prevent apps from running outside of specific physical locations (geofencing), and will attempt to detect a rooted device (though that is impossible in practice).&lt;/p&gt;

&lt;p&gt;So, this still sounds great. From a functionality point of view this is a superior experience for both the user and IT, so what is the problem?&lt;/p&gt;

&lt;h2&gt;Userspace containerization (or building castles)&lt;/h2&gt;

&lt;p&gt;Lets start with the obvious one first. The inside (wrapped) app is modified to not be able to interact with the real device, but to interact with the wrapper instead. Two standard ways this is done is by providing an SDK that corporate apps can be written with and the other is called app wrapping. It should be noted that while using the SDK is the safer option, it will likely lock you in to a single MAM vendor.&lt;/p&gt;

&lt;p&gt;App wrapping on Android involves modifying the Dalvik bytecode ahead of time to add all of the functional additions as well as changing functions that would normally interact directly with the system (think filesystem operations, intents, binder calls, etc) to use analogous calls in the wrapper instead. The effect here is that the wrapper can 1) ensure filesystem writes only go to allowed locations and are encrypted and 2) to prevent IPC with apps outside of the &quot;container&quot;.&lt;/p&gt;

&lt;p&gt;Well, that is the thought, anyway.&lt;/p&gt;

&lt;p&gt;No one in their right mind would believe that they can write a libc wrapper that intercepts open() calls to make security decisions and think that it buys them anything, but that is fundamentally what is happening here. App wrappers cannot contain numerous, supported features on Android such as jni to native libraries and java reflection. A particularly crafty app might even have a scripting language interpreter or its own java class loader that would be nearly impossible for the wrapper to understand and secure.&lt;/p&gt;

&lt;p&gt;There is no chance that an MAM implementation could keep an app that wanted to exfiltrate corporate data from doing so. That is an easy problem to solve though, you only wrap trusted apps, because they are either corporate or known 3rd party apps, right? Well, hopefully, for your sake, those apps don't have vulnerabilities that a spear phisher can take advantage of to gain access to corporate data (spoiler: they do).&lt;/p&gt;

&lt;p&gt;In the scheme of things this is a relatively low threat, though, so lets move onto the real issue.&lt;/p&gt;

&lt;h2&gt;The insecure platform (or the sand)&lt;/h2&gt;

&lt;p&gt;People have tried building secure on top of insecure as long as personal computers have been around. The appeal is that there is always an insecure platform, be it Windows, Linux, iOS, or Android and there is always a need to access secure data is always there.&lt;/p&gt;

&lt;p&gt;I'll take this opportunity to suggest that, if you haven't already, you should read:
&lt;a href=&quot;http://csrc.nist.gov/nissc/1998/proceedings/paperF1.pdf&quot;&gt;The Inevitability of Failure: The Flawed Assumption of Security in Modern Computing Environments&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fact is that if the system below your application isn't secure no amount of anything will make your application (or wrapper) secure. Detecting rooted devices is not enough. Most detection is heuristic, such as checking for the existence of /system/xbin/su. Suppose the device is not rooted by the user such that su exists but by an adversary? Root access gained for the intention of stealing corporate data would not likely be detected by an MAM solution and therefore malicious applications running on the device would be able to affect the corporate apps in various ways, from communicating with them, bypassing the wrapper, all the way to scanning their memory and extracting corporate data.&lt;/p&gt;

&lt;p&gt;Most snake oil vendors will claim encryption solves this problem. Encryption may be a suitable solution to data-at-rest, data not currently being accessed that is sitting on disk, but when your corporate email app is running the emails are in memory, not encrypted. Even if an industrious app writer did extra work to keep them encrypted in memory the decryption key must also be in memory, and is vulnerable.&lt;/p&gt;

&lt;p&gt;So, this is the real threat. If your app has data I want and it runs on a standard Android or iOS phone, I'll be able to get it, no matter what your MAM vendor is telling you.&lt;/p&gt;

&lt;p&gt;As a non-security related aside, you probably don't have permission to download 3rd party apps from the app store and wrap them, which would constitute unlicensed distribution, you'd have to get permission from the app owner. An interesting ramification of this is that GPL apps can't be legally wrapped since the GPL license of the app would have to apply to the wrapper as well.&lt;/p&gt;

&lt;h1&gt;The solution&lt;/h1&gt;

&lt;p&gt;Just like in standard computing the solution isn't hard, but is rarely used.&lt;/p&gt;

&lt;p&gt;You must have a secure host platform if you want your applications to be secure. Unfortunately not many options exist for this but fortunately there are options that are freely available. The one that I favor is, of course, SELinux. I've been involved in building SELinux systems to secure even the most important data for nearly a decade now and it has proven true.&lt;/p&gt;

&lt;p&gt;Anecdotally, I have security researcher friends who work on the offensive side of the fence that have told me when they encounter an SELinux machine they bail and look for an easier target. It is important to note that we aren't talking about out-of-the-box Fedora installs, though, but systems intentionally and knowingly hardened against this type of adversary.&lt;/p&gt;

&lt;p&gt;Which brings us back to Android. The Security Enhanced Android (SE Android) project has been picking up more and more steam. Much of it is already merged into AOSP which allows all Android vendors to use it and recently Samsung has announced a device that will have it included by default. This is definitely a step in the right direction but a far cry from what it will take to feel confident allowing important corporate data to be accessed on non-corporate owned devices.&lt;/p&gt;

&lt;p&gt;With a secure platform you can enjoy the functionality benefits of an MAM solution and be confident that security provided by the platform will keep their castles secure, both from the inside and the outside.&lt;/p&gt;

&lt;p&gt;Unfortunately, none of this is a solution you can use today. Technology must, as usual, catch up to market demands. The demand must be there, though. Demand secure platforms. There is no excuse for Android vendors to not include SE Android in future offerings, all the hard work has already been done by early adopters.&lt;/p&gt;

&lt;p&gt;Update:
My &lt;a href=&quot;http://securityblog.org/2013/04/12/mrats-bypass-mam/&quot;&gt;next entry&lt;/a&gt; has validation for this post, seen in the wild.&lt;/p&gt;</content:encoded>
	<dc:date>2013-04-11T05:00:00+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/62711.html">
	<title>Dan Walsh: New Security Feature in Fedora 19 Part 1: New Confined/Permissive Process Domains</title>
	<link>http://danwalsh.livejournal.com/62711.html</link>
	<content:encoded>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; rel=&quot;nofollow&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;In &lt;a href=&quot;http://danwalsh.livejournal.com/58178.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Fedora 18&lt;/a&gt;, we added 8 new permissive domains, all of&amp;nbsp; which are now enforcing in Fedora 19. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 18 Permissive Domains/ Now Confined in Fedora 19&lt;/b&gt;&lt;br /&gt;&lt;span&gt; &amp;nbsp; pkcsslotd_t (daemon manages PKCS#11 objects between PKCS#11-enabled applications)&lt;br /&gt;&amp;nbsp;&amp;nbsp; slpd_t&amp;nbsp; (Server Location Protocol Daemon)&lt;br /&gt;&amp;nbsp;&amp;nbsp; sensord_t (Sensor information logging daemon)&lt;br /&gt;&amp;nbsp;&amp;nbsp; mandb_t&amp;nbsp; (Cron job used to create /var/cache/man content)&lt;br /&gt;&amp;nbsp;&amp;nbsp; glusterd_t (policy for glusterd service)&lt;br /&gt;&amp;nbsp;&amp;nbsp; stapserver_t (Instrumentation System Server) Note: This was back ported to Fedora 17.&lt;br /&gt;&amp;nbsp;&amp;nbsp; realmd_t (dbus system service which manages discovery and enrollment in realms and domains like Active Directory or IPA)&lt;br /&gt;&amp;nbsp;&amp;nbsp; phpfpm_t (FastCGI Process Manager) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 19 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; systemd_localed_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; systemd-localed is a system service that may be used as mechanism to&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change the system locale settings, as well as the console key mapping&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and default X11 key mapping.&amp;nbsp; systemd-localed is automatically&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activated on request and terminates itself when it is unused.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; systemd_hostnamed_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; systemd-hostnamed is a system service that may be used as mechanism to&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change the system hostname.&amp;nbsp; systemd-hostnamed is automatically&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activated on request and terminates itself when it is unused.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; systemd_sysctl_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; systemd-sysctl.service is an early-boot service that configures&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sysctl(8) kernel parameters.&lt;br /&gt;&lt;br /&gt;&amp;nbsp; httpd_mythtv_script_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mythtv cgi scripts used for managing mythtv scheduling and content.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; openshift_cron_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenShift System Cron jobs run as openshift_cron_t, not gear cron jobs.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; swift_t&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OpenStack Object Storage (swift) aggregates commodity servers to work together&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; in clusters for reliable, redundant, and large-scale storage of static objects.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 19 Modules Removed&lt;/b&gt;&lt;br /&gt;shutdown.pp (Command no longer supported, functions suplanted by systemd)&lt;br /&gt;consoletype.pp(Command should no longer be used, suplanted by systemd-logind)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 19 Modules Renamed or Consolodated&lt;/b&gt;&lt;br /&gt;amavis.pp clamav.pp - These have been consolodated into a unified view of antivirus.pp, All aliased o antivirus_t.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; typealias antivirus_t alias { amavis_t clamd_t clamscan_t freshclam_t } ;&lt;br /&gt;&lt;br /&gt;ctdbd.pp changed name upstream to ctdb.pp&lt;br /&gt;isnsd.pp changed name upstream to isnd.pp&lt;br /&gt;pacemaker.pp and corosync.pp rgmanager.pp aisexec.pp - These have been consolodated into a unified view of rhcs.pp, all aliased to the new type cluster_t.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; typealias cluster_t alias { aisexec_t corosync_t pacemaker_t rgmanager_t }</content:encoded>
	<dc:date>2013-04-10T13:04:24+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/62262.html">
	<title>Dan Walsh: Security Vs Usability</title>
	<link>http://danwalsh.livejournal.com/62262.html</link>
	<content:encoded>One of the interesting things about working in the security field, is walking the balance between security and usability.&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;On one of the many mailing lists I read, an admin as complaining about his Apache server being hacked.&amp;nbsp; Some application had been hacked in a way that it got apache to write to a particular directory and then executed the code it has written.&lt;br /&gt;&lt;br /&gt;I decided to look at how SELinux Policy controlled httpd_t.&amp;nbsp; I wanted to know what file types was httpd_t allowed to write and execute.&lt;br /&gt;&lt;br /&gt;In Fedora 19, I executed the following command.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; sesearch -A -C -s httpd_t -p execute -c file | grep write&lt;br /&gt;DT allow httpd_t httpdcontent : file { ioctl read write create getattr setattr lock append unlink link rename execute open } ; [ httpd_enable_cgi httpd_unified &amp;amp;&amp;amp; httpd_builtin_scripting &amp;amp;&amp;amp; ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This indicates that the apache deamon (httpd_t) is allowed to write and execute files that have a label that has the attribute httpdcontent.&amp;nbsp; But they would have to have the httpd_enable_cgi, httpd_unified, and httpd_builtin_scripting booleans turned on.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;#semanage boolean -l | grep httpd_enable_cgi&lt;br /&gt;httpd_enable_cgi&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd cgi support&lt;br /&gt;# semanage boolean -l | grep httpd_unified&lt;br /&gt;httpd_unified&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; (off&amp;nbsp; ,&amp;nbsp; off)&amp;nbsp; Unify HTTPD handling of all content files.&lt;br /&gt;# semanage boolean -l | grep httpd_builtin_scripting&lt;br /&gt;httpd_builtin_scripting&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd to use built in scripting (usually php)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Out of the box we enable httpd_enable_cgi, so cgi scripts will run with your apache server.&amp;nbsp; We also enable httpd_builtin_scripting, which allows you to run php scripts within the same processes as apache, this also enabled other builtin scripting tools like mod_python and mod_perl.&lt;br /&gt;&lt;br /&gt;We disable httpd_unified, which basically says httpd_t has full access to all httpdcontent files.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# seinfo -ahttpdcontent -x&lt;br /&gt;&amp;nbsp;&amp;nbsp; httpdcontent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_sys_content_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_user_ra_content_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_user_rw_content_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_sys_ra_content_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_sys_rw_content_t&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_user_content_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So rather then treating each type differently we combine all access.&amp;nbsp; We used to have this turned on by default for people who did not understand SELinux, probably still is in RHEL5 and maybe RHEL6.&amp;nbsp; But in latest Fedora and RHEL7 we will turn it off by default.&lt;br /&gt;&lt;br /&gt;If you are running a web site that does not do any scripting, it would probably be advisable to turn off the other two booleans.</content:encoded>
	<dc:date>2013-03-15T14:59:02+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/62070.html">
	<title>Dan Walsh: SELinux Reveals Bugs in Code</title>
	<link>http://danwalsh.livejournal.com/62070.html</link>
	<content:encoded>I have noticed over the years random confined process that get avc denials for the SYS_RESOURCE and SYS_ADMIN capabilities.&amp;nbsp; Most of the time, these are not easily repeated.&amp;nbsp; The combination of these two usually indicate a confined processes is attempting to use a system resources beyond the limits for the owner UID.&amp;nbsp; For example in RHEL6 a user, dwalsh, is only allowed to run 1025 processes, and an individual process running as dwalsh, is only allowed to open 1024 files.&lt;br /&gt;&lt;br /&gt;/usr/include/linux/capability.h documents SYS_RESOURCE as the following&lt;br /&gt;&lt;br /&gt;&lt;span&gt;/* Override resource limits. Set resource limits. */&lt;br /&gt;/* Override quota limits. */&lt;br /&gt;/* Override reserved space on ext2 filesystem */&lt;br /&gt;/* Modify data journaling mode on ext3 filesystem (uses journaling&lt;br /&gt;&amp;nbsp;&amp;nbsp; resources) */&lt;br /&gt;/* NOTE: ext2 honors fsuid when checking for resource overrides, so&lt;br /&gt;&amp;nbsp;&amp;nbsp; you can override using fsuid too */&lt;br /&gt;/* Override size restrictions on IPC message queues */&lt;br /&gt;/* Allow more than 64hz interrupts from the real-time clock */&lt;br /&gt;/* Override max number of consoles on console allocation */&lt;br /&gt;/* Override max number of keymaps */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The goal of these limits is to prevent an individual user from doing a fork bomb or opening so many files the system gets a Denial of Service.&lt;br /&gt;&lt;br /&gt;Even root processes are governed by these limits,&amp;nbsp; however root processes almost always have SYS_ADMIN and SYS_RESOURCE capabilities, unless they have dropped them using something like libcap/libcap-ng or you are using an Mandatory Access System like SELinux.&lt;br /&gt;&lt;br /&gt;Lon Hohberger, who is working on the OpenStack team at Red Hat and currently working on making SELinux work well with OpenStack, discovered some problems in RHEL6, that could and probably are triggering these AVC's.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bug #1 &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Prior to RHEL6.4 ANY login to the system, including root,&amp;nbsp; would get a process limit of 1024.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# ulimit -u&lt;br /&gt;1024&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Meaning if you started any processes on a system that already had 1025 processes running, the kernel would be checking SYS_RESOURCE.&amp;nbsp; If you executed a command like&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# service httpd restart&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then httpd would fall under the same limits, since httpd_t is not allowed these Capabilities, httpd_t would generate the AVC's and probably fail to start.&lt;br /&gt;&lt;br /&gt;Worse then this, if you executed:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# yum -y update&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is a decent chance that during the update some packages post install would do a&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# service foobar restar&lt;/span&gt;t&lt;br /&gt;&lt;br /&gt;If foobar was confined by SELinux, then the AVC could be generated.&lt;br /&gt;&lt;br /&gt;Luckily we have had a fix for this in RHEL6.4,&amp;nbsp; although this fix has not gone into Fedora yet...&lt;br /&gt;&lt;br /&gt;The following line as added to&lt;span&gt; /etc/security/limits.d/90-nproc.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;root soft nproc unlimited&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BUG #2&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First if you login as root to a RHEL6.4 system, and check the max processes limit, you will get something like:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# ulimit -u&lt;br /&gt;29924&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you login as a normal user you would get:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; ulimit -u&lt;br /&gt;1024&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you run su from your normal user account and check the ulimit you get:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# ulimit -u&lt;br /&gt;29924&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But if you run sudo as a normal user and run ulimit you get:&lt;br /&gt;&lt;span&gt;# ulimit -u&lt;br /&gt;1024&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;su and sudo should work the same way.&lt;br /&gt;&lt;br /&gt;This is probably a bug in sudo or in the sudo pam stack.&amp;nbsp; Have not determined which yet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BUG #3&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This one might be controversial, since these limits are supposed to count the resources used by a particular UID, we should be looking at ALL of the processes kicked off by the user, not only those running under his UID.&amp;nbsp;&amp;nbsp;&amp;nbsp; Since sudo in the above example was not modifying the maximum running processes when user dwalsh became root, the process started counted against the total number of root processes rather then the total number of processes started by dwalsh.&amp;nbsp; I believe this is wrong.&amp;nbsp; The kernel should be counting the number of processes started by user dwalsh and should look at the LoginUID rather then the actual UID.&amp;nbsp; Now if dwalsh logged onto a system and was able to get some processes running as root, they could continue to count against dwalshs resource constraints and not against the systems.&amp;nbsp;&amp;nbsp;&amp;nbsp; I realize this might be difficult since you would probably want processes that have the SYS_RESOURCE capability to not count against the total.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;systemd to the rescue&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;systemd has helped fix a lot of these issues.&lt;br /&gt;&lt;br /&gt;In RHEL6 if an admin starts/restarts a system daemon, that daemon ends up being a subprocess of the user, meaning inherits any of the constraints on the user processes.&amp;nbsp; In the latest Fedora's, systemd starts most system daemons.&amp;nbsp; The user process sends a message to systemd and systemd starts/restarts the service, which means the service gets the system constraints not the user constraints.</content:encoded>
	<dc:date>2013-03-14T18:35:27+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="hatenablog://entry/6435988827676747615">
	<title>KaiGai Kohei: OpenCLでCPU/GPUを使い分ける？</title>
	<link>http://kaigai.hatenablog.com/entry/2013/04/03/033106</link>
	<content:encoded>&lt;p&gt;最近、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PG&quot;&gt;PG&lt;/a&gt;-Stromに興味があるという方からちょくちょく、個別に質問メールを頂く事がある。&lt;/p&gt;
&lt;p&gt;その中で頂いたコメントに興味深い洞察が。&lt;/p&gt;
&lt;blockquote&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;による&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%A2%A5%AF%A5%BB%A5%E9%A5%EC%A1%BC%A5%B7%A5%E7%A5%F3&quot;&gt;アクセラレーション&lt;/a&gt;は確かに興味深い機能だけれども、PG-Stromの本質は突き詰めていえばパイプライン処理のお化けだよね？だから、計算処理をCPUでやるようにしても良いんじゃない？&lt;/blockquote&gt;
&lt;p&gt;確かに。&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;による並列処理はハマると物凄い費用対効果をもらたすけれども、例えば&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%C0%B5%B5%AC%C9%BD%B8%BD&quot;&gt;正規表現&lt;/a&gt;マッチみたく、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;向きじゃない処理もある。&lt;/p&gt;
&lt;p&gt;PG-Stromの場合、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SQL&quot;&gt;SQL&lt;/a&gt;のWHERE句に与えられた条件から行を評価する&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B4%D8%BF%F4&quot;&gt;関数&lt;/a&gt;を自動的に生成、それを&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/JIT&quot;&gt;JIT&lt;/a&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%B3%A5%F3%A5%D1%A5%A4%A5%EB&quot;&gt;コンパイル&lt;/a&gt;して実行する。たぶん、プランナの時点でCPU実行用、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;実行用の２種類の関数を自動的に生成して、計算&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%B5%A1%BC%A5%D0&quot;&gt;サーバ&lt;/a&gt;に渡すという処理は実現可能だろう。&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVidia&quot;&gt;NVidia&lt;/a&gt;の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;を前提とするCUDAと異なり、OpenCLは&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/AMD&quot;&gt;AMD&lt;/a&gt;の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;や&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Xeon&quot;&gt;Xeon&lt;/a&gt; Phiもサポートする。それどころか、OpenCL Cで書かれたコードをCPU用にコンパイルする事も可能。&lt;/p&gt;
&lt;p&gt;その辺の事情もあり、今、PG-StromをOpenCLで再実装し直している。(works in progress)&lt;/p&gt;
&lt;p&gt;だが、CPUと&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;用にそれぞれ計算サーバ書くのか、実装が複雑になってやだなぁ～と思っていたところ、実は勘違いである事が判明。&lt;/p&gt;
&lt;p&gt;以下のgpuinfoコマンドの出力は、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVidia&quot;&gt;NVidia&lt;/a&gt;のCUDA 4.2と、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;のOpenCL &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SDK&quot;&gt;SDK&lt;/a&gt;を&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB&quot;&gt;インストール&lt;/a&gt;した環境でのもの。&lt;/p&gt;
&lt;p&gt;なんと、Platform-1で&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;が、Platform-2でCPUが認識されている。&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVidia&quot;&gt;NVidia&lt;/a&gt;のOpenCL&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%E9%A5%A4%A5%D6%A5%E9%A5%EA&quot;&gt;ライブラリ&lt;/a&gt;でも、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;のOpenCLライブラリでも同様。&lt;/p&gt;
&lt;p&gt;という事はですよ、要求された計算の特性に応じて、1個の計算サーバでCPU/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;を使い分けるという芸当もできるという事になるじゃありませんか。&lt;/p&gt;
&lt;p&gt;いやー、面白い。実装意欲を掻き立てられる。&lt;/p&gt;
&lt;p&gt;なお、以下のコマンド gpuinfo の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/URL&quot;&gt;URL&lt;/a&gt;は↓です。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/kaigai/gpuinfo&quot; target=&quot;_blank&quot;&gt;https://github.com/kaigai/gpuinfo&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;[kaigai@iwashi gpuinfo]$ ./gpuinfo
platform-index:      1
platform-vendor:     &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVIDIA&quot;&gt;NVIDIA&lt;/a&gt; Corporation
platform-name:       &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVIDIA&quot;&gt;NVIDIA&lt;/a&gt; CUDA
platform-version:    OpenCL 1.1 CUDA 4.2.1
platform-profile:    FULL_PROFILE
platform-extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing
 cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll
  Device-01
  Device type:                     &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;
  Vendor:                          &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/NVIDIA&quot;&gt;NVIDIA&lt;/a&gt; Corporation (id: 000010de)
  Name:                            &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GeForce&quot;&gt;GeForce&lt;/a&gt; GT 640
  Version:                         OpenCL 1.1 CUDA
  Driver version:                  310.32
  OpenCL C version:                OpenCL C 1.1
  Profile:                         FULL_PROFILE
  Device available:                yes
  Address bits:                    32
  Compiler available:              yes
  Double FP config:                Denorm, INF/NaN, R/nearest, R/zero, R/INF, FMA
  Endian:                          little
  Error correction support:        no
  Execution capability:            kernel, native kernel
  Extensions:                      cl_khr_byte_addressable_store cl_khr_icd \
   cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query \
   cl_nv_pragma_unroll  cl_khr_global_int32_base_atomics \
   cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics \
   cl_khr_local_int32_extended_atomics cl_khr_fp64
  Global memory cache size:        32 KB
  Global memory cache type:        read-write
  Global memory cacheline size:    128
  Global memory size:              2047 MB
  Host unified memory:             no
  Image support:                   yes
  Image 2D max size:               32768 x 32768
  Image 3D max size:               4096 x 4096 x 4096
  Local memory size:               49152
  Local memory type:               &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SRAM&quot;&gt;SRAM&lt;/a&gt;
  Max clock frequency:             901
  Max compute units:               2
  Max constant args:               9
  Max constant buffer size:        65536
  Max memory allocation size:      511 MB
  Max parameter size:              4352
  Max read image args:             256
  Max samplers:                    32
  Max work-group size:             1024
  Max work-item sizes:             {1024,1024,64}
  Max write image args:            16
  Memory base address align:       4096
  Min data type align size:        128
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - char:      1
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - short:     1
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - int:       1
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - long:      1
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - float:     1
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - double:    1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - char:   1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - short:  1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - int:    1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - long:   1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - float:  1
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - double: 1
  Profiling timer resolution:      1000
  Queue properties:                out-of-order execution, profiling
  Sindle FP config:                Denorm, INF/NaN, R/nearest, R/zero, R/INF, FMA

platform-index:      2
platform-vendor:     &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;(R) Corporation
platform-name:       &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;(R) OpenCL
platform-version:    OpenCL 1.2 &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/LINUX&quot;&gt;LINUX&lt;/a&gt;
platform-profile:    FULL_PROFILE
platform-extensions: cl_khr_fp64 cl_khr_icd cl_khr_global_int32_base_atomics \
  cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics \
  cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store \
  cl_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/intel&quot;&gt;intel&lt;/a&gt;_printf cl_ext_device_fission cl_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/intel&quot;&gt;intel&lt;/a&gt;_exec_by_local_thread
  Device-01
  Device type:                     CPU
  Vendor:                          &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;(R) Corporation (id: 00008086)
  Name:                                   &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Intel&quot;&gt;Intel&lt;/a&gt;(R) &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Xeon&quot;&gt;Xeon&lt;/a&gt;(R) CPU E5-2670 0 @ 2.60GHz
  Version:                         OpenCL 1.2 (Build 56860)
  Driver version:                  1.2
  OpenCL C version:                OpenCL C 1.2
  Profile:                         FULL_PROFILE
  Device available:                yes
  Address bits:                    64
  Compiler available:              yes
  Double FP config:                Denorm, INF/NaN, R/nearest, R/zero, R/INF, FMA
  Endian:                          little
  Error correction support:        no
  Execution capability:            kernel, native kernel
  Extensions:                      cl_khr_fp64 cl_khr_icd \
    cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics \
    cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics \
    cl_khr_byte_addressable_store cl_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/intel&quot;&gt;intel&lt;/a&gt;_printf cl_ext_device_fission \
    cl_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/intel&quot;&gt;intel&lt;/a&gt;_exec_by_local_thread
  Global memory cache size:        256 KB
  Global memory cache type:        read-write
  Global memory cacheline size:    64
  Global memory size:              386942 MB
  Host unified memory:             yes
  Image support:                   yes
  Image 2D max size:               16384 x 16384
  Image 3D max size:               2048 x 2048 x 2048
  Local memory size:               32768
  Local memory type:               &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/DRAM&quot;&gt;DRAM&lt;/a&gt;
  Max clock frequency:             2600
  Max compute units:               32
  Max constant args:               480
  Max constant buffer size:        131072
  Max memory allocation size:      96735 MB
  Max parameter size:              3840
  Max read image args:             480
  Max samplers:                    480
  Max work-group size:             1024
  Max work-item sizes:             {1024,1024,1024}
  Max write image args:            480
  Memory base address align:       1024
  Min data type align size:        128
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - char:      16
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - short:     8
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - int:       4
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - long:      2
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - float:     4
  Native &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - double:    2
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - char:   16
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - short:  8
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - int:    4
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - long:   2
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - float:  4
  Preferred &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/vector&quot;&gt;vector&lt;/a&gt; width - double: 2
  Profiling timer resolution:      1
  Queue properties:                out-of-order execution, profiling
  Sindle FP config:                Denorm, INF/NaN, R/nearest
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</content:encoded>
	<dc:date>2013-03-07T23:00:00+00:00</dc:date>
	<dc:creator>kaigai</dc:creator>
</item>
<item rdf:about="http://securityblog.org/2013/02/11/security-anti-pattern-mobile-hypervisors">
	<title>Joshua Brindle: Security Anti-Pattern - Mobile Hypervisors (for user facing VM's)</title>
	<link>http://securityblog.org/2013/02/11/security-anti-pattern-mobile-hypervisors</link>
	<content:encoded>&lt;p&gt;One of the things I was working on for most of 2012 was mobile security, specifically SE Android.&lt;/p&gt;

&lt;p&gt;My exposure to mobile was limited to using smart phones and making minor customizations to third party ROM's before 2012.&lt;/p&gt;

&lt;p&gt;That would all change. A group of us started looking at a specific RFP that many believed would be the major mobile entréinto the federal government and military. It wasn't. It turned into a fiasco.&lt;/p&gt;

&lt;p&gt;What it did do, however, was solidify many people's belief that hypervisors on mobile platforms was the way to achieve multi-level cross domain access. It convinced me that they couldn't be more wrong.&lt;/p&gt;

&lt;p&gt;Since then, my colleagues and myself were on a mission to convince the world that virtualization on mobile for security is the wrong answer. Now that I am out on my own I want to take this opportunity to share some of my own beliefs on the matter.&lt;/p&gt;

&lt;p&gt;First a CYA part: Although these beliefs were formed while I was working elsewhere I have no reason to believe they are proprietary and I don't, in any way, represent anyone except myself.&lt;/p&gt;

&lt;h2&gt;The Fiasco&lt;/h2&gt;

&lt;p&gt;At the beginning I, like everyone else, had no reason to doubt all the vendors out there selling mobile virtualization solutions. After all, they had demos, they had huge numbers like deployed on 1.5 billion devices. Many proposal writers would have been satisfied with this and gone to the next issue. However, because of the insane schedule requirements of this particular RFP I wanted to make sure there was software available &lt;em&gt;today&lt;/em&gt; (which was March, 2012) that could be used immediately, on hardware that was already available.&lt;/p&gt;

&lt;p&gt;Boy, that is an interesting rabbit hole. Anyone working in mobile knows that information in general is hard to come by. Anecdotally, people working at major mobile device manufacturers sometimes have trouble getting spec sheets for their own phones. Mobile hypervisors are no exception, and possibly worse.&lt;/p&gt;

&lt;p&gt;Unlike Intel, which makes its own chips, ARM does not. Instead they license the chip designs to chip makers. Those makers, in general, are free to pick and choose various capabilities, extended instruction sets, add proprietary instruction sets, etc. They can even choose the endieness. This does not make a friendly environment for people who need to work very closely to the hardware, like a hypervisor developer.&lt;/p&gt;

&lt;p&gt;Like Intel, ARM has virtualization extensions. For quite a while, in fact. ARM also has TrustZone, which is made for DRM, but provides a secure-world split from the rest of the system, and can be used for a hypervisor. The challenge at the time was that &lt;em&gt;there were no mobile phones on the market that implemented either of these completely, correctly, or enabled&lt;/em&gt;. Further, TrustZone configuration is available only to the chip maker. This means that hypervisors that run on these technologies quite possibly work, on a development board, but not on any phones. Finally, a hardware vendor admitted that they never enable things like TrustZone because they didn't want to get into the key management business. Yay.&lt;/p&gt;

&lt;p&gt;Well, there is still paravirtualization, right? Paravirtualization is great, really. Except that it requires modifying the OS, more specifically it means modifying the drivers. So, onto lesson #2 for the mobile noobs. No one gets driver source code except the chip manufacturers. That includes the people packaging them up into boards, the people building phones, the people building the OS for the phones, etc. Some chip manufacturers won't even let Google release &lt;em&gt;binary&lt;/em&gt; blobs of their drivers on the website for Nexus devices, despite the fact that Nexus owners can unlock their phones and pull them all off.&lt;/p&gt;

&lt;p&gt;One conclusion was that, while someone with deep connections to the chip makers might be able to eventually produce a phone that can run a hypervisor for multiple guest operating systems, it wasn't happening with phones on the market at the time, it wasn't happening within the schedule of this particular RFP, and it certainly wasn't going to be us doing it.&lt;/p&gt;

&lt;h2&gt;Reset&lt;/h2&gt;

&lt;p&gt;So, now the belief I went into this with has been broken down. Why did we have that belief at all? Why did we start thinking it was the right answer? We fell into the same trap that everyone else did. The Cross Domain Solution community has forgotten its heritage. Virtualization has become the magic bullet for cross domain access solutions, but why?&lt;/p&gt;

&lt;p&gt;Once upon a time there were many trusted operating systems. They were mostly based on their non-trusted siblings. The names were straightforward; you had Trusted Solaris, Trusted IRIX, Trusted Xenix, etc. These were evaluated. You could run applications at multiple levels on them just fine. And people did, just not very many people.&lt;/p&gt;

&lt;p&gt;By the end of the UNIX wars, most of these systems were Trusted Solaris, but they still weren't in huge use. Most people had settled on Windows for their standard tasks. Windows applications didn't run on Trusted Solaris. In fact, modern Solaris applications didn't run on Trusted Solaris, which was typically a couple major releases behind.&lt;/p&gt;

&lt;p&gt;What to do? Well, SELinux was being developed. Virtualization was becoming possible on x86. The NSA tied the 2 together and released NetTop. You could now run Windows apps at multiple levels right next to each other on the same system, albeit very slowly. Then there were the various HAP (High Assurance Platform) projects, and other variations. Long story short, people started defaulting to 'virtualize for cross domain access', without even thinking.&lt;/p&gt;

&lt;p&gt;For mobile this trap can be avoided entirely. You have a platform, and people are using apps written for that platform, not for another platform. You don't need to virtualize to run the apps you want.&lt;/p&gt;

&lt;h2&gt;Security Anti-pattern&lt;/h2&gt;

&lt;p&gt;Up until now I've been focusing on why hypervisors aren't there for mobile, and why that was the default thought anyway, but not much about the security anti-pattern part. So lets get started on that.&lt;/p&gt;

&lt;p&gt;Mobile security is an interesting beast. It has all the issues of regular computing and a whole host of its own.&lt;/p&gt;

&lt;h3&gt;Power Management&lt;/h3&gt;

&lt;p&gt;Take power management, for example. On mobile systems you want the main application processor powered down as often as possible. How do you do that while maintaining a nice user experience? You don't want an app sitting in the background constantly polling for email, killing your battery, but you also don't want everything to fire up and go download data the instant the user unlocks the device, since that will make it unusable for some amount of time. Google implemented wakelocks for this purpose. They allow apps to notify the kernel that they are doing something, and that the kernel shouldn't put the device to sleep. You also want apps to be able to simultaneously use wakelocks, and let the system sleep sooner.&lt;/p&gt;

&lt;p&gt;Now, instead of just getting to the kernel above the apps, those wakelocks would need to make it all the way to the hypervisor. Further, without sharing wakelocks between VM's you'll have the same power draining serial usage of processor awake time.&lt;/p&gt;

&lt;p&gt;See what I did there? Automatic info-flow between VM's, regardless of whether you do it or not. If VM1 is doing something it'll keep the processor awake, VM2 will know. If you share wakelocks and VM1 is doing something VM2 will know.&lt;/p&gt;

&lt;p&gt;The old trusty high assurance MILS way of fixing this? Fixed time-slice scheduling. Give each VM X amount of time, move on to the next when time is up. In this world, how will the hypervisor know when to sleep? How do you manage talking on the phone, a somewhat real-time activity, if you are cycling through VM's? Finally, what is someone going to do with a phone that has a 1 hour battery life because VM's can't cooperate?&lt;/p&gt;

&lt;p&gt;So, choose between punching a hole in the hypervisor or getting miserable power performance.&lt;/p&gt;

&lt;h3&gt;Holes, holes everywhere&lt;/h3&gt;

&lt;p&gt;I already mentioned the issue with drivers. The current solution for hypervisors is to pass device access straight through to one (or more) of the VM's.&lt;/p&gt;

&lt;p&gt;This is pretty standard for all virtualization based cross domain solutions, actually. Hypervisors are suppose to be small, they can't have a graphics subsystem. By using an IOMMU they assign a single VM to manage graphics (and nothing else) and then assign the DMA memory range of the device to that VM. No other VM can access that memory, so then you build one-way pipelines from all the VM's to the graphics VM and let it do compositing, etc.&lt;/p&gt;

&lt;p&gt;As a sidenote, none of the solutions I know of actually have shared 3d acceleration, if you need 3d acceleration you have to lock a single VM to a video card.&lt;/p&gt;

&lt;p&gt;So, back to mobile. You &lt;em&gt;might&lt;/em&gt; be able to find an SoC with a working IOMMU, but I wouldn't count on it. I could find nothing of the sort back then.&lt;/p&gt;

&lt;p&gt;This same method is used for all kinds of devices, such as networking. With networking, however, you now have 2-way communication. High assurance systems will need separate network cards that can each be assigned to a single VM. How do you do this on a mobile device, where there is generally one cellular radio? Typically the idea is that you have separate encryption VM's for each user facing VM.&lt;/p&gt;

&lt;p&gt;How many device VM's are you willing to have? How many paths through the hypervisor do you open? How much security do you end up having when every device is shared between all VM's? What is the performance and power penalty if a simple action like downloading some data from a website, storing it to the filesystem and displaying a message to the screen involves no fewer than 4 VM's?&lt;/p&gt;

&lt;p&gt;In the end you have VM's that are trusted to do the separation between user-facing VM's instead of having the hypervisor solely doing that. This means that all those assurance arguments and the fact that your hypervisor only has 10k lines of code is irrelevant. You've just added a bunch of Linux kernels to your trusted base.&lt;/p&gt;

&lt;p&gt;In desktop virtualization based solutions these device managing VM's were typically SELinux systems. SE Android could be similarly used to lock down these systems, and at the time it was just being released. I figured that since it had to be done anyway, in order for the hypervisor use case to ever work, I might we well focus on it. At least then there would be a secure platform that could be used until the whole hypervisor thing got resolved. At this point my opinion is that even if they are available and working they aren't worth it, but I know many who disagree.&lt;/p&gt;

&lt;h3&gt;Functionality&lt;/h3&gt;

&lt;p&gt;Security is always at odds with functionality, by definition. Mobile users have fairly high expectations of their devices. One example is the ability to receive phone calls. Personally I have bad experiences with my smart phones receiving phone calls without extra security so this is a serious uphill battle.&lt;/p&gt;

&lt;p&gt;So, if a user is using a secret level VM, and his child's school calls on the unclass VM to tell him that his child has been hurt and is going to the hospital, should he be able to be receive that call? I don't think many people would want to use these devices if the answer is no, but what does saying yes entail? More holes punched through the hypervisor? Probably, but you've already made plenty of those.&lt;/p&gt;

&lt;p&gt;How about the baseband processor? Oh, right, I haven't mentioned that yet. Pretty much every smart phone has a whole 'nother processor, operating system and software stack connected to the radio. Sometimes this processor is actually primary (it bootstraps and starts the application processor).&lt;/p&gt;

&lt;p&gt;So, on some smart phones the baseband processor is connected directly to the microphone. Obviously while in the secret VM access to the microphone must be restricted. What does this mean? There must be a VM managing communication with the baseband processor, so it is going to have to make the hard decision as to allow the microphone to be used while a secret VM is active. This, obviously, opens all sorts of serious issues.&lt;/p&gt;

&lt;p&gt;There are many other examples of this. Switching between 5 VM's to check email isn't going to make anyone happy. Not getting text messages from the wife while at work may not make your home life better.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;You'll notice that the title of this entry specifically mentions user facing VM's on mobile devices. I do not object to using a hypervisor in conjunction with a specialized integrity measurement and monitoring system for attestation purposes. The device access necessary to such a VM would be minimal, and it would only need to do something when an attestation request was made, so it has no reason to wake up the phone. It also doesn't add many VM's that need to constantly be scheduled.&lt;/p&gt;

&lt;p&gt;I &lt;em&gt;do&lt;/em&gt; object to the sentiment that a hypervisor is &lt;em&gt;required&lt;/em&gt; for multi-level cross domain access on a mobile device. I believe the sentiment is guided by where the desktop multi-level market landed, without the requirements that got it there. Additionally, I believe, by the time you have a functional implementation you won't have any more assurance than running an SE Android system that implements multi-level access controls. On top of that, the system will be significantly less usable, battery life and performance will suffer, and you'll never get away from having to modify the underlying OS anyway.&lt;/p&gt;

&lt;p&gt;SE Android is being developed at a rapid pace and new features are added often. I can't wait to see where it goes, but I hope the hypervisor evangelists aren't able to take the steam out of it before it gets there.&lt;/p&gt;</content:encoded>
	<dc:date>2013-02-11T06:00:00+00:00</dc:date>
</item>
<item rdf:about="http://securityblog.org/2013/02/06/big-changes">
	<title>Joshua Brindle: Big changes</title>
	<link>http://securityblog.org/2013/02/06/big-changes</link>
	<content:encoded>&lt;p&gt;New blogging system... Also I left Tresys.&lt;/p&gt;

&lt;p&gt;After almost 9 years there I have resigned, which was a hard thing to do.&lt;/p&gt;

&lt;p&gt;Spencer Shimko, Brandon Whalen and I left Tresys a couple weeks ago to start our own company, &lt;a href=&quot;http://quarksecurity.com/&quot;&gt;Quark Security&lt;/a&gt;. That decision wasn't easy but it is a good time in our careers and we all believe that we are prepared to succeed running our own company. We were joined by an ex-Tresys employee, Ed Sealing.&lt;/p&gt;

&lt;p&gt;So, after a very crazy 2012, almost entirely focusing on mobile security for me, we are going forward, trying to figure out how to make our mark on the world. We are learning about the nitty gritty details about government contracting that we were never exposed to before. It is all very fascinating and definitely unlike what I've done before.&lt;/p&gt;

&lt;p&gt;Strangely enough, my workload is much lighter at the moment, than it was before I left, so I hope to be able to spend some time writing up my thoughts on various things, including mobile security, before I get ramped back up to pre-leaving workloads.&lt;/p&gt;</content:encoded>
	<dc:date>2013-02-06T06:00:00+00:00</dc:date>
</item>
<item rdf:about="http://blog.namei.org/?p=559">
	<title>James Morris: Save the Date: 2013 Linux Security Summit</title>
	<link>http://blog.namei.org/2013/02/04/save-the-date-2013-linux-security-summit/</link>
	<content:encoded>&lt;p&gt;This year&amp;#8217;s &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2013&quot;&gt;Linux Security Summit&lt;/a&gt; will be co-located with &lt;a href=&quot;http://events.linuxfoundation.org/events/linuxcon&quot;&gt;LinuxCon&lt;/a&gt; (along with &lt;a href=&quot;http://www.linuxplumbersconf.org/2013/&quot;&gt;Linux Plumbers&lt;/a&gt;) in New Orleans, USA, on the 19th and 20th of September.&lt;/p&gt;
&lt;p&gt;The format is expected to be similar to the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012/Schedule&quot;&gt;2012&lt;/a&gt; summit.&lt;/p&gt;
&lt;p&gt;A CfP will be issued soon.&lt;/p&gt;</content:encoded>
	<dc:date>2013-02-04T04:38:37+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3654">
	<title>Russell Coker (security): SE Linux Things To Do</title>
	<link>http://etbe.coker.com.au/2013/01/31/selinux-todo/</link>
	<content:encoded>&lt;p&gt;At the end of &lt;a href=&quot;http://etbe.coker.com.au/2013/01/28/selinux-status-lca2013/&quot;&gt;my talk on Monday about the status of SE Linux [1]&lt;/a&gt; I described some of the things that I want to do with SE Linux in Debian (and general SE Linux stuff). Here is a brief summary of some of them:&lt;/p&gt;
&lt;p&gt;One thing I&amp;#8217;ve wanted to do for years is to get X Access Controls working in Debian. This means that two X applications could have windows on the same desktop but be unable to communicate with each other by any of the X methods (this includes screen capture and clipboard). It seems that the Fedora people are moving to sandbox processes with Xephyr for X access (&lt;a href=&quot;http://danwalsh.livejournal.com/31146.html&quot;&gt;see Dan Walsh&amp;#8217;s blog post about sandbox -X [2]&lt;/a&gt;). But XAce will take a lot of work and time is always an issue.&lt;/p&gt;
&lt;p&gt;An ongoing problem with SE Linux (and most security systems) is the difficulty in running applications with minimum privilege. One example of this is utility programs which can be run by multiple programs, if a utility is usually run by a process that is privileged then we probably won&amp;#8217;t notice that it requires excess privileges until it&amp;#8217;s run in a different context. This is a particular problem when trying to restrict programs that may be run as part of a user session. A common example is programs that open files read-write when they only need to read them, if the program then aborts when it can&amp;#8217;t open the file in question then we will have a problem when it&amp;#8217;s run from a context that doesn&amp;#8217;t grant it write access. To deal with such latent problems I am considering ways of analysing the operation of systems to try and determine which programs request more access than they really need.&lt;/p&gt;
&lt;p&gt;During my talk I discussed the possibility of using a shared object to log file open/read/write to find such latent problems. A member of the audience suggested static code analysis which seems useful for some languages but doesn&amp;#8217;t seem likely to cover all necessary languages. Of course the benefit of static code analysis is that it will catch operations that the program doesn&amp;#8217;t perform in a test environment &amp;#8211; error handling is one particularly important corner case in this regard.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://etbe.coker.com.au/2013/01/28/selinux-status-lca2013/&quot;&gt; http://etbe.coker.com.au/2013/01/28/selinux-status-lca2013/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[2]&lt;a href=&quot;http://danwalsh.livejournal.com/31146.html&quot;&gt; http://danwalsh.livejournal.com/31146.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;yarpp-related-rss&quot;&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/2012/06/22/se-linux-policy-wheezy/&quot; rel=&quot;bookmark&quot; title=&quot;New SE Linux Policy for Wheezy&quot;&gt;New SE Linux Policy for Wheezy&lt;/a&gt; &lt;small&gt;I&amp;#8217;ve just uploaded a new SE Linux policy for Debian/Wheezy....&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content:encoded>
	<dc:date>2013-01-30T21:16:33+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3650">
	<title>Russell Coker (security): My SE Linux Status Report – LCA 2013</title>
	<link>http://etbe.coker.com.au/2013/01/28/selinux-status-lca2013/</link>
	<content:encoded>&lt;p&gt;This morning I gave a status report on SE Linux. The talk initially didn&amp;#8217;t go too well, I wasn&amp;#8217;t in the right mental state for it and I moved through the material too fast. Fortunately Casey Schaufler asked some really good questions which helped me to get back on track. The end result seemed reasonably good. Here&amp;#8217;s a summary of the things I discussed:&lt;/p&gt;
&lt;p&gt;Transaction hooks for RPM to support SE Linux operations. This supports signing packages to indicate their security status and preventing packages from overwriting other packages or executing scripts in the wrong context. There is also work to incorporate some of the features of that into &amp;#8220;dpkg&amp;#8221; for Debian.&lt;/p&gt;
&lt;p&gt;Some changes to libraries to allow faster booting. Systems with sysvinit and a HDD won&amp;#8217;t be affected but with systemd and SSD it makes a real difference. Mostly Red Hat&amp;#8217;s work.&lt;/p&gt;
&lt;p&gt;Filename transition rules to allow the initial context to be assigned based on file name were created in 2011 but are not starting to get used.&lt;/p&gt;
&lt;p&gt;When systemd is used for starting/stopping daemons some hacks such as run_init can be avoided. Fedora is making the best progress in this regard due to only supporting systemd while the support for other init systems will limit what we can do for Debian. This improves security by stopping terminal buffer insertion attacks while also improving reliability by giving the daemon the same inherited settings each time it&amp;#8217;s executed.&lt;/p&gt;
&lt;p&gt;Labelled NFS has been accepted as part of the NFSv4.2 specification. This is a big deal as labelled NFS work has been going for many years without hitting such a milestone in the past.&lt;/p&gt;
&lt;p&gt;ZFS and BTRFS support but we still need to consider management issues for such snapshot based filesystems. Filesystem snapshots have the potential to interact badly with relabelling if we don&amp;#8217;t develop code and sysadmin practices to deal with it properly.&lt;/p&gt;
&lt;p&gt;The most significant upstream focus of SE Linux development over the last year is SE Android. I hope that will result in more work on the X Access Controls for use on the desktop.&lt;/p&gt;
&lt;p&gt;During question time I also gave a 3 minute &amp;#8220;lightning talk&amp;#8221; description of SE Linux.&lt;/p&gt;
&lt;div class=&quot;yarpp-related-rss&quot;&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&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/2012/06/17/debian-selinux-june-2012/&quot; rel=&quot;bookmark&quot; title=&quot;Debian SE Linux Status June 2012&quot;&gt;Debian SE Linux Status June 2012&lt;/a&gt; &lt;small&gt;It&amp;#8217;s almost the Wheezy freeze time and I&amp;#8217;ve been working...&lt;/small&gt;&lt;/li&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;/ol&gt;
&lt;/div&gt;</content:encoded>
	<dc:date>2013-01-28T02:56:30+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/61710.html">
	<title>Dan Walsh: Where did audit2allow go in Fedora 18?</title>
	<link>http://danwalsh.livejournal.com/61710.html</link>
	<content:encoded>One of the goals of Fedora 18 is to shrink the size of the Minimal install as much as possible.&amp;nbsp;&amp;nbsp; We are concentrating on keeping this minimal.&lt;br /&gt;&lt;br /&gt;Since a minimal install machine does not need to do SELinux policy development, it was decided to remove the selinux-policy-devel package from the minimal install, which is fairly large.&amp;nbsp; But audit2allow was in policycoreutils-python, and required the selinux-policy-devel package.&amp;nbsp; audit2allow needs the interface files in selinux-policy-devel package in order for&amp;nbsp; &lt;span&gt;audit2allow -R to work.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I decided to move the audit2allow script to policycoreutils-devel package, since its main job is to help develop selinux-policy.&lt;br /&gt;If you do not find audit2allow you your system, just&lt;br /&gt;&lt;br /&gt;&lt;span&gt;yum install policycoreutils-devel&lt;/span&gt;&lt;br /&gt;or&lt;br /&gt;&lt;span&gt;yum install /usr/bin/audit2allow &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: The latest setroubleshoot-server package requires policycoreutils-devel, so if you have this installed you will get audit2allow for free...</content:encoded>
	<dc:date>2013-01-18T14:37:20+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/61646.html">
	<title>Dan Walsh: rsync and SELinux</title>
	<link>http://danwalsh.livejournal.com/61646.html</link>
	<content:encoded>I have been pinged by a couple of users having problems with SELinux and rsync.&amp;nbsp; We began confining the rsync service back in RHEL5.&lt;br /&gt;&lt;br /&gt;The biggest problem SELinux has with rsync is there is no way to distinguish between the client and the server from an SELinux point of view.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;rsync as a daemon&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If someone sets up an rsync service to listen for connections they use the /usr/bin/rsync executable.&amp;nbsp; In order to confine this application we label /usr/bin/rsync as rsync_exec_t.&amp;nbsp; The init daemons (init_t, initrc_t) will transition to rsync_t when they execute /usr/bin/rsync. SELinux policy allows share parts of the host, mainly readonly, and allows admins to setup directories labeled rsync_data_t where content could be uploaded to the rsync domain.&lt;br /&gt;&lt;br /&gt;There are lots of booleans defined for rsync_t to share data.&amp;nbsp; On Fedora 18, I see.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;getsebool -a | grep rsync&lt;br /&gt;postgresql_can_rsync --&amp;gt; off&lt;br /&gt;rsync_anon_write --&amp;gt; off&lt;br /&gt;rsync_client --&amp;gt; off&lt;br /&gt;rsync_export_all_ro --&amp;gt; off&lt;br /&gt;rsync_use_cifs --&amp;gt; off&lt;br /&gt;rsync_use_nfs --&amp;gt; of&lt;br /&gt;&lt;br /&gt;man rsync_selinux &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;to see more info.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;rsync as a client.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you execute rsync as a client from a user script, everything works fine, since we do not transition from unconfined_t or other user domains to rsync_t, rsync runs within the user domain and is able to read/write anything the user process label is allowed to read/write.&lt;br /&gt;&lt;br /&gt;If a service that SELinux does not have policy runs runs within the init system and attempts to use rsync as a client it can have problems.&amp;nbsp; You see the service running within the init system that has no policy will run as either init_t or initrc_t.&amp;nbsp; When a process running as init_t or initrc_t executes /usr/bin/rsync (rsync_exec_t), the rsync process will transition to rsync_t and SELinux will treat it as the rsync daemon not as a client.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There are many possible solutions for this problem.&amp;nbsp;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Best would be to write policy for the init service that is currently running without confinement.&amp;nbsp;&amp;nbsp; I realize&amp;nbsp; that most users will not do this, but you could contact us for help.&lt;/li&gt;&lt;li&gt;In RHEL5 you could turn on the rsync_disable_trans boolean.&amp;nbsp; Which will stop the transition from initrc_t to rsync_t, and rsync_t would just tun in&amp;nbsp; initrc_t domain, which by default is an unconfined domain.&lt;/li&gt;&lt;li&gt;You could use audit2allow to add all of the rules to rsync_t to allow it to run as a client.&lt;/li&gt;&lt;li&gt;You could change the label of /usr/bin/rsync to bin_t using semanage fcontext -m -t bin_t /usr/bin/rsync which would also stop the transition.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/47066.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;You could make rsync_t an unconfined domain.&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;There are many ways of fixing this problem.&amp;nbsp; And perhaps I need to talk to the rsync packagers to see if we could figure a better way of handling this in the future.&amp;nbsp;</content:encoded>
	<dc:date>2013-01-07T16:28:59+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3575">
	<title>Russell Coker (security): Finding an ATM Skimmer</title>
	<link>http://etbe.coker.com.au/2012/12/23/finding-an-atm-skimmer/</link>
	<content:encoded>&lt;p&gt;A member of &lt;a href=&quot;http://www.sage-au.org.au/&quot;&gt;SAGE-AU [1]&lt;/a&gt; found two &lt;a href=&quot;http://en.wikipedia.org/wiki/Skimming_(credit_card_fraud)#Skimming&quot;&gt;ATM skimmers [2]&lt;/a&gt; and gave me permission to publish his description and analysis of the situation. I&amp;#8217;ve lightly edited this from a mailing list post to a blog format with permission from the author. &lt;a href=&quot;http://www.couriermail.com.au/news/queensland/european-atm-skimming-machine-your-credit-cards-new-worst-enemy-in-australian-crime-first/story-e6freoof-1226521141277&quot;&gt;This Courier-Mail article refers to the skimmers in question [3]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;People were wondering what gave the skimmers away so here goes, NB this is only about the 2 I discovered.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The actual atms in question were the free standing type (but even this doesn&amp;#8217;t matter in the scheme of things because they can be on those in a bank of the things).&lt;/li&gt;
&lt;li&gt;I&amp;#8217;d actually conducted transaction and was waiting for my card to come out of the machine &amp;#8211; these things looked that good. The colours matched &amp;#8211; especially in the 3/4 or less light that you typically have on the fascia&amp;#8217;s of such machine. The backing plate grey matched atm fascia as did the green &amp;#8220;bubble&amp;#8221; where the card goes.&lt;/li&gt;
&lt;li&gt;WHAT REALLY CAUSED SUSPICION &amp;#8211; my card was having difficulty coming out of the atm at end of transaction i.e. card coming out extra slow &amp;#8211; then only the end couple of mm, I had to physically grab my card with fingertips to get it out and there was barely perceptible movement of skimmer due to my fingers using the green &amp;#8220;bubble&amp;#8221; as purchase point, THAT was what made me suspect. I then really had close look and found that I could move the &amp;#8220;bubble&amp;#8221; with its backing plate &amp;#8211; I pulled it off the machine and then looked at the atm next to it and found it to look exactly the same. These things are held on by double sided tape.&lt;/li&gt;
&lt;li&gt;Grabbed the cleaning lady wandering past showed her the device and asked her to get security. Security and centre operations manager subsequently showed up, while waiting for them I had to stop people from using either machine (everyone amazed at how good these things looked). Centre ops guy went and checked other machines in the centre, I left my details and they called the cops&amp;#8230; I went straight to my credit union and reported what had happened and they cancelled my card and ordered a new one on the spot for me.&lt;/li&gt;
&lt;li&gt;Coincidently (or not) the centre ops and security lady told me that the machines had been serviced (refilled) not too much earlier that day &amp;#8211; i.e. I wondered if the bad guys did the &amp;#8220;service&amp;#8221; or were tracking armaguard servicing types.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Quick side notes: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;3 more skimmers have been found since then.&lt;/li&gt;
&lt;li&gt;Subsequently, I found out these were the type that needed to be picked up for the bad guys to retrieve the data i.e. these weren&amp;#8217;t the type that transmitted to some-one sitting near by via Bluetooth/wireless i.e. in this instance I need not have cancelled my card and gotten a new one from my credit union.&lt;br /&gt;HOWEVER, it is best practice if you discover one and you&amp;#8217;ve used that machine to immediately have your financial institution cancel your card and issue you a new one &amp;#8211; though getting the new one can take up to a week.&lt;/li&gt;
&lt;li&gt;As I understand it, These 2 devices (i.e. others could be different) have 2 usb ports one for the reader and the other to a pinhole camera (commercially available type removed from it&amp;#8217;s original housing). The magnetic stripe data is held on the audio track associated with the video and there was an 8GB storage card to hold it all i.e. it makes things easier for the bad guys to match PINs to card details.&lt;/li&gt;
&lt;li&gt;If you do find a skimmer DO NOT touch the insides (non public facing parts) of it &amp;#8211; this is where the cops can really try lift dna and prints from; gathering prints from externally is far more fraught as everyone and their dog has probably touched the exterior of the skimmer.&lt;/li&gt;
&lt;li&gt;In the lead up to Xmas these things or similar are highly likely to become more prevalent as we all go about parting with dosh  while gift shopping &amp;#8211; SO BE AWARE AND CAREFUL.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://www.sage-au.org.au/&quot;&gt; http://www.sage-au.org.au/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[2]&lt;a href=&quot;http://en.wikipedia.org/wiki/Skimming_(credit_card_fraud)#Skimming&quot;&gt; http://en.wikipedia.org/wiki/Skimming_(credit_card_fraud)#Skimming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[3]&lt;a href=&quot;http://www.couriermail.com.au/news/queensland/european-atm-skimming-machine-your-credit-cards-new-worst-enemy-in-australian-crime-first/story-e6freoof-1226521141277&quot;&gt; http://tinyurl.com/aqu9yb6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;yarpp-related-rss&quot;&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/06/14/finding-thread-unsafe-code/&quot; rel=&quot;bookmark&quot; title=&quot;Finding Thread-unsafe Code&quot;&gt;Finding Thread-unsafe Code&lt;/a&gt; &lt;small&gt;One problem that I have had on a number of...&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-12-23T01:08:49+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="hatenablog://entry/12704830469096319076">
	<title>KaiGai Kohei: SE-PostgreSQLでリモートプロセスのセキュリティラベルを使用する</title>
	<link>http://kaigai.hatenablog.com/entry/20121206/1354771579</link>
	<content:encoded>&lt;p&gt;&lt;a href=&quot;http://atnd.org/events/34176&quot;&gt;PostgreSQL Advent Calendar 2012&lt;/a&gt;に参加しています。&lt;/p&gt;

&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;何を設定する必要があるのか？&lt;/h4&gt;
    &lt;p&gt;何か世のため人のためになりそうなネタは・・・という事で、SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;でリモートプロセスのセキュリティラベルを使用する方法をまとめてみました。&lt;/p&gt;&lt;p&gt;v9.1からサポートされたSE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;は、OSの機能である&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;と連携して、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SQL&quot;&gt;SQL&lt;/a&gt;を介したDBオブジェクトへのアクセスに対して強制アクセス制御を行う機能です。&lt;br /&gt;
かいつまんで言えば、○○のテーブルは機密度の高い情報を持っている、□□は機密度が低いと言った形で、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;標準のDBアクセス制御機能に加えて、OSの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%BB%A5%AD%A5%E5%A5%EA%A5%C6%A5%A3%A5%DD%A5%EA%A5%B7%A1%BC&quot;&gt;セキュリティポリシー&lt;/a&gt;に従ってアクセス制御を行います。そのため、同じ”情報”であるにも関わらず、保存先がファイルかデータベースかといった”格納手段”によって異なるポリシーでアクセス制御が行われる事を避ける事ができます。&lt;br /&gt;
SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;が追加のアクセス制御を行う際には、『誰が（subject）』『何に（object）』『何をする（action）』のかをひとまとめにして、OSの一部である&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;に伺いを立てるのですが、この時に『誰が』『何に』を識別するために、セキュリティコンテキストと呼ばれる特別な識別子が使用されます。&lt;br /&gt;
セキュリティコンテキストというのはこんな感じです。ファイルのセキュリティコンテキストを確認するには ls -Z を、プロセスの場合は ps -Z や id -Z を実行して確認できます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[kaigai@iwashi ~]$ ls -Z
drwxr-xr-x. kaigai users unconfined_u:object_r:user_home_t:s0 patch/
drwxr-xr-x. kaigai users unconfined_u:object_r:user_home_t:s0 repo/
drwxr-xr-x. kaigai users unconfined_u:object_r:user_home_t:s0 rpmbuild/
drwxr-xr-x. kaigai users unconfined_u:object_r:user_home_t:s0 source/
drwxr-xr-x. kaigai users unconfined_u:object_r:user_home_t:s0 tmp/
[kaigai@iwashi ~]$ ps -Z
LABEL                             PID TTY          TIME CMD
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 28791 pts/4 00:00:00 bash
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 29093 pts/4 00:00:00 ps&lt;/pre&gt;&lt;p&gt;DBオブジェクトの場合はSECURITY LABEL構文を用いて設定できるほか、システムビューのpg_seclabelsを用いて参照する事ができます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;postgres=# SELECT provider,label FROM pg_seclabels
              WHERE objtype = 'table' AND objname = 't1';
 provider |                  label
----------+------------------------------------------
 selinux  | unconfined_u:object_r:sepgsql_table_t:s0
(1 row)&lt;/pre&gt;&lt;p&gt;そしてDB利用者の場合。やっと今回の記事の主題にたどり着けたワケですが、SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;は『接続元プロセスのセキュリティコンテキスト』をDB利用者のセキュリティコンテキスト（= DB利用者の権限）として扱います。&lt;/p&gt;&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;は&lt;tt&gt;getpeercon(3)&lt;/tt&gt;という&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/API&quot;&gt;API&lt;/a&gt;を持っており、この人はソケットのファイル&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%C7%A5%A3%A5%B9%A5%AF%A5%EA%A5%D7%A5%BF&quot;&gt;ディスクリプタ&lt;/a&gt;を引数として与えると、接続相手のセキュリティコンテキストを返します。SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;はこの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/API&quot;&gt;API&lt;/a&gt;を使用して『接続元プロセスのセキュリティコンテキスト』を取得しています。&lt;br /&gt;
で、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/UNIX&quot;&gt;UNIX&lt;/a&gt;ドメインソケットによるローカル接続の場合は特別な設定は何も必要ないのですが、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/TCP/IP&quot;&gt;TCP/IP&lt;/a&gt;によるリモート接続の場合、OSは相手側プロセスの情報を持っていないため、ネットワーク接続の確立に先立って双方のセキュリティコンテキストを交換する Labeled Network の設定を行う必要があります。&lt;br /&gt;
この機能、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Linux&quot;&gt;Linux&lt;/a&gt; kernel 2.6.16 からサポートされた機能で、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の鍵交換デーモンである racoon と連携してネットワーク接続先とセキュリティコンテキストを交換します。つまり、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;で通信経路が保護されている（少なくとも、改ざん検知できる）事が前提です。&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;が前提ですよ。大切な事なので２回書きました。&lt;/p&gt;&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Linux&quot;&gt;Linux&lt;/a&gt; kernelのバージョンからも分かるようにそれほど新しい機能ではないのですが、意外と設定手順がドキュメント化されていませんので、少しまとめてみました。&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;テスト環境の構成&lt;/h4&gt;
    &lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の設定を極める事が目的ではありませんので、今回は、最も単純なHost-to-HostのPSK(Pre-Shared Key)の構成で&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;通信経路を作成します。その上で、Labeled Networkの設定を追加する事にします。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206044548&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206044548.png&quot; alt=&quot;f:id:kaigai:20121206044548p:image&quot; title=&quot;f:id:kaigai:20121206044548p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
今回のテスト環境では、2台のホストをそれぞれサーバとクライアントに見立てて設定を行いました。kg1(192.168.1.42)がクライアント、kg2(192.168.1.43)がサーバであると想定し、この2台の間に&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の接続を設定します。&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%C7%A5%A3%A5%B9%A5%C8%A5%EA%A5%D3%A5%E5%A1%BC%A5%B7%A5%E7%A5%F3&quot;&gt;ディストリビューション&lt;/a&gt;は &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Fedora&quot;&gt;Fedora&lt;/a&gt; 17 を使用し、Development Workstation構成で&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AF%A5%EA%A1%BC%A5%F3%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB&quot;&gt;クリーンインストール&lt;/a&gt;しました。&lt;/p&gt;&lt;p&gt;なお、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;接続の設定に関しては&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Fedora%20Project&quot;&gt;Fedora Project&lt;/a&gt;のドキュメントを参考にしています。&lt;br /&gt;
詳しくは&lt;a href=&quot;http://docs.fedoraproject.org/en-US/Fedora/14/html/Security_Guide/sect-Security_Guide-Virtual_Private_Networks_VPNs-IPsec_Host_to_Host_Configuration.html&quot;&gt;IPsec Host-to-Host Configuration&lt;/a&gt;を参照してください。&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;事前の設定&lt;/h4&gt;
    
&lt;div class=&quot;section&quot;&gt;
    &lt;h5&gt;パッケージの追加&lt;/h5&gt;
    &lt;p&gt;インストール直後の状態では &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/ipsec&quot;&gt;ipsec&lt;/a&gt;-tools と system-config-network パッケージが導入されていませんので、両ホストでこれらのパッケージをインストールします。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# yum install -y ipsec-tools system-config-network&lt;/pre&gt;&lt;p&gt;また、サーバ側には &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/postgresql&quot;&gt;postgresql&lt;/a&gt;-server と &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/postgresql&quot;&gt;postgresql&lt;/a&gt;-contrib パッケージが、クライアント側には &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/postgresql&quot;&gt;postgresql&lt;/a&gt; パッケージが必要です。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# yum install -y postgresql-server postgresql-contrib&lt;/pre&gt;&lt;pre class=&quot;code&quot;&gt;# yum install -y postgresql&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h5&gt;ファイアウォールの設定&lt;/h5&gt;
    &lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の鍵交換デーモンの通信と&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;サーバへの接続にはファイアウォールの設定変更が必要です。&lt;br /&gt;
system-config-firewallを実行して関連するポートを解放してください。&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206050923&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206050923.png&quot; alt=&quot;f:id:kaigai:20121206050923p:image&quot; title=&quot;f:id:kaigai:20121206050923p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の鍵交換デーモン用ポートは、サーバ側/クライアント側の双方で解放が必要です。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206050922&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206050922.png&quot; alt=&quot;f:id:kaigai:20121206050922p:image&quot; title=&quot;f:id:kaigai:20121206050922p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;サーバ用ポートは、サーバ側で解放が必要です。&lt;/p&gt;&lt;p&gt;これらの設定を保存し、有効化してください。&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h5&gt;NetworkManagerの無効化&lt;/h5&gt;
    &lt;p&gt;ちょっとダサいのですが、NetworkManager経由でうまくipsec0デバイスを自動起動させる事ができなかったので、レガシーなnetworkスクリプトによってネットワークデバイスをup/downさせる事にします。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# chkconfig NetworkManager off
# chkconfig network on&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;Host-to-Host &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt; デバイスの作成&lt;/h4&gt;
    &lt;p&gt;今回は、system-config-networkを使ってipsec0デバイスの定義ファイルや、racoonの設定ファイルを自動生成させる方法でHost-to-Hostの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;デバイスを作成します。&lt;br /&gt;
まず、system-config-networkを実行して設定&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GUI&quot;&gt;GUI&lt;/a&gt;を起動します。&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045148&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045148.png&quot; alt=&quot;f:id:kaigai:20121206045148p:image&quot; title=&quot;f:id:kaigai:20121206045148p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
起動画面です。『&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;』のタブを選択します。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045147&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045147.png&quot; alt=&quot;f:id:kaigai:20121206045147p:image&quot; title=&quot;f:id:kaigai:20121206045147p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
左上の『New』をクリックすると、ウィザード形式で&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;設定を追加することができます。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045145&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045145.png&quot; alt=&quot;f:id:kaigai:20121206045145p:image&quot; title=&quot;f:id:kaigai:20121206045145p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
デバイス名を入力します。ここでは『ipsec0』としました。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045144&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045144.png&quot; alt=&quot;f:id:kaigai:20121206045144p:image&quot; title=&quot;f:id:kaigai:20121206045144p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
今回は『Host-to-Host encryption』を選択します。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045143&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045143.png&quot; alt=&quot;f:id:kaigai:20121206045143p:image&quot; title=&quot;f:id:kaigai:20121206045143p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
『Automatic encryption mode selection via IKA (racoon)』を選択します。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045142&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045142.png&quot; alt=&quot;f:id:kaigai:20121206045142p:image&quot; title=&quot;f:id:kaigai:20121206045142p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
この設定での接続相手先の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IP%A5%A2%A5%C9%A5%EC%A5%B9&quot;&gt;IPアドレス&lt;/a&gt;を入力します。画面は192.168.1.42ホストのものなので、接続先は『192.168.1.43』となります。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045141&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045141.png&quot; alt=&quot;f:id:kaigai:20121206045141p:image&quot; title=&quot;f:id:kaigai:20121206045141p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
事前共有型の認証キーを入力します。ここでは『sepgsql920』としました。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045140&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045140.png&quot; alt=&quot;f:id:kaigai:20121206045140p:image&quot; title=&quot;f:id:kaigai:20121206045140p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
入力したパラメータを確認して『Apply』をクリックします。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045139&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045139.png&quot; alt=&quot;f:id:kaigai:20121206045139p:image&quot; title=&quot;f:id:kaigai:20121206045139p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
これで『ipsec0』デバイスが作成されているのが分かります。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20121206045235&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20121206/20121206045235.png&quot; alt=&quot;f:id:kaigai:20121206045235p:image&quot; title=&quot;f:id:kaigai:20121206045235p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
設定を保存すると、右上の『Activate』『Deactivate』を選択することができるようになりますので、『Activate』をクリックしてください。&lt;/p&gt;&lt;p&gt;もう一方のノードでも同様の設定を行います。&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;の動作確認&lt;/h4&gt;
    &lt;p&gt;ひとまず、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;関連の設定が絡まない範囲でHost-to-Host設定の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;がちゃんと動作しているかを確認します。双方のノードでネットワークを再起動します。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# service network restart&lt;/pre&gt;&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/tcpdump&quot;&gt;tcpdump&lt;/a&gt;でパケットを観察すると、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;のAH/ESPプロトコルが使われている事が分かります。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[root@kg2 ~]# tcpdump -n -i eth1 host 192.168.1.42
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
16:55:34.979277 IP 192.168.1.42 &amp;gt; 192.168.1.43: \
    AH(spi=0x03850f37,seq=0x10): ESP(spi=0x0f3c888b,seq=0x10), length 76
16:55:34.979505 IP 192.168.1.43 &amp;gt; 192.168.1.42: \
    AH(spi=0x0ebad42b,seq=0x6): ESP(spi=0x0183d073,seq=0x6), length 76
16:55:34.980000 IP 192.168.1.42 &amp;gt; 192.168.1.43: \
    AH(spi=0x03850f37,seq=0x11): ESP(spi=0x0f3c888b,seq=0x11), length 68
    :
    :&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;Labeled Network の設定&lt;/h4&gt;
    &lt;p&gt;ipsec0デバイスを起動する時に、どの相手との接続に&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;を使うのか、その際のアルゴリズムは何なのか…という事がOS側に伝えられます。これを行うのがsetkeyコマンドなのですが、通常、これはifcfg-ipsec0の記述に基づいて（ここにスクリプトファイル名）が自動的に実行されます。&lt;br /&gt;
実際には以下のような書式をsetkeyコマンドに与えるのですが、Labeled Networkを使用するにあたって重要なのは、2行目の-ctxから始まる行です。これを指定する事で、この&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;通信経路ではLabeled Networkを使用するという事を宣言できます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;spdadd 192.168.11.6 192.168.11.8 any
-ctx 1 1 &quot;system_u:object_r:ipsec_spd_t:s0&quot;
-P out ipsec esp/transport//require;&lt;/pre&gt;&lt;p&gt;が、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Fedora&quot;&gt;Fedora&lt;/a&gt;のInitスクリプトから実行される/etc/sysconfig/network-scripts/ifup-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/ipsec&quot;&gt;ipsec&lt;/a&gt;は、この辺の設定を行うための処理が入っていません。そこで、パッチを当てる事にしました（うげげ…）。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;--- ifup-ipsec.orig	2012-12-03 17:41:38.809689669 +0100
+++ ifup-ipsec	2012-12-04 17:52:43.356150231 +0100
@@ -123,6 +123,8 @@ if [ &quot;$ESP_PROTO&quot; = &quot;none&quot; ]; then
     unset SPI_ESP_IN SPI_ESP_OUT KEY_ESP_IN KEY_ESP_OUT SPD_ESP_IN SPD_ESP_OUT
 fi
 
+test -n &quot;$SELINUX_CONTEXT&quot; &amp;amp;&amp;amp; SELINUX_CONTEXT=&quot;\&quot;${SELINUX_CONTEXT}\&quot;&quot;
+
 /sbin/setkey -c &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;lt;&amp;lt; EOF
 ${SPI_AH_OUT:+delete $SRC $DST ah $SPI_AH_OUT;}
 ${SPI_AH_IN:+delete $DST $SRC ah $SPI_AH_IN;}
@@ -164,33 +166,45 @@ EOF
 # This looks weird but if you use both ESP and AH you need to configure them together, not seperately.
 if [ &quot;$ESP_PROTO&quot; != &quot;none&quot; ] &amp;amp;&amp;amp; [ &quot;$AH_PROTO&quot; != &quot;none&quot; ]; then
 /sbin/setkey -c &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;lt;&amp;lt; EOF
-spdadd $SPD_SRC $SPD_DST any -P out ipsec
+spdadd $SPD_SRC $SPD_DST any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P out ipsec
             ${SPD_ESP_OUT:+esp/$MODE/${TUNNEL_MODE:+$SRC-$DST}/require}
             ${SPD_AH_OUT:+ah/$MODE/${TUNNEL_MODE:+$SRC-$DST}/require}
 	    ;
 
-spdadd $SPD_DST $SPD_SRC any -P in ipsec
+spdadd $SPD_DST $SPD_SRC any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P in ipsec
 	    ${SPD_ESP_IN:+esp/$MODE/${TUNNEL_MODE:+$DST-$SRC}/require}
 	    ${SPD_AH_IN:+ah/$MODE/${TUNNEL_MODE:+$DST-$SRC}/require}
 	    ;
 EOF
 elif [ &quot;$AH_PROTO&quot; = &quot;none&quot; ]; then
 /sbin/setkey -c &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;lt;&amp;lt; EOF
-spdadd $SPD_SRC $SPD_DST any -P out ipsec
+spdadd $SPD_SRC $SPD_DST any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P out ipsec
             ${SPD_ESP_OUT:+esp/$MODE/${TUNNEL_MODE:+$SRC-$DST}/require}
 	    ;
 
-spdadd $SPD_DST $SPD_SRC any -P in ipsec
+spdadd $SPD_DST $SPD_SRC any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P in ipsec
 	    ${SPD_ESP_IN:+esp/$MODE/${TUNNEL_MODE:+$DST-$SRC}/require}
 	    ;
 EOF
 elif [ &quot;$ESP_PROTO&quot; = &quot;none&quot; ]; then
 /sbin/setkey -c &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;lt;&amp;lt; EOF
-spdadd $SPD_SRC $SPD_DST any -P out ipsec
+spdadd $SPD_SRC $SPD_DST any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P out ipsec
             ${SPD_AH_OUT:+ah/$MODE/${TUNNEL_MODE:+$SRC-$DST}/require}
 	    ;
 
-spdadd $SPD_DST $SPD_SRC any -P in ipsec
+spdadd $SPD_DST $SPD_SRC any
+            ${SELINUX_CONTEXT:+-ctx 1 1 ${SELINUX_CONTEXT}}
+            -P in ipsec
 	    ${SPD_AH_IN:+ah/$MODE/${TUNNEL_MODE:+$DST-$SRC}/require}
 	    ;
 EOF&lt;/pre&gt;&lt;p&gt;この修正により、TYPE=&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPSEC&quot;&gt;IPSEC&lt;/a&gt; として定義されている /etc/sysconfig/network-scripts/ifcfg-* 設定ファイルに「&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELINUX&quot;&gt;SELINUX&lt;/a&gt;_CONTEXT=...」という行が存在すれば、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;通信経路を定義する際に、Labeled Networkの定義も同時に行われる事となります。&lt;br /&gt;
『&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/ipsec&quot;&gt;ipsec&lt;/a&gt;_spd_t』というのは、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/IPsec&quot;&gt;IPsec&lt;/a&gt;通信経路に対して定義されているタイプです。現時点ではこれ以外のタイプは定義されていませんので、”お約束”という事にしておきます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# cat /etc/sysconfig/network-scripts/ifcfg-ipsec0
DST=192.168.1.43
TYPE=IPSEC
ONBOOT=yes
IKE_METHOD=PSK
# KaiGai added them
SELINUX_CONTEXT=system_u:object_r:ipsec_spd_t:s0&lt;/pre&gt;&lt;p&gt;うまく設定できていれば、setkey -DPの出力結果の中に『security context: ...』がどーたらという行が出力されているハズです。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# setkey -DP
    :
192.168.1.42[any] 192.168.1.43[any] 255
        out prio def ipsec
        esp/transport//require
        ah/transport//require
        created: Dec  4 16:45:31 2012  lastused: Dec  5 21:26:24 2012
        lifetime: 0(s) validtime: 0(s)
        security context doi: 1
        security context algorithm: 1
        security context length: 33
        security context: system_u:object_r:ipsec_spd_t:s0
        spid=1 seq=0 pid=3500
        refcnt=2&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;のインストール&lt;/h4&gt;
    &lt;p&gt;続いて、SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;のインストールに移ります。&lt;br /&gt;
インストール手順は&lt;a href=&quot;http://www.postgresql.jp/document/9.2/html/sepgsql.html&quot;&gt;&amp;#x516C;&amp;#x5F0F;&amp;#x30C9;&amp;#x30AD;&amp;#x30E5;&amp;#x30E1;&amp;#x30F3;&amp;#x30C8;&lt;/a&gt;にも記載されていますので、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Fedora&quot;&gt;Fedora&lt;/a&gt;のパッケージを前提にざっくりと紹介します。&lt;/p&gt;&lt;p&gt;まず、initdbを実行します。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# postgresql-setup initdb
Initializing database ... OK&lt;/pre&gt;&lt;p&gt;次に、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/postgresql&quot;&gt;postgresql&lt;/a&gt;.conf を編集して shared_preload_libraries に '$libdir/sepgsql' を追加します。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# vi /var/lib/pgsql/data/postgresql.conf
    :
    :
#max_files_per_process = 1000           # min 25
                                        # (change requires restart)
shared_preload_libraries = '$libdir/sepgsql'

# - Cost-Based Vacuum Delay -&lt;/pre&gt;&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;をシングルユーザモードで起動し、各データベースに初期セキュリティラベルを割り当てます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# su - postgres
$ for dbname in template0 template1 postgres
  do
    /usr/bin/postgres --single $dbname &amp;lt; \
      /usr/share/pgsql/contrib/sepgsql.sql &amp;gt; /dev/null
  done&lt;/pre&gt;&lt;p&gt;これでSE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;の初期設定は完了です。&lt;/p&gt;&lt;p&gt;最後に、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/TCP/IP&quot;&gt;TCP/IP&lt;/a&gt;経由での接続を受け付けるための設定を行ってサーバを起動します。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# vi /var/lib/pgsql/data/pg_hba.conf
(以下の一行を追加; 設定簡略化のため、とりあえずtrust)
host    all    all    192.168.1.42/32    trust&lt;/pre&gt;&lt;pre class=&quot;code&quot;&gt;vi /usr/lib/systemd/system/postgresql.service
(以下の一行を編集し、pg_ctlから-iオプションを渡すようにする)
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o &quot;-p ${PGPORT}&quot; -w -t 300
  ↓
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o &quot;-i -p ${PGPORT}&quot; -w -t 300&lt;/pre&gt;&lt;p&gt;サーバを立ち上げます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# service postgresql start&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;試してみる&lt;/h4&gt;
    &lt;p&gt;長かった・・・。&lt;/p&gt;&lt;p&gt;そして、クライアント側から&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/TCP/IP&quot;&gt;TCP/IP&lt;/a&gt;接続で&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;サーバに接続してみます。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[kaigai@kg1 ~]$ id -Z
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[kaigai@kg1 ~]$ psql -h 192.168.1.43 -U postgres postgres
psql (9.1.6)
Type &quot;help&quot; for help.

postgres=# SELECT sepgsql_getcon();
                    sepgsql_getcon
-------------------------------------------------------
 unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
(1 row)&lt;/pre&gt;&lt;p&gt;ふむふむ、ちゃんとセキュリティコンテキストが切り替わっているように見えます。&lt;/p&gt;&lt;p&gt;それでは、クライアント側で権限を切り替えてから&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;に接続してみましょう。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[kaigai@kg1 ~]$ runcon -l s0-s0:c0,c2 bash
[kaigai@kg1 ~]$ id -Z
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0,c2
[kaigai@kg1 ~]$ psql -h 192.168.1.43 -U postgres postgres
psql (9.1.6)
Type &quot;help&quot; for help.

postgres=# SELECT sepgsql_getcon();
                   sepgsql_getcon
----------------------------------------------------
 unconfined_u:unconfined_r:unconfined_t:s0-s0:c0,c2
(1 row)&lt;/pre&gt;&lt;p&gt;キタコレ！&lt;/p&gt;&lt;p&gt;クライアント側のOS上で変更したプロセスのセキュリティコンテキストが、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;側に透過的に伝えられている事が分かります。&lt;/p&gt;&lt;p&gt;なお、以下のようにgetpeercon(3)に失敗している場合は、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/TCP/IP&quot;&gt;TCP/IP&lt;/a&gt;レベルでの接続には成功したものの、Labeled Networkが機能していません。設定を見直してみてください。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ psql -h 192.168.0.43 -U postgres postgres
psql: FATAL:  SELinux: unable to get peer label: Protocol not available&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;まとめ&lt;/h4&gt;
    &lt;p&gt;今回紹介したLabeled Networkの機能を使う事で、SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;が実現する”OSとDBのアクセス制御の統合”を複数ノードから成る環境にも拡大する事ができるようになりました。&lt;br /&gt;
ただ、これは不特定多数からの接続に対して、接続相手のセキュリティコンテキストを受け入れるという設定ではなく、あくまでも、信頼済みのホストが提示するセキュリティコンテキストを受け入れるという形になります。したがって、”誰か分からないけど世界中からアクセスが来る”という場合に使える方法ではなく、自サイトで管理下にあるWebサーバやAPサーバから&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;サーバに接続する際にセキュリティコンテキストを伝達するための手法という事になります。&lt;/p&gt;&lt;p&gt;現時点では、OS標準のスクリプトがLabeled Networkに対応しておらずスクリプトを修正する必要があったり、初回接続時に（racoonの鍵交換に時間がかかって？）タイムアウトになるといった現象が見られました。&lt;br /&gt;
この辺は改良の余地ありなので、引き続き調査してみようと思います。&lt;/p&gt;

&lt;/div&gt;</content:encoded>
	<dc:date>2012-12-06T05:26:19+00:00</dc:date>
	<dc:creator>kaigai</dc:creator>
</item>
<item rdf:about="tag:blogger.com,1999:blog-5024703430482213163.post-1671553651625097256">
	<title>Dominick Grift: Anatomy of a SELinux policy module: Dropbox</title>
	<link>http://selinux-mac.blogspot.com/2012/12/anatomy-of-selinux-policy-module-dropbox.html</link>
	<content:encoded>I was asked to write a SELinux policy module for Dropbox. For obvious reasons i do not use this user application myself but i was willing to make an exception for the sake of writing a SELinux policy configuration for Dropbox.&lt;br /&gt;&lt;br /&gt;The module was designed for and developed on a Fedora 18 (Beta) system.&lt;br /&gt;&lt;br /&gt;Before i start designing and writing a policy configuration for some application i usually do my home work first. That means reading up on the application as much as i can so that i have an idea what to expect.&lt;br /&gt;&lt;br /&gt;In this case i already had a rough idea about the applications functionality. I was interested in seeing what is installed where and when.&lt;br /&gt;&lt;br /&gt;And so i downloaded and extracted two packages from this location:&lt;br /&gt;&lt;br /&gt;https://www.dropbox.com/install&lt;br /&gt;&lt;br /&gt;I focussed on this package:&lt;br /&gt;&lt;br /&gt;https://dl-web.dropbox.com/u/17/dropbox-lnx.x86_64-1.6.2.tar.gz&lt;br /&gt;&lt;br /&gt;and also had a quick look at this:&lt;br /&gt;&lt;br /&gt;https://www.dropbox.com/download?dl=packages/fedora/nautilus-dropbox-1.4.0-1.fedora.x86_64.rpm&lt;br /&gt;&lt;br /&gt;Basically i downloaded both packages and extracted it to see what was in them.&lt;br /&gt;&lt;br /&gt;The dropbox-lnx.x86_64-1.6.2.tar.gz package is expected to be downloaded to &quot;~&quot;&amp;nbsp; and to be extracted there. It extracts a directory called &quot;.dropbox-dist&quot; with various files in it.&lt;br /&gt;&lt;br /&gt;The installation guide suggests that one runs the &quot;dropboxd&quot; file that is location in the extracted &quot;~/.dropbox-dist&quot;&amp;nbsp; location.&lt;br /&gt;&lt;br /&gt;And so i decided to just try it out.&lt;br /&gt;&lt;br /&gt;As it turns out the dropboxd programs runs another file in that location called &quot;dropbox&quot;. Another file in that directory called &quot;library.zip&quot; turned out to be a &quot;hard link&quot; to &quot; dropbox&quot;. I was also able to identify plenty library files by their &quot;.so&quot; extensions.&lt;br /&gt;&lt;br /&gt;Anyways; A graphical window popped up and presented me with a series of questions. I followed the directions and when i was done the window exited and the process installed two more directories in my home directories called &quot;~/.dropbox&quot; and &quot;~/Dropbox&quot;&amp;nbsp; respectively.&lt;br /&gt;&lt;br /&gt;The &quot; ~/.dropbox&quot;&amp;nbsp; directory has various files that seem to be configuration files of some sorts and the &quot;~/Dropbox&quot; directory is the location that gets synchronized.&lt;br /&gt;&lt;br /&gt;Now i' ve had a rough idea of the locations and the nature of the files that were installed.&lt;br /&gt;&lt;br /&gt;The next step was to think about design.&lt;br /&gt;&lt;br /&gt;Were using the common security models available to us: Role based access control and Type enforcement. The aim is to improve integrity of our processes and files.&lt;br /&gt;&lt;br /&gt;We must also do our best to support as much of the applications functionality as we possibly can.&lt;br /&gt;&lt;br /&gt;We need to maintain a sub-tile balance between usability and security.&lt;br /&gt;&lt;br /&gt;Designing policy configuration for applications that sit on top of a Desktop environment is more complicated than a text application that you can for example run from a console because they usually interact with components on the Desktop environment and operate on files maintained by the these components.&lt;br /&gt;&lt;br /&gt;In a stock Fedora SELinux policy configuration most of the Desktop enviroment is not targeted. The result of this design decision is that components of the Desktop enviroment run with the same attributes and permissions as the user running them.&lt;br /&gt;&lt;br /&gt;For us that means that we either target each Desktop environment component and each file they maintain that Dropbox interacts with, or we allow our targeted Dropbox application to interact with the components operating, and operate on files they maintain, with the attributes and permissions of the user.&lt;br /&gt;&lt;br /&gt;I decided to go with the latter for simplicity.&lt;br /&gt;&lt;br /&gt;With that in mind i set out some humble security goals to achieve:&lt;br /&gt;&lt;br /&gt;1. Protect user application configuration, data and cache files as much as possible.&lt;br /&gt;2. Protect and contain the Dropbox application and process as much as possible.&lt;br /&gt;&lt;br /&gt;What follows now is my current SELinux policy configuration for Dropbox. The nautilus plugin (nautilus-dropbox-1.4.0-1.fedora.x86_64.rpm) is NOT supported. At least not currently.&lt;br /&gt;&lt;br /&gt;This because i refuse to install it because it depends on libgnome which in turn depends on Orbit and Bonobo and i will do just about anything to not have that installed.&lt;br /&gt;&lt;br /&gt;Here is the configuration. Below the configuration i will touch on its properties in detail:&lt;br /&gt;&lt;br /&gt;1. The ~/mydopbox/mydropbox.te Type enforcement source policy file:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;policy_module(mydropbox, 1.0.0)&lt;br /&gt;&lt;br /&gt;attribute dropbox_domain;&lt;br /&gt;&lt;br /&gt;type dropbox_exec_t;&lt;br /&gt;&lt;br /&gt;type dropbox_home_t;&lt;br /&gt;userdom_user_home_content(dropbox_home_t)&lt;br /&gt;&lt;br /&gt;type dropbox_tmp_t;&lt;br /&gt;userdom_user_tmp_content(dropbox_tmp_t)&lt;br /&gt;&lt;br /&gt;type dropbox_tmpfs_t;&lt;br /&gt;userdom_user_tmpfs_content(dropbox_tmpfs_t)&lt;br /&gt;&lt;br /&gt;type dropbox_port_t;&lt;br /&gt;corenet_port(dropbox_port_t)&lt;br /&gt;&lt;br /&gt;allow dropbox_domain self:capability dac_override; # mount&lt;br /&gt;allow dropbox_domain self:netlink_route_socket r_netlink_socket_perms;&lt;br /&gt;allow dropbox_domain self:process { execmem signal };&lt;br /&gt;allow dropbox_domain self:shm create_shm_perms;&lt;br /&gt;allow dropbox_domain self:tcp_socket create_stream_socket_perms;&lt;br /&gt;allow dropbox_domain self:udp_socket create_socket_perms;&lt;br /&gt;&lt;br /&gt;allow dropbox_domain dropbox_home_t:dir manage_dir_perms;&lt;br /&gt;allow dropbox_domain dropbox_home_t:file manage_file_perms;&lt;br /&gt;allow dropbox_domain dropbox_home_t:sock_file manage_sock_file_perms;&lt;br /&gt;userdom_user_home_dir_filetrans(dropbox_domain, dropbox_home_t, dir, &quot;.dropbox&quot;)&lt;br /&gt;&lt;br /&gt;allow dropbox_domain dropbox_tmp_t:file { manage_file_perms mmap_file_perms };&lt;br /&gt;files_tmp_filetrans(dropbox_domain, dropbox_tmp_t, file)&lt;br /&gt;&lt;br /&gt;can_exec(dropbox_domain, dropbox_exec_t)&lt;br /&gt;&lt;br /&gt;kernel_getattr_core_if(dropbox_domain)&lt;br /&gt;&lt;br /&gt;corecmd_exec_shell(dropbox_domain)&lt;br /&gt;&lt;br /&gt;corenet_tcp_bind_generic_node(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_generic_if(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_generic_node(dropbox_domain)&lt;br /&gt;corenet_udp_bind_generic_node(dropbox_domain)&lt;br /&gt;corenet_udp_sendrecv_generic_if(dropbox_domain)&lt;br /&gt;corenet_udp_sendrecv_generic_node(dropbox_domain)&lt;br /&gt;&lt;br /&gt;corenet_sendrecv_http_client_packets(dropbox_domain)&lt;br /&gt;corenet_tcp_connect_http_port(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_http_port(dropbox_domain)&lt;br /&gt;&lt;br /&gt;allow dropbox_domain dropbox_port_t:{ tcp_socket udp_socket } name_bind; # temporary workaround: 17500&lt;br /&gt;&lt;br /&gt;dev_list_sysfs(dropbox_domain)&lt;br /&gt;dev_read_sysfs(dropbox_domain)&lt;br /&gt;dev_read_urand(dropbox_domain)&lt;br /&gt;&lt;br /&gt;dev_dontaudit_getattr_all_blk_files(dropbox_domain) # panic&lt;br /&gt;dev_dontaudit_getattr_all_chr_files(dropbox_domain) # panic&lt;br /&gt;&lt;br /&gt;fs_getattr_tmpfs(dropbox_domain)&lt;br /&gt;fs_getattr_xattr_fs(dropbox_domain)&lt;br /&gt;fs_rw_inherited_tmpfs_files(dropbox_domain) # this is that xserver shm thing&lt;br /&gt;&lt;br /&gt;auth_read_passwd(dropbox_domain)&lt;br /&gt;&lt;br /&gt;init_getattr_initctl(dropbox_domain)&lt;br /&gt;&lt;br /&gt;libs_exec_ldconfig(dropbox_domain)&lt;br /&gt;&lt;br /&gt;mount_exec(dropbox_domain)&lt;br /&gt;mount_manage_pid_files(dropbox_domain) # mount: read/write /run/mount/utab&lt;br /&gt;&lt;br /&gt;sysnet_exec_ifconfig(dropbox_domain)&lt;br /&gt;sysnet_read_config(dropbox_domain)&lt;br /&gt;&lt;br /&gt;userdom_manage_user_home_content_dirs(dropbox_domain)&lt;br /&gt;userdom_manage_user_home_content_files(dropbox_domain)&lt;br /&gt;userdom_mmap_user_home_content_files(dropbox_domain) # libraries in ~/.dropbox-dist&lt;br /&gt;userdom_user_home_dir_filetrans_user_home_content(dropbox_domain, dir) # cannot use named file transition due to random names&lt;br /&gt;userdom_use_user_terminals(dropbox_domain)&lt;br /&gt;&lt;br /&gt;optional_policy(`&lt;br /&gt; dbus_session_bus_client(dropbox_domain) # probably not actually optional&lt;br /&gt; dbus_connect_session_bus(dropbox_domain) # probably not actually optional&lt;br /&gt;')&lt;br /&gt;&lt;br /&gt;optional_policy(`&lt;br /&gt; gnome_read_generic_data_home_dirs(dropbox_domain) # searching ~/.local/share&lt;br /&gt; gnome_read_home_config(dropbox_domain) # ibus, might not be optional&lt;br /&gt;&lt;br /&gt; # hack&lt;br /&gt; gen_require(`&lt;br /&gt;  type config_home_t;&lt;br /&gt; ')&lt;br /&gt;&lt;br /&gt; allow dropbox_domain config_home_t:dir setattr_dir_perms;&lt;br /&gt;')&lt;/pre&gt;&lt;/blockquote&gt;&amp;nbsp;2. The ~/mydopbox/mydropbox.if Interface source policy file:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;Blogspot does not format this content properly: View&lt;span&gt;/Get&lt;/span&gt; it here instead:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;http://pastebin.com/zcfSK2n3&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;## Dropbox is a free service that lets you bring all your photos, docs, and videos anywhere.&lt;br /&gt;&lt;br /&gt;#######################################&lt;br /&gt;## &lt;br /&gt;## The role template for the dropbox module.&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## This template creates a derived domains which are used&lt;br /&gt;## for dropbox applications.&lt;br /&gt;## &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## The prefix of the user domain (e.g., user&lt;br /&gt;## is the prefix for user_t).&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## The role associated with the user domain.&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## The type of the user domain.&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;#&lt;br /&gt;template(`dropbox_role_template',`&lt;br /&gt; gen_require(`&lt;br /&gt;  attribute dropbox_domain;&lt;br /&gt;  type dropbox_exec_t, dropbox_home_t, dropbox_tmpfs_t;&lt;br /&gt; ')&lt;br /&gt;&lt;br /&gt; ########################################&lt;br /&gt; #&lt;br /&gt; # Declarations&lt;br /&gt; #&lt;br /&gt;&lt;br /&gt; type $1_dropbox_t, dropbox_domain;&lt;br /&gt; userdom_user_application_domain($1_dropbox_t, dropbox_exec_t)&lt;br /&gt; role $2 types $1_dropbox_t;&lt;br /&gt;&lt;br /&gt; ########################################&lt;br /&gt; #&lt;br /&gt; # Policy&lt;br /&gt; #&lt;br /&gt;&lt;br /&gt; domtrans_pattern($3, dropbox_exec_t, $1_dropbox_t)&lt;br /&gt;&lt;br /&gt; ps_process_pattern($3, $1_dropbox_t)&lt;br /&gt; allow $3 $1_dropbox_t:process { ptrace signal_perms };&lt;br /&gt;&lt;br /&gt; allow $1_dropbox_t $3:process signull;&lt;br /&gt; allow $1_dropbox_t $3:unix_stream_socket connectto;&lt;br /&gt;&lt;br /&gt; allow $3 dropbox_exec_t:file { manage_file_perms relabel_file_perms };&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;dropbox&quot;)&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;dropboxd&quot;)&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;library.zip&quot;)&lt;br /&gt;&lt;br /&gt; allow $3 dropbox_home_t:dir { manage_dir_perms relabel_dir_perms };&lt;br /&gt; allow $3 dropbox_home_t:file { manage_file_perms relabel_file_perms };&lt;br /&gt; allow $3 dropbox_home_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };&lt;br /&gt; userdom_user_home_dir_filetrans($3, dropbox_home_t, dir, &quot;.dropbox&quot;)&lt;br /&gt;&lt;br /&gt; kernel_read_system_state($1_dropbox_t)&lt;br /&gt;&lt;br /&gt; corecmd_bin_domtrans($1_dropbox_t, $3)&lt;br /&gt;&lt;br /&gt; corenet_all_recvfrom_unlabeled($1_dropbox_t)&lt;br /&gt; corenet_all_recvfrom_netlabel($1_dropbox_t)&lt;br /&gt;&lt;br /&gt; logging_send_syslog_msg($1_dropbox_t) # might want to make this conditional if possible&lt;br /&gt;&lt;br /&gt; optional_policy(`&lt;br /&gt;  dropbox_dbus_chat($1, $3) # probably not actually optional&lt;br /&gt; ')&lt;br /&gt;&lt;br /&gt; optional_policy(`&lt;br /&gt;  xserver_user_x_domain_template($1_dropbox, $1_dropbox_t, dropbox_tmpfs_t) # might not be optional&lt;br /&gt; ')&lt;br /&gt;')&lt;br /&gt;&lt;br /&gt;########################################&lt;br /&gt;## &lt;br /&gt;## Send and receive messages from&lt;br /&gt;## dropbox over dbus.&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## The prefix of the user domain (e.g., user&lt;br /&gt;## is the prefix for user_t).&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;## Domain allowed access.&lt;br /&gt;## &lt;br /&gt;## &lt;br /&gt;#&lt;br /&gt;interface(`dropbox_dbus_chat',`&lt;br /&gt; gen_require(`&lt;br /&gt;  type $1_dropbox_t;&lt;br /&gt;  class dbus send_msg;&lt;br /&gt; ')&lt;br /&gt;&lt;br /&gt; allow $2 $1_dropbox_t:dbus send_msg;&lt;br /&gt; allow $1_dropbox_t $2:dbus send_msg;&lt;br /&gt;')&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&amp;nbsp;3. The ~/mydopbox/mydropbox.fc File contexts source policy file:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;HOME_DIR/\.dropbox(/.*)? gen_context(system_u:object_r:dropbox_home_t,s0)&lt;br /&gt;HOME_DIR/\.dropbox-dist/dropbox(d)? -- gen_context(system_u:object_r:dropbox_exec_t,s0)&lt;br /&gt;HOME_DIR/\.dropbox-dist/library\.zip -- gen_context(system_u:object_r:dropbox_exec_t,s0)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Declaring types, classifying them and making sure that SELinux knows what to label what&lt;br /&gt;&lt;br /&gt;Note that the policy above is the current result. Many of the properties of Dropbox where discovered after studying the contents of the package by trial and error.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;type dropbox_exec_t;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;This is the declaration of the type of the dropbox executable files. Since &quot;library.zip&quot; is a hard link of &quot;dropbox&quot;, we need to make sure that both are labeled identical. The file &quot;dropboxd&quot; is also a Dropbox user application executable file.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;HOME_DIR/\.dropbox-dist/dropbox(d)? -- gen_context(system_u:object_r:dropbox_exec_t,s0)&lt;br /&gt;HOME_DIR/\.dropbox-dist/library\.zip -- gen_context(system_u:object_r:dropbox_exec_t,s0)&lt;/pre&gt;&lt;/blockquote&gt;Above is how we instruct SELinux about where these Dropbox application executable files are located and how they should be labeled.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;type dropbox_home_t;&lt;br /&gt;userdom_user_home_content(dropbox_home_t)&lt;/pre&gt;&lt;/blockquote&gt;This is the declaration of the Dropbox user configuration content located in &quot;~/.dropbox&quot; as well as the interface call that classifies the type as &quot; user home content&quot;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;HOME_DIR/\.dropbox(/.*)? gen_context(system_u:object_r:dropbox_home_t,s0)&lt;/pre&gt;&lt;/blockquote&gt;Here we tell SELinux that the ~/.dropbox directory and everything in it should be labeled with type &quot;dropbox_home_t&quot; which is the Dropbox user home content type.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;type dropbox_tmp_t;&lt;br /&gt;userdom_user_tmp_content(dropbox_tmp_t)&lt;/pre&gt;&lt;/blockquote&gt;Dropbox maintains a file in &quot; $TMP&quot;. Here we declare a type &quot;dropbox_tmp_t&quot; for this file and we classify this file &quot;user tmp content&quot; by calling the &quot;userdom_user_tmp_content() interface with the &quot;dropbox_tmp_t&quot; file type parameter.&lt;br /&gt;&lt;br /&gt;SELinux does not have to be aware of the location of the file in &quot;$TMP&quot; since for reason that i will not touch on in this article it should not maintain any contexts in &quot;$TMP&quot;. Hence there is no entry for this in the &quot;~/mydropbox/mydropbox.fc&quot;&amp;nbsp; file.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;type dropbox_tmpfs_t;&lt;br /&gt;userdom_user_tmpfs_content(dropbox_tmpfs_t)&lt;/pre&gt;&lt;/blockquote&gt;Dropbox opens a GTK window when you first run it to guide you through the installation process. Dropbox also has i icon in the taskbar that opens a settings window if you select it. The result is that Dropbox interacts with X server and operates on content maintained by X server.&lt;br /&gt;&lt;br /&gt;For this we have to declare a type for Dropbox shared memory in &quot;/dev/shm&quot;. We classify this type &quot;user tmpfs content&quot;.&lt;br /&gt;&lt;br /&gt;There is no need to specificy a file context for this content as SELinux should not maintain file contexts in this locations for the same reasons as it should not maintain them in &quot;$TMP&quot;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;type dropbox_port_t;&lt;br /&gt;corenet_port(dropbox_port_t)&lt;/pre&gt;&lt;/blockquote&gt;Dropbox listens on the UDP and TCP network for connections on port 17500. We Declare a type for this port object and classify the type &quot;corenet_port&quot;. This will allow us to tell SELinux that Dropbox may only bind TCP and UDP sockets to ports that are classified &quot;dropbox_port_t&quot;.&lt;br /&gt;&lt;br /&gt;Ports are not files and thus their contexts should not be specified in the file context file (~/mydropbox/mydropbox.fc).&lt;br /&gt;&lt;br /&gt;Instead we need to , after we installed the policy module package, manually label the 17500 UDP and TCP ports type &quot;dropbox_port_t&quot;&lt;br /&gt;&lt;br /&gt;This is done by issuing the following command:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;semanage port -a -t dropbox_port_t -p tcp 17500&lt;br /&gt;semanage port -a -t dropbox_port_t -p udp 17500 &lt;/blockquote&gt;You may have noticed that we have not yet classified our &quot; dropbox_exec_t&quot; user application executable file type.&lt;br /&gt;&lt;br /&gt;You may also have notices that we have not yet declared and classified a type for the Dropbox process.&lt;br /&gt;&lt;br /&gt;This is because of the properties of this application and it is also related to my design decision.&lt;br /&gt;&lt;br /&gt;Dropbox runs Nautilus and Firefox on your behalf to open your &quot;~/Dropbox&quot;&amp;nbsp; location and to direct you to the &quot;www.dropbox.com&quot;&amp;nbsp; website respectively.&lt;br /&gt;&lt;br /&gt;These two applications are currently not targeted in Fedora and i have decided to not do that either.&lt;br /&gt;&lt;br /&gt;How can we tell SELinux that if Dropbox runs Nautilus or Firefox that it does that on behalf of the user and that SELinux thus should run these two applications with the attributes and permissions of the user rather than the attributes and permission of Dropbox?&lt;br /&gt;&lt;br /&gt;This requires that we create a template because not all SELinux users are created equal. We need to use the &quot;user role prefix&quot; to declare a derived Dropbox process type. This will allow use to create rules that specify with which attributes and permissions Dropbox should run Nautilus and Firefox.&lt;br /&gt;&lt;br /&gt;This is done in a template called &quot;dropbox_role_template&quot; that i have created in the &quot;~/mydropbox/mydropbox.if&quot;&amp;nbsp; interface file.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; type $1_dropbox_t, dropbox_domain;&lt;br /&gt; userdom_user_application_domain($1_dropbox_t, dropbox_exec_t)&lt;br /&gt; role $2 types $1_dropbox_t;&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt;&lt;/blockquote&gt;The above declares a derived dropbox process type &quot;$1_dropbox_t&quot; where &quot;$1&quot;&amp;nbsp; is the &quot;user role prefix&quot;. It then goes on to classify this process &quot;dropbox_domain&quot;&amp;nbsp; This is done by assigning it a &quot;type attribute&quot;&amp;nbsp; that we i declared in the &quot;~/mydropbox/mydropbox.te&quot;&amp;nbsp; type enforcement file. You can find it on top, right below the policy module declaration.&lt;br /&gt;&lt;br /&gt;Next we classify both the Dropbox process type as well as the Dropbox user application executable file type &quot;user application domain&quot;. This interface has all the permissions needed to classify our process type &quot;user application process&quot; and our application executable file &quot;user application executable file&quot;.&lt;br /&gt;&lt;br /&gt;The last rule is a &quot;Role based access control&quot;&amp;nbsp; rule that allows the &quot;calling&quot; role access to the prefixed Dropbox type.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Policy.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;domtrans_pattern($3, dropbox_exec_t, $1_dropbox_t)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This rule is a domain transition rule, or if you like &quot;process type transition rule&quot;. It tells SELinux that the &quot;calling&quot; user process type should transition to the derived Dropbox process type when it runs the Dropbox user application executable file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; ps_process_pattern($3, $1_dropbox_t)&lt;br /&gt; allow $3 $1_dropbox_t:process { ptrace signal_perms };&lt;/pre&gt;&lt;br /&gt;The above rules allow the calling user process type to &quot;ps&quot; processes labeled with the derived Dropbox process type as well as ptrace it and send all signals to it.&lt;br /&gt;&lt;pre&gt;logging_send_syslog_msg($1_dropbox_t) &lt;/pre&gt;&lt;br /&gt;This will allow Dropbox to for example show up in &quot;top&quot;, &quot; ps x&quot;&amp;nbsp; and it allows you to &quot;strace&quot;, kill etc. the Dropbox process.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; allow $1_dropbox_t $3:process signull;&lt;br /&gt; allow $1_dropbox_t $3:unix_stream_socket connectto;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Here are some interesting rules. The first allows the derived Dropbox process type to send null signals to the calling user process type and the second one allows the derived Dropbox process type to connect to the calling user process type with a unix domain stream socket.&lt;br /&gt;&lt;br /&gt;The processes here labeled with the &quot;calling user process types&quot;&amp;nbsp; aren' t actually the calling user. These are for example Nautilus or Firefox. Since we decided not to target them they are labeled with the &quot; calling user process type&quot;.&lt;br /&gt;&lt;br /&gt;In this case Dropbox probably wants to see if Nautilus is already running, and Dropbox probably wants to communicate with Nautilus using a unix domain stream socket.&lt;br /&gt;&lt;br /&gt;These rules are problematic because they are coarse. You can't tell by just looking at these rules who &quot;$3&quot; or if you will the process labeled with the &quot;calling user process type&quot; really is. Is it Nautilus or is it Firefox? Maybe it another process that currently is not targeted.&lt;br /&gt;&lt;br /&gt;Basically it allows Dropbox to send null signals and talk using a unix domain stream socket to any application currently not targeted labeled with the &quot;calling user process type&quot;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; allow $3 dropbox_exec_t:file { manage_file_perms relabel_file_perms };&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;dropbox&quot;)&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;dropboxd&quot;)&lt;br /&gt; userdom_user_home_content_filetrans($3, dropbox_exec_t, file, &quot;library.zip&quot;)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These rules allow processes labeled with the &quot; calling user process type&quot; to &quot;manage and relabel&quot;&amp;nbsp; files labeled with the dropbox use application executable type &quot; dropbox_exec_t&quot;.&lt;br /&gt;&lt;br /&gt;Users need to be able to manage and relabel content in their home directory as they own it.&lt;br /&gt;&lt;br /&gt;The other three rules are interesting as well. They use a pretty new feature called &quot;named file type transitions&quot;,&lt;br /&gt;&lt;br /&gt;These rules tell SELinux that if a process labeled with the &quot; calling user process type&quot; create files with named &quot;dropbox, dropboxd and library.zip&quot;&amp;nbsp; in directories that are labeled with the user home content type &quot;user_home_t&quot; that the files should be created with the dropbox user application executable file type &quot;dropbox_exec_t&quot;.&lt;br /&gt;&lt;br /&gt;This is a important rule because proper labelling of files is of vital importance to the integrity of SELinux policy enforcement.&lt;br /&gt;&lt;br /&gt;When you extract the&amp;nbsp; &quot;dropbox-lnx.x86_64-1.6.2.tar.gz&quot;&amp;nbsp; into you home directory, this rule ensure that the Dropbox executable files automatically get the right security context.&lt;br /&gt;&lt;br /&gt;The file context specification for these files that we added to &quot; ~/mydropbox/mydropbox.fc&quot;&amp;nbsp; ensure that if restorecon gets run on any and all of these files that they will stay labeled properly.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; allow $3 dropbox_home_t:dir { manage_dir_perms relabel_dir_perms };&lt;br /&gt; allow $3 dropbox_home_t:file { manage_file_perms relabel_file_perms };&lt;br /&gt; allow $3 dropbox_home_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };&lt;br /&gt; userdom_user_home_dir_filetrans($3, dropbox_home_t, dir, &quot;.dropbox&quot;) &lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;The same applies to the above except that this applies to Dropbox user home content and it applies to files, directories and sock files.&lt;br /&gt;&lt;br /&gt;The named file transtion rule dictates that SELinux should make sure that processes with the calling user process type create directories with the name &quot;.dropbox&quot; in directories with type &quot;user_home_dir_t&quot; (~) with type &quot;dropbox_home_t&quot;.&lt;br /&gt;&lt;br /&gt;Note: I should probably allow allow processes with the calling process type to manage and relabel files with type dropbox_tmp_t as well dropbox_tmpfs_t. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; kernel_read_system_state($1_dropbox_t)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This rule allows the derived Dropbox process type to read generic system state files in &quot;/proc&quot;, like for example &quot;/proc/meminfo&quot;.&lt;br /&gt;&lt;br /&gt;We added this rule (and some other rules that would normally go into the type enforcement file) here because it uses type attributes and were also using our &quot;dropbox_domain&quot; type attribute in our type enforcement file to write rules.&lt;br /&gt;&lt;br /&gt;One can only assign type attribute to types. You cannot assign a type attribute to a type attribute and thus we decided to deal with this in this manner.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;corecmd_bin_domtrans($1_dropbox_t, $3)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This is the rule that caused me to implement the &quot;dropbox_role_template&quot; template.&lt;br /&gt;&lt;br /&gt;It is what enables us to tell SELinux that dropbox should run application that are not targeted with the &quot;calling user process type&quot;.&lt;br /&gt;&lt;br /&gt;Basically it dictates that when the derived Dropbox process type runs a file with the generic &quot;bin_t&quot;&amp;nbsp; &quot;core command executable type&quot; that the process type should transition from &quot;$1_dropbox_t&quot; (the derived Dropbox process type) to &quot;$3&quot; ( the calling user process type)&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; corenet_all_recvfrom_unlabeled($1_dropbox_t)&lt;br /&gt; corenet_all_recvfrom_netlabel($1_dropbox_t)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These rules allow the derived Dropbox process type to recv from all unlabeled and netlabel network connections.&lt;br /&gt;&lt;br /&gt;It is basically a rule that effectivily disabled SELinux network controls enforcement.&lt;br /&gt;&lt;br /&gt;These rules are here because again they use type attributes and one cannot assign type attributes to type attributes. That means we cannot use our &quot;dropbox_domain&quot;&amp;nbsp; attribute to call these in our ~/mydropbox/mydropbox.te&quot; file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;logging_send_syslog_msg($1_dropbox_t) &lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This rule allows the prefixed Dropbox process type to send messages to syslog. Same as above it uses type attributes and so i had to add it here instead of in the type enforcement file.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;pre&gt; optional_policy(`&lt;br /&gt;  dropbox_dbus_chat($1, $3) # probably not actually optional&lt;br /&gt; ')&lt;/pre&gt;&lt;/blockquote&gt;This allows the derived dropbox process type to communicate using DBUS with processes that are labeled with the &quot;calling user process type&quot;. Probably Nautilus or some Gnome Desktop environment compoment like GVFS.&lt;br /&gt;&lt;br /&gt;Since None of them are targeted we are forced to allow the prefixed dropbox process type to communicate using DBUS with any process as long as its labeled with the &quot;calling user process type&quot;.&lt;br /&gt;&lt;br /&gt;We could have used raw policy to write these rules here but since DBUS is a &quot;object manager&quot; and also since its good to have a &quot; dropbox_dbus_chat&quot; interface we decide to create one (you can find it below the &quot;dropbox_role_template&quot; template in &quot;~/mydropbox/mydropbox.if&quot; and to call it in our own module.&lt;br /&gt;&lt;br /&gt;The &quot;optional_policy&quot; block indicates that this module does not actually depend on the rule in the block. I was assuming that Dropbox does not depend on the presence of DBUS but i may well be mistaken.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt; optional_policy(`&lt;br /&gt;  xserver_user_x_domain_template($1_dropbox, $1_dropbox_t, dropbox_tmpfs_t) # might not be optional&lt;br /&gt; ')&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This rule allows the derived Dropbox process type to interact with X server and to operate on files maintained by X server. It also makes our &quot;dropbox_tmpfs_t&quot; &quot;user tmpfs content&quot; available for use with X server.&lt;br /&gt;&lt;br /&gt;I was under the impression that Dropbox does not depend on X server since on their website they claim that Dropbox works on &quot;any Linux server&quot; but again i may be mistaken.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;allow dropbox_domain self:capability dac_override; # mount&lt;br /&gt;allow dropbox_domain self:netlink_route_socket r_netlink_socket_perms;&lt;br /&gt;allow dropbox_domain self:process { execmem signal };&lt;br /&gt;allow dropbox_domain self:shm create_shm_perms;&lt;br /&gt;allow dropbox_domain self:tcp_socket create_stream_socket_perms;&lt;br /&gt;allow dropbox_domain self:udp_socket create_socket_perms;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These are what i call &quot; self-rules&quot;. Basically rules where a source process labeled with a process type interacts with or operates on itself.&lt;br /&gt;&lt;br /&gt;The first rule allow any Dropbox process type the &quot;dac_override&quot;&amp;nbsp; capability. This capability is needed to override discretionary access controls.&lt;br /&gt;&lt;br /&gt;Dropbox runs the mount command with the derived Dropbox process type (rather than with a process type transition) which is a setuid command.&lt;br /&gt;&lt;br /&gt;When the command is run your shell sessions current &quot;pwd&quot; is probably &quot;~/.dropbox-dist&quot;&amp;nbsp; since thats where you run dropboxd from. The root Linux user does (or might not) have access to that location as &quot; $HOME&quot;&amp;nbsp; might have the &quot;0700&quot; attibutes. The &quot;dac_override&quot;&amp;nbsp; access vector permission allow the process type to access it anyway from a SELinux perspective.&lt;br /&gt;&lt;br /&gt;The second rule is probably to read the routing table. Dropbox is a network application and so i am not surprised that it needs these permissions.&lt;br /&gt;&lt;br /&gt;The third rule allows all Dropbox process types to &quot;execute anonymous memory&quot;, Basically memory that is world writable. It is usually a sign of bad programming practices but there are also legitimate use cases such as &quot;just in time compiling&quot;. This rule also allows Dropbox process types to send generic signals to itself.&lt;br /&gt;&lt;br /&gt;The fourth rule allows Dropbox processes to create shared memory. This is for X server interaction and is related to the &quot; dropbox_tmpfs_t&quot;&amp;nbsp; &quot;user_tmpfs_content&quot;&amp;nbsp; type.&lt;br /&gt;&lt;br /&gt;The fifth and the sixth rule allows dropbox and any other process labeled with any dropbox process type to create tcp stream sockets and udp sockets. This is needed because Dropbox is listening on the network for connections (port udp/tcp 17500 dropbox_port_t)&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;allow dropbox_domain dropbox_home_t:dir manage_dir_perms;&lt;br /&gt;allow dropbox_domain dropbox_home_t:file manage_file_perms;&lt;br /&gt;allow dropbox_domain dropbox_home_t:sock_file manage_sock_file_perms;&lt;br /&gt;userdom_user_home_dir_filetrans(dropbox_domain, dropbox_home_t, dir, &quot;.dropbox&quot;)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These rules allow all Dropbox process types to &quot;manage&quot;&amp;nbsp; directories, files and sock files that are labeled with the &quot;dropbox_home_t&quot; &quot; user home content type&quot;. This is configuration content amongst other things. Stuff that could use protecting to ensure optimal integrity.&lt;br /&gt;&lt;br /&gt;The fourth rule is another named file type transition rule. It dictates that if any dropbox process type creates a directory with name &quot;.dropbox&quot;&amp;nbsp; in directories with type &quot; user_home_dir_t&quot;&amp;nbsp; which is &quot;~&quot;&amp;nbsp; that the directory be created with the &quot;dropbox_home_t&quot; type. Thus file transitioning from &quot;user_home_dir_t&quot; to &quot;dropbox_home_t&quot;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;allow dropbox_domain dropbox_tmp_t:file { manage_file_perms mmap_file_perms };&lt;br /&gt;files_tmp_filetrans(dropbox_domain, dropbox_tmp_t, file)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Dropbox maintains a file in &quot;$TMP&quot; with a random name. It also &quot;mmaps&quot; that file. The second rule dictates that if any Dropbox process type creates a file in a directory with type &quot; tmp_t&quot; that the file is created with the &quot; dropbox_tmp_t&quot;&amp;nbsp; &quot; user_tmp_content&quot; type. Since this file has a random name i have to use a regular file type transition and i cannot use a named file type transition.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;can_exec(dropbox_domain, dropbox_exec_t)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;The dropboxd process executes the dropbox &quot;user application executable file&quot;&amp;nbsp; Both dropboxd as well as dropbox are labeled with the &quot; dropbox_exec_t&quot;&amp;nbsp; type. This rule allows all Dropbox process types to execute files with the dropbox_exec_t type without a process type transition.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;&lt;pre&gt;kernel_getattr_core_if(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;I am not sure why but Dropbox wants to get attribute of the core if file in &quot;/proc&quot;. Fine.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;corecmd_exec_shell(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This rule allows all Dropbox process types to run a shell without a process type transition.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;corenet_tcp_bind_generic_node(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_generic_if(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_generic_node(dropbox_domain)&lt;br /&gt;corenet_udp_bind_generic_node(dropbox_domain)&lt;br /&gt;corenet_udp_sendrecv_generic_if(dropbox_domain)&lt;br /&gt;corenet_udp_sendrecv_generic_node(dropbox_domain)&lt;br /&gt;&lt;br /&gt;corenet_sendrecv_http_client_packets(dropbox_domain)&lt;br /&gt;corenet_tcp_connect_http_port(dropbox_domain)&lt;br /&gt;corenet_tcp_sendrecv_http_port(dropbox_domain)&lt;br /&gt;&lt;br /&gt;allow dropbox_domain dropbox_port_t:{ tcp_socket udp_socket } name_bind; # temporary workaround: 17500&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Network related rules. The first block of rules are &quot;generic&quot; in the sense that it basically does not support the use of the SELinux network controls. Or it supports them in the most generic way.&lt;br /&gt;&lt;br /&gt;The second block allows all dropbox process types to connect to TCP ports that are labeled with the &quot;httpd_port_t&quot;&amp;nbsp; port type. Dropbox connects to &quot;tcp:443&quot; (their Dropbox web application). It allow Dropbox to send and receive client packets that are labeled with the httpd packet type and it allows Dropbox to send and receive traffic from http classified ports.&lt;br /&gt;&lt;br /&gt;The last rule of the bunch allows all dropbox process types to bind TCP and UDP sockets to ports that are labeled with the &quot;dropbox_port_t&quot;&amp;nbsp; port type. We labeled UDP/TCP 17500 with that type.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;dev_list_sysfs(dropbox_domain)&lt;br /&gt;dev_read_sysfs(dropbox_domain)&lt;br /&gt;dev_read_urand(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Above allows all Dropbox process types to list directories with the generic &quot;sysfs_t&quot; type. This is generic content in &quot;/sys&quot;. The second rule allow Dropbox to actually read files with this type.&lt;br /&gt;&lt;br /&gt;The third rule allows all Dropbox process types to read character device nodes with &quot;urandom_device_t&quot; device node type. E.g. /dev/urandom.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;dev_dontaudit_getattr_all_blk_files(dropbox_domain) # panic&lt;br /&gt;dev_dontaudit_getattr_all_chr_files(dropbox_domain) # panic&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&quot;Dontaudit&quot; is a access vector that tells SELinux to silently block a specified interaction or operation.&lt;br /&gt;&lt;br /&gt;In the above case we silently deny any Dropbox process type to get attributes of all block and character files that are classified &quot;device_node&quot;.&lt;br /&gt;&lt;br /&gt;To expose &quot; hidden denials&quot; one needs to issue the &quot;semodule -DB&quot;&amp;nbsp; command which will build the policy database without any &quot; dontaudit&quot; rules. To reinsert the &quot;dontaudit&quot; rules simply issue 'semodule -B&quot;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;fs_getattr_tmpfs(dropbox_domain)&lt;br /&gt;fs_getattr_xattr_fs(dropbox_domain)&lt;br /&gt;fs_rw_inherited_tmpfs_files(dropbox_domain) # this is that xserver shm thing &lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This allow all Dropbox process types to get attributes of filesystems with the &quot;tmpfs_t&quot;&amp;nbsp; filesystem type. This a common access vector for processes that maintain content in the &quot; /dev/shm&quot;&amp;nbsp; location.&lt;br /&gt;&lt;br /&gt;The second rule allow any Dropbox process type to get attribute of any filesystem that supports extended attributes. E.g. types that are classified &quot;filesystem type&quot; as well as &quot;Extended attribute file system&quot;. This is to allow Dropbox to stat &quot;/&quot;&amp;nbsp; which is a common thing to do.&lt;br /&gt;&lt;br /&gt;The Third rule is related to X server interaction. I am not sure why it is the way it is but it has been this way for as long as i can remember. Inherited means that it doesnt actually opens the &quot;generic tmpfs&quot; file but it still reads and writes it. That means that either Dropbox got passed a open file or that there is a leaked file descriptor. Since, if i remember correctly , things will break if you do not allow this, i assume that X server or whatever passed the open file to Dropbox and dropbox reads and write it.&lt;br /&gt;&lt;br /&gt;Note that the file is not labeled with the &quot;dropbox_tmpfs_t&quot;&amp;nbsp; &quot;user tmpfs content&quot; file type either. Instead it is labeled with a generic type for content in &quot;/dev/shm&quot;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;auth_read_passwd(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Allow all Dropbox process types to read files with the passwd_file_t file type. E.g. &quot;/etc/passwd&quot; amongst others.&lt;br /&gt;&lt;br /&gt;This could simply be a side effect from Dropbox running a bash shell. The shell needs to read the password file in order to get the information needed for the shell prompt (user name etc.)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;init_getattr_initctl(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Get attributes of initctl (named pipe i believe it was)&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;libs_exec_ldconfig(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Execute ldconfig program without a process type transition. It probably runs ldconfig on that file it maintains in &quot;$TMP&quot;&amp;nbsp; that it also mmaps.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;mount_exec(dropbox_domain)&lt;br /&gt;mount_manage_pid_files(dropbox_domain) # mount: read/write /run/mount/utab&lt;/pre&gt;&lt;/blockquote&gt;Execute the mount command without a process type transition. Not sure what it does with mount. &lt;br /&gt;&lt;br /&gt;Mount reads and write /run/mount/utab which is labeled with the mount pid file type.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;sysnet_exec_ifconfig(dropbox_domain)&lt;br /&gt;sysnet_read_config(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Executes ifconfig command without a process type transition and read files that are classified network configuration files (net_conf_t) This is probably &quot;/etc/resolve.conf&quot;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;userdom_manage_user_home_content_dirs(dropbox_domain)&lt;br /&gt;userdom_manage_user_home_content_files(dropbox_domain)&lt;br /&gt;userdom_mmap_user_home_content_files(dropbox_domain) # libraries in ~/.dropbox-dist&lt;br /&gt;userdom_user_home_dir_filetrans_user_home_content(dropbox_domain, dir) # cannot use named file transition due to random names&lt;br /&gt;userdom_use_user_terminals(dropbox_domain)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These are interesting. These rules allow all dropbox process types to operate on content maintained by processes labeled with the user process type.&lt;br /&gt;&lt;br /&gt;In some cases this is bad news but in our case we will have to embrace it.&lt;br /&gt;&lt;br /&gt;Here is why&lt;br /&gt;&lt;br /&gt;The first two rules allow all Dropbox process types to manage directories and files that are labeled with the generic user home content type (user_home_t)&lt;br /&gt;&lt;br /&gt;I decided to keep &quot;~/Dropbox&quot; location generic. The idea of Dropbox is that users can &quot;drag and drop&quot;&amp;nbsp; content in there to synchronise with the Dropbox. Usually that is program Photos (~/Pictures), documents (~/Documents), maybe tunes (~/Audio or ~/Music). These locations should be generic since they are not related to any single user application.&lt;br /&gt;&lt;br /&gt;&quot;Drag and dropping&quot;&amp;nbsp; equals &quot;moving&quot; if done on a single partition. When you move a file you also move its context and so we want &quot;~/Dropbox&quot; to have the same type as the content that is expected to be dropped in there.&lt;br /&gt;&lt;br /&gt;If a user is stupid enough to drop his &quot; ~/.gnupg&quot; or &quot;~/.ssh&quot; directory into the &quot;~/Dropbox&quot; then the dropbox process type will not be able to access that content. E.g. it wont be able to synchronize your sensitive files.&lt;br /&gt;&lt;br /&gt;Unless ofcourse if you really want it to. In that case you would first manually relabel the content to the generic user home content type (user_home_t) with the &quot;chcon&quot; command and them drop it into your Dropbox.&lt;br /&gt;&lt;br /&gt;So leaving &quot;~/Dropbox&quot; type &quot;user_home_t&quot;&amp;nbsp; and allowing Dropbox to manage files and directories with the &quot;user_home_t&quot;&amp;nbsp; seems to me the sensible thing to do here.&lt;br /&gt;&lt;br /&gt;The third rule is a bit more controversial. The&amp;nbsp; Dropbox archive copies library files into ~/.dropbox-dist. I decided to only give &quot;dropboxd, dropbox and library.zip&quot;&amp;nbsp; in there a private type for simplicitly but the side effect is the now all dropbox process types need to mmap generic user home content files (the libraries).&lt;br /&gt;&lt;br /&gt;The fourth rule is a file type transition rule. The Dropbox installed creates &quot;~/Dropbox&quot; which we want to have type &quot;user_home_t&quot;. But this location has a fixed name so we could have used a named file transition rather than a normal file transition. However during installation Dropbox also create a directory in &quot;~&quot;&amp;nbsp; with a random name andso we could not use a named file type transition for that anyways, and so it was decided to use this rule&lt;br /&gt;&lt;br /&gt;Basically it dictates that if any Dropbox process type creates a directory in a directory with type &quot;user_home_dir_t&quot;&amp;nbsp; (~) that the directory should be created with the &quot;user_home_t&quot; generic user home content type.&lt;br /&gt;&lt;br /&gt;The fifth rule allows any dropbox process type to &quot;use&quot;&amp;nbsp; user terminals. This will allow Dropbox to print any messages to the terminal when you run &quot;./dropboxd&quot;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;optional_policy(`&lt;br /&gt; dbus_session_bus_client(dropbox_domain) # probably not actually optional&lt;br /&gt; dbus_connect_session_bus(dropbox_domain) # probably not actually optional&lt;br /&gt;')&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This will allow anydropbox domain to become a DBUS session bus client and to aquire service on the session bus. Since i was under the assumption that DBUS is not a requirement for Dropbox i wrapped these rules in a &quot;optional_policy&quot;&amp;nbsp; block that basically tells the policy compiler that these rules are optional. E.g. if they are not available for use then do not sweat it and proceed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;optional_policy(`&lt;br /&gt; gnome_read_generic_data_home_dirs(dropbox_domain) # searching ~/.local/share&lt;br /&gt; gnome_read_home_config(dropbox_domain) # ibus, might not be optional&lt;br /&gt;&lt;br /&gt; # hack&lt;br /&gt; gen_require(`&lt;br /&gt;  type config_home_t;&lt;br /&gt; ')&lt;br /&gt;&lt;br /&gt; allow dropbox_domain config_home_t:dir setattr_dir_perms;&lt;br /&gt;')&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;These rules are related to content in X desktop (XDG) standard locations. Basically all Dropbox process types need to be able to read IBUS files in &quot;~/.config&quot; These IBUS files are labeled with the generic &quot;config_home_t&quot;&amp;nbsp; user home content type.&lt;br /&gt;&lt;br /&gt;Dropbox is probably using some Gnome library that does this on behalf of Dropbox. It also wants to set attributes of generic &quot;config_home_t&quot;&amp;nbsp; directories and search generic &quot;data_home_t&quot;&amp;nbsp; directories (~/.local/share).&lt;br /&gt;&lt;br /&gt;Okay... I think i touched on everything now, except...&lt;br /&gt;&lt;br /&gt;How to actually implement this policy&lt;br /&gt;&lt;br /&gt;Create a working directory and change directory into it:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;mkdir ~/mydropbox; cd ~/mydropbox;&lt;/blockquote&gt;Create three &quot;mydropbox&quot;&amp;nbsp; source policy files:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;touch mydropbox.{te,if,fc}&lt;/blockquote&gt;Copy the policy above in their respective files&lt;br /&gt;&lt;br /&gt;Next, create another file:&lt;br /&gt;&lt;br /&gt;touch myunconfineduser.te&lt;br /&gt;&lt;br /&gt;and paste the following in that file:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre&gt;policy_module(myunconfineduser, 1.0.0)&lt;br /&gt;&lt;br /&gt;gen_require(`&lt;br /&gt; type unconfined_t;&lt;br /&gt; role unconfined_r;&lt;br /&gt;')&lt;br /&gt;&lt;br /&gt;dropbox_role_template(unconfined, unconfined_r, unconfined_t)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;This is what actually calls or if you will activates the &quot;dropbox_role_template()&quot;&amp;nbsp; that i have created in the &quot;~/mydropbox/mydropbox.if&quot;&amp;nbsp; interface file.&lt;br /&gt;&lt;br /&gt;Now build the two policy packages. You may or may not need to install the &quot;selinux-policy-devel&quot;&amp;nbsp; package for this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Make -f /usr/share/selinux/devel/Makefile&lt;/blockquote&gt;&lt;br /&gt;Next install the policy packages that were created in &quot;~/mydropbox&quot;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;sudo semodule -i mydropbox.pp myunconfineduser.pp&lt;/blockquote&gt;&lt;br /&gt;If you have already installed Dropbox then make sure to restore the context of the &quot;~/.dropbox&quot; directories and the &quot;dropboxd, dropbox and library.zip&quot;&amp;nbsp; files in &quot;~/.dropbox-dist&quot;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;restorecon -R -v -F ~ &lt;/blockquote&gt;If you have not yet installed Dropbox:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre class=&quot;command-line&quot;&gt;cd ~ &amp;amp;&amp;amp; wget -O - &quot;https://www.dropbox.com/download?plat=lnx.x86_64&quot; | tar xzf -&lt;/pre&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;pre class=&quot;command-line&quot;&gt;~/.dropbox-dist/dropboxd&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;b&gt;Disclaimer:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;I do not encourage nor endorse the use of Dropbox. Security means taking responsibility. Do not trust your content to third parties. &lt;/b&gt;</content:encoded>
	<dc:date>2012-12-01T10:17:35+00:00</dc:date>
	<dc:creator>Dominick &quot;domg472&quot; Grift (noreply@blogger.com)</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/61349.html">
	<title>Dan Walsh: Using Apache and SELinux Together</title>
	<link>http://danwalsh.livejournal.com/61349.html</link>
	<content:encoded>A few months ago, I wrote an article on &lt;a href=&quot;http://drupalwatchdog.com/2/2/apache-selinux&quot; rel=&quot;nofollow&quot;&gt;&amp;quot;Using Apache and SELinux Together&amp;quot;&lt;/a&gt; for DrupalWatchDog Magazine.&amp;nbsp; They publish it first in hard copy, and then after a couple of months publish it on line.&amp;nbsp; Here is a link to the online version.&lt;br /&gt;&lt;br /&gt;http://drupalwatchdog.com/2/2/apache-selinux&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-11-01T17:42:31+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/61107.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 8: Introducing sepolicy generate</title>
	<link>http://danwalsh.livejournal.com/61107.html</link>
	<content:encoded>&lt;b&gt;sepolgen&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;sepolgen is the tool that I recommend people use to start generating policy.&amp;nbsp; We have decided to merge this tool into the sepolicy suite&lt;br /&gt;&lt;br /&gt;&lt;b&gt;sepolicy generate&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man sepolicy-generate&lt;br /&gt;&lt;br /&gt;sepolicy-generate(8)&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;&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-generate(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-generate - Generate an initial SELinux policy module template.&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy generate [-h] [-t TYPE] [-n NAME] [-T TEST] [ command | confineduser ]&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Use sepolicy generate to generate an SELinux policy Module.&amp;nbsp; sepolicy generate will generate 4 files.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type Enforcing File NAME.te&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This file can be used to define all the types rules for a particular domain.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Interface File NAME.if&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This file defines the interfaces for the types generated in the te file, which can be used by other policy domains.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File Context NAME.fc&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This&amp;nbsp; file defines the default file context for the system, it takes the file types created in the te file and associates file paths to the types.&amp;nbsp; Tools like restorecon and RPM will use these paths to put down labels.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RPM Spec File NAME_selinux.spec&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This file is an RPM SPEC file that can be used to install the SELinux policy on to machines and setup the labelling. The spec file also installs the interface file&amp;nbsp; and&amp;nbsp; a&amp;nbsp; man page describing the policy.&amp;nbsp; You can use sepolicy manpage -d NAME to generate the man page.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Shell File NAME.sh&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This&amp;nbsp; is a helper shell script to compile, install and fix the labelling on your test system.&amp;nbsp; It will also generate a man page based on the installed policy, and compile and&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; build an RPM suitable to be installed on other machines&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If a generate is possible, this tool will print out all generate paths from the source domain to the target domain&lt;br /&gt;&lt;br /&gt;OPTIONS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -h, --help&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; Display help message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -t, --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; Specify the type of policy you want to create.&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; Valid Options:&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; 0 : Standard Init Daemon (Default)&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; 1 : DBUS System Daemon&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; 2 : Internet Services Daemon&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; 3 : Web Application/Script (CGI)&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; 4 : User Application&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; 5 : Sandbox&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; 6 : Minimal Terminal User Role&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; 7 : Minimal X Windows User Role&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; 8 : User Role&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; 9 : Admin User Role&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; 10 : Root Admin User Role&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -n, --name&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; Specify alternate name of policy. The policy will default to the executable or name specified.&lt;br /&gt;&lt;br /&gt;EXAMPLE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy generate /usr/sbin/rwhod&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Generating Policy for /usr/sbin/rwhod named rwhod&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Created the following files in:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rwhod.te # Type Enforcement file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rwhod.if # Interface file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rwhod.fc # File Contexts file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rwhod_selinux.spec # Spec file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rwhod.sh # Setup Script&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;sepolicy generate has some nice new features over sepolgen.&lt;ol&gt;&lt;li&gt;&lt;span&gt;sepolicy generate&lt;/span&gt; does not to be run as root.&lt;/li&gt;&lt;li&gt;&lt;span&gt;sepolicy generate&lt;/span&gt; now generates a RPM spec file. This spec file can be used to build and RPM package that will install the policy package file (pp) and interface file (if) in the correct location, install it into the kernel and fix the labelling.&lt;/li&gt;&lt;li&gt;The &lt;span&gt;sepolicy generate&lt;/span&gt;d setup script&amp;nbsp;continues to install the policy and setup the labelling, and also generates a man page based on the installed policy using &lt;span&gt;sepolicy manpage&lt;/span&gt;, finally it build and compiles the policy and man page into an rpm ready to be installed on other machines.&lt;/li&gt;&lt;/ol&gt;selinux-polgengui no longer needs to be run as root either, since it is using the sepolicy generate python bindings to generate the policy files. sepolgen command will now just execute sepolicy generate as a shell script.</content:encoded>
	<dc:date>2012-10-31T18:23:56+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/60801.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 8: Introducing sepolicy transition</title>
	<link>http://danwalsh.livejournal.com/60801.html</link>
	<content:encoded>Another advanced topic of SELinux, that is hard to understand is process transitions.&amp;nbsp; Basically this is the mechanism where most processes get their labels.&amp;nbsp; The init_t domain transition to the initrc_t domain when it executes an initrc_exec_t labelled script.&amp;nbsp; initrc_t transition to httpd_t when it executes and file labelled httpd_exec_t ...&lt;br /&gt;&lt;br /&gt;Two questions can arise from this,&lt;ul&gt;&lt;li&gt;What process domains can one process domain transition too?&lt;/li&gt;&lt;li&gt;Can one process domain transition to another?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/46653.html&quot; rel=&quot;nofollow&quot;&gt;I orginally created a tool called setrans but now we are shipping it as part of the sepolicy suite.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man sepolicy-transition&lt;br /&gt;sepolicy-transition(8)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-transition(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-transition - Examine the SELinux Policy and generate a process transition report&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy transition [-h] -s SOURCE&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy transition [-h] -s SOURCE -t TARGET&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy transition will show all domains that a&amp;nbsp; give&amp;nbsp; SELinux&amp;nbsp; source domain can transition to, including the entrypoint.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If&amp;nbsp; a&amp;nbsp; target&amp;nbsp; domain is given, sepolicy transition will examine policy for all transition paths from the source domain to the&amp;nbsp; target&amp;nbsp; domain,&amp;nbsp; and&amp;nbsp; will&amp;nbsp; list the paths.&amp;nbsp; If a transition is possible, this tool will print out all transition paths from the source&amp;nbsp; domain&amp;nbsp; to&amp;nbsp; the&amp;nbsp; target domain&lt;br /&gt;&lt;br /&gt;OPTIONS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -h, --help&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; Display help message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -s, --source&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; Specify the source SELinux domain type.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -t, --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; Specify the target SELinux domain type.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If I want to see what process domains guest_t can transition too, I can execute the following:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sepolicy transition -s guest_t&lt;br /&gt;guest_t @ abrt_helper_exec_t --&amp;gt; abrt_helper_t&lt;br /&gt;guest_t @ loadkeys_exec_t --&amp;gt; loadkeys_t&lt;br /&gt;guest_t @ chkpwd_exec_t --&amp;gt; chkpwd_t&lt;br /&gt;guest_t @ passwd_exec_t --&amp;gt; passwd_t&lt;br /&gt;guest_t @ updpwd_exec_t --&amp;gt; updpwd_t&lt;br /&gt;guest_t @ chfn_exec_t --&amp;gt; chfn_t&lt;br /&gt;guest_t @ oddjob_mkhomedir_exec_t --&amp;gt; oddjob_mkhomedir_t&lt;br /&gt;guest_t @ shell_exec_t --&amp;gt; httpd_user_script_t&lt;/span&gt;&lt;/p&gt;&lt;p&gt;If I wanted to see how httpd_t can read system_mail_t&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sepolicy transition -s httpd_t -t system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_mojomojo_script_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; postfix_showq_t --&amp;gt; spamc_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; dovecot_deliver_t --&amp;gt; uux_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; dovecot_deliver_t --&amp;gt; sendmail_t --&amp;gt; uux_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; dovecot_deliver_t --&amp;gt; sendmail_t --&amp;gt; procmail_t --&amp;gt; clamscan_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; dovecot_deliver_t --&amp;gt; sendmail_t --&amp;gt; postfix_master_t --&amp;gt; postfix_local_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; dovecot_deliver_t --&amp;gt; sendmail_t --&amp;gt; postfix_master_t --&amp;gt; postfix_pipe_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; uux_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_openshift_script_t --&amp;gt; openshift_initrc_t --&amp;gt; openshift_domain --&amp;gt; openshift_t --&amp;gt; openshift_mail_t --&amp;gt; exim_t --&amp;gt; clamscan_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_suexec_t --&amp;gt; httpd_bugzilla_script_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; abrt_retrace_worker_t --&amp;gt; mock_t --&amp;gt; mount_t --&amp;gt; lvm_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; daemon --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; abrt_retrace_worker_t --&amp;gt; mock_t --&amp;gt; mount_t --&amp;gt; lvm_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; systemprocess --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; abrt_retrace_worker_t --&amp;gt; mock_t --&amp;gt; mount_t --&amp;gt; lvm_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; sulogin_t --&amp;gt; unconfined_t --&amp;gt; dhcpc_t --&amp;gt; NetworkManager_t --&amp;gt; pppd_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; abrt_retrace_worker_t --&amp;gt; mock_t --&amp;gt; mount_t --&amp;gt; lvm_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; sulogin_t --&amp;gt; unconfined_t --&amp;gt; rpm_t --&amp;gt; rpm_script_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; abrt_retrace_worker_t --&amp;gt; mock_t --&amp;gt; mount_t --&amp;gt; lvm_t --&amp;gt; insmod_t --&amp;gt; initrc_t --&amp;gt; sulogin_t --&amp;gt; unconfined_t --&amp;gt; rpm_script_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; passenger_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_bugzilla_script_t --&amp;gt; system_mail_t&lt;br /&gt;httpd_t --&amp;gt; httpd_mojomojo_script_t --&amp;gt; system_mail_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note currently this command does not take into account boolean settings, it is just showing you that it is possible.&amp;nbsp; Future enhancements would be to list the booleans required to allow the access.&lt;/p&gt;</content:encoded>
	<dc:date>2012-10-29T13:26:28+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/60528.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 8: Introducing sepolicy network</title>
	<link>http://danwalsh.livejournal.com/60528.html</link>
	<content:encoded>One problem uses have with SELinux is understanding the network protections.&amp;nbsp; SELinux controls which ports a domain is able to connect to and which ports it is able to bind to.&amp;nbsp; Since SELinux is a type enforcement system, it controls ports access via types.&amp;nbsp; Processes get assigned types and port numbers get assigned types.&amp;nbsp; Since users think in terms of port numbers, we built a tool to more easily allow users understand the relationships.&lt;a href=&quot;http://danwalsh.livejournal.com/53182.html&quot; rel=&quot;nofollow&quot;&gt;&amp;nbsp; I orginally called this tool senetwork, but now we are shipping it as part of the sepolicy suite.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man sepolicy-network&lt;br /&gt;sepolicy-network(8)&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-network(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-network - Examine the SELinux Policy and generate a network report&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy network [-h] (-l | -p PORT [PORT ...] | -t TYPE [TYPE ...] | -d DOMAIN [DOMAIN ...])&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Use sepolicy network to examine SELinux Policy and generate network reports.&lt;br /&gt;&lt;br /&gt;OPTIONS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -d, --domain&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; Generate a report listing the ports to which the specified domain is allowed to connect and or bind.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -l, --list&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; List all Network Port Types defined in SELinux Policy&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -h, --help&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; Display help message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -t, --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; Generate a report listing the port numbers associate with the specified SELinux port type.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -p, --port&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; Generate a report listing the SELinux port types associate with the specified port number.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sepolicy network allows you to ask SELinux what port type is associated with a specific port number.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sepolicy network --port 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;Or what port number is associated with a port type.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sepolicy network -t dns_port_t&lt;br /&gt;dns_port_t: tcp: 53&lt;br /&gt;dns_port_t: udp: 53&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note that sepolicy also supports bash completion.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sepolicy network -t d&amp;lt;tab&amp;gt;&lt;br /&gt;daap_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dccm_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dhcpc_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp; dict_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dns_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dogtag_port_t &amp;nbsp;&lt;br /&gt;dbskkd_port_t&amp;nbsp;&amp;nbsp; dcc_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dhcpd_port_t&amp;nbsp;&amp;nbsp;&amp;nbsp; distccd_port_t&amp;nbsp; dnssec_port_t &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Finally you can ask which ports a process domain type is allowed to connect or bind:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sepolicy network -d cupsd_t&lt;br /&gt;cupsd_t: tcp name_connect&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; all ports&lt;br /&gt;cupsd_t: tcp name_bind&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reserved_port_t: 1-511&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rpc_port_type: all ports &amp;gt; 500 and&amp;nbsp; &amp;lt; 1024&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipp_port_t: 631,8610-8614&lt;br /&gt;cupsd_t: udp name_bind&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; howl_port_t: 5353&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipp_port_t: 631,8610-8614&lt;/span&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-27T11:57:24+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/60366.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 8: Introducing sepolicy manpage</title>
	<link>http://danwalsh.livejournal.com/60366.html</link>
	<content:encoded>In my previous blog, I introduced the sepolicy command, today I am going to talk about sepolicy manpage.&amp;nbsp; This is probably the most important command in the sepolicy command suite.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man sepolicy-manpage&lt;br /&gt;sepolicy-manpage(8)&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-manpage(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy-manpage - Generate a man page based on the installed SELinux Policy&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy manpage [-w] [-h] [-p PATH ] [-a | -d ]&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Use sepolicy manpage to generate manpages based on SELinux Policy.&lt;br /&gt;&lt;br /&gt;OPTIONS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -a, --all&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; Generate Man Pages for All Domains&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -d, --domain&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; Generate a Man Page for the specified domain. (Supports multiple commands)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -h, --help&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; Display help message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -w, --web&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; Generate an additonal HTML man pages for the specified domain(s).&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -p, --path&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; Specify the directory to store the created man pages. (Default to /tmp)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We are now using this tool to generate hundreds of man pages to document SELinux policy on every process domain.&lt;br /&gt;Each confined domains will have an _selinux extension added for example.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man httpd_selinux&lt;br /&gt;httpd_selinux(8)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELinux Policy documentation for httpd&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_selinux(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpd_selinux - Security Enhanced Linux Policy for the httpd processes&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Security-Enhanced Linux secures the httpd processes via flexible mandatory access control.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The&amp;nbsp; httpd&amp;nbsp; processes&amp;nbsp; execute with the httpd_t SELinux type. You can check if you have these processes running by executing the ps command&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with the -Z qualifier.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For example:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ps -eZ | grep httpd_t&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;These are pretty extensive man pages including sections:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Process types associated with the domain, the tool attempts to associate all process types that begin with the same prefix as the target domain.&lt;/li&gt;&lt;li&gt;File Types associated with the domain. &amp;nbsp; This will list all file types that are included in this policy.&amp;nbsp; (Using the prefix to gather the information)&amp;nbsp; The man page describes what the type is used for, along with the default path labelling on the system.&lt;/li&gt;&lt;li&gt;Booleans associated with the domain.&amp;nbsp; The manpage lists all booleans matching the prefix and then describes what the boolean is used for.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Port Types associated with the domain.&amp;nbsp; The manpage lists the port types matching the prefix and describes the default port numbers assigned to these port types.&lt;/li&gt;&lt;li&gt;Sharing Types associated with the domain.&amp;nbsp; If the domain uses &amp;quot;Sharing Types&amp;quot;&amp;nbsp; like public_content_t, the man page will have a section explaining how to use them.&lt;/li&gt;&lt;li&gt;Managed Files section describes the types that the domain is allowed to write and the default paths associated with these types.&lt;/li&gt;&lt;/ul&gt;This is pretty extensive documentation, and the beauty of it, is that it is automatically generated so it will not get out of date.&amp;nbsp;&lt;br /&gt;In Fedora 18, the man page for Apache is over 1600 lines long.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man httpd_selinux&amp;nbsp; | wc -l&lt;br /&gt;1603&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Currently in Fedora 18 we have over 700 man pages.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man -k selinux | grep _selinux | wc -l&lt;br /&gt;734&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Miroslav Grepl is building a web site that will list all SELinux Policy Man pages for RHEL6, Fedora 17 and Fedora 18.&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-26T12:05:56+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/60135.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 8: Introducing sepolicy</title>
	<link>http://danwalsh.livejournal.com/60135.html</link>
	<content:encoded>Over the years people have struggled to understand SELinux Policy and how it confined applications.&amp;nbsp; Administrators would want to know what types the Apache process can read or write.&amp;nbsp; What booleans were available for samba.&amp;nbsp; Can one domain write to the users home directory?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;sepolicy python bindings&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The tool suite we had to do this was called setools, which included apol (A tcl/tk graphical tool) and sesearch and seinfo.&amp;nbsp; I found that I hardly ever used apol and mainly used sesearch and seinfo.&amp;nbsp; But I wanted more control.&amp;nbsp; I decided to add python bindings for these two commands, which in prior releases were in setools package.&amp;nbsp; These python bindings were rejected for merging upstream, for whatever reason.&amp;nbsp; I decided to move them into their own package sepolicy.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; python&lt;br /&gt;Python 2.7.3 (default, Aug&amp;nbsp; 9 2012, 17:23:57)&lt;br /&gt;[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2&lt;br /&gt;Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; import sepolicy&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; sepolicy.info(sepolicy.ATTRIBUTE)&lt;/span&gt;&lt;br /&gt;Returns a dictionary of all information about SELinux Attributes&lt;br /&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt;sepolicy.search([sepolicy.ALLOW])&lt;/span&gt;&lt;br /&gt;Returns you a dictionary of all allow rules in the policy.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;sepolicy command&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Using these python bindings we have begun to build&amp;nbsp; a new series of commands that I have found very useful for understanding policy.&amp;nbsp; I decided to combine these tools into a new command line tool sepolicy.&amp;nbsp;&amp;nbsp;&amp;nbsp; Some of these tools I have blogged about in the past but now I have consolidated them into a single tool and made it part of the distribution.&amp;nbsp; Over the next couple of blogs I will explain some of the tools.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man sepolicy&lt;br /&gt;&lt;br /&gt;sepolicy(8)&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;&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;&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;&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;&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; sepolicy(8)&lt;br /&gt;&lt;br /&gt;NAME&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy - SELinux Policy Inspection tool&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; semanage {manpage,network,communicate,transition,generate} OPTIONS&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Arguments:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; communicate&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Query SELinux policy to see if domains can communicate with each other sepolicy-communicate(8)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generate&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Generate SELinux Policy module template sepolicy-generate(8)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manpage&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Generate SELinux man pages sepolicy-manpage(8)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; network&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Query SELinux policy network information sepolicy-network(8)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transition&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Query SELinux Policy to see how a source process domain can transition to the target process domain sepolicy-transition(8)&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sepolicy&amp;nbsp; is&amp;nbsp; a&amp;nbsp; tools set that will query the installed SELinux policy and generate useful reports, man pages, or even new policy modules.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; See the argument specific man pages for options and descriptions.&lt;/span&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-26T11:27:36+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/59788.html">
	<title>Dan Walsh: sandbox can now shred in Fedora 18 and RHEL7</title>
	<link>http://danwalsh.livejournal.com/59788.html</link>
	<content:encoded>I have heard from a couple of people who are real concerned about security, that they wanted sandbox to not only delete the content but to &amp;quot;shred&amp;quot; it on exit.&lt;br /&gt;&lt;br /&gt;policycoreutils-2.1.13-17.fc18&lt;br /&gt;policycoreutils-2.1.13-17.el7&lt;br /&gt;&lt;br /&gt;man shred&lt;br /&gt;...&lt;br /&gt;DESCRIPTION&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Overwrite&amp;nbsp; the specified FILE(s) repeatedly, in order to make it harder&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for even very expensive hardware probing to recover the data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;cat untrustedcontent | sandbox --shred sandbox -M filter.sh &amp;gt; /tmp/trustedcontent&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sandbox -X -s -W metacity firefox&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-26T10:33:34+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/59536.html">
	<title>Dan Walsh: Process Confinement in Fedora 18</title>
	<link>http://danwalsh.livejournal.com/59536.html</link>
	<content:encoded>I have not done this blog for a while.&lt;a href=&quot;http://danwalsh.livejournal.com/33287.html&quot; rel=&quot;nofollow&quot;&gt; Fedora 12?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A good estimate of the number of different confined processes is to count the number of types with the domain attribute.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;seinfo -adomain -x | tail -n +2 | wc -l&lt;br /&gt;707&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: I am removing the first line because it lists the attribute name.&lt;br /&gt;&lt;br /&gt;Not all domain types are confined. If we want to look at the number of unconfined domains, we can use the unconfined_domain_type attribute.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;seinfo -aunconfined_domain_type -x | tail -n +2 | wc -l&lt;br /&gt;61&lt;/span&gt;&lt;br /&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; width=&quot;200&quot;&gt;&lt;caption&gt;Unconfined Domains&lt;/caption&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;sosreport_t&lt;/td&gt;&lt;td&gt;bootloader_t&lt;/td&gt;&lt;td&gt;devicekit_power_t&lt;/td&gt;&lt;td&gt;nova_api_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;nova_network_t&lt;/td&gt;&lt;td&gt;dirsrvadmin_unconfined_script_t&lt;/td&gt;&lt;td&gt;nova_objectstore_t&lt;/td&gt;&lt;td&gt;certmonger_unconfined_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;unconfined_cronjob_t&lt;/td&gt;&lt;td&gt;abrt_handle_event_t&lt;/td&gt;&lt;td&gt;setfiles_mac_t&lt;/td&gt;&lt;td&gt;initrc_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;fsadm_t&lt;/td&gt;&lt;td&gt;lvm_t&lt;/td&gt;&lt;td&gt;mdadm_t&lt;/td&gt;&lt;td&gt;rpm_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;wine_t&lt;/td&gt;&lt;td&gt;nova_vncproxy_t&lt;/td&gt;&lt;td&gt;unconfined_dbusd_t&lt;/td&gt;&lt;td&gt;nova_volume_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;nova_scheduler_t&lt;/td&gt;&lt;td&gt;prelink_t&lt;/td&gt;&lt;td&gt;anaconda_t&lt;/td&gt;&lt;td&gt;boinc_project_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;nova_ajax_t&lt;/td&gt;&lt;td&gt;rpm_script_t&lt;/td&gt;&lt;td&gt;system_cronjob_t&lt;/td&gt;&lt;td&gt;openshift_initrc_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;samba_unconfined_net_t&lt;/td&gt;&lt;td&gt;kdumpctl_t&lt;/td&gt;&lt;td&gt;devicekit_disk_t&lt;/td&gt;&lt;td&gt;firstboot_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;samba_unconfined_script_t&lt;/td&gt;&lt;td&gt;nagios_eventhandler_plugin_t&lt;/td&gt;&lt;td&gt;httpd_unconfined_script_t&lt;/td&gt;&lt;td&gt;depmod_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;insmod_t&lt;/td&gt;&lt;td&gt;kernel_t&lt;/td&gt;&lt;td&gt;livecd_t&lt;/td&gt;&lt;td&gt;puppet_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;tomcat_t&lt;/td&gt;&lt;td&gt;apmd_t&lt;/td&gt;&lt;td&gt;clvmd_t&lt;/td&gt;&lt;td&gt;crond_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;inetd_t&lt;/td&gt;&lt;td&gt;init_t&lt;/td&gt;&lt;td&gt;udev_t&lt;/td&gt;&lt;td&gt;virtd_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;nagios_unconfined_plugin_t&lt;/td&gt;&lt;td&gt;rgmanager_t&lt;/td&gt;&lt;td&gt;devicekit_t&lt;/td&gt;&lt;td&gt;inetd_child_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;nova_direct_t&lt;/td&gt;&lt;td&gt;semanage_t&lt;/td&gt;&lt;td&gt;sge_shepherd_t&lt;/td&gt;&lt;td&gt;xdm_unconfined_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;unconfined_t&lt;/td&gt;&lt;td&gt;abrt_watch_log_t&lt;/td&gt;&lt;td&gt;sge_job_t&lt;/td&gt;&lt;td&gt;xserver_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;If you disable the unconfined policy package, which I recommend.&lt;br /&gt;&lt;br /&gt;This leaves only user domains unconfined, along with some domains that do not make sense to confine.&amp;nbsp; (anaconda, firstboot, kernel,rpm)&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semodule -d unconfined&lt;br /&gt;seinfo -aunconfined_domain_type -x | tail -n +2 | wc -l&lt;br /&gt;14&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; width=&quot;200&quot;&gt;&lt;caption&gt;Unconfined Domains&lt;/caption&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;rpm_t&lt;/td&gt;&lt;td&gt;anaconda_t&lt;/td&gt;&lt;td&gt;rpm_script_t&lt;/td&gt;&lt;td&gt;openshift_initrc_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;firstboot_t&lt;/td&gt;&lt;td&gt;kernel_t&lt;/td&gt;&lt;td&gt;livecd_t&lt;/td&gt;&lt;td&gt;unconfined_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;You can disable all unconfined domains by disabling unconfineduser module&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semodule -d unconfineduser&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: You need to setup all your users as confined users, before removing the unconfineduser module.&lt;br /&gt;Disabling the unconfined and unconfineduser policy modules is the equivalent of what we used to call strict policy.&lt;br /&gt;&lt;br /&gt;One other interesting domain is permissive domains. Permissive domains can be listed with the --permissive qualifier.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# seinfo --permissive -x | tail -n +3 | wc -l&lt;br /&gt;31&lt;/span&gt;&lt;br /&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; width=&quot;200&quot;&gt;&lt;caption&gt;Permissive Domains&lt;/caption&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;phpfpm_t&lt;/td&gt;&lt;td&gt;virt_qemu_ga_t&lt;/td&gt;&lt;td&gt;pkcsslotd_t&lt;/td&gt;&lt;td&gt;realmd_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;mandb_t&lt;/td&gt;&lt;td&gt;rngd_t&lt;/td&gt;&lt;td&gt;slpd_t&lt;/td&gt;&lt;td&gt;glusterd_t&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;stapserver_t&lt;/td&gt;&lt;td&gt;sensord_t&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;A couple of other interesting statistics.&lt;br /&gt;&lt;br /&gt;Total number of file types.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;seinfo -afile_type -x | tail -n +2&amp;nbsp; | wc -l&lt;br /&gt;2375&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In order to get the number of allow rules, you need to use sesearch&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sesearch --allow | wc -l&lt;/span&gt;&lt;br /&gt;81736&lt;br /&gt;&lt;br /&gt;Dontaudit Rules&lt;br /&gt;&lt;br /&gt;&lt;span&gt;sesearch --dontaudit | wc -l&lt;/span&gt;&lt;br /&gt;6532</content:encoded>
	<dc:date>2012-10-18T19:00:26+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/59144.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 7: Secure Linux Containers</title>
	<link>http://danwalsh.livejournal.com/59144.html</link>
	<content:encoded>&lt;h1&gt;&lt;span&gt;Secure Linux Containers&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/Securecontainers&quot; rel=&quot;nofollow&quot;&gt;In Fedora 18 we have enhanced the libvirt-sandbox package to allow for easy creation of Secure Containers.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Containers are a form of isolating one or more processes from the rest of the system.&amp;nbsp; Some times containers are described as lightweight virtualization.&amp;nbsp; Containers are really just a userspace concept.&amp;nbsp; The Linux kernel has no concept of a container.&amp;nbsp; The kernel implements namespaces and cgroups.&amp;nbsp; Userspace tools can combine these kernel services into a &amp;quot;container&amp;quot;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Namespaces&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Namespaces are a way of changing a processes view of its environment from its parents processes.&amp;nbsp; For example the file system namespace allows me to change a processes view of the file system hierarchy.&amp;nbsp; pam_namespace introduced way back in Fedora 6/RHEL5, allowed a login program to create a namespace and mount file systems that would not be seen by the ancestor processes.&amp;nbsp; Meaning I could have multiple processes with different /tmp directories and multiple home directories mounted on /home/dwalsh.&lt;br /&gt;&lt;br /&gt;The kernel currently implements 5 name spaces.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;mount - mounting&amp;nbsp; and unmounting filesystems will not affect rest of the system&amp;nbsp;&lt;/li&gt;&lt;li&gt;UTS - setting hostname, domainname will not affect rest of the system&lt;/li&gt;&lt;li&gt;IPC - process will have independent namespace for System V message queues, semaphore sets and shared memory segments&lt;/li&gt;&lt;li&gt;network - process will have independent IPv4 and IPv6 stacks, IP routing tables, firewall rules, the /proc/net&amp;nbsp; and&amp;nbsp; /sys/class/net&amp;nbsp; directory trees, sockets etc.&lt;/li&gt;&lt;li&gt;pid - processes have an independent pids from the rest of the system.&amp;nbsp; Each namespace can have its own pid 1.&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;span&gt;Note: A UID namespace is being developed, but is not ready to be used yet, and I have some concerns about how well this will work. Our tools do not currently use the UID namespace.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;pam_namespace, sandbox -X, unshare, systemd allow allow you to take advantage of namespaces.&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Cgroups&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;CGROUPS&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Wikipedia describes cgroups as:&lt;br /&gt;&lt;br /&gt;&amp;nbsp; cgroups (control groups) is a Linux kernel feature to limit, account and isolate resource usage (CPU, memory, disk I/O, etc.) of process groups.&lt;br /&gt;&lt;br /&gt;Basically you can use cgroups to control the amount of resources a process or groups of processes can get on a system.&amp;nbsp;&lt;br /&gt;&lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/Presentations/cgroups.ogv&quot; rel=&quot;nofollow&quot;&gt;I put together a little screen-cast of cgroups to demonstrate their power.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;LXC&lt;/b&gt;&lt;br /&gt;Tools like LXC have existed for a while to allow users to create containers but the tool set is at a very low level&lt;b&gt;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Libvirt-lxc&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;quot;Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). The main package includes the libvirtd server exporting the virtualization support.&amp;quot;&lt;br /&gt;&lt;br /&gt;libvirt-lxc was introduced in Fedora 16. It enhanced the libvirt API to allow users to build containers using libvirt.&amp;nbsp; This allows you to manage your kvm/qemu virtualization along with your linux containers, all within the same framework.&amp;nbsp; The only problem, is setting up a linux container using the libvirt api is fairly difficult.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/VirtSandbox&quot; rel=&quot;nofollow&quot;&gt;libvirt-sandbox&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Dan Berrange created a new package called libvirt-sandbox in Fedora 17.&amp;nbsp; The libvirt-sandbox package provides an application development library (libvirt-sandbox) to facilitate the embedding of virtualization into applications.&amp;nbsp; One of the main advantages of this new tool set, was that it greatly simplified the API for creating virtual machines and containers.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SELinux&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Using containers by itself does not give you good security separation.&amp;nbsp; The reason for this is kernel file systems like /proc, /sys, cgroupsfs and selinuxfs are not containerized.&amp;nbsp; A privileged process running within a container can affect other processes running outside of the container or processes running in other containers.&amp;nbsp; In libvirt-sandbox and libvirt-lxc you can use SELinux Labelling to further lock down privileged processes, for example preventing mounting of random file systems or stopping processes from disabling SELinux.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;virt-sandbox-service&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Dan Berrange and I have been working to enhance libvirt-sandbox.&amp;nbsp; We have added a command line tool called virt-sandbox-service which allows a user to easily create an application sandbox.&amp;nbsp; virt-sandbox-service allows an administrator to run multiple services on the same machine each service in a secure Linux Container.&amp;nbsp;&amp;nbsp; Some major features of virt-sandbox-service containers.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Use systemd within the container as the init processes.&lt;/li&gt;&lt;li&gt;Uses standard unit files for starting and stopping containerized applications.&lt;/li&gt;&lt;li&gt;Shares the /usr partition, meaning if you are running hundreds of Apache containers, and update Apache code, each container will instantly use the new version of Apache.&lt;/li&gt;&lt;li&gt;Uses SELinux MCS Labelling to separate each container, preventing even root processes from interfering with the host or other containers.&lt;/li&gt;&lt;/ul&gt;The goal of this tool is not to allow general purpose applications to run within the container, although we will work to get most services to be able to run.&amp;nbsp; The tool is not goaled at running full OS chroot, but more towards particular applications.&lt;br /&gt;&lt;br /&gt;I have done preliminary tests on running.&amp;nbsp; httpd, mysql, postgresql, dovecot within these containers.&amp;nbsp; I am hoping people begin to play with the tool and help us expand which applications can run within the container.&amp;nbsp; Also you can run multiple applications within a container at the same time.&amp;nbsp; For example, I have tested httpd and mysql running within the same container.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to use:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# yum install libvirt-sandbox httpd&lt;/span&gt;&lt;br /&gt;There is a bug in the tool right now where it will not work without an /selinux file.&lt;br /&gt;&lt;span&gt;# touch /selinux&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Use the virt-sandbox-service command to create a container.&lt;/p&gt;&lt;pre&gt;&lt;span&gt;virt-sandbox-service create -C -l s0:c1,c2 -u httpd.service container1
Created sandbox container dir /var/lib/libvirt/filesystems/container1
Created sandbox config /etc/libvirt-sandbox/services/container1.sandbox
Created unit file /etc/systemd/system/container1_sandbox.service&lt;/span&gt;

&lt;/pre&gt;&lt;p&gt;Manipulate the data within the container while running outside of the container.&lt;/p&gt;&lt;pre&gt;&lt;span&gt;cd /var/lib/libvirt/filesystems/container1/var/log
touch content
ls -lZ content
# Make sure the content gets created with the correct MCS label.
# Content should be labeled with s0:c1,c2&amp;nbsp;: Not s0
&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span&gt;Now create a file with a bad label for the container.
cat &amp;quot;Secret&amp;quot; &amp;gt; badcontent
chcon -l s0:c3,c4 badcontent
 
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Start the container:&lt;/p&gt;&lt;pre&gt;&lt;span&gt;virt-sandbox-service start container1
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;In another window&lt;/p&gt;&lt;p&gt;Make sure the processes are running with the proper SELinux label. ps -eZ | grep svirt_lxc You should see processes like systemd, systemd-journal, dhclient and httpd running within the container with the MCS label of s0:c1,c2&lt;/p&gt;&lt;p&gt;Connect to the container&lt;/p&gt;&lt;pre&gt;&lt;span&gt;virt-sandbox-service connect container1
id 
getenforce   # Should tell you SELinux is disabled.
setenforce 1 # Should be denied
touch /file  # Should deny you creating this file
touch /var/www/html/content  # Should be allowed
cat /var/www/html/badcontent # Should be denied
Configure the apache server any way you would like, and manipulate html pages
ifconfig eth0  # Grap IP Address for use on next test
# Use the shell running with in the container to attempt to break out of the container. 
^] 
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;On your hosts Firefox use the IP within the container&lt;/p&gt;&lt;pre&gt;&lt;span&gt;firefox $IP # Using IP address from container, make sure you see the content.
&lt;/span&gt;
Shut down the container
&lt;/pre&gt;&lt;pre&gt;&lt;span&gt;virt-sandbox-service stop container1
&lt;/span&gt;
Now lets try to do the same but starting and stopping the container using systemctl commands
&lt;/pre&gt;&lt;pre&gt;&lt;span&gt;systemctl start container1_sandbox.service
systemctl enable container1_sandbox.service # Check on reboot if the container is running
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Make sure the container is running.&lt;/p&gt;&lt;pre&gt;&lt;span&gt;virt-sandbox-service connect container1
ps -eZ
^]

&lt;/span&gt;&lt;span&gt;I would like to hear what you think?  What enhancements you would like to see?  What 
applications would you like to see run within the containers.  

Since this is a first version, we think there could be some growing pains, so use at your own 
risk, but we would love to work with the community to improve this tool set.
&lt;/span&gt;
&lt;/pre&gt;</content:encoded>
	<dc:date>2012-10-18T15:54:24+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/59060.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 6: KRB5 Credential Cache Moved under /run/user directory</title>
	<link>http://danwalsh.livejournal.com/59060.html</link>
	<content:encoded>&lt;h1&gt;&lt;span&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/KRB5CacheMove&quot; rel=&quot;nofollow&quot;&gt;&lt;span&gt;KRB5 Credential Cache Move&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;The default location of a user's Kerberos Credential Cache (CC) has moved from /tmp to user directory under /run/user.&lt;br /&gt;&lt;br /&gt;Back in the 1980's, when Kerberos was first developed, various login programs were enhanced to talk to the Kerberos servers to authenticate users, and to store credentials (tickets and session keys) that they obtained while doing so in a file, sometimes called a ticket file, but now more commonly called a credential cache (ccache for short), for the user to use during their session.&lt;br /&gt;&lt;br /&gt;The cache had to be owned by the user, so that additional tickets obtained by the user could be added to the cache, and so that it could be cleared or just destroyed.&lt;br /&gt;&lt;br /&gt;For the sake of users whose credentials were needed for accessing a remote home directory, login programs could not store the credentials in the user's home directory.&amp;nbsp; Since the only other location where a user could write to was the /tmp directory, the cache file was stored there by default.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Security Problems with the Credential Cache file in /tmp.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There were a couple of problems with storing the cache file in /tmp:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;All users of the system can write to /tmp.&amp;nbsp; To sidestep the possibility that a rogue user could trick the system into writing a user's credentials to an incorrect location, many login facilities would generate uniquely-named credential caches for users.&amp;nbsp; Others used predictable but different names for various other reasons.&lt;/li&gt;&lt;li&gt;But when the name of a user's credential cache isn't predictable, it can cause problems for services which don't run as part of the user's session, and which therefore can't consult the $KRB5CCNAME environment variable to discover which cache to use.&amp;nbsp; Services like these, for example rpc.gssd (the daemon which handles the client parts of Kerberized NFS), have historically had to make a best-guess as to what the Kerberos credential cache file's name was, and they had to do that by trawling through /tmp, looking for potential matches.&lt;/li&gt;&lt;li&gt;/tmp can be setup using pam_namespace such that processes running in the &amp;quot;root&amp;quot; namespace will see a different /tmp then the user sees when he logs in.&amp;nbsp; This can prevent services from even being able to find the Credential Cache.&lt;/li&gt;&lt;li&gt;The /tmp directory is often not a temporary file system.&amp;nbsp;&amp;nbsp; Logging out of the system or rebooting the system would not guarantee the Credential Cache would be removed/destroyed.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;b&gt;SSSD to the rescue in Fedora 18&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In Fedora 18 the Credential Cache file was moved by SSSD, System Security Services Daemon, to /run/user/UID/krb5cc_XXXXXX/tkt.&lt;br /&gt;Where XXXXXX is a random number.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For example on my box when I execute klist i see the following:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; klist&lt;br /&gt;Ticket cache: DIR::/run/user/3267/krb5cc_ca3a4331e17e8e80cb0c46ea507840bc/tkt&lt;br /&gt;Default principal: dwalsh@REDHAT.COM&lt;br /&gt;&lt;br /&gt;Valid starting&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Expires&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Service principal&lt;br /&gt;10/12/12 12:48:17&amp;nbsp; 10/12/12 22:48:17&amp;nbsp; krbtgt/REDHAT.COM@REDHAT.COM&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; renew until 10/12/12 12:48:17&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Note: There are two colons between &amp;quot;DIR&amp;quot; and the path part of the ccache name gives away that the parent of the named path is the directory that's being used to hold the cache file (or possibly more than one cache file).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The main benefit here is that /run/user/3267 and all its sub-directories have a mask of 700 and are owned by dwalsh:dwalsh. No other users know that the cache is there, and they can't tell how big it is or when it was last touched.&amp;nbsp; This means we don't have to deal with other users trying to mess around in /tmp.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Secondarily /run is always tmpfs,&amp;nbsp; if the user logs out cache gets destroyed and if the system crashes the cache file is also gone.&lt;br /&gt;&lt;br /&gt;Since the tickets are stored in a predictable path, privileged processes like rpc.gssd have an easy time finding the correct tickets.&amp;nbsp;&amp;nbsp; And since they are off of /tmp, pam_namespace will not hide the credential cache from the system services.&lt;br /&gt;&lt;br /&gt;Finally now SSSD can actually get multiple tickets from different domains and easily store them in the /run directory, allowing a user&lt;br /&gt;to login into multiple kerberos domains at the same time.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-10-15T18:50:06+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/58647.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 5: Systemd Secures Journald from attack</title>
	<link>http://danwalsh.livejournal.com/58647.html</link>
	<content:encoded>&lt;span&gt;&lt;b&gt;Forward Secure Sealing (FSS)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Forward Secure Sealing is a new feature of systemd/journald in Fedora 18.&lt;br /&gt;&lt;br /&gt;If your machine is cracked, (Did you disable SELinux?) and a hacker gets administrative control, he wants to cover their tracks, by modifying the system log files.&amp;nbsp; This presents a problem in that you might not know when the machine was hacked and whether any of your log files have been tampered with.&amp;nbsp; Before FSS&amp;nbsp; the only way to know your log files have not been tampered with is to store them on a different machine, IE Setup rsysog and auditlogs to be sent to different machines.&amp;nbsp; With FSS you can verify the journald logs on your system and know if they have been tampered with.&amp;nbsp; Even better you will have an idea when the hacker started tampering with them, and which part of the logs files are still valid.&lt;br /&gt;&lt;br /&gt;The basic idea is you establish a verification ID and store it externally or just use a QR code and store it on a smart phone.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://plus.google.com/115547683951727699051/posts/g1E6AxVKtyc&quot; rel=&quot;nofollow&quot;&gt;Read&amp;nbsp;Lennart Poettering posting on Google+ For more explanation.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://lh4.googleusercontent.com/-Yby5d7CcSj0/UDKe0Hy1E4I/AAAAAAAACVY/D54WBgKGiYI/w497-h373/sealing.png&quot; title=&quot;&quot; /&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-09T14:14:05+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/58508.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 4: FreeIPA/SSSD distributes Confined SELinux Users</title>
	<link>http://danwalsh.livejournal.com/58508.html</link>
	<content:encoded>&lt;span&gt;&lt;b&gt;FreeIPA now supports the distribution of SELinux Users&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fdanwalsh.livejournal.com%2F18312.html&amp;amp;ei=px10ULzsFZCG0QH-ioEg&amp;amp;usg=AFQjCNFU9-1YuMLPCvXOMgZAcKMYUX8t7w&quot; rel=&quot;nofollow&quot;&gt;Confined SELinux Users was introduced a while ago.&amp;nbsp;&lt;/a&gt; The basic idea is to give users different access depending on the machine they log into.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Using myself as an example, I regularly login to 5 different machines, not including VMs.&amp;nbsp; My Laptop, My Test machine, shell.devel.redhat.com, people.redhat.com and people.fedoraproject.com.&amp;nbsp;&lt;ul&gt;&lt;li&gt;people.redhat,com and people.fedoraproject.com: I should login as guest_u:guest_r:guest_t:s0.&amp;nbsp; These machines are used to share content via the Web Servers.&amp;nbsp; I should be only allowed to modify my home directory.&amp;nbsp; I should not have access to the network, setuid applications like su and sudo, or be able to build and execute code in the home directory.&lt;/li&gt;&lt;li&gt;shell.devel.redhat.com.&amp;nbsp; This machine is a shared developer shell machine, to be used by all developers.&amp;nbsp; I should be allowed to execute content in the home directory and maybe setup and test networking applications, since this is a development machine.&amp;nbsp; But I am not an administrator, I should not be allowed to execute su or sudo.&amp;nbsp; user_u:user_r:user_t:s0-s0:c0.c1023&amp;nbsp; would be a good SELinux user label for this machine.&lt;/li&gt;&lt;li&gt;My Laptop and test machines, (holycross and redsox), should either be setup to use unconfined_t or staff_t.&amp;nbsp; In my case I run them with staff_u:staff_r:staff_t:s0-s0:c0.c1023, and administrator processes as staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023.&lt;/li&gt;&lt;/ul&gt;The problem with this configuration is that each one of these machines has to be setup individually.&amp;nbsp; My identity is shared by a directory server and authorization is confirmed by kerberos.&amp;nbsp; But until now, there was no standard way to setup these confined users on a centralized server.&lt;br /&gt;&lt;br /&gt;One big advantage of FreeIPA is it adds identity to machines.&amp;nbsp; FreeIPA knows the difference between dwalsh on people.redhat.com versus dwalsh on shell.devel.redhat.com.&amp;nbsp; The FreeIPA team added the ability to store SELinux Users definitions based on User/Machine mappings.&lt;br /&gt;&lt;br /&gt;In Fedora 18 you will be able to setup confined users using the FreeIPA gui.&lt;br /&gt;&lt;br /&gt;&lt;img alt=&quot;&quot; height=&quot;827&quot; src=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/SELinux%20User%20Maps.png&quot; title=&quot;&quot; width=&quot;700&quot; /&gt;&lt;br /&gt;&lt;br /&gt;At Red Hat we could setup a user/machine mapping like all users on people.redhat.com will login with the SELinux user/level&amp;nbsp; guest_u:s0.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SSSD plays a large role in assigning the SELinux User/Level from IPA to the user process at login.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;When a user logins to a box say through sshd, sshd uses the pam stack.&amp;nbsp; One of the first pam modules used is pam_sss. pam_sss sends a request to SSSD telling it that dwalsh is logging in.&amp;nbsp; SSSD contacts the FreeIPA server and asks what SELinux User/Level should dwalsh get when he logs in.&amp;nbsp; SSSD takes the string returned and creates a file in /etc/selinux/POLICYTYPE/logins/dwalsh.&amp;nbsp; During the session of the pam stack, the pam_selinux&amp;nbsp; module is called.&amp;nbsp; pam_selinux reads /etc/selinux/POLICYTYPE/logins/dwalsh and tells the kernel to launch the user process with the SELinux User specified in FreeIPA, for example guest_u:guest_r:guest_t:s0.&lt;br /&gt;&lt;br /&gt;Currently SSSD only supports FreeIPA for this transaction.&amp;nbsp; In the future it could be modified to use other sources for SELinux information.&lt;br /&gt;&lt;pre&gt;
&lt;span&gt;Note: In FreeIPA you can set up a set of the Host Based Access Control rules. These rules define which users (and groups of users) have access to which machines (and groups of machines) via which login services (like ssh, ftp, sudo, su etc.) The administrator can reuse the user-host associations defined in the HBAC rules to define SELinux user mapping rules. This helps to avoid duplicate management and express a notion: user set X can access set of hosts Y and would get SELinux user Z.&lt;/span&gt;

&lt;/pre&gt;&lt;b&gt;I have been asked many times when I have given the Confined SELinux Users talk, about how would you manage confined users in a large environment, now we have a solution.&lt;/b&gt;</content:encoded>
	<dc:date>2012-10-09T13:03:46+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="tag:blogger.com,1999:blog-5024703430482213163.post-599643298734095008">
	<title>Dominick Grift: Easy ways to help improve refpolicy contrib</title>
	<link>http://selinux-mac.blogspot.com/2012/10/easy-ways-to-help-improve-refpolicy.html</link>
	<content:encoded>Here is what you can do to help improve refpolicy contrib for your distro and everyone else:&lt;br /&gt;&lt;br /&gt;1. See if the file context specification from the various modules in refpolicy contrib match the locations of the corresponding packages that your distribution uses.&lt;br /&gt;&lt;br /&gt;Here is how i do that on Fedora:&lt;br /&gt;&lt;br /&gt;I basically check each modules file context files.&lt;br /&gt;&lt;br /&gt;Find which package installs the executable file, either with the full path or if my package manager cannot find that using a wild card:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;br /&gt;yum whatprovides /usr/sbin/someapp&lt;/blockquote&gt;or if it cannot find that:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;yum whatprovides *\someapp&lt;/blockquote&gt;&lt;br /&gt;Then you should figure out which (applicable) locations that package installs.&lt;br /&gt;&lt;br /&gt;Applicable locations are among others:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;/etc/someapp /etc/sysconfig/someapp /etc/default/someapp /var/lib/someapp /var/log/someapp /var/spool/someapp /etc/init.d/someapp /etc/rc.d/init.d/someapp /var/run/someapp /var/cache&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;In Fedora i use the handy repoquery tool for that. This tool allows me to list the files that a specificied package installs without me actually having to install the package&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;repoquery -ql someapp | less&lt;/blockquote&gt;&lt;br /&gt;&amp;nbsp;Labeling files properly is very important for SELinux operation and so you can improve your distributions SELinux experience by making use applicable files and locations are labeled correctly by fixing or adding the appropriate file context specification.&lt;br /&gt;&lt;br /&gt;2. Somewhat related to (1): label service etc files with a declared private type for etc files and allow the service to read files it owns with the private type, then also allow the &quot;service&quot;_admin() to find and manage content with that type.&lt;br /&gt;&lt;br /&gt;In the past we only use to label service etc files with a private&quot;files config file&quot; private type if the file has sensitive information.&lt;br /&gt;&lt;br /&gt;Later we came up with an idea to confine root using &quot;service&quot;_admin interfaces that give the caller access to manage a particular service and its files.&lt;br /&gt;&lt;br /&gt;However we do not want to give the &quot;service&quot;_admin access to manage generic etc_t files since that will allow the process to manage things it shouldnt, instead of just the configuration files for the service that the caller is allowed to manage.&lt;br /&gt;&lt;br /&gt;So we need to find each config file a confined service owns label that with a declared &quot;files_config_file&quot; file type, allow the owning service to read applicable content with that type and allow the service admin to get to and manage content with that type.&lt;br /&gt;&lt;br /&gt;You can use the method of (1) to find which etc files a package installs where&lt;br /&gt;&lt;br /&gt;Then if needed declare a new files_config_file type&lt;br /&gt;&lt;br /&gt;&lt;b&gt;type someapp_conf_t;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;files_config_file(someapp_conf_t)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Then make sure the file or directory is labeled correctly in the file context file. Some examples:&lt;br /&gt;&lt;br /&gt;Single configuration file:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;/etc/someapp\.conf -- gen_context(system_u:object_r:someapp_conf_t,s0)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;A configuration directory and all its contents:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;/etc/someapp(/.*)? gen_context(system_u:object_r:someapp_conf_t,s0)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Then allow the service domain type to read the content:&lt;br /&gt;&lt;br /&gt;in case of a single file:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;allow someapp_t someapp_conf_t:file read_file_perms;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;in case of a directories and its contents:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;read_files_pattern(someapp_t, someapp_conf_t, someapp_conf_t)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If your service domain type is not already allowed to read generic etc_t files (e.g. if it does not have a rule similar to for example: files_read_etc_files(someapp_t) then you will also need to allow the service domain type to traverse etc_t directories so that it can actually get to there:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;files_search_etc(someapp_t)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If the module has a service admin interface, for example someapp_admin in the someapp.if interface file, then add the rules that will allow the caller to get to and manage content with the new type:&lt;br /&gt;&lt;br /&gt;a. Import the type by adding for example;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;type someapp_conf_t;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;to the existing &quot;&lt;i&gt;gen_require(`')&lt;/i&gt;&quot; block on top of the interface.&lt;br /&gt;&lt;br /&gt;b. Add the rules to allow caller to get to and manage the content with the new type , for example:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;files_search_etc($1)&lt;/b&gt;&lt;br /&gt;&lt;b&gt;admin_pattern($1, someapp_conf_t)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Note: also consider environment files in /etc/sysconfig. We would want the service administrator to be able to manage those as well.&lt;br /&gt;&lt;br /&gt;If you are unsure about some specifics then look into existing source policy modules. Much efford goes into writing these modules as consistently as possible.&lt;br /&gt;&lt;br /&gt;This allows you to see patterns easily and will help you read the policy.&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-08T06:21:59+00:00</dc:date>
	<dc:creator>Dominick &quot;domg472&quot; Grift (noreply@blogger.com)</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/58178.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 3: New Confined/Permissive Process Domains</title>
	<link>http://danwalsh.livejournal.com/58178.html</link>
	<content:encoded>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; rel=&quot;nofollow&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;In &lt;a href=&quot;http://danwalsh.livejournal.com/54343.html&quot; rel=&quot;nofollow&quot;&gt;Fedora 17&lt;/a&gt;, we added 11 new permissive domains, 10 of which are now enforcing in Fedora 18.&amp;nbsp; matahari policy was removed, since the project was cancelled.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 17 Permissive Domains/ Now Confined in Fedora 18&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;couchdb_t, blueman_t, httpd_zoneminder_script_t, zoneminder_t, selinux_munin_plugin_t, sge_shepherd_t, sge_execd_t,&lt;br /&gt;sge_job_t, keystone_t, pacemaker_t &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 18 Permissive Domains&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; pkcsslotd_t (daemon manages PKCS#11 objects between PKCS#11-enabled applications)&lt;br /&gt;&amp;nbsp;&amp;nbsp; slpd_t&amp;nbsp; (Server Location Protocol Daemon)&lt;br /&gt;&amp;nbsp;&amp;nbsp; sensord_t (Sensor information logging daemon)&lt;br /&gt;&amp;nbsp;&amp;nbsp; mandb_t&amp;nbsp; (Cron job used to create /var/cache/man content)&lt;br /&gt;&amp;nbsp;&amp;nbsp; glusterd_t (policy for glusterd service)&lt;br /&gt;&amp;nbsp;&amp;nbsp; stapserver_t (Instrumentation System Server) Note: This was back ported to Fedora 17.&lt;br /&gt;&amp;nbsp;&amp;nbsp; realmd_t (dbus system service which manages discovery and enrollment in realms and domains like Active Directory or IPA)&lt;br /&gt;&amp;nbsp;&amp;nbsp; phpfpm_t (FastCGI Process Manager) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 18 Confined Domains&lt;/b&gt;&lt;br /&gt;With the open sourcing of OpenShift we have created several new process domains.&amp;nbsp; openshift controls separation between each of its users and users applications, which means it needs to be confined out of the box.&amp;nbsp; &lt;span&gt;openshift_t &lt;/span&gt;is the type that each application runs as, with a difference MCS label.&amp;nbsp; I will blog on the openshift policy in the future.&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; openshift_app_t, openshift_cgroup_read_t, openshift_initrc_t, httpd_openshift_script_t, openshift_t&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 18 Domains Removed&lt;/b&gt;&lt;br /&gt;&lt;span&gt;matahari (Project cancelled)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fedora 18 Domains Reorganization&lt;/b&gt;&lt;br /&gt;We split &lt;span&gt;sandbox&lt;/span&gt; and &lt;span&gt;sandboxX&lt;/span&gt; policy apart, in order to shrink the policy size. and now disable sandbox policy by default.&amp;nbsp; We are doing this because not many people use sandbox (Character only version of sandbox, used for pipes and streams) versus sandboxX.&amp;nbsp; sandbox policy is very big, and disabling by default reduces the size of policy by around 8%.&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-04T14:32:16+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/58032.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 2: Mutual Trusts with Active Directory domains</title>
	<link>http://danwalsh.livejournal.com/58032.html</link>
	<content:encoded>&lt;p&gt;FreeIPA has a couple of new features that are showing up in Fedora 18.&amp;nbsp; Support for SELinux Confined User labelling will be covered in a future blog...&amp;nbsp; In this blog I will be talking about better integration with Windows environments.&lt;br /&gt;&lt;br /&gt;I am saddened to realize that there are still people out there using Microsoft Windows! &amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;My house has been Windows free for a number of years now.&amp;nbsp; It is a lot darker, but much more secure! :^)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I also have heard that those Windows environments are using Active Directory.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Well Fedora 18 will make these environments a little more secure.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/Features/IPAv3Trusts&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;&lt;span&gt;FreeIPA and Active Directory can be setup with mutual trust.&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In Fedora 18 it is possible to create a trust relationship between an FreeIPA and an Active Directory domain.&amp;nbsp; This means users defined in Active Directory can access resources defined in FreeIPA.&amp;nbsp; In a future release,&amp;nbsp; users defined in FreeIPA will be able to access resources defined in Active Directory.&amp;nbsp; You can manage all of your user accounts in a single place.&amp;nbsp; If you are using Active Directory to manage your users, you can now use the same user accounts on your Linux boxes.&lt;br /&gt;&lt;br /&gt;Fedora 17 FreeIPA used &lt;i&gt;winsync&lt;/i&gt; to allow users from an Active Directory domain to access resources in the IPA domain. To achieve this &lt;i&gt;winsync&lt;/i&gt; had to replicate the user and password data from an Active Directory server to FreeIPA server and attempt to keep them in sync.&amp;nbsp; Causing potential race conditions.&lt;/p&gt;&lt;p&gt;In Fedora 18,&amp;nbsp; SSSD, System Security Services Daemon, has been enhanced to work with AD.&amp;nbsp; SSSD understands some of the native AD controls and features that it did not understand in the previous Fedoras.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You can set this up without using FreeIPA at all!&lt;br /&gt;&lt;br /&gt;In addition SSSD can work in the environment where it is connected to FreeIPA that is in trust relationships with AD. In this case, SSSD not only recognises users defined in FreeIPA but also recognizes users coming from the trusted AD domains.&amp;nbsp; SSSD can read user and group directory data directly from the Active Directory server.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Additionally if you do use FreeIPA you can setup Kerberos cross realm trust.&amp;nbsp; This allows Single-Sign-On between the Active Directory and the IPA domain.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;A user from the Active Directory Domain can access kerberized resources from the FreeIPA domain without being asked for a password. &lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;If you choose to setup users in the FreeIPA Domain, they will be able to access resources from the Active Directory domain.&lt;/b&gt; &lt;b&gt;No need to set POSIX attributes in the Active Directory Domain&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Single sign-on for all kerberized services is possible &lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;We may never get to full single sign on, where I only have one password asked of me, but this is a step in right direction.&lt;br /&gt;</content:encoded>
	<dc:date>2012-10-01T15:45:30+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="tag:blogger.com,1999:blog-5024703430482213163.post-1636918091957103071">
	<title>Dominick Grift: Determine whether Cron can execute jobs on behalf of the user with login user SELinux permissions</title>
	<link>http://selinux-mac.blogspot.com/2012/09/determine-whether-cron-can-execute-jobs.html</link>
	<content:encoded>Cron would run jobs on behalf of users in a &quot;cronjob&quot; domain. This domain is reasonable restricted compared to the domain in which most users operate.&lt;br /&gt;&lt;br /&gt;Fedora changed this behaviour to allow Cron to execute these jobs in the default login user domain of the user that owns the job.&lt;br /&gt;&lt;br /&gt;Recently i added a boolean to Reference policy that enables one to tune the policy to allow Cron to run user cronjobs in the default login user domain conditionaly.&lt;br /&gt;&lt;br /&gt;By default Cron will still execute the jobs in the Cron job domain but if you toggle the &lt;i&gt;cron_userdomain_transition&lt;/i&gt; boolean to &lt;b&gt;true&lt;/b&gt; then Cron will run the jobs in the default login user domain of the user owning the job.&lt;br /&gt;&lt;br /&gt;This allows Cron to run jobs with the SE-Linux permissions that the owner of the job has.&lt;br /&gt;&lt;br /&gt;Cron is SELinux aware. It queries the policy to see to which domain it should transition when running a job.&lt;br /&gt;&lt;br /&gt;It does not do a automatic domain transition because it does not actually execute the Cron job. Instead if uses &lt;i&gt;&quot;setexec&quot;&lt;/i&gt; to domain transition.&lt;br /&gt;&lt;br /&gt;It looks to see to which domains the Cron job file is a entrypoint. Then it needs to be able to process transition to that domain and then it checks the default login user domain of a user and with this information it determines in which domain to execute the job&lt;br /&gt;&lt;br /&gt;By default:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;allow cronjob_t user_cron_spool_t:file entrypoint;&lt;br /&gt;allow crond_t cronjob_t:process transition;&lt;/blockquote&gt;&lt;br /&gt;Then there is a default context of for staff this is for example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;system_r:crond_t:s0&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; staff_r:cronjob_t:s0&lt;/blockquote&gt;&lt;br /&gt;But when you tune the policy with &lt;i&gt;cron_userdomain_transition &lt;/i&gt;then these rules will be replaced by:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;allow $1 user_cron_spool_t:file entrypoint;&lt;br /&gt;allow crond_t $1:process transition;&lt;/blockquote&gt;&lt;br /&gt;Where &lt;b&gt;$1&lt;/b&gt; is the calling login user domain, and then it will look up the default login user domain and role, for staff this is for example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&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; SystemLow&amp;nbsp; SystemLow-SystemHigh&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;/blockquote&gt;That means:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&quot;staff_r:staff_t&quot;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Then Cron daemon has permission to run the job in the staff domain with the staff role.&lt;br /&gt;&lt;br /&gt;The benefits of running jobs in the login user domain are that now your Cron job can interact with your processes and operate on your files as if it were you interacting with your processes and operating on your files.&lt;br /&gt;&lt;br /&gt;Needless to say that other SE-Linux rules that apply to you now also apply to your Cron jobs.&lt;br /&gt;&lt;br /&gt;The policy may still have some rough edges but it was tested on Gentoo and is said to work. I did make some changes after that but hopefully i have not introduced regression.&lt;br /&gt;&lt;br /&gt;Currently Redhat distributions do not have this &lt;i&gt;cron_userdomain_transition &lt;/i&gt;boolean and i am not sure if she will adopt it.</content:encoded>
	<dc:date>2012-09-30T12:07:20+00:00</dc:date>
	<dc:creator>Dominick &quot;domg472&quot; Grift (noreply@blogger.com)</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/57723.html">
	<title>Dan Walsh: Where does SELinux allow my application to write?</title>
	<link>http://danwalsh.livejournal.com/57723.html</link>
	<content:encoded>&lt;span&gt;&lt;b&gt;SELinux's Number one goal:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Stop confined application/process from affecting other processes on the system.&amp;nbsp; &lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the biggest ways that a process can affect another process is by writing content that that process reads.&amp;nbsp;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If a hacked process can write ~/.bashrc in a users home directory; the next time the user logs in, the hacker gets control of a process running as unconfined_t.&lt;/li&gt;&lt;li&gt;If a hacked process can write to /etc/httpd/config, the hacker gets control of the Apache process.&lt;/li&gt;&lt;/ul&gt;Because of this SELinux blocks confined applications the ability to write content, unless the directories/files have the proper labels.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Users want to know:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What label is my application allowed to write to?&amp;nbsp;&lt;br /&gt;Where on the file system are these labels?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;For example in another blog, I got asked today where can mozilla_plugins write their logs?&lt;br /&gt;&lt;br /&gt;Well in an effort to better document SELinux policy we have been auto-generating man pages, and have just added a new section called &lt;b&gt;MANAGED FILES&lt;/b&gt;.&amp;nbsp; This section of the man page will list the files/directories that a confined application is able to write.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;man mozilla_plugin_selinux&lt;br /&gt;...&lt;br /&gt;MANAGED FILES&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The SELinux user type mozilla_plugin_t can manage&amp;nbsp; files&amp;nbsp; labelled&amp;nbsp; with&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the&amp;nbsp; following&amp;nbsp; file types.&amp;nbsp; The paths listed are the default paths for&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; these file types.&amp;nbsp; Note the processes UID still need to have&amp;nbsp; DAC&amp;nbsp; per‐&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; missions.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gnome_home_type&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; home_cert_t&lt;br /&gt;&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; /root/.cert(/.*)?&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; /home/[^/]*/.kde/share/apps/networkmanagement/certificates(/.*)?&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; /home/[^/]*/.pki(/.*)?&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; /home/[^/]*/.cert(/.*)?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mozilla_home_t&lt;br /&gt;&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; /home/[^/]*/.java(/.*)?&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; /home/[^/]*/.adobe(/.*)?&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; /home/[^/]*/.gnash(/.*)?&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; /home/[^/]*/.galeon(/.*)?&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; /home/[^/]*/.spicec(/.*)?&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; /home/[^/]*/.mozilla(/.*)?&lt;br /&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Fedora 18, we now have 951 man pages related to SELinux.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;gt; man -k selinux | wc -l&lt;br /&gt;951&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We will be generating these Man Pages in Fedora 17 and RHEL6/RHEL6 and hope to put them up on a web site so that &amp;quot;search engines&amp;quot; will have an easier time searching them.&lt;br /&gt;&lt;br /&gt;You can generate your own man pages using these tools, which should be showing up in policycoreutils soon.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/segenman&quot; rel=&quot;nofollow&quot;&gt;http://people.fedoraproject.org/~dwalsh/SELinux/genman/segenman&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://people.fedoraproject.org/~dwalsh/SELinux/genman/senetwork.py&quot; rel=&quot;nofollow&quot;&gt;http://people.fedoraproject.org/~dwalsh/SELinux/genman/senetwork.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-09-28T12:40:43+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/57377.html">
	<title>Dan Walsh: New Security Feature in Fedora 18 Part 1: SELinux Systemd Access Control</title>
	<link>http://danwalsh.livejournal.com/57377.html</link>
	<content:encoded>&lt;p&gt;For Fedora 17 I did a series of blogs on new security features. I guess it is time to start it for Fedora 18.&lt;br /&gt;&lt;span&gt;If you want me to talk about a new security feature,&amp;nbsp; email dwalsh@redhat.com, or comment on this blog.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;b&gt;New Feature in Fedora 18 &lt;a href=&quot;https://fedoraproject.org/wiki/Features/SELinuxSystemdAccessControl&quot; rel=&quot;nofollow&quot;&gt;SELinux Systemd Access Control.&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In previous versions of Fedora/RHEL SELinux could control which processes were able to start/stop services based on the label of the process and the label on the Init Script.&lt;br /&gt;&lt;br /&gt;For example NetworkManager (NetworkManager_t) was allowed to execute /etc/init.d/ntp (ntp_initrc_exec_t) but not allowed to access /etc/init.d/httpd (httpd_initrc_exec_t).&lt;br /&gt;&lt;br /&gt;With the advent of systemd we lost this ability since systemd starts and stops all services.&lt;br /&gt;&lt;br /&gt;We had to allow NetworkManager (NetworkManager_t) to execute systemctl which would send a dbus message to systemd, and systemd would start/stop whatever service NetworkManager requested. Actually we ended up allowing NetworkManager to do everything systemctl could do.&amp;nbsp;&amp;nbsp; We also wanted to setup confined administrators, but we ended up having to allow them to either start/stop all services or no services.&amp;nbsp; We could no longer allow the webadm_t to only start/stop httpd_t.&lt;br /&gt;&lt;br /&gt;In Fedora 18, we have fixed this by making systemd an SELinux Access Manager.&amp;nbsp; Now systemd will retrieve the label of the process running systemctl or the process that sent systemd a dbus message.&amp;nbsp; systemd will then look up the label of the unit file that the process wanted to configure.&amp;nbsp; Finally systemd will ask the kernel if SELinux policy allows the specific access between the process label and the unit file label.&amp;nbsp; This means a hacked NetworkManager or any other application that needs to interact with systemd for a specific service can now be confined via SELinux.&amp;nbsp; Policy writers can use these fined grained controls to confine administrators.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Policy changes.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;We have added a new class to SELinux Policy called &amp;quot;&lt;span&gt;service&lt;/span&gt;&amp;quot;.&amp;nbsp; The service class has the following permissions defined:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;start stop status reload kill load enable disable&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This means a policy writer can allow a domain to get the status on a service or start and stop a service, but not enable or disable a service.&amp;nbsp; This gives us better control then we have ever had in the past.&lt;br /&gt;&lt;br /&gt;To demonstrate this, I setup webadm_t as my root process:&lt;br /&gt;&lt;span&gt;&lt;a href=&quot;http://danwalsh.livejournal.com/18578.html&quot; rel=&quot;nofollow&quot;&gt;Note: For more information on setting up confined users see my other blogs.&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# id -Z&lt;br /&gt;staff_u:webadm_r:webadm_t:s0-s0:c0.c1023&lt;br /&gt;# /bin/systemctl status httpd.service&lt;br /&gt;httpd.service - The Apache HTTP Server&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Active: inactive (dead)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; CGroup: name=systemd:/system/httpd.service&lt;br /&gt;&lt;br /&gt;# /bin/systemctl status NetworkManager.service&lt;br /&gt;Failed to issue method call: SELinux policy denies access.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In a separate window running as unconfined_t, I can look at the AVC message created.&lt;br /&gt;&lt;br /&gt;# id -Z&lt;br /&gt;staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023&lt;br /&gt;# ausearch -m user_avc&lt;br /&gt;time-&amp;gt;Thu Sep 27 08:54:10 2012&lt;br /&gt;type=USER_AVC msg=audit(1348750450.105:135): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:&amp;nbsp; denied&amp;nbsp; { &lt;span&gt;status&lt;/span&gt; } for auid=3267 uid=0 gid=0 path=&amp;quot;&lt;span&gt;/usr/lib/systemd/system/NetworkManager.service&lt;/span&gt;&amp;quot; &lt;span&gt;cmdline=&amp;quot;/bin/systemctl status NetworkManager.service&amp;quot;&lt;/span&gt; scontext=staff_u:webadm_r:&lt;span&gt;webadm_t&lt;/span&gt;:s0-s0:c0.c1023 tcontext=system_u:object_r:&lt;span&gt;NetworkManager_unit_file_t&lt;/span&gt;:s0 tclass=&lt;span&gt;service&lt;/span&gt;&amp;nbsp; exe=&amp;quot;/usr/lib/systemd/systemd&amp;quot; sauid=0 hostname=? addr=? terminal=?'&lt;br /&gt;&lt;br /&gt;And of course you could use audit2allow to write policy to allow this access.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;audit2allow -la&lt;br /&gt;#============= webadm_t ==============&lt;br /&gt;allow webadm_t NetworkManager_unit_file_t:service status;&lt;br /&gt;&lt;br /&gt;# audit2allow -laR&lt;br /&gt;#============= webadm_t ==============&lt;br /&gt;networkmanager_systemctl(webadm_t)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make sure you have the latest systemd and selinux-policy to try this out.&amp;nbsp; These are my current versions:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;rpm -q selinux-policy systemd&lt;br /&gt;selinux-policy-3.11.1-26.fc18.noarch&lt;br /&gt;systemd-191-2.fc18.x86_64&lt;/span&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-09-27T13:21:17+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="urn:lj:livejournal.com:atom1:paulmoore:7947">
	<title>Paul Moore: My LPC and LSS 2012 Presentations</title>
	<link>http://paulmoore.livejournal.com/7947.html</link>
	<content:encoded>&lt;p&gt;I gave a brief presentation on virtualization security at the Linux Plumbers Conference this year as well as a lightning talk on seccomp/libseccomp at the Linux Security Summit.  The slides for both presentations are available below.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Virtualization Security Discussion: &lt;a href=&quot;http://www.paul-moore.com/files/lj/virt_security-pmoore-lpc2012-r1.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.paul-moore.com/files/lj/virt_security-pmoore-lpc2012-r1.pdf&lt;/a&gt;&lt;br /&gt;Syscall Filtering Made (sort of) Easy: &lt;a href=&quot;http://www.paul-moore.com/files/lj/libseccomp-pmoore-lss2012-r1.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.paul-moore.com/files/lj/libseccomp-pmoore-lss2012-r1.pdf&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-09-12T22:00:29+00:00</dc:date>
</item>
<item rdf:about="http://blog.namei.org/?p=553">
	<title>James Morris: Linux Security Summit 2012 – Slides published</title>
	<link>http://blog.namei.org/2012/09/11/linux-security-summit-2012-slides-published/</link>
	<content:encoded>&lt;p&gt;Slides from the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;Linux Security Summit 2012&lt;/a&gt; talks are now available via the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012/Schedule&quot;&gt;schedule page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It seems to have been a very successful event, with the move to a two-day format allowing for a day of refereed presentations, and then a day of more collaborative discussion.  We&amp;#8217;re aiming for a a similar format next year.&lt;/p&gt;
&lt;p&gt;Thanks to everyone who made the event happen: presenters, attendees, the program committee, and of course, the great team at Linux Foundation, who made everything work flawlessly!&lt;/p&gt;
&lt;p&gt;ETA: The slides from Matthew Garrett&amp;#8217;s keynote on UEFI Secure Boot are &lt;a href=&quot;http://kernsec.org/files/security_summit_uefi_2012.odp&quot;&gt;now up&lt;/a&gt;.&lt;/p&gt;</content:encoded>
	<dc:date>2012-09-10T14:40:40+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/57276.html">
	<title>Dan Walsh: Running unconfined scripts from a confined domain</title>
	<link>http://danwalsh.livejournal.com/57276.html</link>
	<content:encoded>I received the following email from an engineer named Marko.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;I've got a program (actually a shell script) which does various things and sudoers is configured so that users can run it without a pw being asked. By using sudo from the cmd line everything works as expected.&lt;br /&gt;&lt;br /&gt;However, if the script is invoked by udev rules (and thus run as root) under certain circumstances, it fails on several cases due to AVCs as the commands it is trying to execute won't work or the services it starts/stops fail partially as the context (udev_t) is not what it'd be when run with sudo from the command line. Examples include inability to communicate with dbus, accessing log/config files, etc. So figuring out all of those would be quite a task and if the local program is later changed it might require even more policy changes.&lt;br /&gt;&lt;br /&gt;So what would a custom policy look like for a program &amp;quot;foo&amp;quot; so that it would work equally well when invoked by udev like it now works when a user invokes it from the command like with sudo? Any examples, blog posts, howtos, etc to look at?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically since his users are most likely running as unconfined_t, the sudo command is running the script as unconfined_t and SELinux is not blocking anything.&amp;nbsp; When he runs the command out of udev, it is running as udev_t and udev_t is not allowed the access.&lt;br /&gt;&lt;br /&gt;To solve this problem, Marko has three choices:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add the allow rules to allow udev to have all the access required to run his application&lt;/li&gt;&lt;li&gt;Write policy for his application and transition from udev and unconfined_t to this new domain.&lt;/li&gt;&lt;li&gt;Write policy to allow udev_t to transition to unconfined_t when running only his application.&lt;/li&gt;&lt;/ol&gt;Since Marko did not want to all udev scripts this access, he chose not to do 1.&amp;nbsp; Marko decided it would be to difficult to do 2 and difficult to maintain, so he chose to do 3.&lt;br /&gt;&lt;br /&gt;Here is the original policy written by Marko.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# cat myapp.fc /usr/sbin/myapp --&lt;br /&gt;gen_context(system_u:object_r:myapp_exec_t, s0)&lt;br /&gt;&lt;br /&gt;# cat myapp.te&lt;br /&gt;policy_module(myapp, 1.0.0)&lt;br /&gt;&lt;br /&gt;require {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;type fs_t; type setfiles_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;type udev_t; type unconfined_t;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;class process transition;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;type myapp_exec_t;&lt;br /&gt;&lt;br /&gt;allow setfiles_t myapp_exec_t:file { getattr relabelto };&lt;br /&gt;allow myapp_exec_t fs_t:filesystem { associate };&lt;br /&gt;&lt;br /&gt;allow unconfined_t myapp_exec_t:file *;&lt;br /&gt;&lt;br /&gt;domain_auto_trans(udev_t, myapp_exec_t, unconfined_t);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Not bad.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The first problem I notice is lots of rules around myapp_exec_t.&amp;nbsp; Since the myapp_exec_t was never defined as a particular TYPE of type.&amp;nbsp; Since myapp_exec_t is planned to be used on a file or directory it needs to have the attribute&amp;nbsp; file_type.&amp;nbsp; All domains that interact with all files/directories, have rules defined in policy which allow them to interact with the attribute file_type.&amp;nbsp; You can add the file_type attribute to a file by using the files_type(myapp_exec_t) interface.&amp;nbsp; This will eliminate most of the rules involving myapp_exec_t.&lt;br /&gt;&lt;br /&gt;As a rule of thumb, anytime you define a new type in policy you should call an interface to define the &amp;quot;TYPE&amp;quot; of the type.&amp;nbsp; domain_type() for processes, files_type for files/directories, dev_node() for devices corenet_port() for network ports etc.&lt;br /&gt;&lt;br /&gt;Here is a my simpler policy.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;policy_module(myapp, 1.0.1)&lt;br /&gt;gen_require(`&lt;br /&gt;&amp;nbsp; type udev_t;&lt;br /&gt;&amp;nbsp; type unconfined_t;&lt;br /&gt;&amp;nbsp; role system_r;&lt;br /&gt;')&lt;br /&gt;&lt;br /&gt;type myapp_exec_t;&lt;br /&gt;files_type(myapp_exec_t)&lt;br /&gt;&lt;br /&gt;domain_auto_trans(udev_t, myapp_exec_t, unconfined_t);&lt;br /&gt;allow unconfined_t myapp_exec_t:file entrypoint;&lt;br /&gt;role system_r types unconfined_t;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The domain_auto_trans rule tells the SELinux kernel, when a process labeled udev_t executes a file labeled myapp_exec_t, transition the new process to unconfined_t.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;SELinux controls the labels of &amp;quot;entrypoint&amp;quot;, so we need to state that myapp_exec_t is an entrypoint to the unconfined_t domain.&lt;br /&gt;For a further description of the entrypoint access see:&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=606586&amp;amp;seqNum=2&quot; rel=&quot;nofollow&quot;&gt; SELinux By Example&lt;/a&gt; 2.2.4&lt;br /&gt;&lt;br /&gt;Finally I added the role definition for system_r, since udev_t will be running as system_r, when it executes myapp_t it will attempt to run unconfined_t was system_u:system_r:unconfined_t:s0.&amp;nbsp; roles system_r types unconfined_t, states that the unconfined_t type can be executed in the system_r role.&lt;br /&gt;&lt;br /&gt;While the ideal solution for this problem from a security point of view would have been to write policy for myapp_t, and have unconfined_t and udev_t transition to this domain, as a work around and not shutting SELinux off this is a decent alternative.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note&lt;/b&gt;:&amp;nbsp; When ever you write a shell script that will have more privs then the calling app, you should be really carefull that the calling application can not effect the running app.&amp;nbsp; The script needs to up its environment and ignores stuff from the calling program, if the script takes arguments you must be sure these arguments are handled properly and can not get the script to do something unexpected.&amp;nbsp; SELinux will protect you somewhat but you need to be careful.&amp;nbsp; Every python scripts I write, I always use &lt;b&gt;&amp;quot;#! /usr/bin/python -Es&amp;quot;&lt;/b&gt; for example.&amp;nbsp; &lt;a href=&quot;https://developer.apple.com/library/mac/#documentation/opensource/conceptual/shellscripting/ShellScriptSecurity/ShellScriptSecurity.html&quot; rel=&quot;nofollow&quot;&gt;Apple has a nice page on this.&lt;/a&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-09-05T19:31:27+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="tag:blogger.com,1999:blog-5240359826706545510.post-3189813332154886746">
	<title>Thomas Biege (Security): SUSE Cloud: How we secured the Cloud</title>
	<link>http://thetoms-random-thoughts.blogspot.com/2012/09/suse-cloud-how-we-secured-cloud.html</link>
	<content:encoded>&lt;div class=&quot;separator&quot;&gt;&lt;a href=&quot;https://www.suse.com/common/img/product_icons/suseCloud_doormat_prodIcon.png&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://www.suse.com/common/img/product_icons/suseCloud_doormat_prodIcon.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Yes we did it! We created SUSE Cloud, based on OpenStack, to provide a software stack for IaaS providers and companies that want to create purpose out of their bare metal IT equipment, to build private clouds as easy as installing RPM files.&lt;br /&gt;&lt;br /&gt;The project was very ambitious; integration work, bug fixing, adding features, packaging, testing, and finally releasing a cloud software stack with a SUSE gecko on it within less than 7 month.&lt;br /&gt;&lt;br /&gt;I was asked to take care of the security. It was a challenge because I was not familiar with the inherit security issues of Cloud technology and I had to realize that OpenStack was very complex. Additionally security seems not to be a major concern when OpenStack was designed. Don't get me wrong, the upstream developers have a well working security team, quick patches, professional response and process handling. But for example OpenStack makes heavy use of RESTful APIs which are publically available, authentication (authC) is password-based, connections were not encrypted by default, passwords are send over the wire without encryption, and so on.&lt;br /&gt;&lt;br /&gt;Even if the start of the project was very challenging for everyone involved it was a great success at the end. Let me tell you in this blog how we managed to ship the most secure OpenStack-based Cloud solution. But at first kudos to all people that helped making it possible. I had a lot of help from the SUSE Cloud team, then two of my former team-mates from the SUSE Security-Team (Sebastian Krahmer, Matthias Weckbecker) built the powerful validation and verification team to test the software for vulnerabilities based on an initial risk assessment, and last but not least, the OpenStack (especially the secuirty guys) community which is incredible! &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;The secure application development process&lt;/h2&gt;As you know from my ealier postings, we introduced something equal to Mircosofts &quot;Secure Developemt Life Cylce&quot; process and I called it SAD, Secure Application Development. (Not very clever but good to remember)&lt;br /&gt;In this case we do not develop the stack from scratch, we do integration and add features. So, I had neither influence on the secure coding standards used nor on the code quality. Therefore we were limited to define security requirements and drive the &quot;Verification and Validation&quot; (V&amp;amp;V) process.&lt;br /&gt;&lt;h2&gt;&lt;b&gt;How to find a Needle in a Haystack&lt;/b&gt;&lt;/h2&gt;&lt;div&gt;... at the end you will see that we found many &quot;needles&quot;.&lt;br /&gt;&lt;br /&gt;When you try to get familiar with Cloud Computing you will stumble through a field of marketing buzzwords, various commercial Cloud providers with very special/limited solutions, different security guidelines and so on and so on... maybe you will feel lost.&lt;br /&gt;Well that was the way I felt when I started. I wanted to find Cloud-specific attack vectors / risks which are unique to this new technology... but there isn't much new technology involved in Cloud Computing and there isn't much research of the new stuff.&amp;nbsp;So, where to start?&lt;/div&gt;&lt;div&gt;&lt;div&gt;I decided to start with the things I know best and which are exposed to attackers, not only to grab the low hanging fruits first but also to save some time because time was something we didn't have for this project. These easy wins could be:&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Web-security issues of the Dashboard&lt;/li&gt;&lt;li&gt;deployment issues, like file permissions, host and network hardening&lt;/li&gt;&lt;li&gt;API security&lt;/li&gt;&lt;/ol&gt;Therefore my risk assessment was focused on these attack vectors.&lt;br /&gt;&lt;ol&gt;&lt;/ol&gt;&lt;h2&gt;Security Requirements&lt;/h2&gt;The German Federal Office for Information Security (&lt;a href=&quot;https://www.bsi.bund.de/EN/Home/home_node.html&quot; target=&quot;_blank&quot;&gt;BSI&lt;/a&gt;) provides some simple and effective &lt;a href=&quot;https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/Minimum_information/SecurityRecommendationsCloudComputingProviders.pdf?__blob=publicationFile&quot; target=&quot;_blank&quot;&gt;security requirements&lt;/a&gt; for Cloud Service Providers which I prefered to use because we are a German company and the set of recommendations is manageable.&lt;br /&gt;&lt;h2&gt;Our Testing&lt;/h2&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;My testing suite based on the OWASP testing guide v3&lt;/li&gt;&lt;li&gt;Fuzzing&lt;/li&gt;&lt;li&gt;API fuzzing&lt;/li&gt;&lt;li&gt;Manual reviews&lt;/li&gt;&lt;li&gt;Code reviews&lt;/li&gt;&lt;li&gt;Regression testing&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;h2&gt;Vulnerabilities and Hardening&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;CVE-2012-2094: The log viewer of the Dashboard was vulnerable to an XSS attack.&lt;/li&gt;&lt;li&gt;CVE-2012-2144: One of the first bugs we found was a Session Fixation vulnerability in the Dashboard&lt;/li&gt;&lt;li&gt;CVE-2012-3360: (&lt;a href=&quot;https://bugs.launchpad.net/nova/+bug/1015531&quot; target=&quot;_blank&quot;&gt;lpd#1015531&lt;/a&gt;) The Nova API was vulnerable to Path Traversal which allowed remote users to overwrite arbitrary files with chosen content.&lt;/li&gt;&lt;li&gt;CVE-2012-3537 The crowbar ohai plugin insecurely handles temp. files which leads to local privilege escalation&lt;/li&gt;&lt;li&gt;CVE-2012-3540: Just a few days before the Gold Master we found an Open Redirect vulnerability using the &lt;span&gt;next=&lt;/span&gt;&lt;span&gt; paramater&lt;/span&gt;, that would allow a remote attacker to execute a Phishing attack.&lt;/li&gt;&lt;li&gt;CVE-2012-3551: A simple XSS attack was possible using the &lt;span&gt;file=&lt;/span&gt;&lt;span&gt; parameter&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/keystone/+bug/963098&quot; target=&quot;_blank&quot;&gt;lpd#963098&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;https://bugs.launchpad.net/horizon/+bug/948317&quot; target=&quot;_blank&quot;&gt;lpd#948317&lt;/a&gt;: Guessing passwords was very easy, there is no way to specify a mandatory password policy for newly created users in the Dashboard, authentication violations weren't logged by Keystone, and there is no limit &amp;nbsp;per client for guessing passwords. We tried to introduce cracklib to enforce a password policy, but it was just &lt;b&gt;&quot;a&quot;&lt;/b&gt; policy not the one the CSP would like to use, therefore a configureable regex was introduced in local_settings.py, BTW, don't foret to enable it. Additionally our Keystone server logs authentication violation in &lt;span&gt;/var/log/keystone&lt;/span&gt; now. A rate limit to stop online password guessing will be introduced later.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/swift/+bug/1006414&quot; target=&quot;_blank&quot;&gt;lpd#1006414&lt;/a&gt;&amp;nbsp;: Remote command execution via &lt;span&gt;pickle&lt;/span&gt;. No CVE-ID assigned, severity unclear.&lt;/li&gt;&lt;li&gt;With SUSE Cloud it is possible to enable SSL for the API, the Dashboard (Session Cookies use &quot;secure&quot; and &quot;httpOnly&quot; flag in SSL mode), the VNC server, etc. All this interfaces to the Cloud are used via the Internet and are therefore easy to attack.&lt;/li&gt;&lt;li&gt;OpenStack, crowbar, ceph come with a lot of configuration files, a lot of them contain passwords, keys and other sensitive information. These files are not world-readable anymore in SUSE Cloud.&lt;/li&gt;&lt;li&gt;Default passwords/secrets/keys (for example to secure session cookies) are a big problem in current web-frameworks like Rails or Django, especially when you use cloned images in a VM. (Django's SECRET_KEY was fixed, take care yourself about static secrets)&lt;/li&gt;&lt;li&gt;Fuzzing the RESTful APIs of Nova/Compute and Keystone was done using the &lt;a href=&quot;https://gitorious.org/test-suite/test-suite&quot; target=&quot;_blank&quot;&gt;fuzz_xmlrpc.pl script&lt;/a&gt;&amp;nbsp;and did not reveal any additional suspicious actions (beside watching logs and error messages, behavior was monitored with an inotify and exec monitor). This testing was sufficient for the first round.&lt;/li&gt;&lt;li&gt;... and various other tiny issues...&amp;nbsp;&lt;/li&gt;&lt;li&gt;... about 40% of the current Essex security issues were found by us.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;Lessons learned&lt;/h2&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Agile development is something I really like, it doesn't try to tame the chaos, it is just open, pragmatic, and adaptive. The problem is that the code changes very often and even lately. This can cause failures to re-occurre therefore automatic regression testing is very important. (CI server)&lt;/li&gt;&lt;li&gt;To make automatic regression testing effective it is very important for security engineers to create testcases (proof-of-concept exploits) which is time consuming but a clear proof of the problem which helps developers to understand the problem, and to reproduce it automatically.&lt;/li&gt;&lt;li&gt;Even if&amp;nbsp;creative minds, which security engineers are IMO, didn't like it, but risk assessment based on design analysis is the key element to be successful.&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;What will come next?&lt;/h2&gt;Automatic security tests are my major concern for the next product release, this would minimize regressions and gives the security engineers the time to concentrate on more sophisticated attacks as well on focusing on design improvements. I will try to leave my microcosm and get more involved in the upstream development as well as defining meaningful security guidelines for CSPs and for Cloud Computing software stack developers.&lt;br /&gt;This project brings a lot of joy and the next major release will become even more secure ... so remember to have fun! :-)&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-09-03T03:59:56+00:00</dc:date>
	<dc:creator>Thomas (noreply@blogger.com)</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=550">
	<title>James Morris: Linux Security Summit 2012 – Schedule update</title>
	<link>http://blog.namei.org/2012/08/29/linux-security-summit-2012-schedule-update/</link>
	<content:encoded>&lt;p&gt;Just to let folks know who are attending, we&amp;#8217;ve added a lightning talks slot to the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012/Schedule&quot;&gt;LSS 2012 schedule&lt;/a&gt;, on Friday 31st August at 2pm.&lt;/p&gt;
&lt;p&gt;If you have any emerging topics to discuss, come along on the day and contact me to schedule a slot.  We have one confirmed talk already: Dave Jones will be discussing his Trinity system call fuzzing work.&lt;/p&gt;
&lt;p&gt;Note that this change pushes the &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012/Abstracts/Bryant&quot;&gt;LF Linux Security Workgroup BoF&lt;/a&gt; back thirty minutes.&lt;/p&gt;</content:encoded>
	<dc:date>2012-08-29T04:41:52+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="hatenablog://entry/12704830469096319078">
	<title>KaiGai Kohei: mod_selinuxのアーキテクチャを考える(後編)</title>
	<link>http://kaigai.hatenablog.com/entry/20120818/1345236810</link>
	<content:encoded>&lt;p&gt;&lt;a href=&quot;http://d.hatena.ne.jp/kaigai/20120811/1344667946&quot;&gt;&amp;#x524D;&amp;#x56DE;&amp;#x306E;&amp;#x8A18;&amp;#x4E8B;&lt;/a&gt;では、現在の mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt; モジュールの問題点を解決するために複数のタスクキューにワーカースレッドを紐付ける方法を考え、そこから一歩考察を進めて、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;を使ってマルチプロセス実装にすればよりセキュアなWebアプリケーション環境を実現できるのではないか？というアイデアを紹介した。&lt;/p&gt;

&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;実際にやってみた。&lt;/h4&gt;
    &lt;p&gt;もちろん&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;の権限に紐付けてリクエストの送出先を切り替える&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;モジュールは存在しないので、既存のものに少し手を加える事にする。今回は（たぶん最も広く使われているであろう）&lt;a href=&quot;http://httpd.apache.org/mod_fcgid/&quot;&gt;mod_fcgid&lt;/a&gt;をベースに修正を加える事にする。&lt;/p&gt;&lt;p&gt;mod_fcgidモジュールでは&lt;a href=&quot;http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidwrapper&quot;&gt;FcgidWrapper&lt;/a&gt;ディレクティブを使って、例えば .&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/php&quot;&gt;php&lt;/a&gt; 拡張子を持つURLが指定された場合、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;プロトコルを介して/usr/bin/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/php&quot;&gt;php&lt;/a&gt;-cgiにリクエストを処理させるという指定ができる。&lt;br /&gt;
例えばこんな感じ。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;AddHandler      fcgid-script     .php
FcgidWrapper    /usr/bin/php-cgi .php&lt;/pre&gt;&lt;p&gt;で、mod_fcgidのソースを読んでみて気が付いたのだが、この人は&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;常駐プログラムが既に起動しているかどうかをチェックするために、内部テーブルをスキャンして、動作中のプロセスを起動したときの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%B3%A5%DE%A5%F3%A5%C9%A5%E9%A5%A4%A5%F3&quot;&gt;コマンドライン&lt;/a&gt;文字列（要はFcgidWrapperで指定した内容）と、これから起動する&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;常駐プログラムの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%B3%A5%DE%A5%F3%A5%C9%A5%E9%A5%A4%A5%F3&quot;&gt;コマンドライン&lt;/a&gt;文字列を比較するという処理を行っている。&lt;br /&gt;
そうすると、仮にラッパープログラムの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%B3%A5%DE%A5%F3%A5%C9%A5%E9%A5%A4%A5%F3&quot;&gt;コマンドライン&lt;/a&gt;文字列の一部を、HTTPリクエストを処理するセキュリティコンテキスト（あるいはユーザIDでも可）で置換するような仕組みを作ってあげれば、FcgidWrapperを次のように指定するだけで、後はmod_fcgidが善きに計らってくれる。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;FcgidWrapper  &quot;runcon %(SELINUX_CONTEXT) /usr/bin/php-cgi&quot; .php&lt;/pre&gt;&lt;p&gt;例えば、HTTPユーザ alice の場合に %(&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELINUX&quot;&gt;SELINUX&lt;/a&gt;_CONTEXT)が &quot;system_u:system_r:&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;_t:s0:c0&quot; に置換されたら、この設定内容は次のコマンドと等価である。おそらく、認証モジュールで設定するようなHTTP&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B4%C4%B6%AD%CA%D1%BF%F4&quot;&gt;環境変数&lt;/a&gt;か何かを使うのが汎用的な実装だろう。兎に角、%(&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELINUX&quot;&gt;SELINUX&lt;/a&gt;_CONTEXT)の部分を動的に置換するというのがポイントである。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;FcgidWrapper  &quot;runcon system_u:system_r:httpd_t:s0:c0 /usr/bin/php-cgi&quot; .php&lt;/pre&gt;&lt;p&gt;もう一点。&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;のような動的コンテンツであれば既存の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;の設定と同様にできるが、静的コンテンツの場合、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/apache&quot;&gt;apache&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;はhandlerフックの一番最後で他のモジュールが処理できないタイプのHTTPリクエストを処理する…という流れになる。&lt;br /&gt;
つまり、ap_hook_handler() に APR_HOOK_LAST を付けて関数ポインタを登録し、静的コンテンツを読むだけの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;常駐プログラムを実行するような拡張が必要になる。&lt;/p&gt;&lt;p&gt;この２点の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%CB%E2%B2%FE%C2%A4&quot;&gt;魔改造&lt;/a&gt;を加えた mod_fcgid がこちら。&lt;br /&gt;
  &lt;a href=&quot;https://github.com/kaigai/mod_fcgid&quot;&gt;https://github.com/kaigai/mod_fcgid&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;KaiGai版 mod_fcgid のインストールと設定&lt;/h4&gt;
    &lt;p&gt;mod_fcgid(&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%CB%E2%B2%FE%C2%A4&quot;&gt;魔改造&lt;/a&gt;版)のインストールは以下の通り。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ git clone git://github.com/kaigai/mod_fcgid.git
$ cd mod_fcgid
$ git checkout --track origin/defhnd
$ ./configure.apxs &amp;amp;&amp;amp; make
$ sudo make install&lt;/pre&gt;&lt;p&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Apache&quot;&gt;Apache&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;の設定ファイルを編集。ここでは、.&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/php&quot;&gt;php&lt;/a&gt; ファイルに対してrunconを介して/usr/bin/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/php&quot;&gt;php&lt;/a&gt;-cgiを実行するのと同時に、静的コンテンツに対しては&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/fcgi&quot;&gt;fcgi&lt;/a&gt;-cat(後述)コマンドを実行する。&lt;br /&gt;
runconの引数に%(AUTHENTICATE_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELINUX&quot;&gt;SELINUX&lt;/a&gt;_TYPE)と%(AUTHENTICATE_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELINUX&quot;&gt;SELINUX&lt;/a&gt;_RANGE)が付いているが、これは実行時にHTTP&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B4%C4%B6%AD%CA%D1%BF%F4&quot;&gt;環境変数&lt;/a&gt;と置換される。で、この&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B4%C4%B6%AD%CA%D1%BF%F4&quot;&gt;環境変数&lt;/a&gt;を設定するのがauthn_dbd_moduleで、AuthDBDUserPWQueryが2個以上のカラムを返すとき、それらの内容はHTTP&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B4%C4%B6%AD%CA%D1%BF%F4&quot;&gt;環境変数&lt;/a&gt;として後続のモジュールで参照する事ができる。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;LoadModule fcgid_module      modules/mod_fcgid.so
LoadModule dbd_module        modules/mod_dbd.so
LoadModule authn_dbd_module  modules/mod_authn_dbd.so

DBDriver    pgsql
DBDParams   &quot;host=localhost dbname=web user=apache&quot;

AddHandler      fcgid-script  .php
FcgidWrapper    &quot;/bin/runcon -t %(AUTHENTICATE_SELINUX_TYPE)  \
                             -l %(AUTHENTICATE_SELINUX_RANGE) \
                     /usr/bin/php-cgi&quot; .php
FcgidDocumentWrapper  &quot;/bin/runcon -t %(AUTHENTICATE_SELINUX_TYPE)  \
                                   -l %(AUTHENTICATE_SELINUX_RANGE) \
                           /usr/local/bin/fcgi-cat&quot;

&amp;lt;Directory &quot;/var/www/html&quot;&amp;gt;
# BASIC authentication
AuthType    Basic
AuthName    &quot;Secret Zone&quot;
AuthBasicProvider    dbd
AuthDBDUserPWQuery    &quot;SELECT upasswd, selinux_type, selinux_range \
                       FROM uaccount WHERE uname = %s&quot;
Require     valid-user
&amp;lt;/Directory&amp;gt;&lt;/pre&gt;&lt;p&gt;次に、認証DBのセットアップ。uaccountテーブルに&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/BASIC%C7%A7%BE%DA&quot;&gt;BASIC認証&lt;/a&gt;の情報をインプットしておく。$PGDATAは&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;のDB&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AF%A5%E9%A5%B9%A5%BF&quot;&gt;クラスタ&lt;/a&gt;のトップディレクトリ。まぁ、COPYコマンドで読めればドコでもいいんですが。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ htpasswd -c $PGDATA/uaccount.master alice
New password:
Re-type new password:
Adding password for user alice
$ htpasswd $PGDATA/uaccount.master bob
New password:
Re-type new password:
Adding password for user bob
$ createdb web&lt;/pre&gt;&lt;pre class=&quot;code&quot;&gt;$ pgsql web
web=# CREATE USER apache;
CREATE ROLE
web=# CREATE TABLE uaccount (
     uname   text primary key,
     upasswd text,
     selinux_type text,
     selinux_range text
 );
CREATE TABLE
web=# GRANT SELECT on uaccount TO public;
GRANT
web=# COPY uaccount(uname,upasswd) FROM '/opt/pgsql/uaccount.master';
web=# COPY uaccount(uname,upasswd) FROM '/opt/pgsql/uaccount.master' DELIMITER ':';
COPY 2
web=# UPDATE uaccount SET selinux_type = 'httpd_t';
UPDATE 2
web=# UPDATE uaccount SET selinux_range = 's0:c0' WHERE uname = 'alice';
UPDATE 1
web=# UPDATE uaccount SET selinux_range = 's0:c1' WHERE uname = 'bob';
UPDATE 1
web=# SELECT * FROM uaccount;
 uname |                upasswd                | selinux_type | selinux_range
-------+---------------------------------------+--------------+---------------
 alice | $apr1$HQtZm8Sz$ZwXm9tx6Kz7g2wiE1LBUZ/ | httpd_t      | s0:c0
 bob   | $apr1$YJWn7hx3$iJyazYClFeFF0n8EgIMSi. | httpd_t      | s0:c1
(2 rows)&lt;/pre&gt;&lt;p&gt;次に、静的ドキュメントを参照するFactCGI常駐プログラムの&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/fcgi&quot;&gt;fcgi&lt;/a&gt;-catをビルドして /usr/local/bin にインストールする。こやつのビルドには &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/fcgi&quot;&gt;fcgi&lt;/a&gt;-devel パッケージも必要です。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ git clone git://github.com/kaigai/toybox.git
$ cd toybox
$ gcc -g fcgi-cat.c -lfcgi -o fcgi-cat
$ sudo install -m 755 fcgi-cat /usr/local/bin&lt;/pre&gt;&lt;p&gt;最後に、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%BB%A5%AD%A5%E5%A5%EA%A5%C6%A5%A3%A5%DD%A5%EA%A5%B7%A1%BC&quot;&gt;セキュリティポリシー&lt;/a&gt;を追加し、Booleanを調整して設定は終わり。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ make -f /usr/share/selinux/devel/Makefile webapps.pp
$ sudo semodule -i webapps.pp
$ sudo setsebool httpd_can_network_connect_db on&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;動かしてみた&lt;/h4&gt;
    &lt;p&gt;お試しとして、以下の内容の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;スクリプトを実行させてみる。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&amp;lt;?php
echo &quot;&amp;lt;h3&amp;gt;&quot;.selinux_getcon().&quot;&amp;lt;h3&amp;gt;\n&quot;;
echo &quot;&amp;lt;h3&amp;gt;username = &quot;.$_SERVER[&quot;REMOTE_USER&quot;].&quot;&amp;lt;/h3&amp;gt;\n&quot;;

phpinfo();
?&amp;gt;&lt;/pre&gt;&lt;p&gt;ユーザ alice としてアクセスした場合。確かにDBで指定した通り、セキュリティコンテキストの末尾が &quot;:s0:c0&quot; となっている。&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120818053227&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120818/20120818053227.png&quot; alt=&quot;f:id:kaigai:20120818053227p:image&quot; title=&quot;f:id:kaigai:20120818053227p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;一方、ユーザ bob としてアクセスした場合。今度はセキュリティコンテキストの末尾が &quot;:s0:c1&quot; となっている。Server &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/API&quot;&gt;API&lt;/a&gt;の欄が &quot;CGI/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;&quot; となっている点にも注目。&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120818053226&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120818/20120818053226.png&quot; alt=&quot;f:id:kaigai:20120818053226p:image&quot; title=&quot;f:id:kaigai:20120818053226p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;では、静的ドキュメントを参照した場合。２つの画像ファイル test00.jpg と test01.jpg のセキュリティコンテキストはそれぞれ以下のように設定されているため、alice は test00.jpg を参照できるが、test01.jpg は見えないはず。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;$ ls -Z /var/www/html
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 mytest.php
-rwxr--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0:c0 test00.jpg
-rwxr--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0:c1 test01.jpg&lt;/pre&gt;&lt;p&gt;これが test00.jpg を参照したケース。正しく読み込めている。&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120818053858&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120818/20120818053858.png&quot; alt=&quot;f:id:kaigai:20120818053858p:image&quot; title=&quot;f:id:kaigai:20120818053858p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;今度は test01.jpg を参照した場合。サーバは 403 Forbidden を返している。ヒャッハー！&lt;br /&gt;
&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120818053857&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120818/20120818053857.png&quot; alt=&quot;f:id:kaigai:20120818053857p:image&quot; title=&quot;f:id:kaigai:20120818053857p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;画像は省略するが、これをユーザbobで試した場合は逆の結果となる。&lt;/p&gt;&lt;p&gt;もちろん、これらは&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;で動作しているので、psコマンドを叩くと常駐プロセスの様子が見える。&lt;br /&gt;
確かにユーザ alice と bob それぞれのHTTPリクエストを処理するために、別個のプロセスが起動している。&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[root@iwashi ~]# ps -AZ | grep php-cgi
system_u:system_r:httpd_t:s0:c0 23960 ?        00:00:00 php-cgi
system_u:system_r:httpd_t:s0:c1 24062 ?        00:00:00 php-cgi
[root@iwashi ~]# ps -AZ | grep fcgi-cat
system_u:system_r:httpd_t:s0:c0 24098 ?        00:00:00 fcgi-cat
system_u:system_r:httpd_t:s0:c1 24107 ?        00:00:00 fcgi-cat&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;まとめ&lt;/h4&gt;
    &lt;p&gt;今までの mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt; と違い、この方法では全てのDSOモジュールに作用させるという事はできない。&lt;br /&gt;
&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;なら&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;用の、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Ruby&quot;&gt;Ruby&lt;/a&gt;なら&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Ruby&quot;&gt;Ruby&lt;/a&gt;用の設定がそれぞれ必要となる。これは確かにデメリット。&lt;/p&gt;&lt;p&gt;その一方で、HTTPユーザ毎にアプリを実行するメモリ空間を分けられるという事は、セキュリティの観点からは非常に大きなアドバンテージである。Web管理者がその気になれば、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Apache&quot;&gt;Apache&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;では一切Webアプリの実行を行わず、ある種の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%A2%A5%D7%A5%EA%A5%B1%A1%BC%A5%B7%A5%E7%A5%F3%A5%B5%A1%BC%A5%D0&quot;&gt;アプリケーションサーバ&lt;/a&gt;として振る舞う&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;常駐プログラムが、HTTPユーザ毎に閉じたコンテナ環境を提供するという事も可能だろう。&lt;br /&gt;
セキュリティの強化を目的とするモジュールなので、ここのアドバンテージはでかい、と思う。&lt;/p&gt;

&lt;/div&gt;</content:encoded>
	<dc:date>2012-08-17T20:53:30+00:00</dc:date>
	<dc:creator>kaigai</dc:creator>
</item>
<item rdf:about="hatenablog://entry/12704830469096319080">
	<title>KaiGai Kohei: mod_selinuxのアーキテクチャを考える(前編)</title>
	<link>http://kaigai.hatenablog.com/entry/20120811/1344667946</link>
	<content:encoded>&lt;p&gt;mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt;は&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/apache&quot;&gt;apache&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;のプラグインで、利用者のHTTP要求の認証(BASICとかDIGESTとか)結果に基づいて、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;スクリプトや静的コンテンツを参照するContents Handlerの実行権限を切り替える。&lt;br /&gt;
やっている事は単純で、ap_hook_handlerの先頭で mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt; が処理を乗っ取り、一時的にワーカースレッドを作成して権限を縮退させる。で、以降のContents Handlerの実行はワーカースレッドに託されるという形になる。&lt;/p&gt;&lt;p&gt;だが、このデザインだと問題になる事が２点。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ap_invoke_handler()が再入可能ではない&lt;/li&gt;
&lt;li&gt;Bounds domainの範囲でしかドメイン遷移ができない&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;前者の問題について。CGIが自サーバ内のURLを含むLocation: ヘッダを返した場合など、internal redirectionという処理が走り、cgi_handlerのコンテキストでap_invoke_handler()が再び呼ばれる事がある。&lt;br /&gt;
この場合、再びHTTP認証が実行され、その結果、cgi_hanclerのコンテキストとは異なるsecurity contextが指定される事があり得る。が、既にsecurity contextを変更する権限を放棄しているハズなので、詰む。この場合はエラーを返してごめんなさいするしかない。&lt;br /&gt;
この問題は、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;に限った話ではなく、CAP_SETUIDを放棄するシナリオでも同じ。&lt;/p&gt;&lt;p&gt;後者の問題について。これは&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;固有の話で、マルチスレッドのアプリがドメイン遷移を行う場合、遷移先のドメインは bounds domain 制約を満足する必要がある。&lt;br /&gt;
（いや、これは元々私の提案だが・・・。）&lt;br /&gt;
ドメイン &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;_t が user_webapp_t の bounds domain であるという状態は、user_webapp_t の持っている権限は全て &lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;_t も持っているという事。つまり、ドメイン遷移元の&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;_tは、システム管理系のツール等もWeb経由で実行させると考えると、相当に広範な権限を付与する必要がある・・・事になる。&lt;br /&gt;
実際に&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%BB%A5%AD%A5%E5%A5%EA%A5%C6%A5%A3%A5%DD%A5%EA%A5%B7%A1%BC&quot;&gt;セキュリティポリシー&lt;/a&gt;を書くとなると、これが地味に効いてくる。&lt;br /&gt;
端的に言って、書きにくい・・・。（´ω｀;;）&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120811141418&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120811/20120811141418.png&quot; alt=&quot;f:id:kaigai:20120811141418p:image&quot; title=&quot;f:id:kaigai:20120811141418p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
まず前者の問題を解決するため、mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt;の構造を上の模式図のように変更してみた。このデザインではsecurity context毎にタスクキューを持ち、ap_handler_hookの先頭でHTTP認証に応じてキューにタスクを振り分けるという形になる。&lt;br /&gt;
キューは on demand で生成され、適合する security context が存在しない場合にはTask Launcher Threadにキュー生成要求を行ってこれを作成してもらう。&lt;br /&gt;
このデザインだと、ap_invoke_handler()の延長でinternal redirectionが走った場合でも、再帰して呼び出されたap_handler_hookの先頭で行う処理は『適切なキューに処理要求を投げる』だけなので問題は生じない。&lt;/p&gt;&lt;p&gt;・・・と、ここまで実装してハタと気が付いた。&lt;/p&gt;&lt;p&gt;これって本質的には (1)プロトコル処理サーバ と (2)&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%A2%A5%D7%A5%EA%A5%B1%A1%BC%A5%B7%A5%E7%A5%F3%A5%B5%A1%BC%A5%D0&quot;&gt;アプリケーションサーバ&lt;/a&gt; の分離と同じことだよねと。&lt;br /&gt;
だとすると、上のデザインでは各キューに紐付いていたワーカースレッドをワー&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AB%A1%BC%A5%D7&quot;&gt;カープ&lt;/a&gt;ロセスとして分離すると、最初に挙げた２つの問題のうち後者の Bounds domain の制限を取り払う事ができるようになる。&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120811141416&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120811/20120811141416.png&quot; alt=&quot;f:id:kaigai:20120811141416p:image&quot; title=&quot;f:id:kaigai:20120811141416p:image&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;つまり、利用者のcredentials（uid/gid/security context）毎にワー&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AB%A1%BC%A5%D7&quot;&gt;カープ&lt;/a&gt;ロセスをon demandで起動し、HTTPリクエストの解析は&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/apache&quot;&gt;apache&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/httpd&quot;&gt;httpd&lt;/a&gt;自身で行う一方で、静的コンテンツの参照も含めたHTTPリクエストの処理をワー&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AB%A1%BC%A5%D7&quot;&gt;カープ&lt;/a&gt;ロセスで実行するようにすれば、問題は全て解決するのではなかろうか。&lt;/p&gt;&lt;p&gt;幸いな事に、この手のプロトコルとして&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/FastCGI&quot;&gt;FastCGI&lt;/a&gt;が既に定義されており、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PHP&quot;&gt;PHP&lt;/a&gt;や&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Ruby&quot;&gt;Ruby&lt;/a&gt;、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Java&quot;&gt;Java&lt;/a&gt;などメジャーどころの言語はこれに対応している。&lt;/p&gt;&lt;p&gt;．．．とすると、mod_&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/selinux&quot;&gt;selinux&lt;/a&gt;を拡張するよりも、mod_fcgidに対する追加機能として&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;（やその他のセキュリティ機構を包含する）仕組みを提案した方が、メンテナンスが楽になるのかな、と考え中。&lt;/p&gt;</content:encoded>
	<dc:date>2012-08-11T06:52:26+00:00</dc:date>
	<dc:creator>kaigai</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/56976.html">
	<title>Dan Walsh: Article I wrote on Harvard PAAS.</title>
	<link>http://danwalsh.livejournal.com/56976.html</link>
	<content:encoded>Occasionally I write longer articles that I feel are too long for a blog...&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://www.linux.com/news/enterprise/systems-management/613339:harvard-goes-paas-with-selinux-sandbox?utm_source=twitterfeed&amp;amp;utm_medium=twitter&quot; rel=&quot;nofollow&quot;&gt;Harvard CS Uses PAAS and Fedora.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Kind of nice to get the message out to other people also.&amp;nbsp; Thanks to OpenSource.com for publishing it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</content:encoded>
	<dc:date>2012-08-04T11:52:22+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/56760.html">
	<title>Dan Walsh: SELinux Apache Security Study</title>
	<link>http://danwalsh.livejournal.com/56760.html</link>
	<content:encoded>Kirill Ermakov recently posted a &lt;a href=&quot;http://ptresearch.blogspot.com/2012/08/selinux-in-practice-dvwa-test.html&quot; rel=&quot;nofollow&quot;&gt;study&lt;/a&gt; he did of SELinux protections against a vulnerable Apache server.&lt;br /&gt;&lt;br /&gt;After reading the study you might come a way with the idea that SELinux did not block anything.&amp;nbsp; After all it allowed the hacked process to read /etc/passwd.&amp;nbsp; SELinux also allowed a hacked Apache to upload a file and execute it.&lt;br /&gt;&lt;br /&gt;This points out what most people do not understand about SELinux.&amp;nbsp; SELinux does not necessarily block errors in applications from happening.&amp;nbsp; SELinux will just contain them.&amp;nbsp; If you are able to subvert the Apache application then you can become the Apache application and will have the rights allowed to the apache application.&amp;nbsp; In his examples he was able to take over the Apache server and do what an apache server needs to do, including reading the /etc/passwd file.&amp;nbsp; A better test would be:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Try to connect to a few network ports like the mail port&amp;nbsp; - Out of the box we should not allow Apache to connect to&amp;nbsp;many network ports.&lt;/li&gt;&lt;li&gt;Read /secrets/mysecrets&amp;nbsp; - Random content on the file system should not be readable by Apache&lt;/li&gt;&lt;li&gt;Read /home/dwalsh/creditcard.txt - Random content in a users home dir should not be readable by apace&lt;/li&gt;&lt;li&gt;Read /var/lib/mysql/mysqld.data. - Database data should not be readable by Apache except if allowed through a constricted path like a unix domain socket.&lt;/li&gt;&lt;li&gt;Try to run su or sudo, or strace, or network sniffer.&lt;/li&gt;&lt;/ul&gt;All things the Apache server should not be allowed to do.&lt;br /&gt;&lt;br /&gt;If an Apache server has a bug in its code, then it can be owned whether or not SELinux is in enforcing mode, the goal is to confine the attacker to just the Apache data and not allow him to attack other data or processes on the system.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Apache Booleans &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now lets look further at Apache SELinux policy configuration.&amp;nbsp; A while ago I wrote a blog on &lt;a href=&quot;http://danwalsh.livejournal.com/25265.html&quot; rel=&quot;nofollow&quot;&gt;&amp;quot;Security vs Usability&amp;quot;&lt;/a&gt;, in which I explained the continuing conflict between setting up a machine with security as tight as possible, but not so tight as forcing people to turn the security off.&amp;nbsp; When we ship SELinux policy we have to make compromises on security, to avoid the &amp;quot;Just turn it off crowd&amp;quot;.&lt;br /&gt;Lets look at some of these compromises,&amp;nbsp; and maybe explain how you could tighten the security in your Apache.&lt;br /&gt;&lt;br /&gt;Out of the box SELinux in RHEL6 has the following boolean settings for an Apache server.&lt;br /&gt;&lt;br /&gt;On RHEL6 we have&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# semanage boolean -l | grep httpd | grep -v off&lt;br /&gt;httpd_enable_cgi&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd cgi support&lt;br /&gt;httpd_dbus_avahi&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow Apache to communicate with avahi service via dbus&lt;br /&gt;httpd_unified&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Unify HTTPD handling of all content files.&lt;br /&gt;httpd_builtin_scripting&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd to use built in scripting (usually php)&lt;br /&gt;httpd_tty_comm&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Unify HTTPD to communicate with the terminal. Needed for entering the passphrase for certificates at the terminal.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On RHEL7 and Fedora we have&lt;br /&gt;&lt;br /&gt;&lt;span&gt;#&amp;nbsp; semanage boolean -l | grep httpd | grep -v off&lt;br /&gt;httpd_enable_cgi&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; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd cgi support&lt;br /&gt;httpd_graceful_shutdown&amp;nbsp;&amp;nbsp;&amp;nbsp; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow HTTPD to connect to port 80 for graceful shutdown&lt;br /&gt;httpd_builtin_scripting&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (on&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp; on)&amp;nbsp; Allow httpd to use built in scripting (usually php)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was interested on how he was able to execute tmp_t content.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s httpd_t -t httpd_tmp_t -p execute -C&lt;br /&gt;Found 1 semantic av rules:&lt;br /&gt;DT allow httpd_t httpd_tmp_t : file { ioctl read getattr lock execute&lt;br /&gt;execute_no_trans open } ; [ httpd_tmp_exec httpd_builtin_scripting &amp;amp;&amp;amp; ]&lt;br /&gt;&lt;br /&gt;# sesearch -A -s httpd_sys_script_t -t httpd_tmp_t -p execute -C&lt;br /&gt;Found 1 semantic av rules:&lt;br /&gt;DT allow httpd_sys_script_t httpd_tmp_t : file { ioctl read getattr lock execute execute_no_trans open } ; [ httpd_tmp_exec httpd_enable_cgi &amp;amp;&amp;amp; ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Reading this, it looks like SELinux should have blocked the ability for the Apache process or a cgi script to execute the content by default. IE You would need to turn on the httpd_tmp_exec boolean as well as the httpd_enable_cgi boolean.&lt;br /&gt;&lt;br /&gt;But examining further the booleans, I wanted to know what content could httpd_t (Apache) or httpd_sys_script_t (Apache CGI Scripts) could execute and write.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# sesearch -A -s httpd_sys_script_t -t httpd_sys_content_t -p execute -C&lt;br /&gt;Found 3 semantic av rules:&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow httpd_sys_script_t exec_type : file { ioctl read getattr lock execute execute_no_trans open } ;&lt;br /&gt;&amp;nbsp;&amp;nbsp; allow httpd_sys_script_t httpd_sys_content_t : file { ioctl read getattr lock execute entrypoint open } ;&lt;br /&gt;ET allow httpd_sys_script_t httpd_sys_content_t : file { ioctl read getattr lock execute execute_no_trans entrypoint open } ; [ httpd_enable_cgi httpd_unified &amp;amp;&amp;amp; ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So the problem here is actually httpd_unified.&amp;nbsp; httpd_unified basically says to SELinux allow Apache processes to treat all Apache content with the same rules.&amp;nbsp; In RHEL7 we feel users are familiar enough with SELinux to disable the httpd_unified boolean by default.&amp;nbsp;&amp;nbsp; If this boolean is off, then users would have to label files/directories as httpd_sys_content_rw_t if they wanted Apache to be able to write to a directory rather then the read/only label of httpd_sys_content_t.&amp;nbsp; With the boolean on, Apache processes can read/write/execute all httpd_sys_content* labels.&lt;br /&gt;&lt;br /&gt;If you are not uploading data to Apache then it is a good idea to turn off this boolean.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P httpd_unified 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now lets look at other booleans that are turned on by default in RHEL6. (And RHEL7 for that matter).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;httpd_enable_cgi&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This boolean enables your Apache server to run cgi scripts.&amp;nbsp; We leave this on by default because out of the box, any person running Apache would blow up with a permission denied when they tried to execute a cgi script.&amp;nbsp; If you were not running cgi scripts, it would be a good idea to turn this off.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P httpd_enable_cgi 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;httpd_builtin_scripting&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This boolean your Apache server to run builtin scripting, mod_php, mod_python, mod_perl ...&lt;br /&gt;We leave this on by default because out of the box, any person running Apache would blow up with a permission denied when they tried to execute a php script.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you are just allowing users to view Apache content, then you really should turn off both of these booleans.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P httpd_builtin_scripting 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;httpd_tty_comm&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;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This boolean allows httpd to talk to the terminal that launches it.&amp;nbsp; The risk here is a hacked apache server could trick an admin into entering his password, by putting a passwd: prompt on the screen and then reading the admins commands.&amp;nbsp; This access is necessary for people who setup apache servers which require a passwd from the admin when they start, it also allow apache to output errors to the screen, like the configuration is screwed up.&amp;nbsp; In Fedora and RHEL7 this output is handled by systemd, so this access is no longer needed, and can be disabled by default.&amp;nbsp; If your apache server does not require a password at start and you know that your config is correct you should turn this boolean off.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P httpd_tty_comm 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;httpd_dbus_avahi&lt;br /&gt;&lt;br /&gt;This boolean allows apache to communicate with the avahi daemon over DBUS.&amp;nbsp; This boolean should have been disabled by default, but most likely does not add much risk.&amp;nbsp; It is turned off by default in Fedora and RHEL7.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# setsebool -P httpd_dbus_avahi 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Bottom line as people grow to peoples understanding of SELinux, we can slowly tighten up the controls...</content:encoded>
	<dc:date>2012-08-02T20:01:02+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="urn:lj:livejournal.com:atom1:paulmoore:7832">
	<title>Paul Moore: New Release for libseccomp</title>
	<link>http://paulmoore.livejournal.com/7832.html</link>
	<content:encoded>&lt;p&gt;Just a few minutes ago we announced the second release of the libseccomp library, version 1.0.0. The libseccomp library is designed to provide an easy to use, platform independent, interface the Linux's syscall filtering mechanism: seccomp.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Significant changes in this release include:&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The API is now context-aware; eliminating all internal state but breaking compatibility with the initial 0.1.0 release. The major version number has been bumped with this release to allow both version to coexist on the same system.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Added support for multiple, simultaneous build jobs and verbose build output.  This should not affect individual developers, but it should make life easier for packagers.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;Once again, thanks to everyone who has submitted suggestions, provided testing &lt;br /&gt;help, and contributed patches to the project.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;SourceForge project page: &lt;a href=&quot;http://sourceforge.net/projects/libseccomp&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/projects/libseccomp&lt;/a&gt;&lt;br /&gt;Direct download: &lt;a href=&quot;http://sf.net/projects/libseccomp/files/libseccomp-1.0.0.tar.gz/download&quot; rel=&quot;nofollow&quot;&gt;http://sf.net/projects/libseccomp/files/libseccomp-1.0.0.tar.gz/download&lt;/a&gt;&lt;/p&gt;</content:encoded>
	<dc:date>2012-07-31T19:03:59+00:00</dc:date>
</item>
<item rdf:about="http://danwalsh.livejournal.com/56534.html">
	<title>Dan Walsh: SELinux with cp/mv</title>
	<link>http://danwalsh.livejournal.com/56534.html</link>
	<content:encoded>Back in March 22nd, 2006, I wrote a blog on &lt;a href=&quot;http://danwalsh.livejournal.com/2639.html&quot; rel=&quot;nofollow&quot;&gt;coreutils and SELinux .&lt;/a&gt; In that blog I had a couple of paragraphs on cp and the mv command.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;strong&gt;mv&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The mv command will attempt to maintain the security context of the file when it is moved to a different directory... This causes some&lt;br /&gt;confusion, but this works the same was as with discretionary access. If I create a file owned by dwalsh in /tmp and then copy it to /etc, the ownership of the file will still be dwalsh in /etc. Similarly if the file was created in /tmp, it will have a security context of tmp_t, so when it is moved to /etc. It will continue to have tmp_t as it's security context.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;cp&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The cp command is a little different. If a file exists at you are copying over, the new file will maintain the file context of the previous file. So if I look at /etc/resolv.conf, I will see that it is labeled net_conf_t. If I copy a file over it say /tmp/resolv.conf, labeled tmp_t, onto /etc/resolv.conf, it will still be labeled net_conf_t. If I moved the file /tmp/resolv.conf onto /etc/resolv.conf, it will end up with tmp_t.&lt;br /&gt;&lt;br /&gt;If the file does not exist it follow the rules defined above, IE it will either get the security context of the directory, or if a file_transition rule exists it will transition the context to follow the rule. So if you remove /etc/resolv.conf and cp /tmp/resolv.conf to /etc, you will end up with a security context of etc_t. Similarly if cp /etc/resolv.conf to ~/ it will end up with a security context of user_home_t. cp has an option to preserve the mode, ownership, and timestamps, but this option does not work with the file_context, you&amp;nbsp; need to use -Z.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;UPDATE: We now have named file transitions in Fedora which for certain files/directory get labeled correctly on creation, so cp of a file named resolv.conf into a directory labeled etc_t will now get labeled net_conf_t atomically. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;One of the problems we see quite often is a user creates an html file in his home dir or in /tmp and then moves it to /var/www/html. Apache then gets an access denied because apache is not allowed to read user_home_t. The quickest way to clean this up is with the restorecon command. The restorecon command reads the default file_contexts for the installed policy and then resets the file_context of all specified files.&lt;br /&gt;&lt;br /&gt;restorecon /var/www/html/mypage.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sadly people continue to stumble on this.&amp;nbsp; Today I saw email from a user who was setting up a apache server and obviously mv'd content from his home dir to the&amp;nbsp; /var/www/html/updates directory.&amp;nbsp; I know this because the person attached a setroubleshoot message&lt;br /&gt;Which showed the following alert.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Raw Audit Messages&lt;br /&gt;type=AVC msg=audit(1343656110.659:126): avc:&amp;nbsp; denied&amp;nbsp; { &lt;span&gt;open&lt;/span&gt; } for&amp;nbsp; pid=13506 comm=&amp;quot;&lt;span&gt;httpd&lt;/span&gt;&amp;quot; name=&amp;quot;&lt;span&gt;updates&lt;/span&gt;&amp;quot; dev=&amp;quot;dm-1&amp;quot; ino=278541 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:&lt;span&gt;user_home_t&lt;/span&gt;:s0 tclass=&lt;span&gt;dir&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice the &lt;span&gt;open&lt;/span&gt; access, from &lt;span&gt;httpd&lt;/span&gt; to the &lt;span&gt;updates dir&lt;/span&gt;.&amp;nbsp; I figure the admin mv'd it from his home directory since the content is labeled with he &lt;span&gt;user_home_t&lt;/span&gt; type. SELinux is complaining because from its point of view, the web server is trying to read content in the users homedir. This users homedir might contain credit card information, tax returns, password etc, stuff we would want to block a hacked web site from accessing.&amp;nbsp;&amp;nbsp;&amp;nbsp; I am pretty sure the user went in an changed the discretionary ownership/permissions, since the apache user would not be allowed to read a directory owned by the user with the default permissions on a directory created in his homedir.&lt;br /&gt;After fixing these permissions he did not think about SELinux and tried to run apache and got permission denied.&amp;nbsp; Luckily the setroubleshoot tool was installed and the user got an alert that said.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;SELinux is preventing /usr/sbin/httpd from open access on the directory /var/www/html/updates.&lt;br /&gt;&lt;br /&gt;*****&amp;nbsp; Plugin restorecon (99.5 confidence) suggests&amp;nbsp; *************************&lt;br /&gt;&lt;br /&gt;If you want to fix the label.&lt;br /&gt;/var/www/html/updates default label should be httpd_sys_content_t.&lt;br /&gt;Then you can run restorecon.&lt;br /&gt;Do&lt;br /&gt;# /sbin/restorecon -v /var/www/html/updates&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you create content in your home dir to be used&amp;nbsp; by a service, it is always a good idea to check all the security attributes of the content after you cp/mv it in place.&amp;nbsp; restorecon is often the correct tool to use.&amp;nbsp; And please read the alerts...&lt;br /&gt;&lt;br /&gt;For more information on SELinux and apache, you can read the apache_selinux man page.&lt;br /&gt;&lt;br /&gt;man apache_selinux</content:encoded>
	<dc:date>2012-07-30T18:40:03+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="urn:lj:livejournal.com:atom1:paulmoore:7632">
	<title>Paul Moore: Configuration Recipe: MLS System with Multiple Single Label Networks</title>
	<link>http://paulmoore.livejournal.com/7632.html</link>
	<content:encoded>&lt;p&gt;One of the most common complaints I hear about the labeled networking access controls in Linux is that users don't know how to configure them for their given scenario.  To help solve that problem I'm going to try and document some basic use cases and the associated labeled networking &quot;configuration recipes&quot;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;To start off, I'm going to tackle a fairly common use case: a SELinux system with different MLS/MCS labels connected to multiple, single label networks. Imagine a SELinux based system providing services, e.g. a web server, to multiple different networks, each consisting of label un-aware clients, e.g. Windows desktops, operating at different securit labels.  For this example, we will assume that the SELinux system is connected to two single label networks, one labeled at s1:c3,c5 (eth0,10.0.0.0/24) and the other labeled at s2:c4,c6 (eth1,10.0.1.0/24).  To complete the example, we will also assume that the SELinux system is running at least one application which needs to connect to the local system (localhost) at different levels.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The first step is to configure NetLabel to label incoming traffic on the unlabeled, single label networks.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;
# netlabelctl unlbl add interface:eth0 address:0.0.0.0/0 \
  label:system_u:object_r:netlabel_peer_t:s1:c3,c5
# netlabelctl unlbl add interface:eth1 address:0.0.0.0/0 \
  label:system_u:object_r:netlabel_peer_t:s2:c4,c6
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;In general we don't have to worry about the outbound traffic in this case since NetLabel sends all traffic unlabeled by default, but let's go ahead and assume that isn't the case for the sake of demonstration.  The commands below remove the default mapping and instruct NetLabel to send unlabeled traffic to both of the single label networks as well as any networks not explicitly specified (both IPv4 and IPv6).&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;
# netlabelctl map del default
# netlabelctl map add default address:10.0.0.0/24 protocol:unlbl
# netlabelctl map add default address:10.0.1.0/24 protocol:unlbl
# netlabelctl map add default address:0.0.0.0/0 protocol:unlbl
# netlabelctl map add default address:::/0 protocol:unlbl
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Next we want to configure the system to send labeled traffic to itself, so we need to tell NetLabel to send CIPSO labeled traffic to all of the system's addresses (in this case that would be 10.0.0.2, 10.0.1.2, and 127.0.0.0/8). However, first we need to configure a CIPSO DOI for this local traffic labeling; in this example we will use DOI #32 and the pass through DOI type with the enumerated (tag #2) and restricted bitmaps (tag #1) tags.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;
# netlabelctl cipsov4 add pass doi:32 tags:2,1
# netlabelctl map add default address:10.0.0.2 protocol:cipsov4,32
# netlabelctl map add default address:10.0.1.2 protocol:cipsov4,32
# netlabelctl map add default address:127.0.0.0/8 protocol:cipsov4,32
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Now we should have all of the labeling configuration in place and it is just a matter of making sure your SELinux configuration/policy is correct for the accesses you want to allow.  One important thing to remember is that you likely will want to use the &lt;i&gt;semanage&lt;/i&gt; tool to set the SELinux label for the single label interfaces; this will ensure that only traffic labeled as s1:c3,c5 can traverse the eth0 interface and only traffic labeled as s2:c4,c6 can traverse the eth1 interface.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;
# semanage interface -a -t netif_t -r s1:c3,c5 eth0
# semanage interface -a -t netif_t -r s2:c4,c6 eth1
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;At this point, if you haven't already, you should double check your SELinux policy as you will most likely need to add some custom policy modules to match your new labeled networking configuration, but thankfully that is something which has gotten much easier the past few years and already has plenty of good documentation available.  You may also want to start investigating the &lt;i&gt;xinetd&lt;/i&gt; &lt;i&gt;LABELED&lt;/i&gt; configuration option as a way of starting server applications at the label of the incoming connection request; it can be a very useful option for systems like this where you have client requests coming in at different levels.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Good luck, and don't hesitate to add any problems or questions you may have in the comments.&lt;/p&gt;</content:encoded>
	<dc:date>2012-07-06T21:10:10+00:00</dc:date>
</item>
<item rdf:about="hatenablog://entry/12704830469096319082">
	<title>KaiGai Kohei: 人生に影響を与えたプレゼンテーション</title>
	<link>http://kaigai.hatenablog.com/entry/20120630/1341032908</link>
	<content:encoded>&lt;p&gt;10年近くも技術者をやっていると、他の人のプレゼンテーションを見る機会はちょくちょくある。（別に&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/OSS&quot;&gt;OSS&lt;/a&gt;/&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/Linux&quot;&gt;Linux&lt;/a&gt;に限った話じゃなくて）&lt;br /&gt;
全く印象に残らないものから、発表後にプレゼンターを捕まえて議論が始まるもの、中には自分の考え方や活動に影響を与えたプレゼンテーションというのもあるハズ。&lt;/p&gt;&lt;p&gt;パッと二つ思い浮かんだのでご紹介。&lt;br /&gt;
・・・まぁ、他の人はどんなプレゼンテーションを見て心動かされたのか知りたい、という下心もあるんですが。&lt;/p&gt;

&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;&lt;a href=&quot;https://events.linuxfoundation.org/images/stories/slides/jls09/jls09_bottomley.pdf&quot;&gt;How to Contribute to the Linux Kernel, and Why it Makes Economic Sense (James Bottomley, Novell; LinuxCon/Japan 2009)&lt;/a&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120630132648&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120630/20120630132648.jpg&quot; alt=&quot;f:id:kaigai:20120630132648j:image:w360&quot; title=&quot;f:id:kaigai:20120630132648j:image:w360&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;なぜ&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AA%A1%BC%A5%D7%A5%F3%A5%BD%A1%BC%A5%B9&quot;&gt;オープンソース&lt;/a&gt;への貢献が重要で、ビジネス上も意義のある事である事なのかを説いたLinuxCon/Japan 2009でのキーノートの一節。&lt;br /&gt;
本来、企業が何か&quot;価値&quot;を顧客に届けるには、その価値の源泉であるUnique Innovationの部分と、その前提であるDelivery Support for the innovationの部分に投資をしなければならないが、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AA%A1%BC%A5%D7%A5%F3%A5%BD%A1%BC%A5%B9&quot;&gt;オープンソース&lt;/a&gt;を活用する事で企業はUnique Innovationの部分に注力でき、コミュニティと歩調を合わせて進む（勝手forkをしない）事でDelivery Support for the innovationの部分をShared Cost（そう、freeではなくshared costなのです）に保つ事ができるという趣旨の発表。&lt;/p&gt;&lt;p&gt;確かに自分のケースを振り返ってみても、SE-&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/PostgreSQL&quot;&gt;PostgreSQL&lt;/a&gt;を開発するために、その価値の源泉である&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SELinux&quot;&gt;SELinux&lt;/a&gt;との連携モジュールはともかくとして、&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/SQL&quot;&gt;SQL&lt;/a&gt;&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%B9%BD%CA%B8%B2%F2%C0%CF&quot;&gt;構文解析&lt;/a&gt;やクエリ最適化、クエリ実行といった&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/RDBMS&quot;&gt;RDBMS&lt;/a&gt;それ自身を作るなんてのはあり得ない話。確かに自分も&quot;巨人の肩に乗って&quot;開発しているんだと納得したものだ。&lt;/p&gt;&lt;p&gt;企業が&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/%A5%AA%A1%BC%A5%D7%A5%F3%A5%BD%A1%BC%A5%B9&quot;&gt;オープンソース&lt;/a&gt;の開発に貢献した方が、より低いコストでイノベーションを達成できる事、そして&quot;Free&quot;でなく&quot;Shared cost&quot;である事。この考え方は正に自分の人生に影響を与えたと思う。&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot;&gt;
    &lt;h4&gt;&lt;a href=&quot;http://www.pgcon.org/2011/schedule/events/352.en.html&quot;&gt;Parallel Image Searching Using PostgreSQL and PgOpenCL (Tim Child, 3DMashUp; PGcon2011)&lt;/a&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;span&gt;&lt;a href=&quot;http://f.hatena.ne.jp/kaigai/20120630132647&quot; class=&quot;hatena-fotolife&quot;&gt;&lt;img src=&quot;http://cdn-ak.f.st-hatena.com/images/fotolife/k/kaigai/20120630/20120630132647.jpg&quot; alt=&quot;f:id:kaigai:20120630132647j:image:w360&quot; title=&quot;f:id:kaigai:20120630132647j:image:w360&quot; class=&quot;hatena-fotolife&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;もう一つは、昨年のPGconで聴講したTim ChildのPG/OpenCLの発表。&lt;br /&gt;
内容は&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/RDBMS&quot;&gt;RDBMS&lt;/a&gt;に格納した画像データ（レコード長がかなり大きい）を&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;で高速に処理するというもの。&lt;br /&gt;
何が心に刺さったかというと、（一字一句正確ではないかもしれないが）最後のまとめで彼が語った『Database records are ideal data structure for parallel processing（データベースのレコードは理想的な並列処理のデータ構造だ）』という一言。&lt;/p&gt;&lt;p&gt;これを聞いて、なるほど&lt;a class=&quot;keyword&quot; href=&quot;http://d.hatena.ne.jp/keyword/GPU&quot;&gt;GPU&lt;/a&gt;を使ってCPUをオフロードすれば、検索処理を高速に処理できるではないか・・・？という発想でCUDAやOpenCLを調査し、その半年後にできたのがPG-Stromというモジュールだったりする。&lt;/p&gt;&lt;p&gt;さて、他の人に聞いてみたら、どんな『自分の人生に影響を与えたプレゼンテーション』が出てくるのだろう？&lt;/p&gt;

&lt;/div&gt;</content:encoded>
	<dc:date>2012-06-30T05:08:28+00:00</dc:date>
	<dc:creator>kaigai</dc:creator>
</item>
<item rdf:about="urn:lj:livejournal.com:atom1:paulmoore:7234">
	<title>Paul Moore: Full SELinux Labels Over Loopback with NetLabel and CIPSO</title>
	<link>http://paulmoore.livejournal.com/7234.html</link>
	<content:encoded>&lt;div&gt;Perhaps one of the largest shortcomings of the CIPSO network labeling protocol when used with SELinux is the fact that it can only convey the SELinux MLS attributes across the network. &amp;nbsp;There are plenty of good reasons for this: strict conformance with protocol specification, limited space in the IPv4 header, interoperability with non-SELinux systems, etc. &amp;nbsp;However, regardless of the reasons why, there will always be use cases where it would be very nice to have the full SELinux label without the performance, scalability and management overhead of labeled IPsec. &amp;nbsp;While I can't say I have solution for all of those use cases, today I am going to let you in on one of NetLabel's best kept secrets: NetLabel and CIPSO can convey the full SELinux label over local connections, and it has been able to do so for years.&lt;br /&gt;&lt;br /&gt;Now, before I got into the details of &amp;quot;how&amp;quot;, I just want to be clear that what I'm about to tell you isn't really a secret, it just hasn't been very well&amp;nbsp;publicized. &amp;nbsp;After all, I'm not sure how it could be a secret when the code is available for anyone and everyone to review and inspect. &amp;nbsp;Further, the &amp;quot;how&amp;quot; is even documented in the &lt;i&gt;netlabelctl&lt;/i&gt; manpage, so if this capability is NetLabel's best kept secret it has clearly been hiding in plain sight.&lt;br /&gt;&lt;br /&gt;Enough of the &amp;quot;secret&amp;quot;, let's explain how to get this working. &amp;nbsp;First off, if you're going to try this on your own system (any modern Linux distribution that supports SELinux and NetLabel should work), you might want to grab a copy of the &lt;a href=&quot;http://www.paul-moore.com/files/lj/getpeercon_server.c&quot; rel=&quot;nofollow&quot;&gt;getpeercon_server&lt;/a&gt; test tool that I've used in the example below; instructions for building the test tool are at the top of the file. &amp;nbsp;Once you've got everything built and you've verified that your SELinux and NetLabel installation is working as you would expect, you need to start off by configuring the CIPSO Domains Of Interpretation (DOI). &amp;nbsp;For this example we are going to create two DOIs, one using the standard, MLS-only passthrough type and the other using the local-connection-only full SELinux type. &amp;nbsp;Don't forget that you can always check the &lt;i&gt;netlabelctl&lt;/i&gt; manpage for more information on the commands below.&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;# netlabelctl cipsov4 add pass doi:1 tags:1&lt;br /&gt;# netlabelctl cipsov4 add local doi:2&lt;br /&gt;# netlabelctl -p cipsov4 list&lt;br /&gt;Configured CIPSOv4 mappings (2)&lt;br /&gt; DOI value : 1                                                                  &lt;br /&gt;   mapping type : PASS_THROUGH                                                  &lt;br /&gt; DOI value : 2                                                                  &lt;br /&gt;   mapping type : LOCAL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;After you've setup the CIPSO DOI's you need to configure NetLabel to send traffic using these new DOIs. &amp;nbsp;In our example we are going to configure the system such that traffic sent to 127.0.0.1 (localhost) will use DOI #2, the local-only full SELinux label DOI, and traffic sent to 10.250.2.92 (the system's eth0 address) will use DOI #1, the normal MLS-only DOI. &amp;nbsp;Don't forget that we first need to remove the default unlabeled mapping so we can use the &lt;a href=&quot;http://paulmoore.livejournal.com/2884.html&quot; rel=&quot;nofollow&quot;&gt;address selectors&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;# netlabelctl map del default&lt;br /&gt;# netlabelctl map add default address:0.0.0.0/0 protocol:unlbl                                                                          &lt;br /&gt;# netlabelctl map add default address:::/0 protocol:unlbl&lt;br /&gt;# netlabelctl map add default address:127.0.0.1 protocol:cipsov4,2&lt;br /&gt;# netlabelctl map add default address:10.250.2.92 protocol:cipsov4,1&lt;br /&gt;# netlabelctl -p map list&lt;br /&gt;Configured NetLabel domain mappings (1)                                         &lt;br /&gt; domain: DEFAULT                                                                &lt;br /&gt;   address: 127.0.0.1/32                                                        &lt;br /&gt;    protocol: CIPSOv4, DOI = 2&lt;br /&gt;   address: 10.250.2.92/32&lt;br /&gt;    protocol: CIPSOv4, DOI = 1&lt;br /&gt;   address: 0.0.0.0/0&lt;br /&gt;    protocol: UNLABELED&lt;br /&gt;   address: ::/0&lt;br /&gt;    protocol: UNLABELED&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;With that we're finished, now it's time to test it out. &amp;nbsp;Testing is quite simple, make sure you have a TCP client like telnet or netcat installed and then start the getpeercon_server test tool you built earlier; in this example getpeercon_server is listening on TCP port 5000.&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;# ./getpeercon_server 5000&lt;br /&gt;-&amp;gt; running as unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023&lt;br /&gt;-&amp;gt; creating socket ... ok&lt;br /&gt;-&amp;gt; listening on TCP port 5000 ... ok&lt;br /&gt;-&amp;gt; waiting ... connect(10.250.2.92,system_u:object_r:netlabel_peer_t:s0)&lt;br /&gt;Connected to 10.250.2.92:5000&lt;br /&gt;-&amp;gt; connection closed&lt;br /&gt;-&amp;gt; waiting ... connect(127.0.0.1,unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023)&lt;br /&gt;Connected to 127.0.0.1 5000&lt;br /&gt;-&amp;gt; connection closed&lt;br /&gt;-&amp;gt; waiting ...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;It works! When we connected to 10.250.2.92 we saw the familiar &amp;quot;netlabel_peer_t&amp;quot; type, but when we connected to 127.0.0.1 we saw the full SELinux label of our telnet client process, &amp;quot;unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023&amp;quot;. &amp;nbsp;Go ahead and try it out for yourself, just remember that you can only use the &amp;quot;local&amp;quot; DOI type on network connections that run over the loopback network interface.&lt;/div&gt;</content:encoded>
	<dc:date>2012-06-29T22:12:09+00:00</dc:date>
</item>
<item rdf:about="tag:blogger.com,1999:blog-5024703430482213163.post-4035831456624635000">
	<title>Dominick Grift: Hard coded types create hard dependencies on selinux policy</title>
	<link>http://selinux-mac.blogspot.com/2012/06/hard-coded-types-create-hard.html</link>
	<content:encoded>Long time no see.  I believe that applications like sandbox (sandbox_web_t) and sshd (chroot_user_t) hard code types. I do not like that but my personal opinion aside; This creates hard dependencies on SELinux policy.  If you do not have a policy that provides these types then you will end up with broken functionality.  I believe one example is that sandbox does not work in Debian because Debian selinux-policy does not provide the types that sandbox requires.  That is all folks.</content:encoded>
	<dc:date>2012-06-27T09:15:16+00:00</dc:date>
	<dc:creator>Dominick &quot;domg472&quot; Grift (noreply@blogger.com)</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=541">
	<title>James Morris: Linux Security Summit 2012 – Schedule Published</title>
	<link>http://blog.namei.org/2012/06/27/linux-security-summit-2012-schedule-published/</link>
	<content:encoded>&lt;p&gt;The schedule for &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;LSS 2012&lt;/a&gt; is &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012/Schedule&quot;&gt;now published&lt;/a&gt;.  See also the email &lt;a href=&quot;http://marc.info/?l=linux-security-module&amp;#038;m=134077686500654&amp;#038;w=2&quot;&gt;announcement&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As previously mentioned, &lt;a href=&quot;http://kernsec.org/wiki/index.php/Linux_Security_Summit_2012&quot;&gt;LSS&lt;/a&gt; this year 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;/p&gt;
&lt;p&gt;On Day 1, we&amp;#8217;re privileged to have a keynote by &lt;a href=&quot;http://mjg59.dreamwidth.org/&quot;&gt;Matthew Garrett&lt;/a&gt;.  He&amp;#8217;s one of the best speakers in the community, and I believe he&amp;#8217;ll be discussing secure boot.&lt;/p&gt;
&lt;p&gt;Following the keynote, we have eight refereed presentations on new and interesting Linux security development topics.&lt;/p&gt;
&lt;p&gt;On Day 2, we&amp;#8217;ll have kernel security subsystem updates from maintainers, followed by an afternoon of breakout sessions.  The breakout sessions are for deeper dives into specific areas, and may include development discussions and hack sessions.   An BoF is planned to discuss an LF Security Workgroup, and attendees may propose more sessions in the leadup to the conference by emailing the program committee.&lt;/p&gt;
&lt;p&gt;Thanks to all of the committee members for reviewing the proposals and helping to organize the summit &amp;#8212; it&amp;#8217;s shaping up as an interesting and productive event!&lt;/p&gt;</content:encoded>
	<dc:date>2012-06-27T06:22:01+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3326">
	<title>Russell Coker (security): New SE Linux Policy for Wheezy</title>
	<link>http://etbe.coker.com.au/2012/06/22/se-linux-policy-wheezy/</link>
	<content:encoded>&lt;p&gt;I&amp;#8217;ve just uploaded a new SE Linux policy for Debian/Wheezy. It now works correctly with systemd and Chromium, two significant features that I wanted for Wheezy. Now it turns out that we have until the end of the month for Wheezy updates, so I may get another version of the policy uploaded before then. If so it will only be for relatively minor changes, I think that most SE Linux users would be reasonably happy with policy the way it is. Anything that doesn&amp;#8217;t work now can probably be solved by local configuration changes.&lt;/p&gt;
&lt;h3&gt;execmem&lt;/h3&gt;
&lt;p&gt;The current version of KDE in Debian is 4.8.4, it seems that large parts of the KDE environment depend on execmem access, this includes kwin and plasma-desktop. Basically there is no possibility of having a KDE desktop environment without those programs and therefore KDE depends on execmem access.&lt;/p&gt;
&lt;p&gt;Debugging this is difficult as the important programs SEGV when denied execmem access and the KDE crash handler really gets in the way of debugging it &amp;#8211; running /usr/bin/plasma-desktop results in the process forking a child and detaching from the gdb session.&lt;/p&gt;
&lt;p&gt;The most clear example of an execmem issue in KDE is from the program /usr/lib/kde4/libexec/kwin_opengl_test which gives the following error:&lt;br /&gt;
&lt;b&gt;LLVM ERROR: Allocation failed when allocating new memory in the JIT&lt;br /&gt;
Can&amp;#8217;t allocate RWX Memory: Permission denied&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;To make this work you run the command &amp;#8220;&lt;b&gt;setsebool -P allow_execmem 1&lt;/b&gt;&amp;#8221; which gives many domains the ability to create writable-executable memory regions.&lt;/p&gt;
&lt;p&gt;I raised this issue for discussion on the SE Linux mailing list and &lt;a href=&quot;http://marc.info/?l=selinux&amp;#038;m=134011618909818&amp;#038;w=2&quot;&gt;Hinnerk van Bruinehsen wrote an informative message in response summarising the situation [1]&lt;/a&gt;. It seems that it&amp;#8217;s possible to compile some of the programs in question to not use the JIT and therefore not require such access and there is a build option in Gentoo to allow it. But it&amp;#8217;s impractically difficult for me to fork KDE in Debian so the only option is to recommend that people enable the &lt;b&gt;allow_execmem&lt;/b&gt; boolean for Debian desktop systems running SE Linux.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[1]&lt;a href=&quot;http://marc.info/?l=selinux&amp;#038;m=134011618909818&amp;#038;w=2&quot;&gt; http://marc.info/?l=selinux&amp;#038;m=134011618909818&amp;#038;w=2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;yarpp-related-rss&quot;&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/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/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/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;/ol&gt;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-06-21T14:12:14+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3318">
	<title>Russell Coker (security): Debian SE Linux Status June 2012</title>
	<link>http://etbe.coker.com.au/2012/06/17/debian-selinux-june-2012/</link>
	<content:encoded>&lt;p&gt;It&amp;#8217;s almost the Wheezy freeze time and I&amp;#8217;ve been working frantically to get things working properly.&lt;/p&gt;
&lt;h3&gt;Policy Status&lt;/h3&gt;
&lt;p&gt;At the moment I&amp;#8217;m preparing an upload of the policy which will support KDE (and probably most desktop environment) logins and many little fixes related to server operations (particularly MTAs). I would like to get another version done before Wheezy is released, but if Wheezy releases with version 2.20110726-6 of the policy that will be OK. It will work well enough for most things that users will be able to use local changes for the things that don&amp;#8217;t work.&lt;/p&gt;
&lt;p&gt;One significant lack with the current policy is that systemd won&amp;#8217;t work. I&amp;#8217;ve included most of the policy changes needed, but haven&amp;#8217;t done any of the testing and tweaking that is necessary to make it work properly.&lt;/p&gt;
&lt;p&gt;I would like to see policy support for systemd in a Wheezy update if I don&amp;#8217;t get it done in time for the first release. If I don&amp;#8217;t get it done in time for the release and if the release team don&amp;#8217;t accept it for an update then I&amp;#8217;ll put it in my own repository so anyone who needs it can get it.&lt;/p&gt;
&lt;h3&gt;/run Labelling&lt;/h3&gt;
&lt;p&gt;One significant change for Wheezy is to use a tmpfs mounted on /run instead of /var/run. This means that lots of daemon start scripts create subdirectories of /run at boot time which need to have SE Linux labels applied for correct operation. The way things work is that usually the daemon will write to the directory immediately after the init script has created it, so I can&amp;#8217;t just have my own script recursively relabel all of /run.&lt;/p&gt;
&lt;p&gt;Some packages that need to be patched are &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677831&quot;&gt;x11-common #677831&lt;/a&gt;, &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677686&quot;&gt;clamav-daemon #677686&lt;/a&gt;, &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677685&quot;&gt;sasl2-bin #677685&lt;/a&gt;, &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677684&quot;&gt;dkim-filter #677684&lt;/a&gt;, and &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677580&quot;&gt;cups #677580&lt;/a&gt;. I am sure that there are others.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;[ -x /sbin/restorecon ] &amp;amp;&amp;amp; /sbin/restorecon -R $DIR&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Generally if you are writing an init script and creating a directory under /run then you need to have some shell code like the above immediately after it&amp;#8217;s created. Also the same applies for directories under /tmp and any other significant directories that are created at boot time.&lt;/p&gt;
&lt;h3&gt;Upgrading&lt;/h3&gt;
&lt;p&gt;Currently there are some potential problems with the upgrade process, I&amp;#8217;m working on them at the moment. Ideally an &amp;#8220;&lt;b&gt;apt-get dist-upgrade&lt;/b&gt;&amp;#8221; would cleanly upgrade everything. But at the moment it seems likely that the upgrade might initially go wrong and then work on the second try. There are some complications such as the &lt;b&gt;selinux-policy-default&lt;/b&gt; package owning a config file which is used by &lt;b&gt;mcstransd&lt;/b&gt; (which is part of the &lt;b&gt;policycoreutils&lt;/b&gt; package), when the config file format changes you get order dependencies for the upgrade.&lt;/p&gt;
&lt;h3&gt;Kernel Support&lt;/h3&gt;
&lt;p&gt;My aim when developing a new SE Linux release for Debian is that the policy should work as much as possible with the user-space from the previous release. So if you upgrade from Squeeze to Wheezy you should be able to start the process by upgrading the SE Linux policy (which drags in the utilities and lots of libraries). This means that if you have a server running you don&amp;#8217;t have to put it out of action for the entire upgrade, you can get the policy going and then get other things going. I haven&amp;#8217;t tested this yet but I don&amp;#8217;t expect any problems (apart from all the dependencies).&lt;/p&gt;
&lt;p&gt;Also the policy should work with the kernel from the previous release. So if you have a virtual server where it&amp;#8217;s not convenient to upgrade the kernel then that shouldn&amp;#8217;t stop you from upgrading the user-space and the SE Linux policy. I&amp;#8217;ve tested this and found one bug, &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677730&quot;&gt;the sepolgen-ifgen utility that you need to run before audit2allow -R won&amp;#8217;t work if the kernel is older than the utilities #677730&lt;/a&gt;. I don&amp;#8217;t know if it will be possible to get this fixed. Anyway it&amp;#8217;s not that important, you can always copy the audit log to another system running the same policy to run audit2allow, it&amp;#8217;s not convenient but not THAT difficult either.&lt;/p&gt;
&lt;h3&gt;The End Result&lt;/h3&gt;
&lt;p&gt;I think that the result of using SE Linux in Wheezy will be quite good for the people who get the upgrade done and who modify a few init scripts that don&amp;#8217;t get the necessary changes in time. I anticipate that someone who doesn&amp;#8217;t know much about SE Linux will be able to get a basic workstation or small server installation done in considerably less than an hour if they read the documentation and someone who knows what they are doing will get it done in a matter of minutes (plus download and install time which can be significant on old hardware).&lt;/p&gt;
&lt;p&gt;At the moment I&amp;#8217;m in the process of upgrading all of my systems to Unstable (currently Testing has versions of some SE Linux packages that are too broken). While doing this I will keep discovering bugs and fix as many of them as possible. But it seems that I&amp;#8217;ve already fixed most things that affect common users.&lt;/p&gt;
&lt;p&gt;Also BTRFS works well. Not that supporting a new filesystem is a big deal (all that&amp;#8217;s needed is XATTR support), but having all the nice new features on one system is a good thing. Now I just need to get systemd working.&lt;/p&gt;
&lt;div class=&quot;yarpp-related-rss&quot;&gt;
&lt;p&gt;Related posts:&lt;/p&gt;&lt;ol&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/2012/03/06/selinux-debian-2012-03/&quot; rel=&quot;bookmark&quot; title=&quot;SE Linux Status in Debian 2012-03&quot;&gt;SE Linux Status in Debian 2012-03&lt;/a&gt; &lt;small&gt;I have just finished updating the user-space SE Linux code...&lt;/small&gt;&lt;/li&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;/ol&gt;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-06-17T06:48:39+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="urn:lj:livejournal.com:atom1:paulmoore:7019">
	<title>Paul Moore: Announcing the libseccomp Project</title>
	<link>http://paulmoore.livejournal.com/7019.html</link>
	<content:encoded>&lt;div&gt;This morning we announced the first release of the libseccomp library, version 0.1.0. The libseccomp library is designed to provide an easy to use, platform independent, interface the Linux's syscall filtering mechanism: seccomp. Linux Weekly News wrote up a nice &lt;a href=&quot;http://lwn.net/Articles/494252&quot; rel=&quot;nofollow&quot;&gt;summary of the project&lt;/a&gt; that I would encourage you to read as it provides a basic introduction to seccomp and the libseccomp API. For those of you interested in playing with seccomp/libseccomp, you will need Linux 3.5-rc1 or later, and the libseccomp library which you can download from the links below.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I want to say a special thanks to everyone who has submitted suggestions, provided testing help, and&amp;nbsp;contributed code to the project; your help made it much easier to get to this point.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SourceForge project page: &lt;a href=&quot;http://sourceforge.net/projects/libseccomp&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/projects/libseccomp&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Direct download: &lt;a href=&quot;http://downloads.sf.net/project/libseccomp/libseccomp-0.1.0.tar.gz&quot; rel=&quot;nofollow&quot;&gt;http://downloads.sf.net/project/libseccomp/libseccomp-0.1.0.tar.gz&lt;/a&gt;&lt;/div&gt;</content:encoded>
	<dc:date>2012-06-08T15:08:19+00:00</dc:date>
</item>
<item rdf:about="http://blog.namei.org/?p=537">
	<title>James Morris: Congratulations to Chris Mason</title>
	<link>http://blog.namei.org/2012/06/08/congratulations-to-chris-mason/</link>
	<content:encoded>&lt;p&gt;As many of you will know, I &lt;a href=&quot;http://blog.namei.org/2012/02/10/end-of-an-era-for-me/&quot;&gt;started a new role at Oracle&lt;/a&gt; earlier in the year, going to work on Chris Mason&amp;#8217;s team.  He &lt;a href=&quot;http://lwn.net/Articles/500738/&quot;&gt;announced this week&lt;/a&gt; that he&amp;#8217;s moving onto a new position at Fusion-io.  His leadership at Oracle will be missed, and I would like to congratulate him on his new role.&lt;/p&gt;
&lt;p&gt;Also, just to head off the inevitable internet rumours, I thought I&amp;#8217;d post here that I will be taking on many of Chris&amp;#8217;s previous responsibilities at Oracle, including leading the mainline kernel development team.  We&amp;#8217;re actively hiring, by the way, so if you want to hack on the Linux kernel for a great company&amp;mdash;remotely, from almost anywhere on the planet&amp;mdash;email me :-)&lt;/p&gt;</content:encoded>
	<dc:date>2012-06-08T04:04:25+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=535">
	<title>James Morris: Reminder: CFP for the 2012 Linux Security Summit closes in 1 week!</title>
	<link>http://blog.namei.org/2012/05/17/reminder-cfp-for-the-2012-linux-security-summit-closes-in-1-week/</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-05-16T21:45:17+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=533">
	<title>James Morris: Kernel Security Talk at LinuxCon Japan</title>
	<link>http://blog.namei.org/2012/05/02/kernel-security-talk-at-linuxcon-japan/</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-05-02T01:57:49+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/56179.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part X - Firewalld</title>
	<link>http://danwalsh.livejournal.com/56179.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-04-25T12:37:48+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55837.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part IX - File Name Transitions</title>
	<link>http://danwalsh.livejournal.com/55837.html</link>
	<content:encoded>&lt;a href=&quot;http://danwalsh.livejournal.com/46018.html&quot; rel=&quot;nofollow&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; rel=&quot;nofollow&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; rel=&quot;nofollow&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;</content:encoded>
	<dc:date>2012-04-24T14:12:18+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3263">
	<title>Russell Coker (security): Neighborhood Watch</title>
	<link>http://etbe.coker.com.au/2012/04/23/neighborhood-watch/</link>
	<content:encoded>&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;div class=&quot;yarpp-related-rss&quot;&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;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-04-22T16:00:28+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=529">
	<title>James Morris: 2012 Linux Security Summit (San Diego) – Call for Particpation</title>
	<link>http://blog.namei.org/2012/04/13/2012-linux-security-summit-san-diego-call-for-particpation/</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-04-12T14:00:09+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3232">
	<title>Russell Coker (security): The Security Benefits of Automation</title>
	<link>http://etbe.coker.com.au/2012/03/30/security-benefits-automation/</link>
	<content:encoded>&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;div class=&quot;yarpp-related-rss&quot;&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;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-03-30T12:42:29+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55588.html">
	<title>Dan Walsh: runuser versus su</title>
	<link>http://danwalsh.livejournal.com/55588.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-03-28T12:40:09+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55324.html">
	<title>Dan Walsh: Eating my own dogfood.</title>
	<link>http://danwalsh.livejournal.com/55324.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-22T14:19:45+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/55229.html">
	<title>Dan Walsh: Solution to /myapache labeling problem from yesterday...</title>
	<link>http://danwalsh.livejournal.com/55229.html</link>
	<content:encoded>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; rel=&quot;nofollow&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;</content:encoded>
	<dc:date>2012-03-20T13:30:25+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54803.html">
	<title>Dan Walsh: SELinux Types Revisited.</title>
	<link>http://danwalsh.livejournal.com/54803.html</link>
	<content:encoded>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.</content:encoded>
	<dc:date>2012-03-19T16:06:00+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54707.html">
	<title>Dan Walsh: Secure Boot versus Ksplice.</title>
	<link>http://danwalsh.livejournal.com/54707.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-15T12:50:56+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54343.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VIII - New SELinux Domains in F17</title>
	<link>http://danwalsh.livejournal.com/54343.html</link>
	<content:encoded>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.</content:encoded>
	<dc:date>2012-03-13T14:47:35+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/54092.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VII - thumbnail protection.</title>
	<link>http://danwalsh.livejournal.com/54092.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-03-12T15:55:56+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53878.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - man pages for SELinux user/role domains</title>
	<link>http://danwalsh.livejournal.com/53878.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-08T16:46:18+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53603.html">
	<title>Dan Walsh: Excuse me son, but your code is leaking !!!</title>
	<link>http://danwalsh.livejournal.com/53603.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-08T04:34:27+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53378.html">
	<title>Dan Walsh: bash completion for setsebool/getsebool added for Fedora 17</title>
	<link>http://danwalsh.livejournal.com/53378.html</link>
	<content:encoded>&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... :^)</content:encoded>
	<dc:date>2012-03-06T16:43:32+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3189">
	<title>Russell Coker (security): SE Linux Status in Debian 2012-03</title>
	<link>http://etbe.coker.com.au/2012/03/06/selinux-debian-2012-03/</link>
	<content:encoded>&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;div class=&quot;yarpp-related-rss&quot;&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;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-03-06T06:44:33+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/53182.html">
	<title>Dan Walsh: senetwork: new tool for examining SELinux networking policy.</title>
	<link>http://danwalsh.livejournal.com/53182.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-02T21:35:09+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52958.html">
	<title>Dan Walsh: VMWare wants you to turn SELinux off?  Really?</title>
	<link>http://danwalsh.livejournal.com/52958.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-03-01T13:50:07+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52550.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part VI - systemd-journal</title>
	<link>http://danwalsh.livejournal.com/52550.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-29T14:53:13+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52281.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part V - sudo can now use sssd for authorization data (sudoers)</title>
	<link>http://danwalsh.livejournal.com/52281.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-28T17:03:55+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/52156.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part IV - man pages for SELinux service domains</title>
	<link>http://danwalsh.livejournal.com/52156.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-27T16:11:34+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51942.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part III - systemd starting daemons</title>
	<link>http://danwalsh.livejournal.com/51942.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-02-24T17:02:20+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51459.html">
	<title>Dan Walsh: Fedora 17 New Security Feature part II - PrivateTmp</title>
	<link>http://danwalsh.livejournal.com/51459.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-23T14:34:28+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/51435.html">
	<title>Dan Walsh: How can I allow a process to listing all processes on a system.</title>
	<link>http://danwalsh.livejournal.com/51435.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-20T16:45:00+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50980.html">
	<title>Dan Walsh: SELinux problems on Fedora 17.</title>
	<link>http://danwalsh.livejournal.com/50980.html</link>
	<content:encoded>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...</content:encoded>
	<dc:date>2012-02-13T20:35:38+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://blog.namei.org/?p=520">
	<title>James Morris: End of an Era (for me)</title>
	<link>http://blog.namei.org/2012/02/10/end-of-an-era-for-me/</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-02-10T08:31:45+00:00</dc:date>
	<dc:creator>jamesm</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50790.html">
	<title>Dan Walsh: secommunicate is a handy little tool to analyze policy communication</title>
	<link>http://danwalsh.livejournal.com/50790.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-02-07T16:50:33+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50526.html">
	<title>Dan Walsh: Dan Walsh on Twitter @rhatdan</title>
	<link>http://danwalsh.livejournal.com/50526.html</link>
	<content:encoded>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.</content:encoded>
	<dc:date>2012-02-06T22:03:25+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50380.html">
	<title>Dan Walsh: Small change to semanage login record creation.</title>
	<link>http://danwalsh.livejournal.com/50380.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-06T15:24:04+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/50014.html">
	<title>Dan Walsh: Why I love Open Source...  II</title>
	<link>http://danwalsh.livejournal.com/50014.html</link>
	<content:encoded>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.</content:encoded>
	<dc:date>2012-02-03T17:23:11+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/49762.html">
	<title>Dan Walsh: 10 things you probably did not know about SELinux,  #10 shipping policy versions</title>
	<link>http://danwalsh.livejournal.com/49762.html</link>
	<content:encoded>&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;</content:encoded>
	<dc:date>2012-02-02T15:14:21+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/49564.html">
	<title>Dan Walsh: More on deny_ptrace ...</title>
	<link>http://danwalsh.livejournal.com/49564.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-02-01T15:03:43+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://danwalsh.livejournal.com/49336.html">
	<title>Dan Walsh: Fedora 17 New SELinux Feature part I - deny_ptrace</title>
	<link>http://danwalsh.livejournal.com/49336.html</link>
	<content:encoded>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;</content:encoded>
	<dc:date>2012-01-31T18:43:57+00:00</dc:date>
	<dc:creator>dwalsh@redhat.com</dc:creator>
</item>
<item rdf:about="http://etbe.coker.com.au/?p=3133">
	<title>Russell Coker (security): SE Linux Status in Debian 2012-01</title>
	<link>http://etbe.coker.com.au/2012/01/25/se-linux-status-2012-01/</link>
	<content:encoded>&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;div class=&quot;yarpp-related-rss&quot;&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;
&lt;/div&gt;</content:encoded>
	<dc:date>2012-01-25T11:36:31+00:00</dc:date>
	<dc:creator>etbe</dc:creator>
</item>

</rdf:RDF>
