By Zed A. Shaw

Mongrel2 v1.7: SSL, Config-From-Anything, Filters, Reloading

This is just a quick blog post announcing a fresh release of Mongrel2 v1.7 that has support for:

  • SSL with a nice configuration system.
  • Config-From-Anything foundations laid and mostly working.
  • Much better reloading support.
  • Lots of bug fixes all around.
  • The beginning of the Filters feature.

You can grab this release at http://mongrel2.org/static/downloads/mongrel2-1.7.tar.bz2 and it has the MD5 3f7ec3fa4cf10d71e6a1ef34b60a8106 just in case.

WARNING: This release is after quite a few upheavals to the project, namely switching to github, problems with griefers on github, major refactoring internally, and other changes, so be warned that it might be as solid as past releases.

SSL Support

I've still got to document this, but Alex Gartrell worked on this feature based on a bounty from a contributor to the project to get it done. It's working now, and how you use it is:

Change your Server to have:

  Server(use_ssl = 1, port=443)

Then add this to your settings:

  settings = {
    "certdir": "certs/",
    "ssl_ciphers": "SSL_RSA_AES_256_SHA SSL_EDH_RSA_AES_256_SHA" 
  }

Or just don't include ssl_ciphers. Next you want to make a UUID.crt and UUID.key file with UUID being the one for that server and put them in the certs/ dir in your chroot, here's mine:

  $ ls certs/
  2f62bd5-9e59-49cd-993c-3b6013c28f05.crt
  2f62bd5-9e59-49cd-993c-3b6013c28f05.key

After that start that server and you've got SSL. I'll leave it to you to figure out how to get openssl to make these cert keys.

Config-From-Anything

In the process of trying to fix reloading once and for all, I just dove in and completely refactored how configurations work, and got the basis of the Config-From-Anything feature working. The gist of the feature is that, because Mongrel2 uses a consistent normalized data model for its configuration, then it should be able to load it from anything that returns the same data model.

Well, now it can. You can now create a module that Mongrel2 will load and use for callbacks that it configures itself from. There's only a simple null.so module right now, for unit testing, but I've got some basic documentation so people can start hacking on this.

I wouldn't totally trust it yet, but I wanted to release it so that anyone who's interested in working on this kind of module can start playing with it and help define the feature better.

There's also a place-holder for a zmq.so which will eventually let Mongrel2 load from any ZeroMQ service that follows this protocol. It's most likely that people will end up just using that unless they're totally devoted to doing without ZeroMQ.

Filters

I also got the guts of loadable filters ready for people to play with and look at, but no way to configure them yet. I decided to go ahead and release these too so people who are interested can check them out and help define what they will do. The short pitch for filters is that they are loadable .so modules that Mongrel2 will inject into its connection state machine runs. This means you can implement things like mod_gzip, authentication, embed programming languages, etc. and it has a very simple programming model.

For those people interested in this, look at tools/filters. When I figure out how to configure them then we'll be ready to start making filters.

Reloading

As usual, we're trying to get reloading very tight because one of the big users is using it to do an on-the-fly hosted game platform. With this release the reloading is pretty great compared to before. There's still some spots that need tightening and a couple of memory leaks, but other than that it's working much more reliably.

What's Up For v1.8

The big stuff in the works for 1.8 are:

  • Client side chunked-encoding with git as the test client. The goal is to get whatever stupid crap git+libcurl does to work so that people can write handlers that work with git's idiotic traffic pattern.
  • A working ZeroMQ configuration connector so you can point Mongrel2 at a zmq server and configure it on the fly.
  • Improved docs and usability on the SSL, plus a full security audit.
  • Cleanup of m2sh so that it may work with the new config-from-anything better.
  • More documentation all around on writing handlers.
  • A new website now that we've moved to github.

If you run into bugs, just go ahead and put them in the github mongrel2 issues