This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

XEXEC Plugin

XEXEC is an experimental non-standard extension to the IMAP protocol that allows you to run any server side application and have it communicate with email plugins (Thunderbird) allowing custom client/server applications to communicate over an existing authenticated IMAP channel. The email client sends the XEXEC command with the name of the server side module that it wishes to run along with parameters to pass to the server. Here are some examples:

XEXEC blacklist add joe@example.com
XEXEC whitelist del joe@example.com
XEXEC changepassword MyNewPassword
XEXEC forwardmail myaccount@yahoo.com

Uses for XEXEC

The XEXEC can be used to run anything but in theory it should be used for client server applications that relate to email or groupware applications like calendars and contact lists. Its main purpose is to allow email clients to set server side settings over the existing authenticated channel without having the user have to log in separately using a different application to control user settings. Examples of possible usage includes:

Wouldn't it be nice if you could change your email password in your email client and have it set the new password on the server at the same time? This would eliminate the need to change the server and client passwords separately. Or imagine sending outgoing email without having to configure SMTP. You just set up the incoming email and the outgoing email works as well. Or wouldn't you like to do some of the fancy tricks that Microsoft Exchange Servers do without having to use Exchange? It is our hope that this experimental protocol will lead to significant expansion of IMAP functionality.

About this Plugin

This plugin is the idea of Marc Perkel of Junk Email Filter who hired Nicolas Boullis ( nicolas.boullis@free.fr) to write the code. I (Marc Perkel marc@perkel.com) am trying to get the concept out there in some sort of working form with the idea that it will catch on. Hopefully other people who find this concept useful will build on the idea, do it right, and perhaps some variation of this concept will eventually become a standard.

Status

This plugin is a nonstandard experimental extension to the IMAP protocol. It is offered as a proof of concept and it is my hope that it will catch on in some form and make it into the IMAP officially. At this point there is nothing on the client side to talk to anything on the server side. So this code is presently useless until more development is done.

Configuration

To activate and configure this plugin you have to first add it to your dovecot.conf file. You can do so as follows:

protocol imap {
   mail_plugins = xexec
} 

Then to add applications you specify the module name and map it to a server side executable program.

 xexec = module:executable

Here are some examples:

plugin {
  xexec = blacklist:/usr/local/dovecot/blacklist.sh %u
  xexec2 = whitelist:/usr/local/dovecot/whitelist.sh %u
  xexec3 = average:/usr/local/dovecot/average
  xexec4 = smtp:/usr/local/dovecot/smtp
}

The idea is that the module name will be a reference to an executable and will hide what is happening on the server. When the command XEXEC module <parameters> is passed then the server will run the executable and pass the parameters to the executable.

Interacting with XEXEC

A typical session with XEXEC might look like this.

* OK Dovecot ready.
001 login marc@perkel.com password
001 OK Logged in.
002 xexec blacklist add joe@example.com
* OK Adding joe@example.com to server side blacklist for marc@perkel.com
002 OK command exited successfully
003 xexec changepassword MyNewPassword
* OK New Password set Sucessfully for marc@perkel.com
003 OK command exited successfully

As for the gory details:

(Stupid) example of a backend application with 2-way interaction:

function my_read () {
  printf '\05\n'
  read $1
}

echo 'Number of values?'
my_read count

sum=0

for i in `seq $count`; do
  echo "Value #${i}:"
  my_read val
  sum=`expr $sum + $val`
done

echo "Average: `expr $sum / $count`"

Download and Installation

For dovecot 1.0:

For dovecot 1.1:

Patch for v1.1 contributed by Stephan Bosch.

SMTP over IMAP

One of the purposes of developing XEXEC was to lead to SMTP over IMAP. The idea is rather than having a separate configuration for outgoing email that users would use the already authenticated IMAP session to transport outgoing email to an SMTP server which would accept it for outgoing delivery. Such a system would have several advantages.

SENDER (IMAP) -> DOVECOT (local) -> SMTP-OUT (SMTP) ---------> SMTP-IN -> RECIPIENT (IMAP)

IMAP would be a consumer to server protocol. SMTP would be a server to server protocol.

License

This software and the concepts behind is are free. No patent or copyrights are asserted on the concept. This is a gift to the world community. Code is released under GPL2.

Help Needed

We could use some help with this project. We haven't even started writing any client side code. We are looking for sharp people with good ideas to help develop this concept in a way that will eventually lead to becoming part of the standard. We envision that certain commands to do ordinary universal stuff (password, smtp, whit list, black list, forwarding) will become standardized so that features to set server side settings can become part of standard email applications.

None: Plugins/xexec (last edited 2009-06-02 12:49:35 by office01)