Auto-install

tmda-cgi is now capable of autoinstalling TMDA on user accounts.

TMDA must already be installed on the server.

This feature does not install TMDA, but configures an already existing e-mail account so it will work with TMDA.

To use this feature, the user need only log in to tmda-cgi (program or remote authentication is strongly recommended if you wish to use auto-install) and click "Sign up." However, the system administrator will need to verify how the installation will be done beforehand!

skel
anomalies
   PERMISSIONS
   VIRTUAL_TEST
   REAL_ONLY
   VIRTUAL_ONLY
   PARENT_RE

skel

Before allowing users to auto-install or auto-uninstall, carefully check over each file in the skel/install directory. These files will be copied to the user's directory upon installation.

Important note: The skel directories included with tmda-cgi were designed for servers running qmail. If you use a different mail server package, do not use the files as-is! You should look through these files and see how they work, but you will need to create a totally different set of skel files.

skel files allow for variable substitution. All of the following text strings, if found in the file or filename, will be replaced with the following:

%(Base)s The path to TMDA's root directory.
%(CryptKey)s A new valid, random, cryptographic key.
%(Domain)s Best guess of the user's domain.
%(Home)s The path to the user's home directory.
%(Name)s A quoted string or None, depending on whether user's real name is available.
%(Parent)s The constant string "..".
%(qUser)s Same as %(qUser)s below, except that any "." characters have been replaced with ":" characters. .qmail files require user names to be renamed in this fashion.
%(RealHome)s The home directory for the real user in use. If a real user is logging in, then this is their home directory. If a virtual user is logging in, then this is typically /home/vpopmail.
%(ShortUrlDom)s The domain name portion of the URL the user surfed up, without any "www.", if present.
Also see %(UrlDomain)s, below.
%(UrlDomain)s The domain name portion of the URL the user surfed up.
Also see %(ShortUrlDom)s, above.
%(User)s The user's login name, or the left-most portion (before the "@") of the user's e-mail address in the case of virtual users.
%(VirtUser)d 1 if the user is a virtual user, 0 if the user is real.
%(VPop)s The path to the virtual user's home directory (for example: /home/vpopmail).
%(VPopBin)s The path to the virtual user's bin directory (for example: /home/vpopmail/bin).

If you need to put a "%" in one of the skel files, you will have to type "%%" instead. This will prevent errors during the install process.

In addition to a skel/install directory, there is also a skel/uninstall directory. If you have any files which should be installed after the uninstall process is complete, you may place skeletons for them files here. For example, qmail users should add a .qmail-default file after uninstallation so that any future mail that comes in for a tagged address will still be accepted.

anomalies

skel directories may optionally have a file called anomalies. This file contains Python code which tells the installer/uninstaller what it should do beyond simply copying the files to the user's directory.

anomalies supports the following variables:

PERMISSIONS

A dictionary of filenames and what octal permissions should be assigned to them.

Install example:
PERMISSIONS = {".tmda/crypt_key": 0600}

VIRTUAL_TEST

A regular expression test which can be applied to a user's HOME directory. If the test matches, then the user is assumed to be a virtual user.

Example:
VIRTUAL_TEST = "^" + VPop

REAL_ONLY

A list of files or a dictionary of lists which should only be copied if the user logging in is "real" (i.e. VIRTUAL_TEST did not match the user's HOME directory).

The optional dictionary structure of this configuration variable allows you to specify different files based on the mail program (see MAIL_TRANSFER_AGENT) you're using. You can only have one mail program installed, of course, so if you are creating this skel directory by hand, feel free to simply use a list.

Install example:
REAL_ONLY = {"qmail": [".qmail", ".qmail-default"]}

Uninstall example:
REAL_ONLY = {"qmail": [".qmail-default"]}

VIRTUAL_ONLY

VIRTUAL_ONLY is the compliment to REAL_ONLY, above. These files should only be copied if the user logging in is a virtual user (i.e. VIRTUAL_TEST matched the user's HOME directory).

Install example:
VIRTUAL_ONLY = {"qmail": ["%(Parent)s/.qmail-%(User)s",
  "%(Parent)s/.qmail-%(User)s-default"]}

Uninstall example:
VIRTUAL_ONLY = {"qmail": ["%(Parent)s/.qmail-%(User)s-default"]}

PARENT_RE

PARENT_RE is a regular expression which tests if we are in the user's "parent" directory. Finding the parent directory is not as simple as doing a ".." because virtual user systems with many users may stack the domain multiple layers down. By using this test we can tell when we have removed enough directories.

Example:
PARENT_RE = "^" + VPop + "/domains/[^/]+\.[^/]+$"