Archive for April, 2005

SNI Support in Mozilla

Friday, April 29th, 2005

There is now a patch to support Server Name Indication in Mozilla!

Coal isn’t a Fossil Fuel?

Thursday, April 28th, 2005

So, I really try to avoid most political issues.. but Seriously, this is wrong.

Quote from http://www.whitehouse.gov/news/releases/2005/04/20050427-3.html :
….
We need to get on a path away from the fossil fuel economy.
….

And Later…

Quote from http://www.whitehouse.gov/news/releases/2005/04/20050427-3.html :
….
I have asked Congress for more than $2 billion over 10 years for my coal research initiative.
…..

Last time I checked, COAL is a fossil fuel.

TLS Server Name Indication.

Sunday, April 24th, 2005

I have TLS 1.1 Server Name Indication working in mod_gnutls.

What is Server Name Indication?
When a client connects to a server using SSL, the server will send the Public Certificate to them. This enables them to actually decrypt the data sent from the server later. Here is a short simplified example:

1. C: (TLS Handshake) Hello, I support XYZ Encryption.
2. S: (TLS Handshake) Hi There, Here is my Public Certificate, and lets use this encryption algorithm.
3. C: (TLS Handshake) Sounds good to me.
4. C: (Encrypted) HTTP Request
5. S: (Encrypted) HTTP Reply

The problem in HTTP is we don’t know which Public Certificate to send, until step 4. This is long after the public certificate has been sent. Protocols such as IMAP and SMTP, which use STARTTLS, have a different pattern:

1. C: (Cleartext) I am using server 'mail.example.com'
2. S: (Cleartext) By The Way, I also support TLS Encryptionn.
3. C: (Cleartext) Lets use Encryption, aka 'STARTTLS'.
4. C: (TLS Handshake) Hello, I support XYZ Encryption.
5. S: (TLS Handshake) Hi There, Here is my Public Certificate, and lets use this encryption algorithm.
6. C: (TLS Handshake) Sounds good to me.
7. C & S: (Encrypted) Exchange Data

Since the client tells the server which host it is connecting to in step 1, the server can pick the correct certificate in step 5. It is possible to do this in HTTP, using TLS Upgrade. This is slightly more complicated, and presents other security issues. The Server Name Indication approach has a much simplier setup:

1. C: (TLS Handshake) Hello, I support XYZ Encryption, and I am trying to connect to 'site.example.com'.
2. S: (TLS Handshake) Hi There, Here is my Public Certificate, and lets use this encryption algorithm.
3. C: (TLS Handshake) Sounds good to me.
4. C: (Encrypted) HTTP Request
5. S: (Encrypted) HTTP Reply

The only difference is a few extra bytes sent in Step 1. The client passes along which hostname it wants, and the server now has a clue which public certificate to send.

Currently, the only browser with SNI support is Opera 8.0. What Server Name Indication (SNI) has the potential to bring, is cheap encryption. A Self Signed Certificate might be free, but it does not mean they can easily be used. Other protocols like IMAP use STARTTLS to decide which server to connect to first, and then to start the TLS Connection. Traditionally, HTTP has required one IP address for every SSL Host. For some people, IP Addresses are cheap, but for many, they are not. SNI Breaks this last barrier, and allows a single IP Address to host hundreds of SSL Websites.

I have setup a demo server at sni.corelands.com. If you visit https://one.sni.corelands.com/ with Opera, you will not get an SSL Hostname Mismatch. If you use any other browser, you will.

Browser Detection.. is bad.

Saturday, April 16th, 2005

UMO uses browser detection to try to determine which version of some extensions you want to download. For example, the Enigmail Extension, you need a version for every OS, including Windows, Linux and OS X. Look at the Enigmail Page.

Well, I see a download for Windows, but I am using OS X. When you visit it, you might see it for Linux, or OS X — its hard to tell, since the page is cached with a Squid frontend, you get the download link for whatever OS viewed the page before you.

The solution is to add a Vary: User-Agent HTTTP header, to make the cache use a different version of the Cache for every User Agent — and therefore show the correct download link. The bad news is that Squid doesn’t support the Vary header. I geuss the only option is Apache 2.1.

GPL Libraries suck

Sunday, April 10th, 2005

I am fed up with people creating LIBRARIES and then licening them under the GPL. Please use the LGPL. Thanks.

Todays disapointment was in regards to the Xapian search engine library.

I am still trying to find a full text search library to embed with mod_mbox — Lucene4c isn’t ‘there’ yet.

It is just frustrating to be working on an open source project, and be unable to use what looks like a cool open source library.

Forcing a Kernel Panic

Saturday, April 9th, 2005

Ever Wondered how to panic a Linux Kernel? It is really easy. Here is your source code:

Quote from panic.c:
#define __NO_VERSION__
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>

int init_module(void)
{
    panic(" insert lame excuse here");
    return 0;
}

Then compile it with gcc -I/usr/src/linux/include -D__KERNEL__ -DMODULE -o panic.o -c panic.c.
Now just run insmod panic.o.

Okay, So I was a little bored tonight.

TCP_CORK is good for your server

Thursday, April 7th, 2005

Christopher Baus has a great article on TCP_CORK.


Hopefully this weekend I can do some tcpdump action on apache, and look at how much packet fragmentation there is, since Apache does not use TCP_CORK, but instead it only uses TCP_NODELAY, which can result in non-optimal conditions if you do many small write()s.

The long road of development….

Wednesday, April 6th, 2005

I released mod_gnutls today. I started hacking on the idea in August 2004, more than 7 months ago. This is the longest any of my open source modules have been under development without a release.

mod_gnutls is an alternative to mod_ssl. mod_ssl is a giant beast of a module — no offense to it’s authors is intended — but I believe it has fallen prey to massive feature bloat.

When I started hacking on httpd, mod_ssl remained a great mystery to me, and when I actually looked at it, I ran away. The shear ammount code is depressing, and it does not conform to the style guidelines. It was painful to read, and even harder to debug. I wanted to understand how it worked, and I had recently heard about GnuTLS, so long story short, I decided to write mod_gnutls.

Lines of Code in mod_ssl: 15,324
Lines of Code in mod_gnutls: 1,886

One of the unique features is support for a distributed SSL Session Cache using memcached. If anyone has a cluster of HTTPS servers, and would like a performance boost, I would love some test results.

Right now its not quite a viable alternative to mod_ssl — it mostly needs testing and some serious code reviews. I plan to add full support for SSL Client Certificates in the next version.

I am pretty sure I will release a 0.1.1 in the next week that can compile on the 2.0.x branch. There are a few function renames that force the current 0.1.0 release to require the 2.1.x-dev branch.

It only took 7 months of hacking, but I am happy with the results so far. mod_gnutls forced me to truely learn about input and output filters like never before. The best way to really understand something is to write it from scratch — and the result is that I now understand mod_ssl and GnuTLS better than before.