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

<channel>
	<title>Felipe Alfaro Solana &#187; Mac OS X</title>
	<atom:link href="http://www.felipe-alfaro.org/blog/category/apple/mac-os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.felipe-alfaro.org/blog</link>
	<description>A little bit of technology, security and networking with Linux, FreeBSD and Mac OS X, plus some personal opinions.</description>
	<lastBuildDate>Sun, 23 Oct 2011 16:46:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Error Configuring db46 – MacPorts</title>
		<link>http://www.felipe-alfaro.org/blog/2010/12/20/error-configuring-db46-%e2%80%93-macports/</link>
		<comments>http://www.felipe-alfaro.org/blog/2010/12/20/error-configuring-db46-%e2%80%93-macports/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 17:11:51 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=569</guid>
		<description><![CDATA[Recently, I could not get db46 to install from Macports: $ sudo /opt/local/bin/port install db46 ... Error: db46 requires the Java for Mac OS X development headers. Error: Download the Java Developer Package from: Error: Target org.macports.configure returned: missing Java headers The solution consists of creating symbolic link to the installed files: sudo ln -s [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I could not get <code>db46</code> to install from Macports:</p>
<div>
<pre>$ sudo /opt/local/bin/port install db46
...
Error: db46 requires the Java for Mac OS X development headers.
Error: Download the Java Developer Package from:
Error: Target org.macports.configure returned: missing Java headers</pre>
</div>
<p>The solution consists of creating symbolic link to the installed files:</p>
<div>
<pre>sudo ln -s /Developer/SDKs/MacOSX10.6.sdk/System/Library/\
  Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers \
  /System/Library/Frameworks/JavaVM.framework/\
  Versions/CurrentJDK/Headers</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2010/12/20/error-configuring-db46-%e2%80%93-macports/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to disable Bonjour in Mac OS X Snow Leopard</title>
		<link>http://www.felipe-alfaro.org/blog/2010/04/07/how-to-disable-bonjour-in-mac-os-x-snow-leopard/</link>
		<comments>http://www.felipe-alfaro.org/blog/2010/04/07/how-to-disable-bonjour-in-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 01:31:43 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=501</guid>
		<description><![CDATA[From Mac OS X v10.6: Disabling mDNSResponder will disable DNS I found how to disable Bonjour broadcasting without disabling mDNSResponder &#8212; because disabling mDNSResponder effectively breaks DNS name resolution. To disable Bonjour broadcasting, just add: &#60;string&#62;-NoMulticastAdvertisements&#60;/string&#62; to the array in the ProgramArguments section in System/Library/LaunchDaemons/com.apple.mDNSResponder.plist: ... &#60;key&#62;ProgramArguments&#60;/key&#62; &#60;array&#62; &#60;string>/usr/sbin/mDNSResponder&#60;/string&#62; &#60;string>-launchd&#60;/string&#62; &#60;string>-NoMulticastAdvertisements&#60;/string&#62; &#60;/array&#62; ...]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://support.apple.com/kb/HT3789?viewlocale=en_US">Mac OS X v10.6: Disabling mDNSResponder will disable DNS</a> I found how to disable Bonjour broadcasting without disabling <code>mDNSResponder</code> &#8212; because disabling <code>mDNSResponder</code> effectively breaks DNS name resolution.</p>
<p>To disable Bonjour broadcasting, just add:</p>
<div>
<pre>
&lt;string&gt;-NoMulticastAdvertisements&lt;/string&gt;
</pre>
</div>
<p>to the array in the <code>ProgramArguments</code> section in <code>System/Library/LaunchDaemons/com.apple.mDNSResponder.plist</code>:</p>
<div>
<pre>
...
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string>/usr/sbin/mDNSResponder&lt;/string&gt;
            &lt;string>-launchd&lt;/string&gt;
            &lt;string>-NoMulticastAdvertisements&lt;/string&gt;
        &lt;/array&gt;
...
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2010/04/07/how-to-disable-bonjour-in-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Talk Video might cause up to a 30-second delay while sleeping on Snow Leopard</title>
		<link>http://www.felipe-alfaro.org/blog/2009/09/08/google-talk-video-might-cause-up-to-a-30-second-delay-while-sleeping-on-snow-leopard/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/09/08/google-talk-video-might-cause-up-to-a-30-second-delay-while-sleeping-on-snow-leopard/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 23:09:02 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=417</guid>
		<description><![CDATA[Currently available version of Google Talk Video plug-in for Mac OS X (1.0.13.1284) might cause up to a 30-second delay while putting the computer to sleep under Snow Leopard. This has been reported and discussed in the following Apple support thread. In the end, the solution typically requires to uninstall Google Talk Video. The solution [...]]]></description>
			<content:encoded><![CDATA[<p>Currently available version of Google Talk Video plug-in for Mac OS X (1.0.13.1284) might cause up to a 30-second delay while putting the computer to sleep under Snow Leopard.</p>
<p>This has been reported and discussed in the <a href="1.0.13.1284">following Apple support thread</a>. In the end, the solution typically requires to uninstall Google Talk Video. The solution was found and reported by <a href="http://discussions.apple.com/profile.jspa?userID=76761">Snoop Dogg</a> in that same thread.</p>
<p>Basically, the misbehaving process can be found by running <code>sudo pmset -g log</code> then looking for the process with the highest response time. In my case:</p>
<div>
<pre>
$ sudo pmset -g log
...
 * Domain: applicationresponse.timedout
 - Message: Kernel GoogleTalkPlugin com.apple.powermanagement.applicationrespons
e.timedout 30000 ms
 - Time: 9/2/09 12:42:47 AM GMT+02:00
 - Signature: GoogleTalkPlugin
 - UUID: AD1E9199-B66D-41CB-BF4F-590EF232DE79
 - Result: Noop - Response time (ms): 30000
...
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/09/08/google-talk-video-might-cause-up-to-a-30-second-delay-while-sleeping-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Official Chromium builds for Mac OS X</title>
		<link>http://www.felipe-alfaro.org/blog/2009/05/16/official-chromium-builds-for-mac-os-x/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/05/16/official-chromium-builds-for-mac-os-x/#comments</comments>
		<pubDate>Fri, 15 May 2009 20:52:05 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=344</guid>
		<description><![CDATA[Recently, the Chromium team has started to provide official builds of Chromium for Mac OS X. Looks to me these builds are just the output of the continuous build process &#8212; also known as waterfall. In any case, these are good news and to me a proof that Chromium for Mac OS X keeps evolving [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, the Chromium team has started to provide  <a href="http://build.chromium.org/buildbot/snapshots/sub-rel-mac/">official builds of Chromium for Mac OS X</a>. Looks to me these builds are just the output of the continuous build process &#8212; also known as <a href="http://build.chromium.org/buildbot/waterfall/waterfall">waterfall</a>.</p>
<p>In any case, these are good news and to me a proof that Chromium for Mac OS X keeps evolving at a fast pace and that it is making very good progress. As a consequence, a few days ago, I switched to Chromium as my main browser (also in Linux) and I must say it feels great so far.</p>
<p>PS: This post was written entirely under Chromium for Mac OS X. No crashes or any strange behavior were experienced.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/05/16/official-chromium-builds-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Chromium for Mac OS X</title>
		<link>http://www.felipe-alfaro.org/blog/2009/05/01/chromium-for-mac-os-x/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/05/01/chromium-for-mac-os-x/#comments</comments>
		<pubDate>Fri, 01 May 2009 17:40:11 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=294</guid>
		<description><![CDATA[Chromium is the open source browser developed by Google. The differences between Chromium and Chrome are very minimal. Chrome has custom icons and other parafernalia that, due to licensing issues, can&#8217;t be made available in Chromium. Chrome is also available as a binary for Microsoft Windows operating systems, and can be downloaded from the Google [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/chromium/">Chromium</a> is the open source browser developed by Google. The differences between Chromium and Chrome are very minimal. Chrome has custom icons and other parafernalia that, due to licensing issues, can&#8217;t be made available in Chromium. Chrome is also available as a binary for Microsoft Windows operating systems, and can be downloaded from the <a href="http://www.google.com/chrome">Google Chrome</a> Web site.<br />
Other than that, Chromium is a fully functional browser product that is currently available only as source code. Chromium is available for Windows, Mac OS X and Linux. The Mac OS X and Linux ports are still under heavy development but are becoming more and more usable over time.</p>
<p>For more than a month I&#8217;ve been tracking development of Chromium for Mac OS X. I&#8217;ve been building and testing Chromium for Mac OS X myself [1] and my general impression is that development pace is pretty fast. For example, yesterday, a mock Preferences dialog box was added. A few days ago, working support for draggable and dettachable tabs was also added (previously it was possible to detach a tab from a window but it was not possible to re-attach it to an existing window).</p>
<p>Overall, the Mac OS X port of Chromium is getting more and more usable and stable. I&#8217;m now able to use it for most browsing tasks. The look and feel matches perfectly Aqua but also resembles a lot its Windows counterpart. While it is true there are a few annoyances, like losing the focus on edit controls when switching tabs, or tabs crashing at times when executing a paste operation, they are getting fixed in each iteration. The browser feels extremely fast when compared to Firefox 3.0 and faster than Firefox 3.1, Safari or Safari 4 beta. Heavy and complex Web pages like Google Reader or Google Mail load almost instantly while still looking correct. Some Web pages get rendered slightly different from other browsers. As an example, Google Mail looks slightly different with bigger spacing between lines in the mail thread (main) view and also slightly smaller fonts, but these are very subtle differences that do not affect usability or readability.</p>
<p>I must confess I&#8217;m pretty impressed about Chromium. When Google disclosed Chrome and the initial availability for the Windows platform only I was very disappointed. I also thought that it&#8217;d take much longer to see a nearly-functional port for Mac OS X or Linux. But I was wrong. It is good to be wrong. Let&#8217;s hope the development pace keeps on the same levels <img src='http://www.felipe-alfaro.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>PS: By the way, this post was written entirely from Chromium in Mac OS X. The tab crashed a couple of times but WordPress has a nice auto-save feature that I really appreciate <img src='http://www.felipe-alfaro.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>[1] <a href="http://code.google.com/p/chromium/wiki/MacBuildInstructions">http://code.google.com/p/chromium/wiki/MacBuildInstructions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/05/01/chromium-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Safari/MacBook security</title>
		<link>http://www.felipe-alfaro.org/blog/2009/03/19/safarimacbook-security/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/03/19/safarimacbook-security/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 09:32:45 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=281</guid>
		<description><![CDATA[It is probably not very well-known for many, and probably ignored by most, but it seems that Mac OS X and specifically Safari leaves much to be desired when talking about security. During the Pwn2Own contest, Safari was the first browser to fall, in the order of seconds, when put under attack by Charlie Miller. [...]]]></description>
			<content:encoded><![CDATA[<p>It is probably not very well-known for many, and probably ignored by most, but it seems that Mac OS X and specifically Safari leaves much to be desired when talking about security.</p>
<p>During the Pwn2Own contest, Safari was the first browser to fall, in the order of seconds, when put under attack by Charlie Miller. This has been reported in several places, like <a href="http://blogs.zdnet.com/security/?p=2917">Pwn2Own 2009: Safari/MacBook falls in seconds</a>, or <a href="http://www.osnews.com/story/21089/Miller_Safari_on_Mac_First_to_Fall_During_PWN2OWN_Contest">Miller: Safari on Mac First to Fall During PWN2OWN Contest</a>, or <a href="http://www.osnews.com/story/21162/Miller_Cracks_Safari_Within_Seconds_Wins_PWN2OWN_Contest">Miller Cracks Safari Within Seconds, Wins PWN2OWN Contest</a>. For the second year in a row, Safari/MacBook has been the browser to fall under attack the first.</p>
<p>So, if you are a user of Mac OS X, be very careful when using Safari. These attacks so far require you to click on links specifically crafted to cause harm to your computer, which might allow the attacker to gain total control of your machine. Hence, the importance of never running with an account that has administrative privileges.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/03/19/safarimacbook-security/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FreeNX, usermode authentication and Mac OS X</title>
		<link>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/</link>
		<comments>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 13:43:03 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NX]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/?p=264</guid>
		<description><![CDATA[I&#8217;ve always been looking for a way in NX/FreeNX to be able to authenticate using mechanisms other than username and password, like SSH private/public keys or Kerberos. Turns out that it is possible Someone pointed me to the FreeNX 0.7.3 announcement that contains the following excerpt: Usermode and SUID Wrapper ================== We are now very [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been looking for a way in NX/FreeNX to be able to authenticate using mechanisms other than username and password, like SSH private/public keys or Kerberos. Turns out that it is possible <img src='http://www.felipe-alfaro.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Someone pointed me to the <a href="http://mail.kde.org/pipermail/freenx-knx/2008-August/007324.html">FreeNX 0.7.3 announcement</a> that contains the following excerpt:</p>
<blockquote><p><code><br />
Usermode and SUID Wrapper<br />
==================</p>
<p>We are now very close to login directly with users and I also heard of a C program, which can be seamlessly put between nxclient and nxssh. So with client support we now have three alternatives:</p>
<p>1. Login as user via ssh and connect to server with ssh command on server again.<br />
2. Login as user and use usermode to save all sessions locally for each user.<br />
3. Use a SUID nx (not root!) wrapper to startup a new "trusted" session.</p>
<p>One is error prone, two is good, but looses the central structure, three is best of both worlds and with being suid nx also has the most advantages, however not the dreaded public key problems.</p>
<p>_Yes_, this means if you use the suid wrapper, you still need the nx user, but you can remove the public keys and it'll still work.</p>
<p>The SUID wrapper is a part from the work of the redesign and thanks goes to Alistair Riddoch from Google here.<br />
</code></p></blockquote>
<p>By default, NoMachine&#8217;s NX nxserver requires nxclient to login via SSH into the remote machine as user <code>nx</code>. As <code>nxserver</code> is defined as the login shell, it is run by the <code>sshd</code> daemon. From there on, there is a dialogue between nxclient and nxserver where nxclient supplies the user credentials (username and password that were specified in the nxclient configuration). There is, in fact, a second authentication that is performed via another SSH session to 127.0.0.1 using nxclient&#8217;s supplied credentials. If this second authentication succeeds, the NX session is activated and accessible from the NX client.</p>
<p>This works well for remote servers that are shared by multiple users, as the <code>nx</code> user and its centralized approach makes it very easy to see how many sessions are currently running (or suspended), terminate them, etc. However, for machines that are not shared by multiple users, or in those cases where authentication mechanisms other than username and password are required, this model does not work very well.</p>
<p>This is where FreeNX&#8217;s usermode enters the scene. Basically, what it means, is that authentication to nxserver does no longer happen as the <code>nx</code> user but as the end-user himself. Now, the number of SSH sessions is reduced to one that authenticates the user directly by means of SSH&#8217;s built-in authentication capabilities, and where nxserver is run under the end-user credentials instead of the <code>nx</code> user. This, obviously, kills the centralized approach originally envisioned by NoMachine, since now all the control and session files can&#8217;t be stored easily and securely in a central location but are now stored in the user&#8217;s home directory. But I think the upsides of the usermode support outdo the lack of centralized management. At least in my case, I don&#8217;t need centralized management since it&#8217;s me who manages all my boxes and logs into them.</p>
<h2>How to install and configure FreeNX to support usermode</h2>
<p>Next I describe what I had to do, both on the remote machine and also on the client, to get a working FreeNX environment that supports usermode. Other modes are also supported, like legacy nx-based, SUID and others.</p>
<h3>Download NX4U tarball from BerliOS and extract it</h3>
<div>
<pre>
$ wget http://download.berlios.de/freenx/NX4U.tar.gz
$ sudo tar -C /opt -zxf NX4U.tar.gz
</pre>
</div>
<p><em>NOTE</em>: The NX4U tarball that I used can also be downloaded from this Web site <a href="http://www.felipe-alfaro.org/blog/wp-content/NX/NX4U.tar.gz">here</a>.</p>
<p><em>NOTE</em>: The NX4U set and the nxssh wrapper are smart enough so that you can also extract the NX4U tarball in other locations. Looking at the source code for the nxssh wrapper &#8212; <code>nxssh-4US.c</code> &#8212; nxssh wrapper uses the following PATH to locate the nxserver binary:</p>
<pre>
#define NXSERVER_PATH \
"~/bin:
~/NX4U/:
/usr/NX/bin:
/opt/NX/bin:
/opt/NX4U/bin:
/usr/NX4U/bin:
/usr/local/NX4U/bin:
/usr/lib/nx/bin"
</pre>
<h3>Compile the nxssh wrapper</h3>
<p>First, download the source code from the SVN repository:</p>
<div>
<pre>
$ svn checkout https://developername@svn.berlios.de/svnroot/repos/freenx/trunk
</pre>
</div>
<p>NOTE: I saved a copy of the SVN repository that I used. The tarball is available in this Web site <a href="http://www.felipe-alfaro.org/blog/wp-content/NX/freenx-trunk.tar.bz2">here</a>.<br />
Build the nxssh wrapper for Mac OS X. nxssh is a simple C program that currently compiles for me with no problems on Linux and Mac OS X:</p>
<div>
<pre>
$ cd trunk/freenx-utils/nxpublickey/
$ make nxssh
</pre>
</div>
<p>NOTE: The Makefile also has a target named nxssh.exe to compile the wrapper for Windows.</p>
<p>Now, let&#8217;s rename NoMachine&#8217;s nxssh binary to mxssh (the nxssh wrapper expects NoMachine&#8217;s nxssh binary to be renamed to mxssh), then install the nxssh wrapper:</p>
<div>
<pre>
$ sudo bash
# mv /usr/NX/bin/nxssh /usr/NX/bin/mxssh
# install -m755 nxssh /usr/NX/bin/nxssh
# ^D
</pre>
</div>
<h3>Configure <code>.ssh/config</code></h3>
<p>What looks like a bug in NoMachine&#8217;s nxssh, will cause authentication requests using public key to fail with a <code>"percent_expand: NULL replacement"</code> error unless <code>.ssh/config</code> is modified to explicitly state the location of the public key. For example:</p>
<div>
<pre>
Host my.host.org
        IdentityFile ~/.ssh/id_dsa
</pre>
</div>
<h3>Configure nxclient</h3>
<p>In order to use usermode authentication, make sure to prepend the hostname with the @ (at) sign:</p>
<p><code>Hostname: @my.host.org</code></p>
<p>Also, make sure the username has the @ (at) sign prepended plus @U (at U) appended. These non-standard forms are parsed by the nxssh wrapper and enable usermode authentication (or other authentications like SUID):</p>
<p><code>Username: @myself@U</code></p>
<p>For more information about possible syntaxes, take a look at <code>freenx-utils/nxpublickey/nxssh-wrapper</code> (the shell script implementation of the <code>nxssh</code> wrapper).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2009/01/18/freenx-usermode-authentication-and-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Kerberizing Leopard&#8217;s Remote Login (built-in SSH) service</title>
		<link>http://www.felipe-alfaro.org/blog/2007/12/07/kerberizing-leopards-ssh/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/12/07/kerberizing-leopards-ssh/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 20:31:29 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/2007/12/07/kerberizing-leopards-built-in-openssh-server/</guid>
		<description><![CDATA[0. Introduction Enabling Kerberos/GSSAPI support in Leopard&#8217;s Remote Login (SSH) service is straightforward. As Leopard&#8217;s Remote Login is built using OpenSSH, most of what is described here applies perfectly to other flavors of UNIX. Kerberos/GSSAPI authentication allows for Single Sign-On capabilities in OpenSSH in such a way that it makes very convenient to work with [...]]]></description>
			<content:encoded><![CDATA[<h2>0. Introduction</h2>
<p>Enabling Kerberos/GSSAPI support in Leopard&#8217;s Remote Login (SSH) service is straightforward. As Leopard&#8217;s Remote Login is built using <a href="http://www.openssh.org/">OpenSSH</a>, most of what is described here applies perfectly to other flavors of UNIX.</p>
<p>Kerberos/GSSAPI authentication allows for Single Sign-On capabilities in <a href="http://www.openssh.org/">OpenSSH</a> in such a way that it makes very convenient to work with or manage multiple machines while only having to authenticate to the network every certain amount (Kerberos uses a form of cached credentials that expire within hours, typically). In this document I describe how to enable support for Kerberos/GSSAPI authentication to Leopard&#8217;s implementation of <a href="http://www.openssh.org/">OpenSSH</a>. Leopard includes many of the tools from the <a href="http://web.mit.edu/Kerberos/">MIT&#8217;s implementation of Kerberos</a>, so this makes the whole process even easier.</p>
<p>The process consists on:</p>
<ol>
<li>Creating the Kerberos principal</li>
<li>Creating <code>/etc/krb5.conf</code></li>
<li>Adding the Kerberos principal to the keytab file</li>
<li>Reconfiguring OpenSSH to support Kerberos authentication</li>
<li>Restarting OpenSSH</li>
<li>Enabling Kerberos authentication on OpenSSH clients</li>
<li>Testing</li>
</ol>
<h2>1. Creating the Kerberos principal</h2>
<p>When a Kerberized SSH client tries to authenticate to a Kerberized OpenSSH service, the client will request a Kerberos service ticket for that specific OpenSSH service. The Kerberos service ticket contains, among other things, a shared secret (for example, a 3DES private key) that has to be distributed to both the client and the server, called K<>client,server. The KDC will generate such shared secret and will encrypt it twice. Once, with a shared secret between the KDC and the client principal, called K<sub>KDC,client</sub>, and another one with a shared secret between the KDC and the server principal, K<sub>KDC,server</sub>.</p>
<p>In this step, we will create the Kerberos principal that represents the OpenSSH server and consequently its shared secret, K<sub>KDC,server</sub>. Later on, we will upload this shared secret to the OpenSSH server and install it into the Keytab file, so that the OpenSSH server can access it and use it to decrypt the user&#8217;s service ticket in order to retrieve the shared secret, K<sub>client,server</sub>.</p>
<div>
<pre>
$ kadmin
Authenticating as principal alice/admin@LAN with password.
Password for alice/admin@LAN:
kadmin:  addprinc -randkey host/ssh.lan
WARNING: no policy specified for host/ssh.lan@LAN; defaulting to no policy
Principal "host/ssh.lan@LAN" created.
</pre>
</div>
<p>NOTE: If you are logged in as <code>root</code> into the KDC, you can use <code>kadmin.local</code> instead of <code>kadmin</code> if you prefer, as the former doesn&#8217;t require any authentication (being able to run it as <code>root</code> is enough to prove yourself authorized).</p>
<p>The Kerberos principal associated with the OpenSSH has been created, the shared secrets generated, stored and protected by the stash key. We can check the status of the principal using the following command:</p>
<div>
<pre>
kadmin:  getprinc host/ssh.lan
Principal: host/ssh.lan@LAN
Expiration date: [never]
Last password change: Thu Dec 06 19:42:50 CET 2007
Password expiration date: [none]
Maximum ticket life: 0 days 10:00:00
Maximum renewable life: 7 days 00:00:00
Last modified: Thu Dec 06 19:42:50 CET 2007 (root/admin@LAN)
Last successful authentication: [never]
Last failed authentication: [never]
Failed password attempts: 0
Number of keys: 2
Key: vno 5, Triple DES cbc mode with HMAC/sha1, no salt
Key: vno 5, DES cbc mode with CRC-32, no salt
Attributes:
Policy: [none]
kadmin:  exit
</pre>
</div>
<p>Now that the principal has been created, we can move onto the next step.</p>
<h2>2. Creating <code>/etc/krb5.conf</code></h2>
<p>One of the requirements for Kerberizing OpenSSH server is configuring the Kerberos libraries via <code>/etc/krb5.conf</code>. These libraries are used by the OpenSSH server, <code>kpasswd</code>, the OpenSSH client and tools like <code>kadmin</code> or <code>kinit</code>.</p>
<p>This configuration file will also allow us to connect to the Kerberos administration server remotely by using <code>kadmin</code>, in order to download the OpenSSH shared secret. In my case, <code>/etc/krb5.conf</code> looks like this:</p>
<div>
<pre>
[libdefaults]
        default_realm = LAN
        dns_fallback = "no"
        default_tgs_enctypes = des-cbc-crc
        default_tkt_enctypes = des-cbc-crc

[realms]
        LAN = {
                kdc = kdc.lan:88
                admin_server = kdc.lan:749
        }

[domain_realm]
        .lan = LAN

[login]
        krb4_convert = true
        krb4_get_tickets = false
</pre>
</div>
<h2>3. Adding the Kerberos principal to the keytab file</h2>
<div>
<pre>
root@ssh.lan:# kadmin
Authenticating as principal root/admin@LAN with password.
Password for root/admin@LAN:
kadmin:  ktadd -k /etc/krb5.keytab host/ssh.lan@LAN
Entry for principal host/ssh.lan@LAN with kvno 7,
 encryption type Triple DES cbc mode with HMAC/sha1 added to
 keytab WRFILE:/etc/krb5.keytab.
Entry for principal host/ssh.lan@LAN with kvno 7,
 encryption type DES cbc mode with CRC-32 added to
 keytab WRFILE:/etc/krb5.keytab.
</pre>
</div>
<p>This will add the OpenSSH shared secret to the Kerberos <code>/etc/krb5.keytab</code> file. We need to add the shared secrets to this file properly, as Leopard has a built-in KDC service and machine-specific shared secrets in this file that are used, among others, by the Screen Sharing service, the AFP service and the SAMBA service.</p>
<p>To check that OpenSSH shared secret was added to the keytab file, we use <code>ktutil</code> to read and display the contents of the Keytab file:</p>
<div>
<pre>
root@ssh.lan:# ktutil
ktutil:  rkt /etc/krb5.keytab
ktutil:  list
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    3 afpserver/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   2    3 afpserver/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   3    3 afpserver/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   4    3 cifs/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   5    3 cifs/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   6    3 cifs/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   7    3 vnc/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   8    3 vnc/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
   9    3 vnc/LKDC:SHA1.E803840ADEAA3E91BF895E969F56FEDFF321BDD5@LKDC...
  10    7                      host/ssh.lan@LAN
  11    7                      host/ssh.lan@LAN
</pre>
</div>
<p>Once installed in the keytab file, OpenSSH will be able to access the shared secret, K<sub>KDC,server</sub> used to decrypt Kerberos service tickets shown by clients.</p>
<li>4. Reconfiguring OpenSSH to support Kerberos authentication</li>
<p>It is also necessary to change OpenSSH&#8217;s server configuration file, <code>/etc/sshd_config</code> to explicitly enable Kerberos/GSSAPI authentication. To achieve this, modify <code>/etc/sshd_config</code> file and add the following lines (by default they are either uncommented or disabled):</p>
<div>
<pre>
# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
</pre>
</div>
<h2>5. Restarting OpenSSH</h2>
<p>To last step on the server side requires that we restart the OpenSSH service so the previous changes are taken into effect:</p>
<div>
<pre>
root@ssh.lan:# launchctl
aunchd% stop com.openssh.sshd
launchd% start com.openssh.sshd
</pre>
</div>
<h2>6. Enabling Kerberos authentication on OpenSSH clients</h2>
<p>Some OpenSSH clients have Kerberos authentication disabled by default. The easiest way to enable Kerberos/GSSAPI authentication in clients is by adding the following directives to <code>$HOME/.ssh/config</code>:</p>
<div>
<pre>
Host *
        Protocol 2
        GSSAPIAuthentication yes
        GSSAPIKeyExchange yes
        GSSAPIDelegateCredentials no
        GSSAPITrustDns no
</pre>
</div>
<p>This will enable Kerberos/GSSAPI authentication on the client side. The fact that Kerberos/GSSAPI authentication succeeds depends on several factors, like the user having a valid Kerberos TGT, the remote server having Kerberos/GSSAPI authentication enabled, and that the clocks on both the client and server machines are synced (most implementations refuse Kerberos/GSSAPI authentication if the clocks differ more than 5 minutes).</p>
<h2>7. Testing</h2>
<p>First, we need to get a TGT from the Kerberos KDC:</p>
<div>
<pre>
$ kinit
Please enter the password for falfaro@LAN:
</pre>
</div>
<p>To check that it worked, we list the tickets available to us, and make sure we see a ticket valid for service <code>krbtgt/*</code>:</p>
<div>
<pre>
$ klist
Kerberos 5 ticket cache: 'API:Initial default ccache'
Default principal: falfaro@LAN

Valid Starting     Expires            Service Principal
12/06/07 18:06:26  12/07/07 04:06:26  krbtgt/LAN@LAN
	renew until 12/13/07 18:06:26
</pre>
</div>
<p>Now, let&#8217;s try to log in into the OpenSSH server. Kerberos/GSSAPI authentication should be negotiated, as shown by the debugging information:</p>
<div>
<pre>
core2:~ falfaro$ ssh -v solana
OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /Users/falfaro/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to solana [10.42.242.12] port 22.
debug1: Connection established.
debug1: identity file /Users/falfaro/.ssh/id_rsa type -1
debug1: identity file /Users/falfaro/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.5
debug1: match: OpenSSH_4.5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.5
debug1: Offering GSSAPI proposal:
 gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==,
 gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==,
 gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==,
 gss-gex-sha1-A/vxljAEU54gt9a48EiANQ==,
 gss-group1-sha1-A/vxljAEU54gt9a48EiANQ==,
 gss-group14-sha1-A/vxljAEU54gt9a48EiANQ==,
 gss-gex-sha1-bontcUwnM6aGfWCP21alxQ==,
 gss-group1-sha1-bontcUwnM6aGfWCP21alxQ==,
 gss-group14-sha1-bontcUwnM6aGfWCP21alxQ==
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'solana' is known and matches the RSA host key.
debug1: Found key in /Users/falfaro/.ssh/known_hosts:8
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue:
 publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Authentication succeeded (gssapi-with-mic).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
Last login: Thu Dec  6 20:29:59 2007 from foo.lan
$ hostname
ssh.lan
$ exit
logout
Connection to solana closed.
</pre>
</div>
<p>If we run <code>klist</code> again, we will see that, in addition to the TGT we saw before, we will see the Kerberos service ticket for the OpenSSH server:</p>
<div>
<pre>
Kerberos 5 ticket cache: 'API:Initial default ccache'
Default principal: alice@LAN

Valid Starting     Expires            Service Principal
12/06/07 18:06:26  12/07/07 04:06:26  krbtgt/LAN@LAN
	renew until 12/13/07 18:06:26
12/06/07 18:07:27  12/07/07 04:06:26  host/ssh.lan@LAN
	renew until 12/13/07 18:06:26
</pre>
</div>
<h2>8. Troubleshooting</h2>
<p>The GSSAPI authentication mechanism is very picky about many things, and error codes and messages are usually very cryptic but not very helpful about what the cause of the error is.</p>
<p>I found that acommon source of authentication problems are entries in <code>/etc/hosts</code> confusing GSSAPi about the host name. For example, entries like this in <code>/etc/hosts</code>:</p>
<div>
<pre>
192.168.0.1  ssh ssh.lan
</pre>
</div>
<p>can cause SSH to think the host name is <code>ssh</code> instead of the expected FQDN &#8212; <code>ssh.lan</code>.The previous entry causes reverse name resolutions for IP <code>192.168.0.1</code> to return <code>ssh</code> as the host name, but not <code>ssh.lan</code>. Since the Kerberos keytab is <code>host/ssh.lan</code> but IP <code>192.168.0.1</code> is resolved to <code>ssh</code> this may cause authentication attempts to fail because no Kerberos keytab for <code>host/ssh</code> exists in <code>/etc/krb5.keytab</code>. The most common symptom is trying to SSH to localhost, getting a failed authentication and but ticket for the target host. Example:</p>
<div>
<pre>
$ kinit
Password for alice@LAN: 

$ klist
Ticket cache: FILE:/tmp/krb5cc_501
Default principal: alice@LAN

Valid starting     Expires            Service principal
05/31/09 01:08:21  06/01/09 01:08:20  krbtgt/LAN@LAN
</pre>
</div>
<p>Then,</p>
<div>
<pre>
$ ssh ssh.lan
alice@ssh.lan's password:
</pre>
</div>
<p>But no Kerberos ticket for <code>ssh.lan</code> was even requested:</p>
<div>
<pre>
$ klist
Ticket cache: FILE:/tmp/krb5cc_501
Default principal: alice@LAN

Valid starting     Expires            Service principal
05/31/09 01:08:21  06/01/09 01:08:20  krbtgt/LAN@LAN
</pre>
</div>
<p>One possible solution consists of removing the matching entry from <code>/etc/hosts</code>, provided that the existing DNS name server can properly resolve the IP address of the server to the correct FQDN. If this is not possible, another solution is making sure the FQDN name is listed before the non-FQDN name in the corresponding line in <code>/etc/hosts</code>.</p>
<h2>8. References</h2>
<p>Some additional and very useful references:</p>
<ul>
<li><a href="http://wiki.linux-nfs.org/wiki/index.php/Enduser_doc_kerberos">Kerberos 5 setup for NFSv4</a>.
<p>Describes common pitfalls, like using a non-FQDN host name in <code>/etc/hosts</code> or not using clock synchronization.
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/12/07/kerberizing-leopards-ssh/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Leopard, NFS, Automounter and Finder</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/21/leopard-nfs-automounter-and-finder/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/21/leopard-nfs-automounter-and-finder/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 00:32:34 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NFS]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/21/leopard-nfs-automounter-and-finder/</guid>
		<description><![CDATA[The AutoFS service in Leopard, also known as automount, is configured by means of text files stored in /etc and the automount command-line utility. The standard automount configuration also allows for local directory service lookups and thus can also be configured by using Directory Utility. The configuration of the automounter starts with the master configuration [...]]]></description>
			<content:encoded><![CDATA[<p>The AutoFS service in Leopard, also known as <code>automount</code>, is configured by means of text files stored in <code>/etc</code> and the <code>automount</code> command-line utility. The standard <code>automount</code> configuration also allows for local directory service lookups and thus can also be configured by using Directory Utility.</p>
<p>The configuration of the automounter starts with the master configuration file, <code>/etc/auto_master</code> The contents of this file look like this:</p>
<div>
<pre>
#
# Automounter master map
#
+auto_master		# Use directory service
/net			-hosts		-nobrowse,nosuid
/home			auto_home	-nobrowse
/Network/Servers	-fstab
/-			-static
</pre>
</div>
<p>Here is a brief description of each one:</p>
<ul>
<li>
<code>/net			-hosts		-nobrowse,nosuid</code></p>
<p>This configures automount of NFS servers in <code>/net</code>. Automounting is done for any resolvable host name (it doesn&#8217;t have to have an entry in <code>/etc/hosts</code> and it&#8217;s browsable under <code>/net</code>. The problem is that <code>/net</code> is not linked from the sidebar in Finder, and thus not very useable except from the command-line.</p>
</li>
<li>
<code>/home			auto_home	-nobrowse</code></p>
<p>This configures automounting of home directories via a directory service, as configured in <code>/etc/auto_home</code>.
</li>
<li>
<code>/Network/Servers	-fstab</code></p>
<p>This line states that all mount entries defined in <code>/etc/fstab</code> should be mounted in <code>/Network/Servers</code>. However, this is not entirely true  as mount entries listed in <code>/etc/fstab</code> have to specify an absolute mount point, or else <code>automount</code> will complain. Since mount entries specify an absolute mount point, and it won&#8217;t be overridden by <code>automount</code><code>, in order to make Finder show the entries in the sidebar it is recommended that the mount point is located in a subdirectory within </code><code>/Networ/</code>.</p>
<p>For example, this how my <code>/etc/fstab</code> file looks like:</p>
<div>
<pre>
media:/export /Network/media nfs nosuid,nodev 0 0
</pre>
</div>
</li>
<li>
<code>/-			-static</code></p>
<p>This entry is very similar to the previous one, but instead of using <code>/etc/fstab</code> as the source of mount entries, this one uses the local directory service instead. Entries can be configured using Directory Utility, and stored as a plist file in <code>/var/db/dslocal/nodes/Default/mounts</code>.</p>
<p>Here is an example of a file named <code>/var/db/dslocal/nodes/Default/mounts/media.lan\:%2Fexport.plist</code>:</p>
<div>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
	&lt;key&gt;dir&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;/Network/media&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;generateduid&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;1895C8D3-7DBF-4857-8D61-04080DFA5B55&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;name&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;media.lan:/export&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;opts&lt;/key&gt;
	&lt;array&gt;
		&lt;string>nosuid&lt;/string&gt;
		&lt;string>nodev&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;vfstype&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;nfs&lt;/string&gt;
	&lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
</div>
</li>
</ul>
<p>Reloading the <code>automount</code> configuration is just as simple as running:</p>
<pre>automount -vc</pre>
<p><code>automount</code> will reload its configuration and will automatically mount any entry listed in <code>/etc/fstab</code>. Additionally, the Finder will display an <em>All&#8230;</em> link in the sidebar that makes very easy to get to the automounted volumes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/21/leopard-nfs-automounter-and-finder/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Mac OS X 10.5 Leopard built-in firewall</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/10/mac-os-x-105-leopard-built-in-firewall/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/10/mac-os-x-105-leopard-built-in-firewall/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 23:15:51 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/10/mac-os-x-105-leopard-built-in-firewall/</guid>
		<description><![CDATA[The firewall in Mac OS X 10.5 Leopard is confusing, to say the least. It is not enabled by default, which is a huge mistake, in my humble opinion. Also, the graphical user interface offers less flexibility than in previous version while trying to configure it. Besides allowing you to independently control the blocking of [...]]]></description>
			<content:encoded><![CDATA[<p>The firewall in Mac OS X 10.5 Leopard is confusing, to say the least. It is not enabled by default, which is a huge mistake, in my humble opinion. Also, the graphical user interface offers less flexibility than in previous version while trying to configure it. Besides allowing you to independently control the blocking of incoming ICMP Echo Requests and logging via <code>syslog</code>, it has the following main operation modes:</p>
<ul>
<li>
<h3>Allow all incoming connections.</h3>
<p>Seems obvious that choosing this setting means that the firewall is essentially disabled and any traffic can freely flow in and out of the computer. </p>
<p>I would not recommend this setting, even for trusted networks. It is easy for a laptop computer to attach to a different network at any time and have the user forget to re-enable the firewall, posing as a potential victim for other users or computers. For a desktop computer it is more and more common to be attached to a network that has some sort of wireless bridging or routing device that might be used by untrusted users to get access to the network, or by trusted users that carry (maybe without their knowledge) malware, for example.</p>
<p>This setting offers little or no security, but makes very easy to share contents or provide external services.</li>
<li>
<h3>Block al incoming connections.</h3>
<p>This seems the safest choice, but might not always be desirable if you are sharing content or have services running that you want to make accessible from the outside (like an SSH server, or even the iTunes music collection).</p>
<p>This is my preferred setting, I have to say. This setting offers adequate security, but stops you from sharing content or offering access to services externally. However, it seems that Leopard&#8217;s firewall does not block all services, and some of them are still accessible from the outside (see at the end of the post for more information).</li>
<li>
<h3>Set access for specific services and applications.</h3>
<p>This is by far the most confusing setting. First, because it doesn&#8217;t seem to add any rules to <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html">IPFW</a>. I&#8217;m starting to believe that Leopard offers two layers of filtering. It seems <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html">IPFW</a> is one of them, but it defaults to use a ruleset with only default accept entry in it (sequence 65535):</p>
<pre>
# ipfw list
65535 allow ip from any to any
</pre>
<p>(NOTE: if you enable the Stealth functionality, a <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html">IPFW</a> rule is added before the default entry, and it looks like this:</p>
<pre>
33300 deny icmp from any to me in icmptypes 8
</pre>
<p>This blocks ICMP Echo Requests, but be aware that Stealth mode is not enabled by default).</p>
<p>About the other filtering layer, I&#8217;m not sure what it is used or how it is implemented, but it seems to be the result of some sort of kernel-level and user-space cooperation. The second reason why I think this setting can be confusing is because it seems to only affect a particular user (normally the logged user), but not the system or other users like <code>root</code>.</p>
<p>For example, I compiled <code>synergy</code> and ran it as user <code>root</code>. Then, I configured the Leopard&#8217;s firewall for access to specific services and applications, but I left the list empty. I verified that I could reach the <code>synergys</code> server at port 24800 from other computer in the same network segment. I was really surprised, to be honest.</p>
<p>The next thing I tried is to kill <code>synergys</code> and to re-run it as my currently logged in user. This time, Leopard presented me with a dialog box that asked whether to allow <code>synergys</code> to accept incoming connections:</p>
<blockquote><p><strong>Do you want the application &#8220;synergys&#8221; to accept incoming network connections?</strong></p>
<p>Clicking Deny may limit the application&#8217;s behavior. This setting can be changed in the Firewall pane of Security Preferences.</p></blockquote>
<p>This caused the expected behavior: any attempt to connect to port 24800 from the outside was blocked by Leopard&#8217;s firewall:</p>
<pre>
22:02:30.989097 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,nop,wscale 3,nop,nop,timestamp 699234003 0,sackOK,eol&gt;
22:02:31.913244 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,nop,wscale 3,nop,nop,timestamp 699234012 0,sackOK,eol&gt;
22:02:32.914300 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,nop,wscale 3,nop,nop,timestamp 699234022 0,sackOK,eol&gt;
22:02:33.915334 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,sackOK,eol&gt;
22:02:34.916398 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,sackOK,eol&gt;
22:02:35.917319 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,sackOK,eol&gt;
22:02:37.919629 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,sackOK,eol&gt;
22:02:41.924491 IP 10.42.242.16.49950 > 10.42.242.12.24800:
  S 3207271609:3207271609(0) win 65535
  &lt;mss 1460,sackOK,eol&gt;
</pre>
<p>Note how the first three segments had the time-stamp and window scaling options activated. The remaining SYN segments didn&#8217;t. This is probably due to Leopard thinking that there was congestion or that it was talking to an old system. </p>
<p>Once I chose <em>Always allow</em>, Leopard added an entry into the Firewall list named <code>synergys</code>. From here on, I was able connect to port 24800. This is the the network capture that <code>tcpdump</code> displayed when trying to connect to port 24800 from another compuer after <code>synergys</code> had been granted access:</p>
<pre>
22:24:20.674656 IP 10.42.242.16.50055 > 10.42.242.12.24800:
  S 2514913060:2514913060(0) win 65535
  &lt;mss 1460,nop,wscale 3,nop,nop,timestamp 699247086 0,sackOK,eol&gt;
22:24:20.675544 IP 10.42.242.12.24800 > 10.42.242.16.50055:
  S 812848149:812848149(0) ack 2514913061 win 65535
  &lt;mss 1460,nop,wscale 1,nop,nop,timestamp 473026159 699247086,sackOK,eol&gt;
22:24:20.675591 IP 10.42.242.16.50055 > 10.42.242.12.24800:
  . ack 1 win 65535 &lt;nop ,nop,timestamp 699247086 473026159&gt;
22:24:20.677911 IP 10.42.242.12.24800 > 10.42.242.16.50055:
  P 1:16(15) ack 1 win 33304 &lt;nop ,nop,timestamp 473026159 699247086&gt;
22:24:20.677959 IP 10.42.242.16.50055 > 10.42.242.12.24800:
  . ack 16 win 65535 &lt;nop ,nop,timestamp 699247086 473026159&gt;
</pre>
<p>Funny enough, keeping my telnet client running while trying to connect at port 24800, waiting for Leopard to remove the time-stamp and window scaling options, then allowing this traffic, didn&#8217;t make Leopard to try to re-negotiate the time-stamp and window scaling options.</p>
<p>Another thing worth mentioning is that once <code>synergys</code> had been granted access to incoming traffic at port 24800, removing it from the list of allowed applications and services didn&#8217;t stop it from receiving traffic. To block <code>synergys</code> from receiving traffic it was necessary to change <em>Allow incoming connections</em> to <em>Block incoming connections</em> (removing its entry from the list did still allow it to receive incoming traffic).</p>
<p>Another interesting feature is that Leopard&#8217;s seems to be aware of service dependency. For example, enabling the Screen Sharing service also starts a local Kerberos 5 KDC which is used to authenticate users. This is fascinating since users of Screen Sharing, for example, will first request a TGT to this local Kerberos 5 KDC (and will be able to decrypt that TGT if they know the correct password), then using the TGT request a service ticket for the Screen Sharing service that can present to it in order to get authenticated. But moreover, trying to connect to the Screen Sharing service for a second time will not require the user to provide his credentials again because a Kerberos service ticket is already available (provided that it didn&#8217;t expire). This is Single Sign-On in its true form.
</li>
</ul>
<h3>Conclusion</h3>
<p>In conclusion, I can&#8217;t say that the graphical user interface provides a lot of room for configuration, neither does it offer any way to configure egress filtering (that is, traffic that originates on the local computer and is to be sent out externally via a network interface).</p>
<p>In general, Leopard&#8217;s default administration tools are probably on par with those from Windows Vista. Even though the underpinnings of the newest member of the Mac OS X family are powered by IPFW, I feel Leopard&#8217;s firewall has a long way to go to in order to get closer to the powerful functionality and configurability of PF or Netfilter/IPtables, for example.</p>
<p>Also, not enabling the firewall by default is a big mistake in my opinion. One of my Mac OS X laptops is listening on port 111/tcp, 1020/tcp and 1021/tcp. The first one is <code>iCalAlarmAgent</code> and the other two are related to <code>launchd</code>. Even if you configure the firewall to block all traffic, these three ports are still accessible from the outside.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/10/mac-os-x-105-leopard-built-in-firewall/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

