<?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>Gustavo F. Padovan &#187; dnscurve</title>
	<atom:link href="http://padovan.org/blog/tag/dnscurve/feed/" rel="self" type="application/rss+xml" />
	<link>http://padovan.org/blog</link>
	<description>a hacking life</description>
	<lastBuildDate>Fri, 23 Jul 2010 22:30:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Arena de Programação do FISL 10</title>
		<link>http://padovan.org/blog/2009/07/arena-de-programacao-do-fisl-10/</link>
		<comments>http://padovan.org/blog/2009/07/arena-de-programacao-do-fisl-10/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 04:15:41 +0000</pubDate>
		<dc:creator>padovan</dc:creator>
				<category><![CDATA[free software]]></category>
		<category><![CDATA[dnscurve]]></category>
		<category><![CDATA[fisl]]></category>
		<category><![CDATA[gpsl]]></category>
		<category><![CDATA[pt_BR]]></category>

		<guid isPermaLink="false">http://padovan.org/blog/?p=38</guid>
		<description><![CDATA[Durante a décima edição do Fórum Internacional do Software Livre [0] em Porto Alegre &#8211; RS, Brasil participei da Arena de Programação do evento. O desafio desse ano foi implementar um servidor e um cache DNS que suportasse o DNSCurve[1], protocolo de criptografia para DNS criado por Daniel J. Bernstein[2], também criador do djbdns[3]. O [...]]]></description>
			<content:encoded><![CDATA[<p>Durante a décima edição do <a title="FISL 10" href="http://fisl.softwarelivre.org/" target="_blank">Fórum Internacional do Software Livre</a> [0] em Porto Alegre &#8211; RS, Brasil participei da Arena de Programação do evento. O desafio desse ano foi implementar um servidor e um cache DNS que suportasse o <a href="http://dnscurve.org">DNSCurve</a>[1], protocolo de criptografia para DNS criado por <a title="Daniel J. Bernstein" href="http://cr.yp.to/djb.html" target="_blank">Daniel J. Bernstein</a>[2], também criador do <a title="djbdns" href="http://cr.yp.to/djbdns.html" target="_blank">djbdns</a>[3]. O desafio foi proposto e julgado pelo djb.</p>
<p>A arena durou 3 dias. Às 22 horas do terceiro dia deveríamos entregar o servidor e o cache com DNSCurve para o Daniel. Meu grupo era formado por mim, pelo <a href="http://jprvita.wordpress.com" target="_blank">João Paulo Rechi Vita</a>[4], que também é aluno aqui da Unicamp e assim como eu, está no <a href="http://code.google.com/soc/" target="_blank">Google Summer of Code</a> pelo projeto <a href="http://www.bluez.org">BlueZ</a>. E por Rodrigo Exterckötter Tjäder, aluno de Ciência da Computação da UFSM &#8211; Universidade Federal de Santa Maria.</p>
<p>Ficamos sabendo o que teríamos que fazer apenas no início do primeiro dia, então passamos as primeiras horas descobrindo do que se tratava o DNSCurve (principalmente eu, que não estudei Redes formalmente na Unicamp ainda). Após entendermos o DNSCurve fomos atrás de implementações de DNS para tomarmos como ponto de partida para nossa implementação. Partimos preferencialmente para implementações em python, pois seria bem mais rápido e tranquilo desenvolver.</p>
<p>Rechi Vita encontrou uma implementação de servidor DNS em python, chamada <a href="http://sourceforge.net/projects/pymds/" target="_blank">pymds</a>[5] e uma implementação de cache chamada <a title="PyDNSCache" href="http://www.rbgrn.net/projects" target="_blank">PyDNSCache</a>[6]. Ambas as implementações são extremamente pequenas, o que facilitou o nosso entendimento e a expansão desses códigos para suportar o DNSCurve.</p>
<p>Para a parte cripotográfica do DNSCurve usamos a <a href="http://github.com/mrd/dnscurve/tree/master" target="_blank">slownacl</a>[7] biblioteca que implementa a todo calculo criptográfico do DNSCurve. Acompanhavam a slowsalt pequenas bibliotecas para manipulação pacotes DNS, isto é, funções prontas pra descriptografar e criptografar pacotes DNS que são enviados e recebidos pelos servidor e cache.</p>
<p>Passamos os dois primeiros dias integrando esses 3 códigos: pymds, PyDNSCache e slownacl. No final do segundo dia tinhamos um servidor e um cache funcionando para o envio e recebimento de pacotes. Mas esse cache nao resolvia nomes recursivamente e como ia dar muito trabalho implementar isso no nosso cache, resolvemos abandoná-lo e partir para uma nova implementação de cache usando a biblioteca <a title="DNS Python" href="http://www.dnspython.org/" target="_blank">dnspython</a>[8]. Com esse novo código foi possível fazer o cache resolver nomes recursivamente e consequentemente conseguir pegar a chave pública do servidor DNS.</p>
<p>O Resultado desses três dias de maratona foi recompesado com a vitória. Nossa solução foi eleita a melhor e recebemos um celular G1 rodando Android cada e muitos elogios do djb sobre o nosso código. =)</p>
<p>Nosso código está <a href="http://www.las.ic.unicamp.br/~joaopaulo/arena/" target="_blank">aqui</a>[9] e abaixo coloco a descrição sobre a implementação que enviamos ao Daniel junto com nosso código:</p>
<p>We implemented the two proposed parts separately.</p>
<p>(1) DNS Server &#8212; pymdscurve.tar.bz2</p>
<p>We based our implementation on pymds [5], a modular python DNS server<br />
licensed under the MIT license. It&#8217;s a standalone DNS server, in terms<br />
it doesn&#8217;t resolve any names it doesn&#8217;t know. For the NaCl functions,<br />
we used the slownacl lib from dnscurve [1]. Despite it doesn&#8217;t says on<br />
the website, we contacted the authors (both Matthew and Angel) and<br />
both of them told us the is public domain and a note on the project<br />
page is missing. Matthew even added a README to the code which says<br />
it&#8217;s public domain and updated some code on the lib to make it<br />
compliant with NaCl spec (article on your website).</p>
<p>(2) DNS Cache</p>
<p>For the cache we tried two different approaches.</p>
<p>(i) PyDNSCacheCurve.tar.bz2 &#8212; First we added the DNSCurve messages to<br />
PyDNSCache [6], which is a very simple DNS cache written in python and<br />
intended to be used as a python library. This code didn&#8217;t had any<br />
license note on the project page either, but we contacted the author<br />
and he licensed it under Creative Commons Attribution 3.0 United<br />
States License. Since it&#8217;s just a cache of DNS information, it used<br />
gethostbyname() from the socket module. We changed it to use a<br />
function we implemented, gethostfromDNS(), to send the necessary DNS<br />
messages to get the information from a server. For the cryptography<br />
part we&#8217;ve also used slownacl from dnscurve [1]. We didn&#8217;t implemented<br />
the ability to resolve names recursively on PyDNSCache, so we<br />
hardcoded the server public key inside the code.</p>
<p>(ii) dnspythoncurve.tar.bz2 &#8212; Since solution (i) was unable to<br />
resolve names recursively, we decided to use dnspython [8], which<br />
provides a lot of helper functions to deal with DNS. We&#8217;ve added<br />
DNSCurve extensions to it and also added a recursive resolver.<br />
dnspython [4] is released under a BSD-style license. Since recursive<br />
resolution works we can get the server name to check if it a DNSCurve<br />
enabled server and, if so, obtain it&#8217;s public key.</p>
<p>We&#8217;ve tested pymdscurve and dnspythoncurve under a scenery with two<br />
servers, one configured as authority for .com and other as authority<br />
for example.com, in order to test recursive resolution. Both config<br />
files are shipped in pymdscurve package.</p>
<p>We plan to send patches back to all projects we&#8217;ve added code to. We<br />
have also added some code to some dns helper functions on dnscurve<br />
[1], outside of slownacl</p>
<p>[0] <a href="http://fisl.softwarelivre.org/" target="_blank">http://fisl.softwarelivre.org</a><br />
[1] <a href="http://dnscurve.org" target="_blank">http://dnscurve.org</a><br />
[2] <a href="http://cr.yp.to/djb.html" target="_blank">http://cr.yp.to/djb.html</a><br />
[3] <a href="http://cr.yp.to/djbdns.html" target="_blank">http://cr.yp.to/djbdns.html</a><br />
[4] <a href="http://jprvita.wordpress.com" target="_blank">http://jprvita.wordpress.com</a><br />
[5] <a href="http://sourceforge.net/projects/pymds/" target="_blank">http://sourceforge.net/projects/pymds/</a><br />
[6] <a href="http://www.rbgrn.net/projects" target="_blank">http://www.rbgrn.net/projects</a><br />
[7] <a href="http://github.com/mrd/dnscurve/tree/master" target="_blank">http://github.com/mrd/dnscurve/tree/master</a><br />
[8] <a href="http://www.dnspython.org/" target="_blank">http://www.dnspython.org/</a><br />
[9] <a href="http://www.las.ic.unicamp.br/~joaopaulo/arena/" target="_blank">http://www.las.ic.unicamp.br/~joaopaulo/arena/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://padovan.org/blog/2009/07/arena-de-programacao-do-fisl-10/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
