<?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"
	>

<channel>
	<title>Felipe Alfaro Solana</title>
	<atom:link href="http://www.felipe-alfaro.org/blog/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>
	<pubDate>Sun, 11 May 2008 04:14:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Seguridad y punto de conexión a la red.</title>
		<link>http://www.felipe-alfaro.org/blog/2008/02/09/seguridad-y-punto-de-conexion-a-la-red/</link>
		<comments>http://www.felipe-alfaro.org/blog/2008/02/09/seguridad-y-punto-de-conexion-a-la-red/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 19:58:11 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/2008/02/09/seguridad-y-punto-de-conexion-a-la-red/</guid>
		<description><![CDATA[Leyendo un artículo de Kriptópolis, me encuentro con una referencia a Peter Tippett en la que éste hace un símil entre la seguridad en la industria automovilística y la industria de la seguridad informática. Aunque puedo coincidir con este señor, creo que no es una comparación del todo justa. En primer lugar, un coche es [...]]]></description>
			<content:encoded><![CDATA[<p>Leyendo un <a href="http://www.kriptopolis.org/de-seguridad-informatica">artículo de Kriptópolis</a>, me encuentro con una referencia a Peter Tippett en la que éste hace un símil entre la seguridad en la industria automovilística y la industria de la seguridad informática. Aunque puedo coincidir con este señor, creo que no es una comparación del todo justa. En primer lugar, un coche es un componente del mundo real que realiza unas funciones concretas (aunque pueda utilizarse para otros fines no contemplados, como descubrir el amor en la adolescencia o rodar colina abajo). Normalmente el coche ofrece menos complejidad que un sistema software, a pesar de que cada día tengan más electrónica, ya que está diseñado para un fin muy específico: gastar combustible, y por ello pagar más impuestos, u obligarme a pagar el impuesto de matriculación y circulación (más impuestos).</p>
<p>Los sistemas informáticos, por el contrario, suelen ser bastante más complejos y también más genéricos o configurables (tomo por ejemplo KDE 4.0.1 que ofrece una barbaridad de opciones de configuración y adaptación que nadie sabe cómo usar realmente), lo que aumenta la complejidad exponencialmente. El problema es que no es humanamente posible diseñar casos de prueba para todas las posibles combinaciones (no sólo del sistema como un ente autónomo, sino del sistema en cooperación con otros, como KDE interaccionando con D-BUS que a su vez interacciona con UDEV que a su vez interacciona con el núcleo). A veces las interfaces no están suficientemente blindadas y simplificadas porque se busca flexibilidad y la capacidad de adaptar el sistema a demandas futuras sin necesidad de re-escribir todo el sistema desde cero (véase como ejemplo SAP R/3, que requiere habitualmente de 14 a 30 meses de configuración para adaptarse a cualquier tipo de empresa, desde la que hace blanqueo de dinero a la que vende bacalao o queso). Hacer estas interfaces tan flexibles hace que puedan ser utilizadas de forma errónea (y que el cliente de la interfaz o el mismo servicio funcionen erráticamente) y que simplemente contengan fallos porque no es factible probar todas las posibles interacciones (llamar al método foo() y después al método bar() para después llamar al método yada(), &#8230; combinación que raramente se utiliza), ya sea por costes monetarios o de tiempo (algunos proyectos tienen que ser entregados en algún momento, no como Windows Vista que se puede demorar ad-infinitum sin que a nadie le importe). Como dicen muchos, la complejidad es el mayor enemigo de la seguridad. Por consiguiente, es imperativo que nosotros (y cuando digo nosotros realmente quiero decir vosotros) pongamos algo de cordura a la complejidad que nos rodea y nos deshagamos de esa nevera que tenemos en la cocina con pantalla LCD de 20&#8243; incorporada que hace cubitos de hielo y la lista de la compra y que viene con conexión a Internet y que la reemplacemos por una de esas neveras que usaban nuestras abuelas que sólo tenían una puerta y ni siquiera un botón para encenderlas o apagarlas (menos aún un botón para resetear, como el que traen las que vienen con Windows Mobile).</p>
<p>Además de todo lo expuesto anteriormente, creo reducir la seguridad de un &#8220;PC&#8221; (sobre todo si es un PC son un sistema operativo de baja calidad, con demasiadas funcionalidades y poco personalizable) a su punto de conexión en la red es un craso error. Cuando hablo de &#8220;punto de conexión a la red&#8221; me refiero a depender de cómo me conecto a Internet: desde mi casa con mi propio cortafuegos suministrado por Telefónica con las contraseñas por defecto habilitadas, o en un cibercafé a través de una red inalámbrica abierta que comparto con aquel señor de la otra esquina y aspecto inquietante. En cualquiera de los dos casos, el nivel de seguridad obtenido es diferente (sobre todo si el señor de la esquina tiene un aspecto realmente inquietante). Si el &#8220;PC&#8221; es un PC de escritorio (preferiblemente de más de 10 kilos y sin asa para poder pasearlo libremente), es probable que el punto de conexión a la red no cambie y, por ende, el nivel de seguridad permanezca relativamente estable a lo largo del tiempo (puede que tu &#8220;PC&#8221; con Windows adquiera algunos &#8220;inquilinos&#8221; traviesos con el paso del tiempo, pero su seguridad no se degradará mucho ya que anteriormente era, de por sí, realmente inseguro). Sin embargo, en dispositivos portátiles o móviles supone un problema mayor. Por ello, es importante asegurar el disposito en sí mismo, eliminando servicios innecesarios, usando un cortafuegos, usando herramientas como NoScript y navegadores seguros (aunque algo inestables como el Firefox), usando el sentido común (el menor común de los sentidos), utilizando gestores adecuados de contraseñas y disponer de múltiples de ellas (usar el PIN de la tarjeta de crédito como contraseña para registrarme en aquel sitio en el que me juraban regalarme un viaje al Túnez si me daba de alta), no usar Windows ni Mac OS X (a cual peor) ni tampoco Linux (mejor un sistema operativo raro, como QNX, MS-DOS o quizá FreeBSD), limitar las horas de navegación a la semana a menos de 300, y no consultar sitios potencialmente peligrosos (como Windows Live! o la página de El Mundo), pueden ayudar a incrementar el nivel de seguridad del usuario sin necesidad de depender en el punto de conexión a la red.</p>
<p>Con esto no quiero decir que la seguridad de la red no sea importante. Todo lo contrario. Pero dado que cada día es más habitual utilizar redes inalámbricas y que dejamos otros usuarios las usen y compartan con nosotros (lo digo como buen FONero que soy), como amigos, novias o vecinos con ADSL de 1Mbps de Terra. Por ello, la frontera entre lo que es &#8220;mi&#8221; red y el &#8220;resto&#8221; es cada día más borrosa y es necesario aplicar el concepto de seguridad por niveles y asegurar todos y cada uno de los componentes. Y eso incluye esta antigua impresora HP LaserJet con el adaptador de Ethernet que alguien compró hace 12 años y que un día se quedó sin tóner y papel porque un hacker se coló en la red y mandó a imprimir el manual de usuario de AutoCAD 9.</p>
<p>En definitiva: os recomiendo que veáis más la televisión y la Fórmula 1 y que dejéis de escuchar la radio o leer periódicos normales o navegar tanto por Internet porque es peligroso y, en general, sólo se encuentran piratas, friks o gente con ideas descabelladas y estúpidas o con ganas de robarnos el dinero o extorsionarnos (desde Rusia, con Amor).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2008/02/09/seguridad-y-punto-de-conexion-a-la-red/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Configuring a diskless Ubuntu</title>
		<link>http://www.felipe-alfaro.org/blog/2007/12/09/configuring-a-diskless-ubuntu/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/12/09/configuring-a-diskless-ubuntu/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 02:30:02 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[DHCP]]></category>

		<category><![CDATA[NFS]]></category>

		<category><![CDATA[PXE]]></category>

		<category><![CDATA[TFTP]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.felipe-alfaro.org/blog/2007/12/09/configuring-a-diskless-ubuntu/</guid>
		<description><![CDATA[This post is not about doing a PXE-based network installation of Ubuntu. There are already many posts describing how to do this. This post is about setting up an Ubuntu workstation in diskless mode, such as the workstation boots via PXE and the root filesystem is mounted over NFS.
The process consists on the following main [...]]]></description>
			<content:encoded><![CDATA[<p>This post is not about doing a PXE-based network installation of Ubuntu. There are already many posts describing how to do this. This post is about setting up an Ubuntu workstation in diskless mode, such as the workstation boots via PXE and the root filesystem is mounted over NFS.</p>
<p>The process consists on the following main steps:</p>
<ol>
<li>Setting up the DHCP server</li>
<li>Setting up the TFTP server and configuring PXE boot</li>
<li>Setting up the NFS server</li>
<li>Bootstrapping a Ubuntu installation into the client&#8217;s root filesystem</li>
<li>Booting up the diskless workstation</li>
</ol>
<h2>1. Setting up the DHCP server</h2>
<p>PXE-enabled workstations need to get an additional option during the DHCP negotiation that will point them to a TFTP server where the PXE-compatible boot loader code can be downloaded. Configuring <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html"><code>dnsmasq</code></a> to hand this option to clients is just as easy as adding the following line to <code>/etc/dnsmasq.conf</code>:</p>
<div>
<pre>
dhcp-boot=pxelinux.0,tftp.lan,10.42.242.13
</pre>
</div>
<p>and restarting the <code>dnsmasq</code> service.</p>
<h2>2. Setting up the TFTP server and configuring PXE boot</h2>
<p>Now that DHCP has been configured, the next step is setting up the TFTP server. The TFTP server will be used by PXE-compatible clients to download the PXE boot loader code, and also the Linux kernel and Linux initial RAM disk.</p>
<p>I will use H. P. Anvin&#8217;s TFTP server as it&#8217;s widely used and works fairly well:</p>
<div>
<pre>
root@tftp.lan:# apt-get install tftpd-hpa
</pre>
</div>
<p><code>tftpd-hpa</code> does not integrate automatically with <code>xinetd</code> so if you want to run the TFTP server under <code>xinetd</code>, you will have to create the following file, which was ported from the <code>inetd</code> description that is created automatically in <code>/etc/inetd.conf</code> when <code>tftpd-hpa</code> is installed:</p>
<div>
<pre>
service tftp
{
        disable         = no
        id              = chargen-dgram
        socket_type     = dgram
        protocol        = udp
        user            = root
        wait            = yes
        server          = /usr/sbin/in.tftpd
        server_args     = -s /var/lib/tftpboot/
}
</pre>
</div>
<p>then restarting the <code>xinetd</code> service.</p>
<p>Configuring PXE boot is just a matter of copying the PXE boot loader code, a configuration file, the Linux kernel and initial RAM disks under the TFTP root. First, install <code>syslinux</code> and copy the PXE boot loader code to the TFTP server root:</p>
<div>
<pre>
root@tftp.lan:# apt-get install syslinux
root@tftp.lan:# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
root@tftp.lan:# mkdir /var/lib/tftpboot/pxelinux.cfg
</pre>
</div>
<p>The Linux PXE boot loader code, <code>syslinux</code>, expects that a configuration file describing what kernel, its boot parameters, and the initial RAM disk to use to be stored within a directory named <code>pxelinux.cfg</code> just under the TFTP server root.</p>
<p>Client-specific config files can be created (based on the client MAC address, for example). We will create a config file that is suitable for any client. This configuration file is called <code>default</code> and can be created by running the following commands:</p>
<div>
<pre>
root@tftp.lan:# KERNEL_VERSION=2.6.22-14-generic
root@tftp.lan:# NFS_IPADDR=$(host nfs.lan | cut -d' ' -f4)
root@tftp.lan:# cat &gt; /var/lib/tftpboot/pxelinux.cfg/default &lt;&lt; EOF
> LABEL linux
> KERNEL vmlinuz-${KERNEL_VERSION}
> APPEND root=/dev/nfs initrd=initrd.img-${KERNEL_VERSION} nfsroot=${NFS_IPADDR}:/home/nfsroot ip=dhcp rw
> EOF
</pre>
</div>
<h2>3. Setting up the NFS server</h2>
<p>In this step, we will configure the NFS server and export the directory where the client&#8217;s root filesystem will be stored.</p>
<p>Let&#8217;s start by installing the NFS server packages:</p>
<div>
<pre>
root@nfs.lan:# apt-get install nfs-kernel-server nfs-common
</pre>
</div>
<p>I will use <code>/home/nfsroot</code> as the root for the client&#8217;s root filesystem</p>
<div>
<pre>
root@nfs.lan:# mkdir /home/nfsroot
</pre>
</div>
<p>Next, add the following line to <code>/etc/exports</code> in order to export the the client&#8217;s root filesystem:</p>
<div>
<pre>
/home/nfsroot *,gss/krb5(rw,no_subtree_check,async,no_root_squash)
</pre>
</div>
<p>Then re-export all the filesystems:</p>
<div>
<pre>
root@nfs.lan:# exportfs -avr
</pre>
</div>
<h2>4. Bootstrapping a Ubuntu installation into the client&#8217;s root filesystem</h2>
<p>The following steps will bootstrap the installation of a minimal Ubuntu Hardy Heron GNU/Linux system into the client&#8217;s root:</p>
<div>
<pre>
root@nfs.lan:# debootstrap --arch i386 hardy \
  /home/nfsroot http://ch.archive.ubuntu.com/ubuntu/
</pre>
</div>
<p>Only the minimum required packages will be downloaded from the Internet and installed into <code>/home/nfsroot</code>. The output of the previous command should look like this:</p>
<div>
<pre>
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: libdb4.6
I: Checking component main on http://ch.archive.ubuntu.com/ubuntu...
I: Retrieving adduser
I: Validating adduser
...
I: Base system installed successfully.
</pre>
</div>
<p>Once the system has been bootstrapped, we need to populate <code>fstab</code>. At least, <code>/proc</code> and <code>/</code> must get mounted, but other filesystems might be referenced in this file too, like additional NFS exports, swap files, and so on. The difference with respect a traditional, disk-based Ubuntu installation, is that the root filesystem gets mounted via NFS by the intial RAM disk, and is referenced by the kernel&#8217;s <code>/dev/nfs</code> block device.</p>
<p>The contents of <code>/home/nfsroot/etc/fstab</code> should look like this:</p>
<div>
<pre>
# /etc/fstab: static file system information.
#
# &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
proc            /proc         proc   defaults       0      0
/dev/nfs        /             nfs    defaults       0      0
</pre>
</div>
<p>Another difference with a traditional Ubuntu system is that we don&#8217;t want the network interfaces be managed by Network Manager. In fact, the main (probably Ethernet) network interface was already configured by the kernel based on PXE&#8217;s supplied configuration. Letting Nework Manager reconfigure or manage this network interface might mean losing the connection to the NFS server and, thus, rendering the system unusable.</p>
<p>To stop Network Manager from managing the main network interface, the contents of <code>/home/nfsroot/etc/network/interfaces</code> must look like this:</p>
<div>
<pre>
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface, commented out for NFS root
iface eth0 inet manual
</pre>
</div>
<p>Finally, we will give the client a generic name. This can be done by storing that generic name into /etc/hostname:</p>
<div>
<pre>
root@nfs.lan:# echo client.lan &gt; /home/nfsroot/etc/hostname
</pre>
</div>
<h2>Booting up the diskless workstation</h2>
<p>Once everything is set up, the last thing to do is testing that the diskless workstation is able to boot via PXE. The mechanics of booting via PXE depend on the machine. On some machines, it&#8217;s just a matter of pressing ESC to get into a menu that allows to override the boot device. On others, the same can be done by pressing F12 during the POST. On most modern systems it&#8217;s possible to reconfigure the system to always boot from the network.</p>
<p>If the client is able to boot from PXE successfully, this is what you will briefly see on your screen:</p>
<div>
<pre>
CLIENT MAC ADDR: 00 11 22 33 44 55 66  GUID: 00000000 0000 0000 0000 000000000000
CLIENT IP: 192.168.0.2  MASK: 255.255.255.0  DHCP IP: 192.168.0.1
GATEWAY IP: 192.168.0.1

PXELNUX 3.36 Debian-2007-08-30  Copyright (C) 1994-2007 H. Peter Anvin
UNDI data segment at:   00094140
UNDI data segment size: 94B0
UNDI code segment at:   0009D5F0
UNDI code segment size: 20B0
PXE entry point found (we hope) at 9D5F:0106
My IP address seems to be C0A80001 192.168.0.2
ip=192.168.0.2:192.168.0.1:192.168.0.1:255.255.255.0
TFTP prefix:
Tring to load: pxelinux.cfg/00-01-02-03-04-05
Tring to load: pxelinux.cfg/C0A80001
Tring to load: pxelinux.cfg/C0A8000
Tring to load: pxelinux.cfg/C0A800
Tring to load: pxelinux.cfg/C0A80
Tring to load: pxelinux.cfg/C0A8
Tring to load: pxelinux.cfg/C0A
Tring to load: pxelinux.cfg/C0
Tring to load: pxelinux.cfg/C
Tring to load: pxelinux.cfg/default
boot:
Loading vmlinuz...
</pre>
</div>
<p>If the system boots up, we will be dropped into a text-mode console where we can log in as <code>root</code> with no password. Of course, the first thing you should do is creating a password for the <code>root</code> user, but if you have been able to get to this point, you probably know how to do it <img src='http://www.felipe-alfaro.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once you are logged in as your in your new diskless workstation, you will probably want to add more functionality. For example, installing the <a href="http://www.openssh.org">OpenSSH</a> server, or the packages for the typical Ubuntu desktop system. Before you do that, we will need to add more Ubuntu repositories to <code>/etc/apt/sources.list</code>. This is how mine looks like:</p>
<div>
<pre>
deb http://ch.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ feisty main restricted
deb http://ch.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb http://ch.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://ch.archive.ubuntu.com/ubuntu/ feisty universe
deb http://ch.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://ch.archive.ubuntu.com/ubuntu/ feisty multiverse
deb http://ch.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb-src http://ch.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse
</pre>
</div>
<p>Finally, I decided to install OpenSSH, OpenNTPD and the typical Ubuntu desktop:</p>
<div>
<pre>
root@client.lan:# apt-get update
root@client.lan:# apt-get install openssh-server openntpd ubuntu-desktop
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/12/09/configuring-a-diskless-ubuntu/feed/</wfw:commentRss>
		</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 or manage [...]]]></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 = &#8220;no&#8221;
        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 &#8217;solana&#8217; 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>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/12/07/kerberizing-leopards-ssh/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing FreeNX 0.7.1 on Ubuntu</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 12:27:20 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[NX]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/</guid>
		<description><![CDATA[Introduction
DISCLAIMER: The contents of this post are mostly based on Manual Installation How-To. Thanks to Brent Davidson and Fabian Franz for writing such a nice HowTo and the beautiful open and free implementation of FreeNX, respectively.
I decided to use FreeNX instead of NoMachine&#8217;s own implementation due to the instability of the latter. Most of the [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p><strong>DISCLAIMER</strong>: The contents of this post are mostly based on <a href="http://www.nabble.com/Manual-Installation-How-To-t4726723.html">Manual Installation How-To</a>. Thanks to Brent Davidson and Fabian Franz for writing such a nice HowTo and the beautiful open and free implementation of FreeNX, respectively.</p>
<p>I decided to use FreeNX instead of NoMachine&#8217;s own implementation due to the instability of the latter. Most of the times, I could not reconnect to my running sessions, or else NX decided to kill my running session and start a new one. FreeNX is a collection of shell scripts, which makes it easier to debug and troubleshoot problems.</p>
<p>The process described in this post starts with the NoMachine&#8217;s binary components, downloadable from the Web, and then overwrites or replaces key components that are binary-only and closed with FreeNX&#8217;s open and free shell scripts, which provides much more flexibility. In my own experience, FreeNX is more robust, stable, predictable, easier to customize and to debug than NoMachine&#8217;s closed binary components.</p>
<h2>Installing the base NoMachine&#8217;s NX binary components</h2>
<p>Download <code>nxclient</code>, <code>nxnode</code> and <code>nxserver</code> from <a href="http://www.nomachine.com/select-package.php?os=linux&#038;id=1">NoMachine</a> as <code>.tar.gz</code> files. The files can be found in the <a href="http://www.nomachine.com/select-package.php?os=linux&#038;id=1">NoMachine downloads</a> or can be downloaded directly from this site, if you trust me:</p>
<p>For IA-32 systems:</p>
<ul>
<li><a href="/blog/wp-content/NX/nxclient-3.0.0-84.i386.tar.gz">nxclient-3.0.0-84.i386.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxnode-3.0.0-93.i386.tar.gz">nxnode-3.0.0-93.i386.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxserver-3.0.0-79.i386.tar.gz">nxserver-3.0.0-79.i386.tar.gz</a></li>
</ul>
<p>For x86_64 systems:</p>
<ul>
<li><a href="/blog/wp-content/NX/nxclient-3.0.0-84.x86_64.tar.gz">nxclient-3.0.0-84.x86_64.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxnode-3.0.0-93.x86_64.tar.gz">nxnode-3.0.0-93.x86_64.tar.gz</a></li>
<li><a href="/blog/wp-content/NX/nxserver-3.0.0-79.x86_64.tar.gz">nxserver-3.0.0-79.x86_64.tar.gz</a></li>
</ul>
<p>Extract the files to <code>/usr</code>. Since the <code>.tar.gz</code> packages always contain relative pathnames that start with <code>./NX</code>, this will create a whole directory tree under <code>/usr/NX</code>.</p>
<div>
<pre>
# tar -C /usr –xzf nxserver-3.0.0-79.i386.tar.gz
# tar -C /usr –xzf nxclient-3.0.0-84.i386.tar.gz
# tar -C /usr –xzf nxnode-3.0.0-93.i386.tar.gz
</pre>
</div>
<h2>Compiling the NX compression libraries</h2>
<h3>Compiling <code>nxcomp</code></h3>
<p>Download the source code for <code>nxcomp</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcomp-3.0.0-48.tar.gz">nxcomp-3.0.0-48.tar.gz</a>.</p>
<p>The <code>./configure</code> is not very robust and doesn&#8217;t check for missing dependencies. This are the packages that are needed to compile <code>nxcomp</code>:</p>
<div>
<pre>
# apt-get install zlib1g-dev libX11-dev libjpeg-dev libpng12-dev \
    x11proto-xext-dev libxdamage-dev libxrandr-dev libxtst-dev \
    libaudiofile-dev
</pre>
</div>
<p>Configuring, building the library and copying it to its final location is just as easy as running:</p>
<div>
<pre>
# tar -xzf nxcomp-3.0.0-48.tar.gz
# cd nxcomp
# ./configure --prefix=/usr/NX
# make
# cp -P libXcomp.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxcompext</code></h3>
<p>Download the source code for <code>nxcompext</code> and <code>nx-X11</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcompext-3.0.0-18.tar.gz">nxcompext-3.0.0-18.tar.gz</a> and <a href="/blog/wp-content/NX/nx-X11-3.0.0-37.tar.gz">nx-X11-3.0.0-37.tar.gz</a>, and extract them:</p>
<div>
<pre>
# tar -xzf nxcompext-3.0.0-18.tar.gz
# tar -xzf nx-X11-3.0.0-37.tar.gz
</pre>
</div>
<p>Before compiling <code>nxcompext</code>, apply the <a href="/blog/wp-content/NX/NXlib-xgetioerror.patch">NXlib-xgetioerror.patch</a>.</p>
<div>
<pre>
# cd nxcompext
# patch -p0 < NXlib-xgetioerror.patch
</pre>
</pre>
</div>
<p>This is required or else the resulting <code>libXcomp.so</code> shared library will complain about <code>_XGetIOError</code> symbol being undefined. In order to troubleshoot this, I had to enable logging in <code>/usr/NX/etc/node.conf</code>:</p>
<div>
<pre>
NX_LOG_LEVEL=7
SESSION_LOG_CLEAN=0
NX_LOG_SECURE=0
</pre>
</div>
<p>Then, looking at <code>/var/log/nxserver.log</code> I found the following error message:</p>
<pre>
Info: Established X client connection.
Info: Using shared memory parameters 1/1/1/4096K.
Info: Using alpha channel in render extension.
Info: Not using local device configuration changes.
/usr/NX/bin/nxagent: symbol lookup error: /usr/NX/lib/libXcompext.so.3:
undefined symbol: _XGetIOError
NX> 1006 Session status: closed
</pre>
<p>Applying the patch solves the problem:</p>
<div>
<pre>
# ./configure --x-includes="/usr/include/xorg -I/usr/include/X11" --prefix=/usr/NX
# make
# cp -P libXcompext.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxcompshad</code></h3>
<p>Download the source code for <code>nxcompshad</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxcompshad-3.0.0-19.tar.gz">nxcompshad-3.0.0-19.tar.gz</a>.</p>
<div>
<pre>
# tar -xzf nxcompshad-3.0.0-19.tar.gz
# cd nxcompshad
# ./configure --prefix=/usr/NX
# make
# cp -P libXcompshad.so* /usr/NX/lib
</pre>
</div>
<h3>Compiling <code>nxesd</code></h3>
<p>Download the source code for <code>nxesd</code> from <a href="http://www.nomachine.com/sources.php">NoMachine&#8217;s source code</a> or here from<br />
<a href="/blog/wp-content/NX/nxesd-3.0.0-4.tar.gz">nxesd-3.0.0-4.tar.gz</a>.</p>
<div>
<pre>
# tar -xzf nxesd-3.0.0-4.tar.gz
# cd nxesd
# ./configure --prefix=/usr/NX
# make
# make install
</pre>
</div>
<h2>Installing FreeNX</h2>
<p>Download <a href="http://freenx.berlios.de/">FreeNX</a> from <a href="http://freenx.berlios.de/download.php">FreeNX downloads</a>, or from this Web site at <a href="/blog/wp-content/NX/freenx-0.7.1.tar.gz">freenx-0.7.1.tar.gz</a> and extract them and apply the <code>gentoo-machine.diff</code> patch:</p>
<div>
<pre>
# tar -xzf freenx-X.Y.Z.tar.gz
# cd freenx-X.Y.Z
# patch -p0 < gentoo-nomachine.diff
</pre>
</pre>
</div>
<p>The <code>gentoo-machine.diff</code> patch must be applied if you are using the <code>/usr/NX</code> directory structure that the NoMachine libraries use.</p>
<p>Next, we replace the original NoMachine key binaries (in fact, they are compiled Perl scripts) with the FreeNX shell scripts:</p>
<div>
<pre>
# cp -f nxkeygen /usr/NX/bin/
# cp -f nxloadconfig /usr/NX/bin/
# cp -f nxnode /usr/NX/bin/
# cp -f nxnode-login /usr/NX/bin/
# cp -f nxserver /usr/NX/bin/
# cp -f nxsetup /usr/NX/bin/
# cp -f nxcups-gethost /usr/NX/bin/
</pre>
</div>
<p>Next, we need to compile the <code>nxserver-helper</code> binary, which is used by the slave mode of <code>nxnode</code>. Basically, <code>nxserver-helper</code> runs a command that has both <code>/dev/fd/3</code> and <code>/dev/fd/4</code> mapped into both ends of a UNIX SOCKET.</p>
<div>
<pre>
# cd nxserver-helper
# make
# cp -f nxserver-helper /usr/NX/bin/
</pre>
</div>
<p>Before being able to set up the FreeNX, install <code>expect</code>, the OpenSSH server and <code>smbmount</code> and <code>smbumount</code>:</p>
<div>
<pre>
$ sudo apt-get install expect smbfs openssh-server
</pre>
</div>
<p>The next step creates symbolic links in <code>/usr/bin</code> to all FreeNX scripts that live in <code>/usr/NX/bin</code> and additional symbolic links for NX compatibility:</p>
<div>
<pre>
# ln -s /usr/NX/bin/nxserver /usr/bin/nxserver
# ln -s /usr/NX/bin/nxsetup /usr/sbin/nxsetup
# ln -s /usr/NX/bin/nxloadconfig /usr/sbin/nxloadconfig
# ln -s /usr/NX/lib/libXrender.so.1.2.2 /usr/NX/lib/libXrender.so.1.2
# ln -s /usr/NX/bin/nxagent /usr/NX/bin/nxdesktop
# ln -s /usr/NX/bin/nxagent /usr/NX/bin/nxviewer
# ln -s /usr/bin/foomatic-ppdfile /usr/lib/cups/driver/foomatic-ppdfile
# ln -s /etc/X11/xinit /etc/X11/xdm
# ln -s /sbin/mount.cifs /sbin/smbmount
# ln -s /sbin/umount.cifs /sbin/smbumount
</pre>
</div>
<p>The final step consists is running the installation stage of FreeNX:</p>
<div>
<pre>
# nxsetup --install
</pre>
</div>
<p>This will create <code>/usr/NX/var</code> directory tree, create the <code>nx</code> user, install the appropiate SSH keys (either the NoMachine&#8217;s keys or custom keys).</p>
<p>Before being able to use FreeNX, create the <code>node.conf</code> configuration file that allow changing the behavior of FreeNX, like logging, path names to several scripts used to start GNOME or KDE, and so on:</p>
<div>
<pre>
# cd freenx-X.Y.Z
# cp node.conf.sample /usr/NX/etc/node.conf
</pre>
</div>
<h2>Future development and ideas</h2>
<ul>
<li>Not having to depend on any single binary file from NoMachine.
<p>The idea is compiling all the components from source code, instead of starting with a binary distribution and replacing key components with their open and free counterparts.</li>
<li>Customizing FreeNX so that I can bypass NoMachine&#8217;s <code>nxclient</code> completely.
<p>Most of my network components are Kerberized and having to keep supplying my password to <code>nxclient</code> seems like a thing of the past to me. The idea is customizing FreeNX in such a way that I can leverage Kerberos authentication and drop password-based authentication completely.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/24/installing-freenx-071-on-ubuntu/feed/</wfw:commentRss>
		</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 file, [...]]]></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>
		</item>
		<item>
		<title>Funny translations using Google Translate</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/14/funny-translations-using-google-translate/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/14/funny-translations-using-google-translate/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 21:23:48 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/14/funny-translations-using-google-translate/</guid>
		<description><![CDATA[Yesterday I was trying to translate some text in German to English, like this one:
Für sämtliche Fragen rund um den Zürcher Verkehrsverbund steht Ihnen ZVV-Contact oder Ihre Verkaufsstelle gerne zur Verfügung.
And the text was translated to this:
For all questions about the ZVV you ZVV-Contact or sell your body to be happy.
I don&#8217;t know if I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was trying to translate some text in German to English, like this one:</p>
<blockquote><p>Für sämtliche Fragen rund um den Zürcher Verkehrsverbund steht Ihnen ZVV-Contact oder Ihre Verkaufsstelle gerne zur Verfügung.</p></blockquote>
<p>And the text was translated to this:</p>
<blockquote><p>For all questions about the ZVV you ZVV-Contact or sell your body to be happy.</p></blockquote>
<p>I don&#8217;t know if I should sell my body, and also I&#8217;m not sure about the price. But what I&#8217;m sure about is that the translation should have looked like this instead:</p>
<blockquote><p>For any questions about the Zürich Public Transportation Authority you can contact ZVV or the closest sales agency.</p></blockquote>
<p>If you don&#8217;t believe me, you can click the next image:</p>
<p><center><a href='http://felipe-alfaro.org/blog/wp-content/uploads/2007/11/german-to-english-translation.png' title='German to English translation using Google Translate'><img src='http://felipe-alfaro.org/blog/wp-content/uploads/2007/11/german-to-english-translation.thumbnail.png' alt='German to English translation using Google Translate' /></a></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/14/funny-translations-using-google-translate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sistema simple de voto electrónico</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/11/sistema-simple-de-voto-electronico/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/11/sistema-simple-de-voto-electronico/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 11:55:18 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/11/sistema-simple-de-voto-electronico/</guid>
		<description><![CDATA[Introducción
En los sistemas convencionales, el votante se dirige a un colegio electoral, introduce su voto, en forma de papeleta, en un sobre, se identifica ante un agente e introduce su voto en una urna. Los sistemas tradicionales separan el proceso de autentificación del votante del proceso recuento de votos, de forma que éstos se realizan [...]]]></description>
			<content:encoded><![CDATA[<h2>Introducción</h2>
<p>En los sistemas convencionales, el votante se dirige a un colegio electoral, introduce su voto, en forma de papeleta, en un sobre, se identifica ante un agente e introduce su voto en una urna. Los sistemas tradicionales separan el proceso de autentificación del votante del proceso recuento de votos, de forma que éstos se realizan de forma independiente.</p>
<p>El proceso de autentificación no tiene acceso al contenido del voto y sirve meramente para evitar que sólo los individuos autorizados puedan ejercer su derecho al voto. Así mismo, el proceso de autentificación es capaz de evitar votos duplicados, es decir, la emisión del mismo voto más de una vez por el mismo individuo, y también es capaz de ofrecer el cómputo de votos recibidos y calcular estadísiticas como el porcentaje de votos recibidos sobre el total de la población con derecho a voto.</p>
<p>El modelo tradicional confía en que el proceso de autentificación fue correctamente realizado, que el transporte entre el sistema de autentificación y el sistema de recuento es fiable (no hay pérdida de datos, ni manipulación del canal, como la eliminación de votos, etc.) y que el registro de los votos no fue alterado. El proceso de recuento es capaz de clasificar el conjunto total de los votos según su contenido, normalmente en un número discreto, finito y normalmente reducido de posibilidades.</p>
<p>Se desea una implementación de sistema de voto electrónico que permita la autentificación del votante a la vez que mantenga el anonimato del voto, conservando la semántica de los sistemas de voto tradicionales.</p>
<h2>Presentación</h2>
<p>Se propone una solución de voto electrónico en la que intervienen tres entidades:</p>
<ul>
<li>El votante</li>
<li>Un sistema de autentificación</li>
<li>Un sistema de recuento o registro de votos</li>
</ul>
<p>El voto se introduce en un sobre, cuyo destinatario final es el sistema de recuento. Este sobre, a su vez, se introduce en otro cuyo destinatario final es el sistema de autentificación. El voto, encapsulado en dos sobres, pasará por los dos sistemas. Primero por el sistema de autentificación que comprobará la identidad del votante, así como que el votante no haya votado ya alguna vez. El sistema de autentificación no tendrá acceso al segundo sobre, que contiene el voto en sí mismo. De esta forma, el voto se oculta del sistema de autentificación. Una vez autentificada la identidad del votante, y sin conocer el contenido del voto, el segundo sobre se envía al sistema de recuento que registrará el voto. El sistema de autentificación elimina la firma digital del votante y la sustituye por la suya a fin de permitir el voto anónimo.</p>
<p>El objetivo del entorno es que el sistema de autentificación no tenga acceso al voto en sí mismo (anonimato) pero pueda validar la identidad del votante, y que el sistema de recuento tenga acceso al voto en sí mismo pero no a la identidad del votante.</p>
<p>Para ello, se propone el siguiente sistema basado en criptografía de clave pública:</p>
<table>
<tr>
<td>E(K, M)</td>
<td>Cifrado con f. de clave pública de un mensaje M utilizando una clave K</td>
</tr>
<tr>
<td>V</td>
<td>Voto electrónico (el equivalente a una papeleta)</td>
</tr>
<tr>
<td>ID<sub>V</sub></td>
<td>Identidad del votante</td>
</tr>
<tr>
<td>K<sub>EV</sub></td>
<td>Clave pública del votante</td>
</tr>
<tr>
<td>K<sub>DV</sub></td>
<td>Clave privada del votante</td>
</tr>
<tr>
<td>K<sub>EA</sub></td>
<td>Clave pública del sistema de autentificación</td>
</tr>
<tr>
<td>K<sub>DA</sub></td>
<td>Clave privada del sistema de autentificación</td>
</tr>
<tr>
<td>K<sub>ER</sub></td>
<td>Clave pública del sistema de recuento</td>
</tr>
<tr>
<td>K<sub>DR</sub></td>
<td>Clave pública del sistema de recuento</td>
</tr>
</table>
<h2>Premisas</h2>
<p>El votante sólo conoce K<sub>EV</sub>, K<sub>DV</sub> (su pareja de claves pública y privada) así como K<sub>EA</sub> y K<sub>ER</sub>. El sistema de autentificación sólo conoce K<sub>EV</sub>, así como K<sub>EA</sub>, K<sub>DA</sub> (su pareja de claves pública y privada) y K<sub>ER</sub>. El sistema de recuento sólo conoce K<sub>EA</sub>, así como K<sub>ER</sub> y K<sub>DR</sub> (su pareja de claves pública y privada).</p>
<h2>Implementación</h2>
<p>A la hora de emitir su voto electrónico, el votante emite el siguiente mensaje, destinado al sistema de autentificación:</p>
<p><center>M<sub>V</sub> = E(K<sub>DV</sub>, E(K<sub>EA</sub>, TS<sub>1</sub> || ID<sub>V</sub> || E(K<sub>ER</sub>, V)))</center></p>
<p>Una vez en posesión de M<sub>V</sub>, el sistema de autentificación puede validar la firma digital de M<sub>V</sub> descrifándolo con la clave pública del votante, K<sub>EV</sub>, y obteniendo:</p>
<p><center>TS<sub>1</sub> || ID<sub>V</sub> || E(K<sub>ER</sub>, <sub>V</sub>)</center></p>
<p>El sistema de autentificación puede validar la autenticidad del votante, pero sin tener acceso al contenido del voto en sí mismo, V, al no tener el sistema de autentificación acceso a K<sub>DR</sub>. El sistema de autentificación debe establecer que ID<sub>V</sub> coincide con la identidad del votante (por ejemplo, su NIF). En ese caso, el sistema de autentificación validará que el votante V no haya votado con anterioridad, comprobando que la estampa de tiempo TS<sub>1</sub> no difiera de la estampa horaria actual en más de un periodo determinado como seguro (por ejemplo, 48 horas). Si la identidad del votante no puede ser comprobada o la estampa horaria TS<sub>1</sub> está fuera del intervalo permitido, el mensaje se descarta. En caso contrario, el sistema de autentificación emite el siguiente mensaje, M<sub>A</sub>, destinado al sistema de recuento:</p>
<p><center>M<sub>A</sub> = E(K<sub>DA</sub>, E(K<sub>ER</sub>, TS<sub>2</sub> || TS<sub>1</sub> || E(K<sub>ER</sub>, V)))</center></p>
<p>El sistema de recuento deberá verificar la firma digital de M<sub>A</sub>. De ser correcta, el sistema de recuento tendrá acceso a:</p>
<p><center>TS<sub>2</sub> || TS<sub>1</sub> || E(K<sub>ER</sub>, V)</center></p>
<p>De no ser correcta, el mensaje M<sub>V</sub> será descartado. El sistema de recuento comprobará que TS<sub>1</sub> = TS<sub>2</sub> ±εy que tanto TS<sub>1</sub> como TS<sub>2</sub> estén dentro de unos márgenes de tiempo aceptables. En ese caso, se podrá proceder a obtener el voto V y registrarlo en un sistema de almacenamiento que sea <em>tamper-resistant</em> (resistente a modificaciones maliciosas o no autorizadas).</p>
<p>Al diferencia de los sistemas tradicionales, donde los votos se acumulan en su totalidad en el sistema de autentificación hasta el cierre de la recepción de votos, el modelo descrito permite dos posibilidades:</p>
<ul>
<li><strong>Acumulación previa:</strong>
<p>Una vez se finalice la admisión de votos, el sistema puede enviar el conjunto de todos los M<sub>A</sub> acumulados, más el cardinal de dicho conjunto, como un mensaje único firmado digitalmente por el sistema de autentificación.</p>
<p>Esto ofrece una reducción en la posibilidad de que un agente externo pueda manipular el canal de comunicación entre el sistema de autentificación y el de recuento, invalidando la votación. A su vez, hace que un agente externo pueda invalidar la votación con tan sólo manipular el estado del sistema de autentifcación. Se disminuye el riesgo de compromiso del canal, pero se aumenta el riesgo en caso de compromiso del sistema de autentificación.</li>
<li><strong>Envío inmediato:</strong>
<p>Esto ofrece una reducción en la posibilidad de que un agente externo pueda manipular el estado del sistema de autentificación (al ser un sistema store-and-forward, el estado se reduce al mínimo), invalidando la votación. A su vez, hace que un agente externo pueda invalidar la votación con tan sólo manipular el canal de comunicaciones mediante la eliminación selectiva de mensajes. Se disminuye el riesgo de compromiso del estado del sistema de autentificación, pero se aumenta el riesgo en caso de compromiso del canal de comunicaciones.</li>
</ul>
<p>Particularmente, creo que la segunda opción es la más aconsejable: es más sencillo delegar la seguridad del canal de comunicaciones a protocolos como IPSec y la correcta secuenciación de mensajes a TCP que implementar la seguridad en el propio protocolo de voto electrónico.</p>
<h2>Autentificación del votante y anonimato del voto</h2>
<p>La seguridad del sistema estriba en que el sistema de recuento desconoce la identidad del usuario que emitió el voto V (ID<sub>V</sub>), y a la vez que se asegura la autenticidad de éste al ser cada voto anónimo autentificado por el sistema de autentificación. A su vez, el sistema de autentificación sólo tiene acceso a la identidad del usuario que emitió el voto V (ID<sub>V</sub>), pero no al contenido de su voto.<br />
La seguridad del sistema depende en la relación de confianza del sistema de recuento sobre el sistema de autentificación, así como la capacidad del sistema de autentificación para validar la identidad ID<sub>V</sub> del votante correctamente, y la capacidad del sistema de recuento para almacenar el recuento de votos de manera que no se pueda manipular maliciosamente.</p>
<p>El modelo descrito sólo es capaz de detectar si el contenido de un voto es inválido en el sistema de recuento. Llegado a este punto, y dado que este sistema no tiene acceso a la identidad del votante, lo único que puede hacer es marcar el voto como inválido. El modelo descrito permite, por lo tanto:</p>
<ul>
<li>Voto válido</li>
<li>Voto en blanco</li>
<li>Voto inválido</li>
</ul>
<p>Será necesario determinar si estas características son deseables a la hora de aplicar el modelo aquí descrito.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/11/sistema-simple-de-voto-electronico/feed/</wfw:commentRss>
		</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>
		</item>
		<item>
		<title>Playing with Mac OS X 10.5 Leopard local directory service, II</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/10/playing-with-mac-os-x-105-leopard-local-directory-service-ii/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/10/playing-with-mac-os-x-105-leopard-local-directory-service-ii/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 19:49:52 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/10/playing-with-mac-os-x-105-leopard-local-directory-service-ii/</guid>
		<description><![CDATA[After experimenting with local files for Mac OS X 10.5 Leopard Directory Service, I read a hint on MacOSXHints name Manage users and groups using a GUI tool.
What this tip describes, basically, is that you can use Mac OS X Server Administration Tools to connect locally to the Directory Service running on Mac OS X [...]]]></description>
			<content:encoded><![CDATA[<p>After experimenting with local files for Mac OS X 10.5 Leopard Directory Service, I read a hint on <a href="http://www.macosxhints.com">MacOSXHints</a> name <a href="http://www.macosxhints.com/article.php?story=20071029181159291">Manage users and groups using a GUI tool</a>.</p>
<p>What this tip describes, basically, is that you can use <a href="http://www.apple.com/downloads/macosx/apple/macosx_updates/serveradmintools105.html">Mac OS X Server Administration Tools</a> to connect locally to the Directory Service running on Mac OS X Leopard. Just start Workgroup Manager, and authenticate to host <code>localhost</code> with the credentials of any user with administrative rights. Using Workgroup Manager it is possible to create and manage users and groups, but more important is that changes take effect immediately, without having to kill <code>/usr/sbin/DirectoryService</code>, rebooting or having to log out. Very nice!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/10/playing-with-mac-os-x-105-leopard-local-directory-service-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Playing with Mac OS X 10.5 Leopard local directory service</title>
		<link>http://www.felipe-alfaro.org/blog/2007/11/06/playing-with-mac-os-x-105-leopard-local-directory-service/</link>
		<comments>http://www.felipe-alfaro.org/blog/2007/11/06/playing-with-mac-os-x-105-leopard-local-directory-service/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 23:14:08 +0000</pubDate>
		<dc:creator>Felipe Alfaro Solana</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://felipe-alfaro.org/blog/2007/11/06/playing-with-mac-os-x-105-leopard-local-directory-service/</guid>
		<description><![CDATA[New with Mac OS X 10.5 is the replacement of the old NetInfo architecture. The new component, Directory Services, is a highly configurable service that can use many back-ends to store, retrieve and abstract concepts like users, groups, machines or mount points.
Directory Services sports LDAP, Active Directory and Open Directory support, and also local files. [...]]]></description>
			<content:encoded><![CDATA[<p>New with Mac OS X 10.5 is the replacement of the old NetInfo architecture. The new component, Directory Services, is a highly configurable service that can use many back-ends to store, retrieve and abstract concepts like users, groups, machines or mount points.</p>
<p>Directory Services sports LDAP, Active Directory and Open Directory support, and also local files. Local files seem to be stored directly in the root volume, in the <code>/var/db/dslocal/nodes/Default/</code> directory. Within this subdirectory, we can found others that create a tree-like, hierarchical structure:</p>
<ul>
<li><code>aliases/</code>. Contains a one pList for every account alias that is registered in the Local directory service. There are some built-in aliases, plus additional aliases that can be created from the Accounts preference pane.</li>
<li><code>config/</code>. Contains several configuration files for components like Kerberos KDC (in a pretty funny format, that basically looks like XML-syntax wrapper that contains the traditional kdc.conf text-based configuration file as a string), Share points and so on.</li>
<li><code>groups/</code>. Contains one pList file for every known local group. The format is pretty straightforward and almost resembles the traditional UNIX <code>/etc/group</code> file, but expressed using XML.</li>
<li><code>machines/</code>. Contains one pList file for every known machine. It seems to me this is the equivalent of the <code>/etc/hosts</code> UNIX file where each machine entry is stored in as a single pList file. For a default Mac OS X installation, you will find a localhost.plist and a broadcasthost.plist entry.</li>
<li><code>mounts/</code>. Contains one pList for every automount point. By default, there are no automount points defined, and they can be created using the Directory Utility application, <code>dscl</code> or by manually creating or changing pList files.</li>
<li><code>networks/</code>. Contains one pList file for every known network. This seems like the equivalent of <code>/etc/ethers</code> in UNIX systems. By default, only a single pList file exists: loopback.plist, which lists 127.0.0.0/8 as a known network.</li>
<li><code>users/</code>. Contains one pList file for every known local user. This is the equivalent of <code>/etc/passwd</code> in any UNIX system. As in modern UNIX systems, the password is stored somewhere else (does anybody know where?).</li>
</ul>
<p>By tweaking these files and restarting the Directory Service, it is possible to emulate the behavior of a UNIX-like system, with the difference that access to these entities is mediated by a service, as is not exposed via a POSIX API that, when configured to use local files, parses the contents of local files. In Mac OS X, it is necessary to notify the Directory Service when the contents of any of the pList files changes.</p>
<p>Another way of editing some of these components without having to use <code>dscl</code> or editing pList files by hand is by right-clicking a user or a group in the Accounts preference pane, then choosing <code>Advanced Options ...</code> from the menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.felipe-alfaro.org/blog/2007/11/06/playing-with-mac-os-x-105-leopard-local-directory-service/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
