PREV Remailer Quick Start UP Remailer Support NEXT Response Blocks

3.3: Remailer Chains

mc-write-mode binds the function mc-remailer-encrypt-for-chain to the key C-c / r. This function rewrites the message for a remailer or chain. The resulting buffer is just a new Email message, so it can itself be rewritten for another remailer; this is one way to manually construct a remailer chain.

Mailcrypt also has powerful facilities for defining automatic chains. We will start with an example. Suppose you have put the following into your `.emacs' file:

(setq mc-remailer-user-chains
      '(("Foo" "alumni" "robo")
        ("Bar" (shuffle-vector ["replay" "flame" "spook"]))
        ("Baz" "Foo" "Bar" "rahul" "Bar")
        ("Quux" 4)))

This code defines four chains. The first is named "Foo" and consists of "alumni" and "robo", in that order. The second is named "Bar" and consists of "replay", "flame", and "spook" in some random order (a different order will be chosen each time the chain is used). The third is named "Baz" and consists of 9 remailers: The two from "Foo", followed by a permutation of the three from "Bar", followed by "rahul", followed by another permutation of the three from "Bar". Finally, the fourth is named "Quux" and consists of a random permutation of the four best remailers as ordered in the `~/.remailers' file.

Now whenever you are prompted for a "remailer or chain", the chains "Foo", "Bar", "Baz", and "Quux" will be available, including TAB completion on their names. By capitalizing their names, you guarantee they will show up near the top of the completion list if you type TAB on an empty input.

Now for the gritty details. mc-remailer-user-chains is a list of chain definitions. A chain definition is a list whose first element is the name (a string) and whose remaining elements form a remailer list. Each element of a remailer list is one of the following:

  1. A raw remailer structure. This is the base case, but you will probably never want nor need to deal with these directly.
  2. A string naming another remailer chain to be spliced in at this point.
  3. A positive integer N representing a chain to be spliced in at this point and consisting of a random permutation of the top N remailers as ordered in the `~/.remailers' file.
  4. An arbitrary Emacs Lisp form, which should return another remailer list which will be spliced in at this point and recursively evaluated. Mmmm, Lisp.

So, in the example "Bar" above, shuffle-vector is actually a Lisp primitive which returns a random permutation of the argument vector. (Which brings up a side note: A remailer list can be a vector instead of a list if you like.)

So where do the definitions for "replay" etc. come from?

There is another variable, mc-remailer-internal-chains, which has the same format as mc-remailer-user-chains. In fact, the concatenation of the two is always used internally when resolving chains by name. The "internal chains" are normally generated automatically from a Levien-format remailer list, which lives in `~/.remailers' by default and is parsed at startup time. The parser creates several chains, each containing a single remailer, and names each chain after the respective remailer.

Thus "replay" (for example) is actually the name of a chain whose single element is the remailer at <remailer@replay.com>. So "replay" is a valid name of a chain to include in the definition of another chain, as was done above in the definition of "Bar".

PREV Remailer Quick Start UP Remailer Support NEXT Response Blocks