Teapop

From LQWiki
Jump to navigation Jump to search

Teapop is a POP3 server designed for virtual hosting. It allows separate configurations for different domains, and can look up authentication and mailbox info from databases. It supports mbox and maildir formats, and both PostgreSQL and MySQL.

Documentation for teapop is somewhat poor, but it is quite flexible.

Using Teapop with MySQL

To use Teapop with MySQL, you need to create a database table that Teapop can use to retrieve each user's password and the location of their mailbox. The table must contain at least a column with the user's name (the name can be specified in the teapop configuration file) and a column called "active" which must contain the value "1" for users that are allowed to login.

Then, in /etc/teapop/teapop.passwd, add a line like the following:

<domain>:*:mysql:<dir>:<hash>:<uid>:<gid>:<host>:<port>:<dbname>:<dbuser>:<dbpass>:<dbtable>:<usercol>:<pass>:<box>:

These fields are as follows:

domain
the domain name used by the user when logging in, or "empty" if the user doesn't use a domain name
dir
the directory within which mailboxes can be found
hash
the type of password returned by the database query: either 'plain' for plaintext passwords or 'md5' for md5 hashed passwords
uid,gid
the user and group used by the server to access the mailbox
host
database hostname
port
database port (may be left blank to use defaults)
dbname
name of database to user
dbuser,dbpass
username and password for authentication to database server
dbtable
table in the database to query
usercol
name of the column in the database table that contains the user's username (without the domain name part, if any is supplied)
pass
SQL expression that returns the user's password
box
SQL expression that returns the name of the user's mailbox within the "dir" directory. If the mailbox is in maildir format, must end with a '/'. Note that as this may be an expression, the '/' may be added automatically, e.g. by using concat(username,'/').