Monkey Server v1.6

Basic Authentication

Monkey provides a basic authentication mechanism through the Auth plugin, this authentication method is described in the RFC2617.

In order to enable basic authentication (basic auth for short) in Monkey you must check that Auth plugin is part of your Monkey installation. If you installed Monkey from sources the plugin will be there.

The basic auth works is designed to work at Virtual Host level, so you are able to protect specific Virtual Hosts and apply different set of users for each one. Please refer to the following section about how to setup basic auth.

Enable Plugin

If the plugin have not been built in static mode (check with '$ monkey -b'), you can enable the Auth plugin through the following the steps mentioned on Plugins section. The plugin name is, so make sure the plugin entry is Load and the absolute path is correct.


Once the plugin is loaded you want to have a list of users who will access the Virtual Host. The Auth plugin distribute a tool named mk_passwd which allows to manage users in a static file. This tool is pretty similar to htpasswd from Apache but the format to store the users is different.

Create an initial users file with one user:

$ mk_passwd -c /etc/monkey/plugins/auth/  myuser mypassword

Now you will have a file containing the new user, the file content should looks like:

$ cat

You can add subsequent users with the same command but omitting the -c flag as this instruct mk_passwd to create a new file, e.g:

$ mk_passwd /etc/monkey/plugins/auth/  my_second_user some_password
$ cat

Edit your virtual host configuration file and specify the Auth rules, e.g: edit /etc/monkey/sites/default and append:

    Location /
    Title    "Let's protect our content..."
    Users    /etc/monkey/plugins/auth/

The Auth plugin is a handler, so we need also to register it into the HANDLER section as follows:

    Match  /.*  auth

When Monkey process the Handlers, it will match the regular expression rules for all requests, and then the Auth plugin will try to match a specific location through the [AUTH] section. A match through the Handler regular expression can have many locations.

Now restart Monkey and reload your web page, you will get the authentication box for the specific virtual host. If you add/delete users you will need to restart the service to make the changes take effect.