## CVM

# The cvm-qmail Module

## Synopsis:

qmail configuration lookup module

## Credentials:

None, only operates as a lookup module.

## Description:

This module uses the standard qmail configuration files to determine if an address is valid, using the same lookups that qmail would. It first checks `control/locals` and then `control/virtualdomains` to determine if the domain is valid, and to determine the prefix to add to virtual domain usernames. If the domain is not found, it fails with OUTOFSCOPE set to true. It then looks up the resulting username in `users/cdb` (or the system password table if the CDB does not exist) to determine the correct home directory. If the address would require a `.qmail-something` file, it ensures that that file exists as well, doing `-default` checks as necessary. If the address is not deliverable based on these checks, it fails with OUTOFSCOPE set to false.

## Configuration Variables:

`$CVM_QMAIL_ASSUME_LOCAL` (optional)
  If set, all domains not found in `control/virtualdomains` are assumed to be local domains.
`$CVM_QMAIL_CHECK_PERMS` (optional)
  If set, the CVM will check that the `.qmail` file is accessible by temporarily switching to the target user ID. If `$CVM_QMAIL_CHECK_PERMS` starts with a "`-`" and the lookup fails because access was denied, then the lookup is rejected with a permanent error, otherwise a temporary I/O error is returned.
`$CVM_QMAIL_LOOKASIDE` (optional)
  This variable contains a list of program names, separated by spaces. If one of these program names is found as a program delivery in the `.qmail` file, cvm-qmail will fail the lookup with OUTOFSCOPE set to true. This is useful for chaining lookups to cvm-vmailmgr or other modules that correspond to programs that are executed from `.qmail-default` files.
`$CVM_QMAIL_MISSINGDOMAIN` (optional)
  If this is set and the domain name is not a local or virtual qmail domain, this domain name is substituted and the lookup succeeds. This allows for setups where domains listed in `control/rcpthosts` and `control/morercpthosts.cdb` (which are accepted by the SMTP receiver) are not listed as local or virtual domains. If this is set to an empty value, "`localhost`" is substituted. This has no effect if `$CVM_QMAIL_ASSUME_LOCAL` is set.
`$CVM_QMAIL_MISSINGUSER` (optional)
  When missing domain substitution is being done, the value of this variable is used to replace the username. The value must exist as a valid system user. Defaults to "`alias`" which will normally exist on all qmail systems.
`$QMAIL_ROOT` (optional)
  The root directory under which all the qmail configuration files are expected to be found. Defaults to "`/var/qmail`", which is the normal qmail install path.