• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

doc_html/H03-May-2022-547532

man_html/H03-May-2022-

AUTHORSH A D28-Feb-2011446 1812

COPYINGH A D28-Feb-201114.8 KiB281237

FAQH A D28-Feb-201128.4 KiB752545

INSTALLH A D28-Feb-20117.9 KiB258188

READMEH A D28-Feb-201110.1 KiB227177

README.activedirectoryH A D28-Feb-2011497 148

README.authvchkpwH A D28-Feb-20111.5 KiB4134

README.filelockingH A D28-Feb-20111.2 KiB3123

README.ipaliasdomainsH A D28-Feb-20111.3 KiB3022

README.ldapH A D28-Feb-201121.5 KiB653468

README.maildropH A D28-Feb-20111.3 KiB3726

README.mysqlH A D28-Feb-201114.1 KiB396296

README.onchangeH A D03-May-20223 KiB8664

README.oracleH A D28-Feb-2011647 2413

README.pgsqlH A D28-Feb-20115.6 KiB184131

README.qmail-defaultH A D28-Feb-201135 31

README.quotasH A D28-Feb-20114.5 KiB10676

README.roamingusersH A D28-Feb-20116.3 KiB126101

README.spamassassinH A D28-Feb-20111.1 KiB3826

README.sybaseH A D28-Feb-2011467 127

README.vdelivermailH A D03-May-20223 KiB6843

README.vlimitsH A D28-Feb-20115.6 KiB134108

README.vpopmaildH A D03-May-202233 KiB1,095706

README.vqmaillocalH A D28-Feb-2011407 2010

TODOH A D28-Feb-201155 21

UPGRADEH A D28-Feb-20117.4 KiB212148

README

1Vpopmail is a set of programs for creating and managing
2multiple virtual domains on a qmail server.
3
4It is geared toward ease of use for system administrators as well
5as security and efficency. With the associated command line programs,
6system administrators never need touch any of the underlying qmail files
7and processes. All details are automatically handled.
8
9--------------------------------------------------------------------------
10
11Features include
12  * Support for 1 to 23 million virtual email domains using a
13    "grow as it goes" balenced directory tree.
14  * Support for 1 to 23 million email users per domain using the
15     same balenced tree structure.
16  * Automates all qmail configurations into handy and scriptable
17    command line programs and documented API library calls.
18  * Automates Unix user/group/other permissioning of directories
19    and files.
20  * Supports authenticated relay control of your qmail smtp server.
21  * Virtual email file/directories can be assigned to any user/group
22    or do the default vpopmail/vchkpw 89/89.
23  * Does not require email user accounts in /etc/passwd
24  * Supports name or IP based virtual domains
25  * Optionally automates support for:
26      * Storing clear text passwords to help tech support workers
27      * Record last authentication and automates deletion of
28        stale accounts.
29      * Storing alias/forwards in mysql or oracle
30  * Configurable logging based on real world admin's comments
31    and requirements.
32  * Support for MySQL, Oracle, PostgreSQL, /etc/passwd, /etc/shadow,
33     LDAP, Sybase, and default cdb authentication storage.
34  * Delivers directly to Maildir for use with qmail-pop3d,
35    .qmail files or any other Maildir program.
36  * No need to have hundreds of .qmail files for virtual domains.
37    Each domain gets it's own directory under vpopmail user with a
38    separate password file for each domain.
39  * Documented C library for all vpopmail features and transactions.
40
41--------------------------------------------------------------------------
42
43Latest versions of vpopmail are available from
44http://sourceforge.net/projects/vpopmail
45
46Recommended mailing lists:
47
48mailto:vchkpw@inter7.com  -  general discussion
49
50mailto:vpopmail-devel@lists.sourceforge.net - developement
51
52--------------------------------------------------------------------------
53
54For general installation instructions see INSTALL file
55
56For people upgrading please read UPGRADE
57
58--------------------------------------------------------------------------
59
60By default, vpopmail stores all the account configuration and settings
61in CDB files. CDB is a fast, reliable & simple database package that was
62written by Dan Bernstein (the author of qmail). CDB is a good choice
63for small vpopmail sites, but if you are running a larger server,
64there are other authentication modules available that can help increase
65performance or improve managability :
66
67  For help with mysql see README.mysql
68
69  For help with postgres see README.pgsql
70
71  For help with LDAP see README.ldap
72
73  For help with oracle see README.oracle
74
75  For help with sybase see README.sybase
76
77--------------------------------------------------------------------------
78
79Qmail and Virtual domains
80
81Qmail has an idea of email domains that are "local" and "virtual". Local
82domains are ones which primarily match against /etc/passwd. Virtual domains
83match against domains listed in the qmail control file "virtualdomains".
84Vpopmail makes use of the qmail users/assign file and virtualdomains file.
85The users/assign file gets compiled into a users/cdb file. It is a hashed
86database to speed searches for patterns. If a pattern is matched then qmail
87delivers the email to the directory defined in the file using the uid and
88gid which as also defined. Vpopmail makes use of this method to have qmail
89deliver all virtual domain email as the single uid/gid vpopmail/vchkpw.
90It also uses it to direct delivery to a vpopmail/domains/<virtualdomain>
91directory.
92
93Once qmail-local gets the information from the users/assign file it performs
94standard .qmail file processing in the directory. Normal .qmail-<user>
95files can be used for forwarding, aliases or invoking programs such as ezmlm.
96If no matches are found qmail-local looks for a .qmail-default file. This is
97the last stage in qmail-locals delivery mechansim. Vpopmail uses this file
98to invoke the vdelivermail program. This program takes two parameters, the
99first is not used (it is there for backward compatibility). The second
100parameter is the default delivery if a virtual domain user can not be found.
101Basically, it can be a directory to deliver the email to, an email address to
102forward the email to or the string "bounce-no-mailbox" to bounce the mail
103back to the sender.
104
105Once vdelivermail is started up, it uses the core vpopmail api calls to
106check for a virtual domain user. If the user exists, the email is delivered
107into their directory. If vpopmail was configured for hard quotas (default
108is yes with 50Meg quota), then the size of the users current email files
109in their Maildir/new and Maildir/cur directories are counted. If the user
110is over quota the email is bounced back to the user with a bounce message
111that can be customized. If the message is 1Kbytes or smaller the email
112will always be delivered. This is so system administration programs can
113always get a message through to the user.
114
115--------------------------------------------------------------------------
116
117Directory structure
118
119Overall vpopmail directory structure
120Vpopmail gets it's own home directory. Under this directory there are
121the following:
122
123  bin - contains all the binaries
124  lib - contains the libvpopmail.a file
125  include - contains the C header files
126  users - for backward compatibility for people who mix /etc/passwd users
127  with vpopmail users in one domain
128  domains - where all the virtual domains are kept.
129
130Virtual domain user directory structure
131Vpopmail uses an adaptive directory structure based on a state file
132".dir-control" which is automatically managed by the core vpopmail api
133functions "vadduser" and "vdeluser". For sites with 100 users or less,
134all user directories are stored in the virtual domain directory. For
135sites that go above 100 users the adaptive directory structure goes into
136effect. The basic idea is to break up the user Maildir directories across
137multple directories and sub directories so that there are never more than
138100 user directories in a single directory.
139
140The default directory setup allows for 62 directories in 3 levels and
141100 user directories per directory. The total number of user directories
142is equal to 100 + (62 * 100) + (62 * 62 * 100) + (62 * 62 * 62 * 100) = over
14324 million directories. This should be more than sufficent for any site
144and probably goes beyond the technology of directory structures.
145
146If you are going to be storing large numbers of user directories, make
147sure you set your file system to have a higher than normal percentage
148of inodes.
149
150Vpopmail will automatically create these directories and sub directories
151as needed and populate each directory with up to 100 user accounts. As
152soon as a directory reaches 100 users it will create the next directory
153or sub directory and store the new users directory there.
154
155Look in the source code release directory contrib/ for a contributed
156directory reorganization program
157
158--------------------------------------------------------------------------
159
160Converting current user accounts
161
162The vconvert program can convert email accounts from one format into
163another format. Conversion can be between /etc/passwd, vpasswd files,
164mysql (small version) and mysql (large version).
165
166Most current vpopmail users would probably be interested in how to
167convert current domains into mysql domains. To make it simple to convert
168an entire machine to mysql, use the following command: vconvert -c -s
169This will go through all the domains in ~vpopmail/domains directory
170and read each vpasswd file and load the contents into the
171vpopmail.vpopmail mysql table. The vpasswd file is left untouched
172for safety. Vconvert can also be run against one or more domains at a
173time. This is done by running the command as so:
174vconvert \c \s domain1 domain2 ...
175
176To convert all users (except root and system accounts) into a mysql
177domain run the following command: vconvert -e -s domain. This reads
178all /etc/passwd accounts and creates mysql entries using their
179passwords. The passwords can be in either /etc/passwd or /etc/shadow.
180These passwords should work under vchkpw authentication program.
181
182--------------------------------------------------------------------------
183
184Security and pop server under tcpserver
185
186If all of your pop email accounts are under virtual domains, you can
187increase the security of your pop server by running it under the uid
188and gid of vpopmail/vchkpw using the tcpserver -u and -g options.
189
190--------------------------------------------------------------------------
191
192Sorting qmail control files
193
194vpopmail now sorts the qmail control files.  When adding a record vpopmail
195uses an insertion sort to keep entries in order.  As it is doing this
196sort, it verifies the order of all records in the file.  If if finds entries
197that are out of order, it will sort the entire file by loading it into
198memory and using qsort.
199
200The files that are sorted:  rcpthosts, morercpthosts, virtualdomains,
201users/alias.  I don't believe there will be any problem having these
202files sorted, since they work in random order already.  It is much
203more convienent searching for a domain with the files in order, and
204programs like vdominfo and vpopmaild will report domain names in order.
205
206At first glance, the sort order may seem bizarre, but once you work with
207it, it should become natural.  Here is a small example from my test server:
208
209developersdesk.com
210admin.developersdesk.com
211mail.developersdesk.com
212test.developersdesk.com
213developersdesk.net
214developersdesk.org
215mvas.com
216mvas.net
217mvas.org
218test.com
219
220They are actually sorted as if they were written like this:
221
222developersdesk.com.mail
223
224I bet for most people that tends to group customers together.  A special
225sort may be apropriate for domains that end in a country code.  If someone
226has any ideas, post it on the SourceFORGE vpopmail-devel mailing list.
227

README.activedirectory

1--------------------------------------------------------------------------
2
3The origin and status of the ActiveDirectory module is unknown
4
5It is believed this module was written to allow a once-off migration
6of accounts from an ActiveDirectory server over to another vpopmail
7authentication system
8
9This module has been removed.  The CDB and MySQL modules are the two
10that are recommended for production environments.
11
12--------------------------------------------------------------------------
13
14

README.authvchkpw

1I have tweaked a bit authvchkpw module for vpopmail. It includes most of the function needed to authenticate.
2To install it you need to apply patch to vpopmail-5.4.26d. It modifies Makefile.am, configure.in, vpopmail.c,
3vpopmail.h and creates a new file authvchkpw.c. I have tested it on my laptop and found it to work. But I give
4no warranty.
5
6AUTHMODULES in courier-imap needs to have authvchkpw as one of the authentication modules
7The module does the following
8reads 5 lines from imaplogin or pop3login. Authenticates the user and if successful executes the imapd or pop3d
9executable. If the authentication is not successful, the data is passed to the next authmodule in chain.
10On successful authentication the module adds entry to lastauth and a entry in relay table.
11Instructions are in INSTALL section below. If you need more help let me know. If more modifications are needed
12let me know.
13
14	/*
15	 * Courier-IMAP authmodules Protocol
16	 * imap\n
17	 * login\n
18	 * postmaster@test.com\n
19	 * pass\n
20	 * newpass\n
21	 * argv[0]=/var/indimail/libexec/authlib/authvchkpw
22	 * argv[1]=/var/indimail/libexec/authlib/authpam
23	 * argv[2]=/var/indimail/bin/imapd
24	 * argv[3]=Maildir
25	*/
26
27INSTALLATION
28
291. Extract vpopmail Development tar.gz file vpopmail-5.4.26d.tar.gz
30   wget http://downloads.sourceforge.net/vpopmail/vpopmail-5.4.26d.tar.gz
31   cd /home/local/src
32   gunzip -c vpopmail-5.4.26d.tar.gz |tar xf -
33
342. patch -p0 authvchkpw-vpopmail-5.4.26d.patch
35
363. cd vpopmail-5.4.26
37   su
38   ./configure # with the usual options
39   make
40   make install-strip
41

README.filelocking

1Version 4.9.7 Release Notes
2
3FILE I/O and LOCKING CODE
4------------------------------------------------------------------
5The file i/o locking code has been audited. All code was changed to
6update files by opening the orignal file in read only mode, unless
7it is the first time, then create it. Then open a temp file with
8a .pid extension. Make all the changes to the temp file. Then use
9the rename(2) function call to automically move the new file over
10the old file. This is similar to how some qmail file modification
11is done.
12
13No read locks are requested for read only i/o.
14
15Write locks are requested for modify i/o.
16
17To reduce the locking load on the file system, a lock is
18not requested for the .dir-control file. If we miss counting
19a user during a simulatious user addition, it's not the
20end of the world. The number of user entry in that file
21is not meant to be exact. It is more of a guide line on
22how to spread out user directories across the vpopmail
233 level user directory tree.
24
25This should reduce the over all file i/o synchronicity
26requirements. And hence reduce the possiblity of lost
27file data (like loosing a complete vpasswd user file!!!)
28
29At least we are using the more reliable rename(2) function.
30
31

README.ipaliasdomains

1VPOPMAIL'S "IP ALIAS" DOMAINS
2-----------------------------
3
4When performing an auth in vpopmail, you would generally use the full email
5address as the username
6
7If many of your users are from a single domain, then you can optionally put
8that domain into the ~vpopmail/etc/defaultdomain file. Then if a user doesnt
9include a domain when they auth, the auth will be automatically performed
10against the domain nominated in the defaultdomain file.
11
12This system works well as most mail servers only need to have one domain
13nominated as a default. However what would happen if you later inherit
14another large domain full of users who have their email clients setup
15to login with just a username only? A vpopmail server can have only one
16default domain. It is going to be a lot of work to have to go to each email
17client and change it over to login with full email address.
18
19vpopmail provides a solution for this scenario : IP Alias Domains.
20
21To use IP Alias Domains, you need to bind some more IP addresses to your
22mail server. Then use the vipmap program to associate a particular domain
23to a particular IP address.
24
25Then when the auth request arrives, if it does not contain a domain,
26vpopmail will attach the matching domain from the IP alias table.
27
28---
29Contributed by Michael Bowe 7th Dec 2003
30

README.ldap

1--------------------------------------------------------------------------
2
3Using vpopmail with LDAP is not very common.
4The LDAP modules are functional, but because it not as popular as using
5CDB or MySQL auth systems, you should be wary of implementing the LDAP
6system on a production server.
7
8--------------------------------------------------------------------------
9
10So far this file is just a collection of everything that has ever been
11written about ldap.  It would be nice for someone who is actually using
12it, or even better someone who has to figure it out for the first time,
13to go through this file and clean it up.  If you do, please send a copy
14to the vpopmail-devel@lists.sourceforge.net so it can be included in
15the next release...
16
17--------------------------------------------------------------------------
18
19README file from ldap patch [1609348]
20
21
22
23OS: FreeBSD devhost.kingdom.lan 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Fri Nov 24 14:49:25 EET 2006
24    life@devhost.kingdom.lan:/usr/src/sys/i386/compile/DEVHOST  i386
25
26##########
27
28gcc:	Using built-in specs.
29	Configured with: FreeBSD/i386 system compiler
30	Thread model: posix
31	gcc version 3.4.4 [FreeBSD] 20050518
32
33##########
34
35LDAP: openldap-2.3.20
36
37##########
38
39OpenLdap Built:
40    LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib/sasl2:/usr/local/BerkeleyDB.4.3/lib"
41    LDFLAGS="-L/usr/local/lib -L/usr/local/lib/sasl2 -L/usr/local/BerkeleyDB.4.3/lib \
42             -R/usr/local/lib -R/usr/local/lib/sasl2 -R/usr/local/BerkeleyDB.4.3/lib" \
43    CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.3/include"
44 ./configure --prefix=/usr/local/ldap --enable-syslog --enable-local \
45 --with-threads --with-tls --with-multiple-precision --with-kerberos \
46 --enable-slapd=yes --enable-slurpd=yes --enable-cleartext=no --enable-crypt=yes \
47 --enable-lmpasswd=yes --enable-spasswd=yes --enable-rewrite=yes --enable-rlookups=yes \
48 --enable-wrappers=yes --enable-dnssrv=yes --enable-modules=yes \
49 --enable-ldap=yes --enable-ldbm=yes --enable-meta=yes --enable-monitor=yes \
50 --enable-null=yes --enable-passwd=yes --enable-perl=yes --enable-relay=yes \
51 --enable-shell=no --enable-sql=no --enable-overlays=yes --enable-dynamic=yes \
52 --with-dyngroup=yes --with-proxycache=yes \
53 --with-cyrus-sasl=yes --enable-spasswd=yes \
54 --enable-bdb=yes --enable-hdb=yes &&
55  make depend &&
56  make &&
57  make install &&
58
59##########
60
61vpopmail-5.4.17
62
63##########
64
651. configure and configure.in
66    "-lresolv" is not used, thus replaced.
67    path to lib has been changed to "-L/usr/local/ldap/lib"
68    path to includes has been changed to "-I/usr/local/ldap/include"
69
70
712. qmailUser.schema
72    the "qmailUser" objectClas is derived from "person" objectClass
73    so there MUST be both "cn" and "sn" objectClass'es.
74
75
763. vauth.h
77    two struct members have been added to "struct vqpasswd"
78    for "cn" and "sn" objectClass'es
79	char *pw_cn;                  /* LDAP's "cn" demanded by "objectClass: qmailUser" */
80	char *pw_sn;                  /* LDAP's "sn" demanded by "objectClass: qmailUser" */
81
82
834. vldap.h
84    two objectClass'es have been added to char *vldap_attrs[]
85    "cn",               /* LDAP's "cn" demanded by "objectClass: qmailUser" */
86    "sn",               /* LDAP's "cn" demanded by "objectClass: qmailUser" */
87
88
895. vldap.c
90    NUM_LDAP_FIELDS constant has been given new values
91    char *ldap_fields[] has been added objectClass'es "cn" and "sn"
92	"cn",	/* 7 LDAP's "cn" demanded by "objectClass: qmailUser" */
93	"sn",	/* 8 LDAP's "cn" demanded by "objectClass: qmailUser" */
94
95    "cn" and "sn" objectClass'es have been added to char *ldap_fields[]
96	"cn",	/* 7 LDAP's "cn" demanded by "objectClass: qmailUser"           */
97	"sn",	/* 8 LDAP's "cn" demanded by "objectClass: qmailUser"           */
98
99    in function vauth_getpw() according to the above mentioned changes:
100	vals = ldap_get_values(ld, msg, "cn");
101	    ...
102	vals = ldap_get_values(ld, msg, "sn");
103	    ...
104    have been added
105
106    in function vauth_adduser() "cn" and "sn" values are processed
107        snprintf(common_name, sizeof(common_name), "%s@%s", user, domain);
108        lm[7]->mod_values[0] = safe_strdup(common_name); for "cn"
109        lm[8]->mod_values[0] = safe_strdup(gecos); for "sn"
110
111
112    in function vauth_setpw() the same "cn" and "sn" values are processed
113	lm[7]->mod_values[0] = safe_strdup(inpw->pw_cn);            /* coonardoo@gmail.com */
114	lm[8]->mod_values[0] = safe_strdup(inpw->pw_sn);            /* coonardoo@gmail.com */
115
116
117    comments have been added for funtion safe_free() as for the warning:
118    "dereferencing type-punned pointer will break strict-aliasing rules"
119    that pops up during compilation. this warning doen't occur with gcc-2.91.* && gcc-4.0.2
120
121
122a shortened variant of slapd configuration of mine is given in the subdirectory ldap here.
123
124###
125#EOF
126###
127
128
129
130--------------------------------------------------------------------------
131
1322006/Jun/30 : Pavel Vinogradov <blaze.cs@gmail.com>
133
134    Now LDAP connection info is stored in ~vpopmail/etc/vpopmail.ldap.
135The format of the file is as follows:
136
137   ldap server|ldap port|ldap user|ldap password|ldap basedn
138
139Comments (lines starting with '#') are allowed.
140Port should be the actual port.
141
142For example:
143
144# This is the LDAP configuration file for vpopmail.
145localhost|389|cn=vpopmailuser, o=vpopmail|vpoppasswd|o=vpopmail
146
147
1482003/Dec/29 : Michael Bowe <mbowe@pipeline.com.au>
149
150A QUICK GUIDE TO VPOPMAIL WITH LDAP
151~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152Latest version of this guide is available from
153http://www.bowe.id.au/michael/isp/vpopmail-ldap.htm
154
155Note that I am not an LDAP expert, so some of the terminology used within
156this guide may not be 100% correct. I wrote this guide because many people
157on the vchkpw mailing list had questions about how to get vpopmail/ldap
158running. The docs we had so far (below) were a little difficult to understand
159and follow for an LDAP beginner, so I decided to put together this doc
160in the hope of presenting an easy-to-follow installation guide.
161
162
163
164OpenLDAP can operate with a number of database filesystems. For this example
165we are going to use the bdb database system.
166
167Download/compile BDB
168
169  cd /usr/local/src
170  wget http://www.sleepycat.com/update/snapshot/db-4.2.52.tar.gz
171  tar xzf db-4.2.52.tar.gz
172  cd db-4.2.52
173  cd build_unix
174  ../dist/configure
175  make
176  make install
177  cd ..
178
179Download/compile OpenLDAP
180
181  http://www.openldap.org/software/download/
182  wget http://www.planetmirror.com/pub/openldap/openldap-release/openldap-2.1.23.tgz
183  tar xzf openldap-2.1.23.tgz
184  cd openldap-2.1.23
185
186  env CPPFLAGS=-I/usr/local/BerkeleyDB.4.2/include \
187    LDFLAGS=-L/usr/local/BerkeleyDB.4.2/lib \
188    ./configure
189
190  make depend
191  make
192  make install
193  cd..
194
195Download/configure/compile vpopmail
196
197  Make the user accounts
198
199    # If you are using RH8.0, you will probably need to run this following command,
200    # because RH8.0 comes preconfigured with UID/GID 89 allocated to postfix
201    #
202    # userdel postfix
203
204    groupadd -g 89 vchkpw
205    useradd -g vchkpw -u 89 vpopmail
206
207    # We recommend you use the user and group id's of 89. The FreeBSD folks
208    # have reserved 89 for the group and 89 for the user for vpopmail.  Feel
209    # free to have the OS assign the group/user id (for example, Solaris won't
210    # allow gid 89).
211
212  Download and unpack the source
213
214    cd /usr/local/src
215    wget http://telia.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.4.tar.gz
216    tar xzf vpopmail-5.4.4.tar.gz
217    chown -R root.root vpopmail-5.4.4
218    cd vpopmail-5.4.4
219
220  Setup the LDAP support in the vpopmail sources
221
222    echo "localhost|389|cn=vpopmailuser, o=vpopmail|vpoppasswd|o=vpopmail" > ~vpopmail/etc/vpopmail.ldap
223    chown vpopmail.vchkpw ~vpopmail/etc/vpopmail.ldap
224    chmod 640 ~vpopmail/etc/vpopmail.ldap
225
226  Compile vpopmail with options like this
227
228    ./configure --enable-auth-module=ldap
229    make
230    make install-strip
231
232Configure/start the OpenLDAP server
233
234  Copy the vpopmail ldap schema into the OpenLDAP schema directory
235
236    cd ldap
237    cp qmailUser.schema /usr/local/etc/openldap/schema
238
239  Configure OpenLDAP to host the vpopmail database
240
241    cp slapd.conf /usr/local/etc/openldap
242    chmod 600 /usr/local/etc/openldap/slapd.conf
243    chown root.root /usr/local/etc/openldap/slapd.conf
244
245  Start the OpenLDP server
246
247    /usr/local/libexec/slapd
248
249  If all goes well, 'ps axf' should give something like this :
250
251    18415 ?        S      0:00 /usr/local/libexec/slapd
252    18416 ?        S      0:00  \_ /usr/local/libexec/slapd
253    18417 ?        S      0:00      \_ /usr/local/libexec/slapd
254
255  Now create the vpopmail database in the LDAP system
256
257    ldapadd -f vpopmail.ldif -x -w vpoppasswd -D'cn=vpopmailuser,o=vpopmail'
258
259  If all goes well you will see something like :
260
261    adding new entry "o=vpopmail"
262
263  Get the ldap server to confirm that the vpopmail database exists
264
265    ldapsearch -x -b 'o=vpopmail'
266
267Now you should be right to go!
268
269As you start adding domains and users, the ldap directory tree will eventually look like this :
270
271  vpopmail (o)
272    somedomain1.com (ou)
273      someuser1
274      someuser2
275      someuser3
276   somedomain2.com (ou)
277      someuser1
278      someuser2
279      someuser3
280
281
282Other useful references I found on the net :
283
284  http://marc.theaimsgroup.com/?l=vchkpw&m=105781736114278&w=2
285  http://www.tiski.de/linux/patches/vpopmail/LDAP-VPOPMAIL.html
286
287
288
289
290**************************************************************************
291
292PREVIOUS VPOPMAIL/LDAP DOCUMENTATION :
293
294See the ldap directory for the
295qmailUser.schema and slapd.conf files
296
297!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
298Only for 2.07+ (Not only but tested on it)
299I used OpenLDAP from SuSe 7.2 version OpenLDAP 2.0.7-Release 21 July 2000 7
300!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
301
302Start:
303
304first install one of ldap sources (rpm is fine :) )
305then create base ldif file thats looks like this ( or similar)
306
307second set up ldap (ok these are basic steps not a real ldap setup howto...)
308first create slapd.conf (or use default created by instalation)
309put into it next lines (on begining of file)
310------------------
311include     /etc/openldap/schema/qmailUser.schema
312schemacheck off
313------------------
314(file definitions qmailUser.schema could be found at the end of this file)
315
316What that above means?
317That is include of qmailUser.schema definiton of qmail (vpopmail) specific
318attributes and is needed.
319then put these lines for database defitinion
320---------------------------------------------
321#######################################################################
322# ldbm database definitions
323#######################################################################
324
325database ldbm
326suffix      "o=vpop"
327rootdn      "cn=Manager, o=vpop"
328rootpw      proba
329directory   /var/lib/ldap
330index   objectClass             pres,eq
331index   cn,sn,uid               eq
332index   qmailUID,qmailGID   eq
333access to *
334        by self write
335        by dn="cn=manager,o=vpop" write
336        by * write
337
338------------------------------------------------
339
340
341-------------------------------
342# vpop
343dn: o=vpop
344objectClass: Organization
345o: vpop
346-------------------------------
347name it first.ldif or whatever
348
349then if all step above works  do next:
350
351-------- command to execute ----------
352ldapadd -x -w proba -D'cn=manager,o=vpop' < first.ldif
353-------- -----------------------------
354
355
356and that should reply to you something like
357
358adding new entry "o=vpop"
359
360
361Next thing you should check is does it realy works ;)
362
363check it simply typing command
364
365-----------command --------
366ldapsearch -x -b 'o=vpop'
367---------------------------
368output is shown below (something like propably not same)
369
370---out---
371version: 2
372
373#
374# filter: (objectclass=*)
375# requesting: ALL
376#
377
378# vpop
379dn: o=vpop
380objectClass: Organization
381o: vpop
382
383---out---
384
385Ok if all that passed ok ( I'll return to qmailUser.schema later)
386you have ldap server up and running (this will not make you ldap guru :)
387even I do not know ldap that much to call myself "good ldaper or like" :) )
388
389
390Next you should compile vpopmail source
391you could use next steps for it
392edit vldap.h and change next lines to yuore settings( // lines are my
393comments you will not find them in vldap.h :) )
394--------
395#define VLDAP_SERVER "localhost" // change this line to point
396                                 // to your ldap server
397
398#define VLDAP_PORT LDAP_PORT // no need to change if you didn't
399                             //change anything)
400
401#define VLDAP_USER "cn=Manager, o=vpop" // MUST change to reflect youre
402                                        //settings from
403#define VLDAP_PASSWORD "proba"  // MUST change to reflect youre
404                                // setting from /etc/openldap/slapd.conf
405
406#define VLDAP_BASEDN "ou=%s, o=vpop" // MUST change to reflect youre
407                                     // setting from /etc/openldap/slapd.conf
408--------
409then type
410"./configure --enable-auth-module=ldap " and that "should" setup ldap in vpopmail
411without hasle :)
412"make" "make install" and that should get you to running version of vpopmail
413in ~vpopmail/bin dir
414try adding new domain with ~vpopmail/bin/vadddomain terere.com dddddasfa
415if there is no any stupid error
416"Error: Unable to chdir to vpopmail/users directory"
417
418that's it :)
419again you can check does it work with
420ldapsearch -x -b'o=vpop' if there is terere.com in output
421
422
423Resources non known except www.openldap.org and www.inter7.com
424
425
426-------------------qmailUser.schema---------------------------
427
428attributetype ( 1.3.6.1.4.1.8868.3.1.2
429        NAME 'qmailGID'
430        DESC 'qmail group id'
431        EQUALITY caseIgnoreIA5Match
432        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{100}
433        SINGLE-VALUE )
434
435attributetype ( 1.3.6.1.4.1.8868.3.1.3
436        NAME 'qmailUID'
437        DESC 'qmail userid'
438        EQUALITY caseIgnoreIA5Match
439        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{100}
440        SINGLE-VALUE )
441
442attributetype ( 1.3.6.1.4.1.8868.3.1.4
443        NAME 'qmaildomain'
444        DESC 'qmail Domain'
445        EQUALITY caseIgnoreIA5Match
446        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{100}
447        SINGLE-VALUE )
448attributetype ( 1.3.6.1.4.1.8868.3.1.6
449        NAME 'mailQuota'
450        DESC 'qmail quota'
451        EQUALITY caseIgnoreIA5Match
452        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{100}
453        SINGLE-VALUE )
454attributetype ( 1.3.6.1.4.1.8868.3.1.7
455        NAME 'mailMessageStore'
456        DESC 'qmail Store'
457        EQUALITY caseIgnoreIA5Match
458        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{100}
459        SINGLE-VALUE )
460
461objectclass ( 1.3.6.1.4.1.8868.3.1
462        NAME 'qmailUser'
463        DESC 'qmail local mail recipient'
464        SUP ( top $ person $ organizationalPerson )
465        MAY ( qmailGID $ qmailUID $ qmaildomain $
466                mailQuota $ mailMessageStore $ name $ sn $ cn $ userPassword) )
467
468
469LDAP FAQ
470
471
4722. After installing vpopmail successfully, running vadddomain gives a core
473   dump error. What's wrong?
474
475You probably configured --with-hardquota=xxxxx. This is a known bug. Hopefully
476it will be fixed soon =)
477
4783. After installing vpopmail successfully, running vadddomain gives an error:
479
480Error: Unable to chdir to vpopmail/users directory
481
482I don't know :(
483From looking at the permissions in /home/vpopmail, everything looks fine.
484If you found a solution to this problem, please let me know (and share
485with other vpopmailers on the mailing list :)
486
487+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
488+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
489+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
490+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
491All errors are fixed for ldap module :)
492This only works on OpenLDAP 2.0.7-Release     21 July 2000
493( I don't use openldap ver 1)
494
495error No. 2 from README.ldap
496
497Fixed ... (snprintf error %s instead %i was in vldap.c on line 463)
498
499error No. 3 from README.ldap
500
501Fixed ... ( everything changed is in vpopmail.patch)
502
503+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
504+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
505+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
506+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
507
508Explanation:
509
510
5112 error (stupid typo error :] )
5123. error(s) were not that stupid :(
513	and need more explaining
514
515Ok here it is ;)
516
517Fist there is a big diference in openldap ver 1 and openldap ver 2
518
519first ther is more strict schema checking
520uid attribute cann't be used with this patch
521need for PosixAccount objectClass ...
522
523third error was or it is not who knows
524
525  memset((char *)crypted, 0x0, 100);
526  if ( password[0] != 0 ) {
527    mkpasswd3(password, crypted, 100);
528//    crypted[0] = 0;
529  } else {
530    mkpasswd3(password, crypted, 100);
531  }
532
533that check simply do not work I know it should but solution is simple ;)
534
535and I think these are all errors
536
537
538This was for all folks trying to make it working with openldap  V2
539
540
541---------- OLD LDAP README ----------------------
542From: vol [mailto:vol]On Behalf Of vol@inter7.com
543Sent: Wednesday, December 05, 2001 1:15 PM
544To: vchkpw@inter7.com
545Subject: vpopmail, the LDAP module, and OpenLDAP
546
547
548Alright.  I've responded to about 15 messages on this list
549about the use of the OpenLDAP module.  I'm going to do my best
550to explain everything that has ever been asked.  In case you
551aren't aware, I'm the author of the LDAP module.  A little background
552on the project, we needed to convert a large LDAP solution over
553to a vpopmail-based LDAP solution as per the client's request.
554I knew nothing of LDAP before I began work on the project, and believe
555you me, I had a hell of a time figuring out exactly how LDAP functioned.
556
557First of all, there is absolutely NO RELATIONSHIP between
558vpopmail's LDAP module, and qmail-ldap.  qmail-ldap is an
559LDAP-enabled qmail-based MTA.  The vpopmail LDAP module reads
560user authentication information out of an LDAP database.
561
562Second, the LDAP module DOES work, however, it is not actively
563maintained because here at Inter7, we dislike LDAP, and anything
564using it with a passion.  LDAP is the most terribly conceived idea
565ever to hit the database industry, and to top it off, it is widely
566used with bulky commercial mail solutions.  I wish I knew why.
567Just to quelch any flaming I might get for my opinions in this area;
568I've been over the code, I've worked with the big solutions, and I've
569seen many benchmarks.
570
571Here are common problems that will arise when trying to use the vpopmail
572LDAP module:
573
574
575
576  1) Unable to add new information to the database (domains, users, etc)
577     and/or unable to authenticate out of the database
578
579     Various misconfigurations can occur here:
580        A) Bad authentication information (see vldap.h)
581        B) Bad BASEDN information (see vldap.h)
582        C) Mismatched schema (see vldap.h, and your ldap configurations)
583
584     This will be the main problem people run into.  This is a
585     misconfiguration on your end.  Not the module.  As far as I know,
586     there have been no major re-writes of the OpenLDAP API that would
587     cause the base functions to work differently causing database
588     information retrieval to fail or act differently.
589
590  2) Things are not properly removed from the database
591
592     This worked in the original code.  Someone reported an error
593     where something was not properly removed from the database.
594     I have not worked with the LDAP module since early 4.x versions.
595     As you know, 5.0 is a big re-write of a lot of the base vpopmail
596     code.  I cannot verify if this is a true bug or not.
597
598Instructions for installing the vpopmail LDAP module:
599
600  Okay, folks.  I need to say right up front.  If you don't know
601  enough about LDAP to construct a database from scratch without
602  reading for hours on end, you're not going to have great success
603  with this installation.  If you're not already an LDAP guru,
604  please just decide upon another database.  You will be a lot
605  happier in the long run.
606
607  First of all, you need to configure your LDAP server.  For our
608  purposes, this will be slapd.  You'll need to edit your slapd.conf
609  and your slapd.oc.conf (I think its called that still).  Add
610  the new schema information.  You can find all this in vldap.c/vldap.h
611  source files (or you used to be able to).  Again, if you don't know
612  what a 'schema' is, you really shouldnt be mucking with LDAP.  Do
613  NOT attempt to modify the structure.  It will BREAK.  Follow the
614  schema from vldap.h/vldap.c.
615
616  Modify vldap.h for the authentication information.
617
618  Now, in the old version I worked with, you had to create the basedn
619  to start.  If this is no longer needed, ignore this step.  Create
620  a little LDIF (you'll probably want to save this in case of problems)
621  and pipe it into the database.
622
623  If you followed these instructions, and understood everything you
624  were doing more or less, your vpopmail LDAP configuration should be
625  working smoothly.
626
627Last words:
628
629  As I said above, the LDAP module has not been verified as extremely
630  functional since early 4.x versions.  We'd prefer, if you must use
631  backend database, that you go with MySQL.  I'd really suggest you
632  look at the benchmarking on the MySQL site.  MySQL cant hold 2
633terabytes
634  of authentication information, but it's three times faster than
635Oracle.
636  On the flip side, Oracle CAN hold 2 terabytes of authentication
637  information, but unless you're a fortune 500 company, you probably
638  will not need to bother with that type of database storage.
639
640  Any further questions about LDAP, we will not be able to help you with
641  unless you want to fund some sort of documentation, update project.
642  We always welcome funding for any project, of course. :)
643
644I hope this has helped those of you who absolutely cannot live without
645LDAP authentication.
646
647Good luck!
648--
649vol@inter7.com
650Inter7 Internet Technologies, Inc.
651www.inter7.com - 847-492-0470
652Prices at http://www.inter7.com/prices
653

README.maildrop

14/28/2007
2
3* Maildrop Support in vdelivermail
4
5Vdelivermail can call maildrop during local delivery to a Maildir.  To enable
6this, simply compile vpopmail with --enable-maildrop=y.  Configure will
7look for the maildrop program in /usr/bin and /usr/local/bin.  If it is not
8found, you will need to specify the location with the additional
9--enable-maildrop-prog='/path/to/maildrop' option.
10
11If you want to disable maildrop processing for a user or all users in a domain,
12you may do so with the vmoduser program:
13
14vmoduser -m user@domain.com
15or
16vmoduser -m domain.com
17
18When compiled with maildrop support, maildrop processing defaults to on for
19users.  If you want to override this default on a system or per domain basis,
20these can be set as well with the following entries to vlimits.default, or
21.qmailadmin-limits, respectively:
22
23disable_maildrop
24
25maildrop is called with no arguments, allowing for the default maildroprc
26location (/etc/maildroprc on Linux, /usr/local/etc/maildroprc on FreeBSD).
27You can find two sample maildroprc files in the maildrop subdirectory.  The
28file maildroprc.v1 is for maildrop versions below 2.0, and maildroprc.v2 is
29for maildrop versions 2.0 or higher.  (Some expression syntax change at 2.0).
30
31If you want to automatically run spamc before calling maildrop, see
32README.spamassassin
33
34
35Bill Shupp
36hostmaster@shupp.org
37

README.mysql

1--------------------------------------------------------------------------
2
3Using vpopmail with MySQL is becoming increasingly popular.
4The code is well tested and can be considered to be just
5as stable as the default CDB authentication system.
6
7--------------------------------------------------------------------------
8
92003/Dec/29 : Michael Bowe <mbowe@pipeline.com.au>
10(Document originally contributed on this date, but has had some
11minor tweaks done since that time)
12
13
14A QUICK GUIDE TO VPOPMAIL WITH MYSQL
15~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16Full doc available from :
17http://www.bowe.id.au/michael/isp/vpopmail-mysql.htm
18
19
20MYSQL :
21
22Setup an account for the MySQL server to run under :
23
24	groupadd mysql
25	useradd -g mysql mysql
26
27Go to their website and download the latest binaries to /usr/local/src.
28In this example I have used the file: mysql-max-3.23.57-pc-linux-i686.tar.gz
29(Note, MySQL v4 has recently been released as "stable", however I am yet
30to do any testing under this new version. I would recommend that you stay with
31v3.23 until the v4 series is more mature)
32
33Unzip / configure the binaries so they get installed to /usr/local/mysql
34
35	cd /usr/local
36	tar xzf /usr/local/src/mysql-max-3.23.57-pc-linux-i686.tar.gz
37	ln -s mysql-max-3.23.57-pc-linux-i686 mysql
38
39Run the installation script that creates/verifies all the various system-use tables etc
40
41	cd mysql
42	scripts/mysql_install_db
43	cd ..
44
45Setup permissions on the MySQL dirs
46
47	chown -R root.mysql mysql-max-3.23.57-pc-linux-i686
48	chmod -R 640 mysql
49	chmod -R u+X,g+X mysql
50	chmod -R ug+x mysql/bin
51	chmod -R g+w mysql/data
52	chmod -R u+x mysql/scripts
53
54Let the MySQL server know what amount of resources it is allowed to use
55
56	# choose an appropriate config file from the samples provided
57	cp /usr/local/mysql/support-files/my-medium.cnf /usr/local/mysql/data/my.cnf
58	# adjust the permissions on the file so that mysql daemon can read the contents
59	chgrp mysql /usr/local/mysql/data/my.cnf
60
61Fire up the server
62
63	cd /usr/local/mysql
64	bin/safe_mysqld --user=mysql &
65
66At this point the mysql daemons should be running. A good way to verify this is to use this command :
67
68	ps axf
69
70If all is well, you should be able to see something like this :
71
72	1073 ? S 0:00 /bin/sh ./bin/safe_mysqld --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/.pid
73	1117 ? S 0:00  \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr/local/m
74	1125 ? S 0:00      \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr/loc
75	1126 ? S 0:00          \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr
76	1143 ? S 0:00          \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr
77	1419 ? S 0:00          \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr
78	1449 ? S 0:00          \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr
79	1471 ? S 0:00          \_ /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --basedir=/usr
80
81(If you received errors, look in the file /usr/local/mysql/data/hostname.err for debugging info)
82
83Next setup a password for the MySQL root user
84
85	/usr/local/mysql/bin/mysqladmin -u root password 'mysql-root-pwd'
86
87Configure MySQL so it is running all the time from bootup onwards
88
89	cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
90	chmod 744 /etc/rc.d/init.d/mysql
91	chkconfig --add mysql
92
93Then I like to use the ntsysv program to double-check that mysql is set to launch at boot time
94
95
96VPOPMAIL
97
98Make the user accounts
99
100	# If you are using RH8.0, you will probably need to run this following command,
101	# because RH8.0 comes preconfigured with UID/GID 89 allocated to postfix
102	#
103	# userdel postfix
104
105	groupadd -g 89 vchkpw
106	useradd -g vchkpw -u 89 vpopmail
107
108	# We recommend you use the user and group id's of 89. The FreeBSD folks
109	# have reserved 89 for the group and 89 for the user for vpopmail.  Feel
110	# free to have the OS assign the group/user id (for example, Solaris won't
111	# allow gid 89).
112
113Download and unpack the source
114
115	cd /usr/local/src
116	wget http://telia.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.7.tar.gz
117	tar xzf vpopmail-5.4.7.tar.gz
118	chown -R root.root vpopmail-5.4.7
119	cd vpopmail-5.4.7
120
121Setup the MySQL support in the vpopmail sources
122
123	# Create the configuration file that vpopmail will use
124	# to setup the connection to the mysql database
125	#
126	# This example will tell vpopmail :
127	#   * Log into the server running on localhost
128	#   * Use the default mysql port
129	#       (In fact if the server is localhost, and you don't specify a port number, then
130	#        I believe the that communications are done via unix sockets rather than TCP/IP)
131	#   * Login with username vpopmailuser
132	#   * Login with password vpoppasswd
133	#   * Use the database called vpopmail
134	#
135
136	echo "localhost|0|vpopmailuser|vpoppasswd|vpopmail" > ~vpopmail/etc/vpopmail.mysql
137	chown vpopmail.vchkpw ~vpopmail/etc/vpopmail.mysql
138	chmod 640 ~vpopmail/etc/vpopmail.mysql
139
140	# log into MySQL as the MySQL root user
141	# and then create the database for vpopmail to use
142	# and then setup the appropriate permissions on this database
143	/usr/local/mysql/bin/mysql --password="mysql-root-pwd"
144
145		CREATE DATABASE vpopmail;
146		GRANT select,insert,update,delete,create,drop ON vpopmail.*
147		TO vpopmailuser@localhost IDENTIFIED BY 'vpoppasswd';
148		quit
149
150Now, build the program with options something like this :
151
152	./configure \
153	  --disable-roaming-users \
154	  --enable-logging=p \
155	  --disable-passwd \
156	  --enable-clear-passwd \
157	  --disable-domain-quotas \
158	  --enable-auth-module=mysql \
159	  --enable-auth-logging \
160	  --enable-sql-logging \
161	  --enable-valias \
162	  --disable-mysql-limits
163
164	make
165	make install-strip
166
167Notes :
168	I used to recommend the --disable-many-domains switch - which
169	tells vpopmail to create one MySQL table per email domain. When
170	I first started building vpopmail servers, I found this to be the
171	most logical way, having each domain in its own table. However there
172	has been some discussion about this config option on the vpopmail
173	mailing lists, and it sound like this option may be removed at some
174	point in the future.  If you have a lot of domains on your server,
175	having each domain in its own table can hurt performance. I now agree
176	that --enable-many-domains is probably the better choice
177
178Review the contents of the file is used to set the default limits for any
179domains / mailboxes in the vpopmail system. Make sure it contains reasonable
180defaults for your system.
181
182	vi ~vpopmail/etc/vlimits.default
183
184Optionally, nominate a "default domain". Users in this domain can login to
185POP3 etc using just their username. Users from all other domains need to use
186their full email address as their login name.
187
188	echo "yourdomain.com" > /home/vpopmail/etc/defaultdomain
189
190
191--------------------------------------------------------------------------
192
193A HANDY TRICK :
194
195----- Original Message -----
196From: "Ken Jones" <kbo@inter7.com>
197To: <vchkpw@inter7.com>
198Sent: Thursday, September 09, 2004 3:48 AM
199Subject: Re: [vchkpw] vpopmail + billing server integration
200> On Wednesday 08 September 2004 12:25 pm, Chris Ess wrote:
201> > On Wed, 8 Sep 2004, Ken Jones wrote:
202> > > Hi,
203> > >
204> > > Here is something we built into vpopmail for sites like yours.
205> > >
206> > > Use mysql on the email server. Have the billing system
207> > > insert an entry in the vpopmail table, leaving the directory
208> > > field blank. vpopmail will automatically create the users
209> > > directory and update the database when any program
210> > > tries to deliver mail to the user, or authenticate as the user.
211> >
212> > That's really neat!  I didn't realize you could do this.  (Now someone
213> > will tell me that it's in the documentation that I seem to've not read
214> > recently.)
215>
216> It is probably in the mailing list archives. I'm not sure if anyone has
217> updated the documentation.
218>
219> >
220> > (I know this is getting offtopic...) So I could use an INSERT statement in
221> > SQL instead of vadduser?  Or am I not understanding this correctly?
222>
223> That is the idea. A while back some folks wanted to hook up their billing
224> systems to vpopmail. Basicly they would insert into the vpopmail sql table.
225> The only thing they couldn't do easily was create the hashed directory path.
226> So we put in vpopmail code to check if the path is blank and automatically
227> create the new path and update the database.
228>
229> You will also need to set the encrypted password using mysql's CRYPT function.
230> Mysql's standard encryption functions are not compatible with unix/linux.
231>
232> Ken
233>
234
235
236----- Original Message -----
237From: "Michael Bowe" <mbowe@pipeline.com.au>
238To: <vchkpw@inter7.com>
239Sent: Thursday, September 09, 2004 7:32 AM
240Subject: Re: [vchkpw] vpopmail + billing server integration
241>
242> ----- Original Message -----
243> From: "Chris Ess" <inter7@cae.tokimi.net>
244>
245> > On Wed, 8 Sep 2004, Ken Jones wrote:
246>
247> > > Use mysql on the email server. Have the billing system
248> > > insert an entry in the vpopmail table, leaving the directory
249> > > field blank. vpopmail will automatically create the users
250> > > directory and update the database when any program
251> > > tries to deliver mail to the user, or authenticate as the user.
252> >
253> > That's really neat!  I didn't realize you could do this.  (Now someone
254> > will tell me that it's in the documentation that I seem to've not read
255> > recently.)
256> >
257> > (I know this is getting offtopic...) So I could use an INSERT statement in
258> > SQL instead of vadduser?  Or am I not understanding this correctly?
259>
260> Yes that feature has been around for a while
261>
262> It has definitely been discussed in the archives of this list, but I would
263> agree that I don't remember seeing it mentioned in the docs.
264>
265> I use this feature to allow an IIS webserver to create mailboxes on my
266> vpopmail server. This is achieved by using an ASP script that creates an
267> appropriate record and inserts it into the vpopmail MySQL. Of course the
268> same sort of thing could be achieved using Apache/PHP.
269>
270> I have some more information and some example code here :
271> http://www.pipeline.com.au/staff/mbowe/isp/webmail-server.htm#Example_scripts
272>
273> ps. one catch with inserting users directly... The mailbox on the disk isnt
274> created until the 1st POP/IMAP login is done, or the 1st mailbox message is
275> received. This can cause a glitch with qmailadmin, because if the user tries
276> to login to qmailadmin before their mailbox on the disk exists, qmailadmin
277> will barf because it cant write a lockfile to the user's dir. So when I
278> insert users directly, the same script also sends the user a "welcome"
279> message to ensure that the mailbox is created immediately.
280>
281> Michael.
282
283
284--------------------------------------------------------------------------
285
286PREVIOUS VPOPMAIL / MYSQL DOCUMENTATION... :
287
288vpopmail now supports mysql. Here is a brief outline on how to
289get it running.
290
291NOTE: make sure you are running the latest stable release of mysql.
292If you have 3.22 installed, you will need to upgrade. The dir_control
293table in vpopmail uses a "unique index (domain)" syntax which isn't
294supported in the 3.22 releases. Thanks to Chris Scheller for
295tracking this down.
296
297There are some things you need to edit by hand to get it to work.
298
2991) Create a ~vpopmail/etc/vpopmail.mysql file and put these fields in
300the file (replacing them with the actual information):
301
302read_server|read port or socket path|read_user|read_password|database_name
303update_server|update port or socket path|update_user|update_password|database_name
304
305For example:
306
307# This is the MySQL configuration file for vpopmail.
308localhost|0|readonly|somepass|vpopmail
309localhost|0|root|secret|vpopmail
310
311You can make changes to this file at any time without needing to
312recompile vpopmail.
313
314If you are NOT using mysql replication then set both of
315these sets to be your primary mysql server information.
316
317If you ARE using mysql replication then set the UPDATE
318set to be your master mysql server and set the READ
319set to be your local mysql server.
320
321After changing the file, make sure it has the correct permissions:
322
323chown vpopmail.vchkpw vpopmail.mysql
324chmod 0640 vpopmail.mysql
325
3262) configure options for mysql support.
327
328--enable-auth-module=mysql
329
330First thing. This turns on mysql code and authentication module.
331
332Now if you aren't lucky and your mysql include and libraries aren't
333in the "default" locations, you will need to use these options.
334
335If your include files are not in /usr/include/mysql or
336/usr/local/include/mysql, add the following configuration option:
337
338--enable-incdir=/path-to-your-include-dir
339
340If your library files are not in /usr/lib/mysql or in
341/usr/local/lib/myqsl , add the following configuration option:
342
343--enable-libdir=/path-to-your-lib-dir
344
345On my machine I do:
346$ ./configure --enable-auth-module=mysql
347
3483) make the software
349
350$ make
351
3524) install as root
353
354$ su
355# make install-strip
356
357
358## CONVERSION FROM CDB TO MYSQL: ##
359
360If you have domains that are already setup as cdb modules and
361you want to convert them to sql:
362
3631) Convert your current virtual domains to sql.
364
365use the vconvert program. You can convert one domain at a time,
366or convert them all.
367
368# ./vconvert -c -m
369this will convert them all from the vpasswd.cdb format to the default
370single table database
371
372# ./vconvert -c -m virtualdomain1 virtualdomain2 ...
373will convert the list of virtual domains from vpasswd.cdb layout to
374single table database
375
376What does the conversion program do? First it creates a table with the name
377of the domain. domain names with "-" or "." are converted to "_". Mysql
378doesn't like "-" or "." in table names.  For example: test-dom.com domain
379gets a table named test_dom_com
380
381Next, the conversion program reads the contents of the vpasswd file and
382adds those records to the mysql database.
383
384
385## OPTIONAL TABLE CUSTOMISATION: ##
386
3871) Customizing the fields in the sql tables.
388
389It is possible to add additional fields to the database table layout.
390vpopmail won't touch these additional fields, but they would be available
391for any other programs to access and use.
392
393Edit vmysql.h and add fields to either SMALL_TABLE_LAYOUT or LARGE_TABLE_LAYOUT
394be sure not to delete any of the fields. Each field in the default layout
395is required for vpopmail.
396

README.onchange

1If --enable-onchange-script is added to the ./configure command
2many vpopmail commands, and calls into the library will call the
3script ~vpopmail/etc/onchange.  Commands that add or update call
4the script after making their changes.  Commands that delete
5something call the script before doing the delete.
6
7When a command calls other commands in the process of doing its job
8only the inital call triggers the script.  For example vadddomain uses
9vadduser and vmoduser to create the postmaster user, and set its
10attributes.  Your script will be called once with cmd set to
11add_domain, and arg1 set to the domain being added.  By the time the
12script is called, the domain and the postmaster user have already
13been created.
14
15When the script is called, it will be passed the following values
16on the command line to indicate what was changed.  Your script should
17check the cmd value to determine what has happened and act accordingly.
18
19
20function called         cmd               arg1            arg2
21----------------------  ------------      -----------     ----------
22
23vadddomain()            add_domain        domain
24vdeldomain()            del_domain        domain
25vadduser()              add_user          user@domain
26vdeluser()              del_user          user@domain
27vaddaliasdomain()       add_alias_domain  domain          real_domain
28vauth_setpw             mod_user          user@domain
29valias_insert           insert_alias      user@domain     alias_line
30valias_remove           remove_alias      user@domain     alias_line
31valias_delete           del_alias         user@domain
32valias_delete_domain()  del_all_alias     domain
33
34
35
36The program, daemon command or function call that triggered the onchange
37script will not return until the script ends.  That means that you should
38keep the run time of the script down, or have the script trigger any
39long running process.
40
41This is based on the onchange patch by John Simpson, used to support
42his validrcptto.cdb patch.  Robin Bowes made the suggestion to return
43information on what was done.
44
45http://qmail.jms1.net/vpopmail
46
47
48
49List of code changes to implement onchange, and what is sent to the script:
50
51file	function		cmd		arg1		arg2
52-----	---------		----		-----		-----
53vcdb.c
54	vauth_setpw()		mod_user	user@domain
55
56vldap.c
57	vauth_setpw()		mod_user	user@domain
58
59vmysql.c
60	vauth_setpw()		mod_user	user@domain
61	valias_insert()		insert_alias	user@domain	alias_line
62	valias_remove()		remove_alias	user@domain	alias_line
63	valias_delete()		del_alias	user@domain
64	valias_delete_domain()	del_all_alias	domain
65
66vpalias.c
67	valias_insert()		insert_alias	user@domain	alias_line
68	valias_delete()		del_alias	user@domain
69
70vpgsql.c
71	vauth_setpw()		mod_user	user@domain
72	valias_insert()		insert_alias	user@domain	alias_line
73	valias_delete()		del_alias	user@domain	alias_line
74	valias_delete_domain()	del_all_alias	domain
75
76vsybase.c
77	vauth_setpw_size()	mod_user	user@domain
78
79vpopmail.c
80	vadddomain()		add_domain	domain
81	vdeldomain()		del_domain	domain
82	vadduser()		add_user	user@domain
83	vdeluser()		del_user	user@domain
84	vaddaliasdomain()	add_alias_domain domain		real_domain
85
86

README.oracle

1--------------------------------------------------------------------------
2
3Using vpopmail with Oracle is very rare.
4
5The Oracle modules are understood to be functional, but because it not
6as popular as using CDB or MySQL auth systems, you should be very wary
7of implementing the Oracle system on a production server.
8
9--------------------------------------------------------------------------
10
11Edit voracle.h and set the service, user and password information.
12
13Then run: proc voracle.pc
14
15proc or Pro-C is oracle's precompiler.
16See your oracle documetation for more
17information.
18
19You might also need to create the tables by hand
20
21relay table
22
23
24

README.pgsql

1/*
2   $Id: README.pgsql,v 1.15 2007-05-22 03:58:58 rwidmer Exp $
3*/
4--------------------------------------------------------------------------
5
6Using vpopmail with PostgreSQL is not very common.
7The PostgreSQL modules are understood to be functional, but because it not
8as popular as using CDB or MySQL auth systems, you should be wary of
9implementing the PostgreSQL system on a production server.
10
11The PostgreSQL backend has improved greatly as of vpopmail 5.4.8, and many
12have been using it on production servers.
13
14--------------------------------------------------------------------------
15
16If you are upgrading an existing PostgreSQL installation (that is using
17valiases) to version 5.4.8 or later for the first time, please run the
18following script to convert the columns from char to varchar:
19
20BEGIN;
21ALTER TABLE valias RENAME alias TO alias2;
22ALTER TABLE valias RENAME domain TO domain2;
23ALTER TABLE valias RENAME valias_line TO valias_line2;
24ALTER TABLE valias ADD alias varchar(32);
25ALTER TABLE valias ADD domain varchar(64);
26ALTER TABLE valias ADD valias_line varchar(160);
27UPDATE valias SET alias=trim(alias2), domain=trim(domain2),
28valias_line=trim(valias_line2);
29ALTER TABLE valias ALTER alias SET NOT NULL;
30ALTER TABLE valias ALTER domain SET NOT NULL;
31ALTER TABLE valias ALTER valias_line SET NOT NULL;
32ALTER TABLE valias DROP alias2;
33ALTER TABLE valias DROP domain2;
34ALTER TABLE valias DROP valias_line2;
35COMMIT;
36VACUUM ANALYZE valias;
37
38(Thanks to Sven Willenberger for the previous script.)
39
40------------------------------------------------------------------------------
412003/Dec/29 : Michael Bowe <mbowe@pipeline.com.au>
42
43A QUICK GUIDE TO VPOPMAIL WITH POSTGRESQL
44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45Full doc available from :
46http://www.bowe.id.au/michael/isp/vpopmail-postgresql.htm
47
48Note :
49  You should not permit end-users to have shell access to this server.
50  PostgreSQL by default allows any local user to access any database on
51  the server. You can certainly tighten the security of the default
52  PostgreSQL installation, but it is pretty much futile considering that
53  vpopmail stores the PostgresSQL login/pass in the "libvpopmail.a" file.
54  It is straightforward for any knowledgeable local user to be able to
55  extract the user/pass from this file
56
57
58PostgreSQL:
59
60Setup an account for the PostgreSQL server to run under :
61
62	useradd postgres
63
64Download and unpack the source
65
66	cd /usr/local/src
67	wget ftp://ftp.au.postgresql.org/pub/postgresql/v7.3.4/postgresql-7.3.4.tar.gz
68	tar xzf postgresql-7.3.4.tar.gz
69	chown -r root.root postgresql-7.3.4
70	cd postgresql-7.3.4
71
72Compile source (installs to /usr/local/pgsql)
73
74	./configure
75	gmake
76	gmake install
77
78Create the data directory
79
80	mkdir /usr/local/pgsql/data
81	chown postgres /usr/local/pgsql/data
82
83Run the installation script that creates/verifies all the various
84system-use tables etc
85
86	su postgres
87	/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
88
89Fire up the server
90
91	/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data > /usr/local/pgsql/data/serverlog 2>&1 &
92
93At this point the PostgreSQL daemons should be running. A good way
94to verify this is to use this command :
95
96	ps axf
97
98If all is well, you should be able to see something like this :
99
100	388 pts/1 S 0:00 /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
101	389 pts/1 S 0:00   \_ postgres: stats buffer process
102	391 pts/1 S 0:00       \_ postgres: stats collector process
103
104(If you received errors, look in the file /usr/local/pgsql/data/serverlog
105for debugging info)
106
107Configure PostgreSQL so it is running all the time from bootup onwards
108
109	# exit back to the root user from the postgres su
110	exit
111	cp /usr/local/src/postgresql-7.3.4/contrib/start-scripts/linux /etc/rc.d/init.d/postgres
112	chmod 744 /etc/rc.d/init.d/postgres
113	chkconfig --add postgres
114
115vpopmail:
116
117Make the user accounts
118
119	# If you are using RH8.0, you will probably need to run this following command,
120	# because RH8.0 comes preconfigured with UID/GID 89 allocated to postfix
121	#
122	# userdel postfix
123
124	groupadd -g 89 vchkpw
125	useradd -g vchkpw -u 89 vpopmail
126
127	# We recommend you use the user and group id's of 89. The FreeBSD folks
128	# have reserved 89 for the group and 89 for the user for vpopmail.  Feel
129	# free to have the OS assign the group/user id (for example, Solaris won't
130	# allow gid 89).
131
132Download and unpack the source
133
134	cd /usr/local/src
135	wget http://telia.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.4.tar.gz
136	tar xzf vpopmail-5.4.4.tar.gz
137	chown -R root.root vpopmail-5.4.4
138	cd vpopmail-5.4.4
139
140Create the a vpopmail database in PostgreSQL
141
142	/usr/local/pgsql/bin/createdb --username=postgres --owner=postgres vpopmail
143
144Now, build the program with a configure something like this :
145
146	./configure \
147	  --disable-roaming-users \
148	  --enable-logging=p \
149	  --disable-ip-alias-domains \
150	  --disable-passwd \
151	  --enable-clear-passwd \
152	  --disable-domain-quotas \
153	  --enable-auth-module=pgsql \
154	  --disable-many-domains \
155	  --enable-auth-logging \
156	  --enable-sql-logging \
157	  --enable-valias
158
159	make
160	make install-strip
161
162------------------------------------------------------------------------------
163PREVIOUS VPOPMAIL / PGSQL DOCUMENTATION :
164
1652002/02/22 : N.Fung <nfung@classY.jp>
166
167Notes on translating vmysql.c to vpgsql.c
168* strings in SQL statements are enclosed with ' and not ".
169* there is no "replace into" in pgsql.
170* 'user' is a reserved column name! Changed 'user' to 'userid'.
171
172To get it going become DBA of PostgreSQL server. Then:
173
1741. /path/to/pgsql/bin/createuser vpopmail
175
176   (no need to grant vpopmail dba rights)
177
1782. /path/to/pgsql/bin/createdb vpopmail
179
180If you want to change "vpopmail", make sure you edit vpgsql.h and compile.
181
182---ends---
183
184

README.qmail-default

1
2   Please see README.vdelivermail
3

README.quotas

1VPOPMAIL AND MAILDIRQUOTAS                               (updated 16/Jan/2004)
2
3* OVERVIEW
4
5    As of version 5.1.1, vpopmail's quota system was changed to support the
6    Maildir++ specification used by the Courier Mail Server and its standalone
7    components (SqWebmail, Courier-IMAP, maildrop).  The Maildir++
8    specification accounts for mail not only in the user's Maildir/new and
9    Maildir/cur directories, but in maildirfolders as well.  This is good news
10    for people who use vpopmail along with any of the agents mentioned above,
11    as ALL messages should be accounted for.
12
13    See http://inter7.com/courierimap/README.maildirquota.html for details on
14    the Maildir++ specification, maildirquotas, and maildirfolders.
15
16    This was accomplished by integrating a lot of functions from vdeliverquota,
17    a tool shipped with courier-imap (among others) to allow non-Maildir++
18    delivery agents to utilize maildirquotas.
19
20* BACKWARDS COMPATIBLE
21
22   The new system is completely backwards compatible with your existing quota
23   settings.  The main difference you will see is that current usage
24   information is now stored in Maildir/maildirsize rather than
25   Maildir/.current_size.
26
27* CONFIGURATION
28
29    QUOTAS
30
31    Quota settings are still stored in vpopmail's authentication module. Just
32    set them as you have in the past with vmoduser -q or vsetuserquota.  But two
33    different formats are now supported:
34
35    Old vpopmail style: 1000000 or 1MB or 1000KB
36    (1MB quota)
37
38    maildirquota style: 1000000S or 1000000S,1000C
39    (1MB quota, or 1MB Quota / 1000 Message Count limit, whichever comes first)
40
41    While both styles will work with 5.1.1 and above, the maildirquota
42    style will ONLY work with 5.1.1 and above.  If you should downgrade your
43    vpopmail installation to a version below 5.1.1, you'll need to make sure
44    your quota settings are in the Old vpopmail style.
45
46    QUOTA WARN MESSAGES
47
48    You can have a quota warning delivered to a user when their message is
49    delivered successfully, but they are now over 90 percent utilisation.  Just
50    edit quotawarn.msg and copy it to ~vpopmail/domains/.quotawarn.msg.  When
51    90 percent utilisation or more is reached, this message is copied verbatim
52    to their mailbox.
53
54    To change the percentage to something other than 90, edit
55    QUOTA_WARN_PERCENT in vdelivermail.c and recompile.
56
57* DOMAIN QUOTAS
58
59    ** NOTE: Domain quotas are currently broken.  Do not use them. **
60
61    If you want to implement a quota for a whole domain, you have 2 options.
62    You can either put the domain under a unique system id and implement
63    system quotas, or (as of 5.3.18) you can use a non-system domain quota.  To
64    implement the former, just use 'vadddomain -u <system user> <domain>' and
65    set the system quota for that user.  To implement the latter, you must first
66    compile vpopmail with "--enable-domainquotas=y".  Then, you can add this to
67    your .qmailadmin-limits file
68
69        quota 50
70	maxmsgcount 1000
71
72    This would set a total domain quota of 50MB , and a maximum
73    message count of 1000 messages for the entire domain.  Modification of
74    domain quotas should be done with the vmoddomlimits program.
75
76    NOTE: Non-system domain quotas are only enforcable when vdelivermail is the
77    local delivery agent.  If you pipe your mail into anything else, like
78    maildrop, then the non-system domain quota will be ignored.  An alternative
79    would be to install the domain under a unique system user (vadddomain -u)
80    and set system quotas on that account.
81
82* CAVEATS
83
84    MAILDROP
85
86    If you use maildrop for filtering, compile it with maildirquota support
87    if you want to use it with vpopmail 5.1.1 and above with quotas.
88
89    POP SERVERS
90
91    qmail-pop3d does not update maildirsize when you delete messages.
92    Furthermore, when using aliases via .qmail files, qmail-local does not
93    know about Maildir++, so messages delivered directly by qmail-local do not
94    get added to the maildirsize file either.  These problem should correct
95    themselves within 15 minutes according to the Maildir++ specification, but
96    this does not appear to be that reliable yet.
97
98    The best available solution is to patch qmail with qmail-maildir++.patch,
99    included in the contrib directory of the vpopmail source.  It will add
100    Maildir++ support to both qmail-pop3d and qmail-local.
101
102* CREDITS
103
104    deliverquota was written by Sam Varshavchik <mrsam@courier-mta.com>
105    deliverquota -> vpopmail integration by Bill Shupp <hostmaster@shupp.org>
106

README.roamingusers

1If you are considering roaming users, you should seriously consider smtp-auth.
2Linux users can follow Bill Shupp's toaster, and I believe Matt Simerson's toaster
3supports smtp-auth for BSD.
4
5Rick Widmer  20070502
6
7
8========================================================================================
9
10November 2003 : Michael Bowe <mbowe@pipeline.com.au>
11
12VPOPMAIL ROAMING USERS
13~~~~~~~~~~~~~~~~~~~~~~
14Latest version available from :
15http://www.bowe.id.au/michael/isp/webmail-server.htm
16
17
18With qmail, the typical way to control mail relaying is to put a list of
19rules into a file called tcp.smtp. The tcprules program is then used to
20compile this file into cdb database format with the output being stored
21in a file called tcp.smtp.cdb. The tcpserver program is configured (using
22the -x parameter) to read this file and thus know which SMTP clients are
23permitted to relay mail.
24
25This type of configuration works well if there is a known range of IP
26addresses that are permitted to relay mail. eg the IP's on the qmail
27server's local LAN. However if the qmail server needs to provide outbound
28SMTP services for clients who may be connecting from any IP, you are going
29to run into problems. What is needed is some way to automate the process
30of granting users the ability to relay mail, without opening up access
31to all and sundry on the Internet.
32
33vpopmail includes a solution for this problem. The solution is known as
34"roaming users" and is typically implemented with a technique known as
35"POP-before-SMTP". Once a client has successfully authenticated via POP3,
36vpopmail will add the client's IP to a list. vpopmail then merges this
37list with the contents of the tcp.smtp file and runs the tcprules
38program to compile a new version of the tcp.smtp.cdb file. Thus the client
39can now relay mail.
40
41In addition to storing the client's IP address, vpopmail will also store
42the time of authentication. The postmaster uses a cronjob on the qmail
43server to periodically (eg once per hour) run the clearopensmtp program.
44This program scans through the list of roaming clients and removes any
45entries that exceed the nominated age (eg 3 hours). This ensures that
46the list of IPs does not grow out of bounds, and that the roaming IPs
47are closed within a reasonable timeframe after being opened.
48
49configure options for vpopmail that relate to roaming users :
50
51  ./configure \
52  --enable-roaming-users \              <- enable roaming users functionality
53  --enable-tcprules-prog=path \         <- defaults to /usr/local/bin/tcprules
54  --enable-tcpserver-file=path \        <- defaults to /home/vpopmail/etc/tcp.smtp
55  --enable-relay-clear-minutes=minutes  <- defaults to 180
56
57Example /var/qmail/supervise/qmail-smtpd/run file for POP-before-SMTP :
58
59  #!/bin/sh
60  QMAILDUID=`id -u qmaild`
61  NOFILESGID=`id -g qmaild`
62  exec /usr/local/bin/softlimit -m 2000000 \
63    /usr/local/bin/tcpserver -v -x /home/vpopmail/etc/tcp.smtp.cdb -c 40 -R \
64    -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
65    /usr/local/bin/rblsmtpd -b -C -r list.dsbl.org \
66    -t 5 \
67    /var/qmail/bin/qmail-smtpd 2>&1
68
69
70Notes :
71
72qmail servers are typically built with the tcp.smtp files being located in
73the /etc directory. This is not usually suitable for vpopmail roaming
74users, since the /etc directory will (should) not have write permissions
75for the vpopmail user. Therefore it is not going to be possible for vpopmail
76to write out updated versions of the tcp.smtp.cdb file. For use with roaming
77users, it is recommended that the tcp.smtp files are stored in ~vpopmail/etc
78
79If a user auths, and their IP already exists in the roaming IP list,
80the timestamp for the entry is updated, but the tcprules program is not run.
81There is no need to rebuild the tcp.smtp.cdb file as the IP address is
82already permitted to relay. Rebuilding the file will only waste disk and CPU
83time.
84
85If the vpopmail server is using the default cdb authentication backend,
86then the list of roaming IPs will be stored in a file called
87~vpopmail/etc/open-smtp. If the vpopmail server is using the MySQL backend,
88the roaming IPs will be stored in a database table called relay. The SQL
89backend will give better performance on a busy server. Either way though,
90you should be cautious about enabling roaming user functionality on a very
91busy server, as a large amount of disk and CPU will be used with the continual
92rebuilding of the tcp.smtp.cdb file. If the server is busy enough you could
93run into nasty file locking issues which will cause vpopmail password
94authentication to intermittently fail. If you absolutely must have
95POP-before-SMTP functionality on your busy server, then there are only two
96possible solutions that I can think of  : 1) you could try putting the
97tcp.smtp files onto a RAM disk, or 2) use vpopmail's MySQL auth backend
98plus use Matt Simerson's tcpserver patch that allows all of the tcp.smtp
99files to be stored in MySQL
100http://matt.simerson.net/computing/mail/qmail/ucspi-tcp-0.88-mysql.patch
101
102For POP-before-SMTP to work, the POP3 daemon will need to run under the
103tcpserver program. This is because vpopmail uses tcpserver's TCPREMOTEIP
104environment variable to work out what IP address the POP3 user is
105connecting from.
106
107Over time POP-before-SMTP is becoming a less favored way of allowing roaming
108users to relay mail. SMTP-Auth appears to becoming the more preferred option,
109as it scales much more easily on a busy server. However for a small to medium
110sized server, POP-before-SMTP is still quite a workable option. If you would
111like investigate the use of SMTP-Auth, take a look at this patch
112http://www.fehcom.de/qmail/smtpauth.html#PATCHES
113
114IMAP-before-SMTP is possible when using Courier-IMAP v3.x. However it only
115works when configured "--with-authvchkpw --without-authdaemon". When running
116--without-authdaemon, Courier-IMAP's authvchkpw code is able to make use of
117vpopmail's roaming user functions to allow IMAP-before-SMTP functionality.
118IMAP-before-SMTP is not possible when Courier-IMAP has been complied
119--with-authdaemon, because in this mode the user's IP address is not made
120available to the authvchkpw code (the TCPREMOTEIP env var is not set). Also,
121in Courier-IMAP v4.x and later, --without-authdaemon functionality is no
122longer available this preventing IMAP-before-SMTP from working.
123
124----------------------------------------------------------------------------
125
126

README.spamassassin

14/28/2007
2
3* SpamAssassin Support in vdelivermail
4
5Vdelivermail can call spamc during local delivery to a Maildir.  To enable
6this, simply compile vpopmail with --enable-spamassassin=y.  Configure will
7look for the spamc program in /usr/bin and /usr/local/bin.  If it not found,
8you will need to specify the location with the additional
9--enable-spamc-prog='/path/to/spamc' option.
10
11If you want to disable spamc processing for a user or domain, you may do so
12with the vmoduser program:
13
14vmoduser -f user@domain.com
15or
16vmoduser -f domain.com
17
18You may also have vdelivermail discard a message found to be spam.  This also
19can be done with vmoduser:
20
21vmoduser -F user@domain.com
22or
23vmoduser -F domain.com
24
25When compiled with SpamAssassin support, spamc processing defaults to "on" for
26users.  Deleting spam defaults to "off".  If you want to override these
27defaults on a system or per domain basis, these can be set as well with the
28following entries to vlimits.default, or .qmailadmin-limits, respectively:
29
30disable_spamassassin
31delete_spam
32
33If you want to automatically filter mail, see README.maildrop
34
35
36Bill Shupp
37hostmaster@shupp.org
38

README.sybase

1--------------------------------------------------------------------------
2
3Using vpopmail with Sybase is very rare.
4
5The Sybase modules are understood to be functional, but because it not
6as popular as using CDB or MySQL auth systems, you should be very wary
7of implementing the Sybase system on a production server.
8
9--------------------------------------------------------------------------
10
11Edit vsybase.h and set the server, user, password and app information
12

README.vdelivermail

1Vdelivermail is the key to the proper operation of your vpopmail installation.
2When qmail attempts to deliver a message to a vpopmail domain the first thing
3it does is look for a .qmail file that matches the incoming address within the
4top level directory for the domain.  If no such .qmail-* file is found, qmail-local
5executes the .qmail-default file for the domain.  This is the point where vpopmail
6takes over the the delivery process.  Vdelivermail searches the user database for
7the domain, and either delivers the message to one of its existing accounts, or
8looks to its second parameter for instructions on what to do with messages to
9accounts that do not exist.
10
11For vpopmail to operate properly, the .qmail-default file in the domain directory must
12be setup properly.  There should only be one line in the file, and it must look like this:
13
14   | /path/to/vdelivermail '' delivery-instruction
15
16
17   | - The initial pipe tells qmail-local to execute a program.
18
19   /path/to/vdelivermail - This is the program that must be executed.
20
21   ''  This unused, empty parameter is required for historical reasons.
22
23   delivery-instruction must be one of:
24
25      someone@anotherexample.com   - an email address anywhere in the world.
26
27      /path/to/some/Maildir        - a Maildir on the local server that the
28                                     vpopmail user has write access to.
29
30      delete                       - Delete all mail to non-existant users
31
32      bounce-no-mailbox            - Bounce all mail to non-existant users
33
34
35Bounce-no-mailbox is no longer recommended, as it allows your mail server to be used
36in Joe-Jobs.  It now seems better to delete all mail to invalid addresses rather than
37spamming the random senders used by spam-bots.
38
39
40When creating a domain you can use one of the following:
41
42   vadddomain -b someone@anotherexample.com example.com [password]
43
44   vadddomain -b /path/to/some/Maildir example.com [password]
45
46   vadddomain -b delete example.com [password]
47
48   vadddomain -b bounce-no-mailbox example.com [password]
49
50
51
52In summary...  the .qmail-default of every virtual domain MUST contain ONLY a single
53line that executes vdelivermail.  The ONLY place you should EVER call vdelivermail
54is from the .qmail-default file of a vpopmail based virtual domain.  There are
55four possible delivery options for non-existant mailboxes that must be the second
56parameter to vdelivermail.  The empty first parameter is required.
57
58If you are not sure what you are doing writing .qmail files, and mucking around
59the internals of vpopmail, I strongly suggest you leave this file to the programs.
60Qmailadmin is probably the easiest way to manage the .qmail-default file once the
61domain has been created.
62
63Due to the requirement that Maildirs accessed by vpopmail must be owned by vpopmail
64I suggest that if you are going to use vpopmail at all that you place all of your
65domains under vpopmail.  While it is possible to continue to have system users, and
66other styles of qmail virtual domains on a vpopmail system, you really have to be a
67qmail guru to make it all work.
68

README.vlimits

1VPOPMAIL DOMAIN LIMITS                                              (1/15/2004)
2
3* OVERVIEW
4
5    Vpopmail can set certain limits for domains. These limits are stored in
6    the file ".qmailadmin-limits", in the domain's directory (i.e.
7    /home/vpopmail/domains/test.com/.qmailadmin-limits).  Limits can optionally
8    be stored in a mysql table (limits) instead when vpopmail is configured
9    with --enable-mysql-limits.  If .qmailadmin-limits does not exist for a
10    domain (or there is no entry for them in the limits table), then
11    ~vpopmail/etc/vlimits.default is used.  ~vpopmail/etc/vlimits.default
12    *must* be present, and is installed with vpopmail automatically.  You may
13    edit it, but do not remove it.
14
15    Items that can be limited include:
16
17    Default Quota for new users (default_quota, in bytes)
18    Default Maximum Message Count Quota for new users (default_maxmsgcount)
19    Disable POP Access (disable_pop)
20    Disable IMAP Access (disable_imap)
21    Disable Dialup Access (disable_dialup)
22    Disable Password Changing (disable_password_changing)
23    Disable External Relay/Roaming Users (disable_external_relay)
24    Disable SMTP AUTHORIZATION (disable_smtp)
25    Disable SqWebMail Access (disable_webmail)
26
27    The following 2 limits require that you configure vpopmail with
28    --enable-domainquotas=y:
29
30    Quota for Entire Domain (quota, in megabytes)
31    Maximum Message Count for Entire Domain (maxmsgcount)
32
33    In addition, you can set QmailAdmin specific limits on the domain
34    administrator (usually postmaster), such as:
35
36    Maximum Number of Pop Accounts (maxpopaccounts)
37    Maximum Number of Forwards (maxforwards)
38    Maximum Number of Autoresponders (maxautoresponders)
39    Maximum Number of Mailing Lists (maxmailinglists))
40
41    The following QmailAdmin specific items are mentioned in the
42    vlimits.default file, but are NOT YET IMPLEMENTED in QmailAdmin:
43
44    perm_account
45    perm_alias
46    perm_forward
47    perm_autoresponder
48    perm_maillist
49    perm_quota
50    perm_defaultquota
51
52* BACKWARDS COMPATIBILITY
53
54    Before Vpopmail 5.4, vpopmail stored some user limits only in the gid
55    field of the user entry, such as NO_POP, NO_IMAP, etc..   When the
56    .qmailadmin-limits file was used by QmailAdmin (prior to 1.2), it treated
57    these limits as *default* limits, and accordingly set the the gid bit flag
58    of the user entry when creating a user.  This is no longer the case since
59    these are now *domain* limits, and not *default* limits.
60
61    The difference with domain limits is that the gid field is not set when a
62    user is created, so modifying .qmailadmin-limits will immediately reflect
63    on all accounts for the domain.  This is accomplished with a new "virtual"
64    vqpasswd field, pw_flags.  pw_flags is a combination of the gid field, and
65    the domain's limits.
66
67    If the pw_flags field is not present, then the gid field is used for
68    backwards compatibility.
69
70    NOTE:  default_quota and default_maxmsgcount use the default approach
71    described above.  It's also important to add that these limits *replace*
72    the old configure options --enable-defaultquota and --enable-hardquota.
73
74* CONFIGURATION
75
76    Modification of domain limits is done with vmoddomlimits.  If no arguments
77    are given, then usage is displayed.  The -S argument will show the current
78    domain limits.  For example, if I wanted to set limits on test.com, I
79    could issue:
80
81    vmoddomlimits -P 11 -L 2 -g p -q 10485760 test.com
82
83    The above command will limit an administrator logged into QmailAdmin
84    (postmaster) to 11 pop accounts, and 2 mailing lists.  It will also deny
85    pop access, and set the default quota to 10MB (in bytes).  Here's the
86    output of vmoddomlimits -S test.com:
87
88	###############################################################
89	Domain: test.com
90	--
91	Max Pop Accounts: 11
92	Max Aliases: -1
93	Max Forwards: -1
94	Max Autoresponders: -1
95	Max Mailinglists: 2
96	GID Flags:
97	  NO_POP
98	Flags (for commandline): p
99	Flags for non postmaster accounts:
100	  pop account:            DENY_CREATE  DENY_MODIFY  DENY_DELETE
101	  alias:                  ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
102	  forward:                ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
103	  autoresponder:          ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
104	  mailinglist:            ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
105	  mailinglist users:      ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
106	  mailinglist moderators: ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
107	  quota:                  ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
108	  default quota:          ALLOW_CREATE ALLOW_MODIFY ALLOW_DELETE
109	Domain Quota: 0 MB
110	Default User Quota: 10485760 bytes
111	Max Domain Messages: 0
112	Default Max Messages per User: 0
113	###############################################################
114
115	REMINDER: "The Flags for non postmaster accounts:" are NOT yet supported
116    by QmailAdmin
117
118    If you want to edit or show the ~vpopmail/etc/vlimits.default file, just
119    use the -d option with vmoddomlimits program and leave off the domain
120    argument.
121
122    To set unique limits on a single user, you may still manually set the gid
123    flag using vmoduser.  The domain limits are applied in addition to the gid
124    flag limits.  So, if you want to *remove* limits for a certain user, like
125    allow POP access when it is turned off for a whole domain, you'll need to
126    set the V_OVERRIDE flag via vmoduser -o user@test.com.  The V_OVERRIDE
127    flag will override any domain limits that are in place.  The user's gid
128    flag limits will still apply.
129
130* CREDITS
131
132    The original vlimits idea and code was done by Brian Kolaci (bk@kola.com).
133    This document was written by Bill Shupp (hostmaster@shupp.org).
134

README.vpopmaild

1NOTE:  New commands added to daemon, with no mention in the help yet...
2
3get_user_size user@example.com
4
5get_domain_size domain
6
7
8
9==========================================================================
10
11
12Vpopmaild provides a way for authorized clients to perform most of the
13tasks you can do with the vpopmail command line tools, without having
14to ssh into the server and run them by hand.  We are not yet at a point
15where every function available in vqadmin and qmailadmin is available
16from the daemon, but that is the plan.
17
18This documentation is still rough, but it is a start.  It is a
19combination of the original information provided by Ken Jones, the
20original author of vpopmaild, a list of functions available by Rick
21Widmer and some pages from John Simpson's qmail web site:
22
23  http://qmail.jms1.net/
24
25
26If you are looking for step by step instructions for setting up a qmail +
27vpopmail server that includes the daemon, try Bill Shupp's toaster:
28
29   http://shupp.org/toaster/
30
31
32Another source of information on the daemain is Inter7's qmail
33wiki:
34
35  http://qmailwiki.inter7.com/Vpopmaild
36
37
38
39The most basic capability of vpopmaild is to verify whether or not a
40given email address and password are correct.  This can be done with
41the slogin command.  Basically, if the slogin command succeeds, the
42address and password are valid. If not, then they are not valid.  You
43should quit or exit the daemon before you close the connection.
44
45Once you are logged in your personal rights will control which commands
46you can use, and how much of the mail system you can control.  The
47daemon supports creating and deleting domains only for system
48administrators.  Creating addresses, aliasas and such within a domain
49for system and domain administrators.  Anyone can change their password,
50set up a forward or vacation message.  (Try help from various users.)
51
52
53There are at least two projects to replace qmailadmin using the daemon.
54Rick Widmer has one on SourceForge called pmailadmin.  Currently only
55the daemon interface and system library are operational.
56
57   http://pmailadmin.sourceforge.net/
58
59Bill Shupp has announced a project, it is currently only available
60if you email the author.
61
62
63There are five sections to the rest of this document:
64
65  1: Using the service
66
67  2: Command List
68
69  3: Installing the Daemon
70
71  4: Bitmap Values
72
73  5: Interpreting Errors
74
75--------------------------------------------------------------------
76--------------------------------------------------------------------
77--------------------------------------------------------------------
78--------------------------------------------------------------------
79
801 :   U s i n g   t h e   s e r v i c e
81
82
83
84If you don't yet have the daemon running, skip down to section 3,
85Installing the Daemon, and use one of those options to start the daemon.
86Once the service is running, you can test it by telnetting to localhost
87port 89. This is a sample of what it looks like when running as a service
88on port 89.
89
90  $ telnet localhost 89
91  Trying 127.0.0.1...
92  Connected to 127.0.0.1.
93  Escape character is '^]'.
94  +OK
95  login userid@domain.xyz p@ssw3rd
96  +OK+
97  vpopmail_dir /home/vpopmail
98  domain_dir /home/vpopmail/domains/domain.xyz
99  uid 89
100  gid 89
101  name userid
102  comment userid
103  quota NOQUOTA
104  user_dir /home/vpopmail/domains/domain.xyz/userid
105  encrypted_password $1$ZXWVRRi9$X.ZdqlNURS32jD4YdkFkq0
106  clear_text_password
107  no_password_change 0
108  no_pop 0
109  no_webmail 0
110  no_imap 0
111  bounce_mail 0
112  no_relay 0
113  no_dialup 0
114  user_flag_0 0
115  user_flag_1 0
116  user_flag_2 0
117  user_flag_3 0
118  no_smtp 0
119  domain_admin_privileges 0
120  override_domain_limits 0
121  no_spamassassin 0
122  delete_spam 0
123  system_admin_privileges 0
124  .
125  quit
126  +OK
127  Connection closed by foreign host.
128
129As you can see, when you successfully log into the service, it shows
130you pretty much everything about the account you are logged into.  The
131clogin command returns the same information, but does not decode the
132gid_flags bitmap.  This reduces the amount of data transferred by about
13360%.  Think Compact Login.  It does this for all commands that return
134bitmap values for the entire session.  If you are writing a program to
135access the daemon, it is probably easier to decode the bitmap than the
136lines of text.  The bit values are listed in section 4 near the end of
137this file.
138
139
140  $ telnet localhost 89
141  Trying 127.0.0.1...
142  Connected to 127.0.0.1.
143  Escape character is '^]'.
144  +OK
145  clogin userid@domain.xyz p@ssw3rd
146  +OK+
147  vpopmail_dir /home/vpopmail
148  domain_dir /home/vpopmail/domains/domain.xyz
149  uid 89
150  gid 89
151  name userid
152  comment userid
153  quota NOQUOTA
154  user_dir /home/vpopmail/domains/domain.xyz/userid
155  encrypted_password $1$ZXWVRRi9$X.ZdqlNURS32jD4YdkFkq0
156  clear_text_password
157  gidflags 196608
158  .
159  quit
160  +OK
161  Connection closed by foreign host.
162
163
164When all you need to know is if the current login is valid, use the slogin
165command.  Think Silent Login.  All this returns is +OK if the user exists
166and the password is valid or -ERR if either is incorrect.  You should send
167the quit command before you disconnect from the service.
168
169  $ telnet 127.0.0.1 89
170  Trying 127.0.0.1...
171  Connected to 127.0.0.1.
172  Escape character is '^]'.
173  +OK
174  login userid@domain.xyz p@ssw3rd
175  +OK
176  quit
177  +OK
178  Connection closed by foreign host.
179
180
181A few things are worth mentioning here...
182
183The help command will show you a list of all of the commands that you have
184permission to use.  Help can be used before or after login.  There are
185three kinds of users with increasing commands that they can use.
186
187A simple user can change their password, create forwards and mail robots,
188and maintain a set of .vpopmail-extension files similar to the .qmail-extension
189capability of qmail-local.
190
191If the domain_admin_privileges flag is set to 1, you are able to administer
192any mailbox within the domain of your account (i.e. if you are logged in as
193postmaster@domain.xyz you will be able to create, delete, and modify
194mailboxes within the domain.xyz domain.
195
196If the system_admin_privileges flag is set to 1, you are able to administer
197any mailbox on the system, plus list, add, remove, and otherwise administer
198entire domains.
199
200The various flags associated with each account are manipulated using the
201mod_user command within the service, or using the vmoduser command line
202program. For example, to set the domain_admin_privileges flag for an
203account, you can use the following command:
204
205As root...
206
207  # vmoduser -a postmaster@domain.xyz
208
209You can run vmoduser by itself to see the list of flags which can be set.
210Note that some of the flags may not have any effect on your system,
211depending on how vpopmail was compiled.
212
213Be very careful with the -S option (which sets the system_admin_privileges
214flag.)  If you are going to have user with system admin rights, you might
215want to create a domain with an illegal name like  illegal.xyz  vpopmaild
216will allow you to login, but there is no way to send email to this domain.
217
218  #  vadddomain illegal.xyz postmaster-password
219  #  vmoduser -S postmaster@illegal.xyz
220
221
222
223--------------------------------------------------------------------
224--------------------------------------------------------------------
225--------------------------------------------------------------------
226--------------------------------------------------------------------
227
2282 :    C o m m a n d s
229
230
231
232consider ordering commands from lesser rights to more rights.
233
234NOTE: mod_user is the one with the breakdown of the gidflage bitmap.
235
236
237--------------------------------------------------------------------
238
239login user@domain.ext password  - verbose user/domain attributes
240clogin user@domain.ext password - compact user/domain attributes
241slogin user@domain.ext password - silent, just return success or
242                                  failure of login
243
244Rights required: Must be a valid email address.
245
246Action:	Verify the username and password of the person desiring to
247	login, and set their access rights.
248
249	For the "login" command, a successful login will return a
250	full list of the user's information.
251
252	For the "clogin" command, a successful login wil return a
253	compact version of the user's information- bitmap values
254	are returned as a single numeric value instead of a line
255	for each bit used. This reduces data transfer, but requires
256	the client to split up the bitmap.
257
258	For the "slogin" command, a successful login only returns
259	the "+OK " response, with no additional information. This
260	is useful in cases where the client does not need to know
261	anything other than whether or not the login attempt was
262	successful (i.e. for the SMTP AUTH command.)
263
264--------------------------------------------------------------------
265
266add_user user@domain.ext password
267
268Rights required: SA_ADMIN, or QA_ADMIN
269
270Action:  Add a new mailbox and user to the specified domain.  ONLY SA_ADMIN
271can add users to domains other than the home domain of the login user.
272
273
274--------------------------------------------------------------------
275
276del_user  user@domain.ext
277
278Rights required: SA_ADMIN, or QA_ADMIN
279
280Action:  Delete a mailbox and user from the specified domain.  ONLY SA_ADMIN
281can delete users from domains other than the home domain of the login user.
282
283
284--------------------------------------------------------------------
285
286mod_user user@domain.ext
287
288Rights required: Only SA_ADMIN can modify users outside
289the login user's home domain.  Only QA_ADMIN can modify other users.
290Any user can modify part of their own data.
291
292Action:  Modify a user account.
293
294The mod_user command is followed by any number of the following options,
295one per line, followed by a line containing only a '.'.  Each flag except
296the clear_all_flags expects a 0 or 1 to set the value of the flag.
297
298Anyone can set these values:
299
300comment - The full name of the user.
301
302clear_text_password - Pass it a clear text password, and it will set both
303                      the clear_text_password and the encrypted_password
304                      field.  It handles encrypting the password internally.
305
306no_spamassassin - Do not run SpamAssasin for this user, if it is set to
307                  be run for users of this domain.
308
309delete_spam - If set, mail identified as spam for this user will be deleted.
310
311
312The QA_ADMIN or SA_ADMIN can change these values:
313
314
315Only a SA_ADMIN or QA_ADMIN with override rights can change these values:
316
317quota - Number of messages they can store.
318
319clear_all_flags - reset all the following flag values to 0.
320
321no_password_change - The user can not change their own password.
322
323no_pop - The user can not access mail via pop.
324
325no_webmail - The user can not access mail via a webmail program.
326
327no_imap - The user can not access mail via imap.
328
329bounce_mail - I'm not sure, but it sounds like a flag to bounce all
330              mail to this user.
331
332no_relay - I'm not sure, but it sounds like a flag to block use of SMTP
333           for this user for mail leaving the server.
334
335no_dialup - This is used by the optional radius server as a flag to stop
336            radius from allowing this user to login to a modem.
337
338user_flag_0 - Set and check this flag for anything you want.
339
340user_flag_1 - Set and check this flag for anything you want.
341
342user_flag_2 - Set and check this flag for anything you want.
343
344user_flag_3 - Set and check this flag for anything you want.
345
346no_smtp - I'm not sure.
347
348domain_admin_privileges - allow this user limited access to their home domain.
349
350override_domain_limits - Allow this user to change domain limits on their
351                         own domain.  Probably also requires domain_admin.
352
353
354Only a SA_ADMIN can change these values:
355
356encrypted_password - an already encrypted password.  This only sets the
357                     encrypted password field.
358
359system_admin_privileges - allow this user full access to all domains.
360
361system_expert_privileges - allow this user to edit .qmail files.
362
363
364
365--------------------------------------------------------------------
366
367user_info user@domain.ext
368
369Rights required: SA_ADMIN, or QA_ADMIN
370
371Action:  Return information about a user.
372
373The following items are returned as a string.
374
375name - User name, same as user part of address selected.
376
377comment - Usually the long name of the user.
378
379quota - How much disk space the user is allowed.
380
381user_dir - The home directory for the user.
382
383encrypted_password - The encrypted value of the password.
384
385clear_text_password - The password in clear text.
386
387
388The following values are returned as the character '1' or '0'. '1'
389says the field is active - for example, an active no_password_change field
390means the user can not change passwords.
391
392no_password_change, no_pop, no_webmail, no_imap, bounce_mail, no_relay,
393no_dialup, user_flag_0, user_flag_1, user_flag_2, user_flag_3, no_smtp
394
395
396The following items confer extra privileges to the user. A '1' says that
397the user has that right.
398
399domain_admin_privileges, override_domain_limits, system_admin_privileges
400
401
402The following items control the operation of Spamassassin.
403no_spamassassin, delete_spam
404
405
406--------------------------------------------------------------------
407
408add_domain domain password
409
410Rights required: SA_ADMIN
411
412Action:  Add a new, real domain.  The postmaster user is automatically
413created, and cannot be deleted.  The password given is assigned to the
414postmaster user.
415
416
417--------------------------------------------------------------------
418
419add_alias_domain domain alias
420
421Rights required: SA_ADMIN
422
423Action:  Add an alias to an existing domain.  Qmail will recognize
424the alias domain name, but all incoming mail to that domain will
425be sent to the real domain.  Currently the order of the parameters
426must be correct.  Consider stealing code from vaddaliasdomain so
427it doesn't matter what order you enter them in.
428
429
430--------------------------------------------------------------------
431
432del_domain domain
433
434Rights required: SA_ADMIN
435
436Action:  Delete a domain from the system.  If the domain is an alias
437it will delete only the alias.  If the domain has aliases, the domain
438and all of its aliases will be deleted.  If you want to warn the user
439of your program when alias domains exist, YOU will have to do it yourself
440by using dom_info() to check the status of the domain in question.
441
442
443--------------------------------------------------------------------
444
445dom_info domain
446
447Rights required: SA_ADMIN
448
449Action: return internal information about a domain.  The information
450returned includes: domain directory, userid, groupid, number of users.
451If you ask for an alias domain, you will receive information for the
452parent domain.  Part of that information will include a list of all
453alias names of the parent domain.
454
455
456--------------------------------------------------------------------
457
458find_domain domain per_page
459
460Rights required: SA_ADMIN
461
462Action: Return the page number that the named domain appears on only if the
463domain exists.  Otherwise, just "." is returned.  This can be used when you are
464using list_domains with the optional page and lines_per_page parameters.  If
465you list the page returned by find_domain, the desired domain will appear on
466that page. It may not be at the top of the page.  The page positions are fixed.
467If no per_page argument is given, it defaults to one item per_page.  Page
468numbers start at 1.
469
470--------------------------------------------------------------------
471
472domain_count
473
474Rights required: SA_ADMIN
475
476Action:  Return the number of domains.  This can be used to determine
477the number of pages of domain information that is available.
478
479
480--------------------------------------------------------------------
481
482user_count domain
483
484Rights required: SA_ADMIN, QA_ADMIN. QA_ADMIN can only manage their
485own domain.
486
487Action: Return the number of accounts in a domain.  This can be used to
488determine the number of pages of user account information that is available.
489
490
491
492--------------------------------------------------------------------
493
494mk_dir directory
495
496Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
497their own domain.  USER can only work within their home directory.
498
499Action:  Create a directory.
500
501Directory can be specified as a real path starting at root, as a domain
502name, or as an email address.  When a domain name is specified, that
503is replaced by the path to the domain directory for that domain.  When
504an email address is specified, that starts at the home directory for
505that email address.
506
507
508--------------------------------------------------------------------
509
510rm_dir directory
511
512Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
513their own domain.  USER can only work within their home directory.
514
515Action:  Remove a directory
516
517Directory can be specified as a real path starting at root, as a domain
518name, or as an email address.  When a domain name is specified, that
519is replaced by the path to the domain directory for that domain.  When
520an email address is specified, that starts at the home directory for
521that email address.
522
523
524--------------------------------------------------------------------
525
526list_dir directory
527
528Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
529their own domain.  USER can only work within their home directory.
530
531Action:  List the contents of a directory.
532
533Directory can be specified as a real path starting at root, as a domain
534name, or as an email address.  When a domain name is specified, that
535is replaced by the path to the domain directory for that domain.  When
536an email address is specified, that starts at the home directory for
537that email address.
538
539Directory contents are returned one per line, with an indication of the
540type of directory entry.  For example:
541
542Maildir dir
543lastauth file
544
545The possible type values are: file, dir, chardev, blkdev, fifo,
546link, sock, unknown.
547
548
549--------------------------------------------------------------------
550
551rm_file filename
552
553Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
554their own domain.  USER can only work within their home directory.
555
556Action:  Remove a file.
557
558Directory can be specified as a real path starting at root, as a domain
559name, or as an email address.  When a domain name is specified, that
560is replaced by the path to the domain directory for that domain.  When
561an email address is specified, that starts at the home directory for
562that email address.
563
564
565--------------------------------------------------------------------
566
567write_file filename
568
569Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
570their own domain.  USER can only work within their home directory.
571
572Action:  Write lines to a file.
573
574Filename can be specified as a real path starting at root, as a domain
575name, or as an email address.  When a domain name is specified, it
576is replaced by the path to the domain directory for that domain.  When
577an email address is specified, that starts at the home directory for
578the email address.
579
580File contents are sent, one line sent to the daemon for each line
581to add to the file.  After the last line send a line containing only
582a period '.' to mark the end of file.
583
584
585--------------------------------------------------------------------
586
587stat_file filename
588
589Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
590their own domain.  USER can only work within their home directory.
591
592Action: Stat a file.
593
594Filename can be specified as a real path starting at root, as a domain
595name, or as an email address.  When a domain name is specified, it
596is replaced by the path to the domain directory for that domain.  When
597an email address is specified, that starts at the home directory for
598the email address.
599
600Currently only the UID of the owner of the file is returned if it exists
601or an error (2202) is returned.  It seems to me this should be extended
602to include at least access rights in octal, size, owner group, last access,
603last mod, last change.
604
605
606--------------------------------------------------------------------
607
608read_file filename
609
610Rights required: SA_ADMIN, QA_ADMIN or USER.  QA_ADMIN can only work within
611their own domain.  USER can only work within their home directory.
612
613Action:  Read lines from a file.
614
615Filename can be specified as a real path starting at root, as a domain
616name, or as an email address.  When a domain name is specified, it
617is replaced by the path to the domain directory for that domain.  When
618an email address is specified, that starts at the home directory for
619the email address.
620
621File contents are received, one line from the daemon for each line
622in the file.  After the last line of the file a line containing only
623a period '.' is sent to mark the end of file.
624
625
626
627--------------------------------------------------------------------
628
629list_domains [page lines_per_page]
630
631Rights required: SA_ADMIN
632
633Action:  List all domains on the system, and their parent domain.
634If the optional page is given, lines_per_page must also be specified.
635When both are given, the data is broken up into pages with lines_per_page
636lines on each.  The page returned is specified by page.
637
638Alias domains are identified by the fact that the domain name does
639not match the real domain name.
640
641
642--------------------------------------------------------------------
643
644list_users domain [page lines_per_page]
645
646Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only manage their
647                 own domain.
648
649Action:  List all Mailbox accounts for a domain.
650
651It returns the same info about a user as something else.  Find it and
652copy the info here.  If the optional page is given, lines_per_page must
653also be specified.  When both are given, the data is broken up into
654pages with lines_per_page lines on each.  The page returned is
655specified by page.
656
657
658--------------------------------------------------------------------
659
660list_alias domain
661
662Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only manage their
663                 own domain.
664
665Action:  List all aliases for a domain.  Currently, this scans the directory
666         for aliases.  It needs to be changed to use the new valias calls
667         Tom just added.
668
669
670List all Mailbox accounts for a domain.
671
672
673--------------------------------------------------------------------
674
675list_lists domain
676
677Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only manage their
678                 own domain.
679
680Action:  Send a list of all mailing lists within a domain.  One entry
681per line, with a line containing only a '.' at the end.
682
683
684--------------------------------------------------------------------
685
686get_ip_map ip_address
687
688Rights required: Anyone
689
690Action: Return the domain associated with this IP Address, if any.
691
692
693--------------------------------------------------------------------
694
695add_ip_map ip_address domain
696
697Rights required: SA_ADMIN
698
699Action:  Make an IP address point to a domain.
700
701WARNING:  It does not look like there is any duplicate checking on
702this, so make sure what you enter is valid!  I think I once got the
703IP and name backwards, and it was stored that way.  The error checking
704belongs in the vpopmail library.
705
706
707--------------------------------------------------------------------
708
709del_ip_map ip_address domain
710
711Rights required: SA_ADMIN
712
713Action:  Delete an association between an IP address and a domain name.
714
715
716--------------------------------------------------------------------
717
718show_ip_map
719
720Rights required: SA_ADMIN
721
722Action:  Display the mapping between IP addresses and domain names.
723
724
725--------------------------------------------------------------------
726
727get_limits domain
728
729Rights required: Any.  SA_ADMIN can read all domains, all other users
730                 can only read their own domain.
731
732Action:  Return Limits information for a domain.  If no special limits
733         are set, it returns the default limit settings for all domains.
734         Find out where these files are kept, and add it here.
735
736max_popaccounts
737max_aliases
738max_forwards
739max_autoresponders
740max_mailinglists
741maxmailinglists
742disk_quota
743max_msgcount
744default_quota
745default_maxmsgcount
746disable_pop
747disable_imap
748disable_dialup
749disable_password_changing
750disable_webmail
751disable_external_relay
752disable_smtp
753disable_spamassassin
754delete_spam
755perm_account
756perm_alias
757perm_forward
758perm_autoresponder
759perm_maillist
760perm_quota
761perm_defaultquota
762
763
764--------------------------------------------------------------------
765
766set_limits domain
767
768Rights required: SA_ADMIN, or QA_ADMIN with override_domain_limits rights.
769
770Action:  Set Limits informaiton for a domain.
771
772max_popaccounts
773max_aliases
774max_forwards
775max_autoresponders
776max_mailinglists
777maxmailinglists
778disk_quota
779max_msgcount
780default_quota
781default_maxmsgcount
782disable_pop
783disable_imap
784disable_dialup
785disable_password_changing
786disable_webmail
787disable_external_relay
788disable_smtp
789disable_spamassassin
790delete_spam
791perm_account
792perm_alias
793perm_forward
794perm_autoresponder
795perm_maillist
796perm_quota
797perm_defaultquota
798
799
800--------------------------------------------------------------------
801
802del_limits domain
803
804Rights required: SA_ADMIN
805
806Action:  Delete the limits file for a domain.  This will make the
807         domain revert to the global limits set somewhere. (Find
808         out where, and add it here.)
809
810
811--------------------------------------------------------------------
812
813get_lastauth user@domain.ext
814
815Rights required: Any.  SA_ADMIN can list any user, QA_ADMIN can list
816                 any user in their domain, USER can list only their
817                 own.
818
819Action:  Return the last time and IP address from the last time the
820user logged in.
821
822
823--------------------------------------------------------------------
824
825get_lastauthip     --    D E L E T E D !
826
827Merged with get_lastauth, use it instead.
828
829
830--------------------------------------------------------------------
831
832add_list
833
834Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only work in
835                 its home domain.
836
837Action:  Add an ezmlm mailing list.  Not implemented yet.
838
839
840--------------------------------------------------------------------
841
842del_list
843
844Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only work in
845                 its home domain.
846
847Action:  Delete an ezmlm mailing list.  Not implemented yet.
848
849
850--------------------------------------------------------------------
851
852mod_list
853
854Rights required: SA_ADMIN, or QA_ADMIN.  QA_ADMIN can only work in
855                 its home domain.
856
857Action:  Modify an ezmlm mailing list.  Not implemented yet.
858
859
860--------------------------------------------------------------------
861
862quit, exit, q
863
864Rights required: Any
865
866Action:  Shutdown the daemon.  You should always call this before
867         exiting the program communicating with the daemon.
868
869
870--------------------------------------------------------------------
871
872help
873
874Rights required: Any
875
876Action:	Display a list of the commands currently available to the
877	client. The list will adjust itself to match the access
878	rights of the userid with which the client is logged in.
879	If the client is not logged in yet, only the "login",
880	"clogin", "slogin", "help", and "quit" commands are shown.
881
882
883
884
885--------------------------------------------------------------------
886--------------------------------------------------------------------
887--------------------------------------------------------------------
888--------------------------------------------------------------------
889
890
8913 :    R u n n i n g   v p o p m a i l d
892
893
894For a simple quick test, just run the daemon at the command line.
895
896As root...
897
898  # ./vpopmaild
899
900
901To run under tcpserver temporarily from the command line:
902
903As root...
904
905  # tcpserver -vHRD 0 89 ./vpopmaild
906
907
908Running vpopmaild under daemontools is the only way to run it as a
909mission critical service.
910
911There is one important difference between this script and a "generic"
912script which usually sets up a service listening on IP address "0", or
913listening on every interface on the server. This is a MAJOR security
914hole- allowing clients to connect across the network allows somebody
915with a packet sniffer to watch every byte which goes across the wire-
916including passwords. This script sets up a service which only listens
917on 127.0.0.1, which on most systems is the "localhost" interface- which
918means that the packets never physically leave the machine, and
919therefore cannot be "sniffed" by other machines.
920
921Setting up the service
922
923Note that the commands below assume that your daemontools services are
924physically running in the /var/service directory.  If you keep your
925services somewhere else, or want to set up your own service directory
926somewhere, that works as well- just make sure that the physical location
927is not under /service or you will not be able to reliably stop the
928service when needed.
929
930As root...
931
932  # mkdir -m 1755 /var/service/vpopmaild
933  # cd /var/service/vpopmaild
934
935Copy the following lines into a file named run in the directory you
936just created.  Don't include the  --- lines in the file, they just
937show the beginning and end of the file.
938
939---------------------------------------------------------------------
940#!/bin/sh
941exec 2>&1
942exec env - PATH="/usr/bin:/bin:/usr/local/bin" \
943     tcpserver -vHRD 127.0.0.1 89 ~vpoppmail/bin/vpopmaild
944---------------------------------------------------------------------
945
946  # chmod 755 run
947  # mkdir -m 755 log
948  # cd log
949
950Copy the following lines into a file named run in the directory you
951just created.
952
953---------------------------------------------------------------------
954#!/bin/sh
955VQ="/var/qmail"
956exec env - PATH="$VQ/bin:/usr/local/bin:/usr/bin:/bin" \
957     multilog t n1024 s1048576 ./mail \
958     '-*' '+*ver: status:*' =lstatus
959---------------------------------------------------------------------
960
961  # chmod 755 run
962  # ln -s /var/service/vpopmaild /service/
963
964Wait a few seconds...
965
966  # svstat /service/vpopmaild
967  /service/vpopmaild: up (pid 22457) 7 seconds
968  /service/vpopmaild/log: up (pid 22460) 7 seconds
969
970
971
972Using the service
973
974Once the service is running, you can test it by telnetting to localhost
975port 89.  Go back to the section on Running the deamon for an example
976session.
977
978
979
980--------------------------------------------------------------------
981--------------------------------------------------------------------
982--------------------------------------------------------------------
983--------------------------------------------------------------------
984
9854 :     B i t m a p   d e f i n i t i o n
986
987
988
989This appeared early in the discussion leading to the daemon, so
990until I find a better place for it, I'll add it here.  The important
991thing is the comments on what each bit is supposed to mean.  This
992may get re-worked into documentation on the daemon.
993
994
995List of bits in the gid or flags field for a user, from a message
996from Ken on the vpopmail list.
997
998
999I'll try to give a detailed listing.
1000#define NO_PASSWD_CHNG 0x01
1001If set, the code should not allow the password to be changed
1002
1003#define NO_POP         0x02
1004If set, reject pop authentications
1005
1006#define NO_WEBMAIL     0x04
1007If set, reject webmail authentications
1008
1009#define NO_IMAP        0x08
1010If set, reject imap authentications
1011
1012#define BOUNCE_MAIL    0x10
1013If set, bounce any incoming mail back to the sender
1014
1015#define NO_RELAY       0x20
1016If set, do not allow the account to relay email.
1017This is useful for sites that want to have email accounts that
1018are only allowed to send email internally.
1019
1020#define NO_DIALUP      0x40
1021If set, code should not allow dialup access. This was originally
1022added to support radius sites.
1023
1024#define V_USER0       0x080
1025#define V_USER1       0x100
1026#define V_USER2       0x200
1027#define V_USER3       0x400
1028After adding the NO_DIALUP flag we realized there may be other
1029flags people will want that are not directly used by any email code.
1030
1031#define NO_SMTP       0x800
1032If set, do not allow smtp connections.
1033
1034#define QA_ADMIN     0x1000
1035If set, the user is granted admin privileges in qmailadmin
1036
1037#define V_OVERRIDE   0x2000
1038If set, the user is not subject to domain limits. Part of the
1039vlimit code.
1040
1041#define NO_SPAMASSASSIN 0x4000
1042If set, (and --enable-spamassassin=y) do not process the
1043incoming mail through spamassassin.
1044
1045#define DELETE_SPAM  0x8000
1046with --enable-spamasssassin=y setting this flag
1047will delete all email above the users required_hits
1048preference.
1049
1050
1051==============================================================================
1052The original readme from Ken:
1053
1054To run as daemon:
1055tcpserver -vHRD 0 89 ./vpopmaild
1056
1057Then as client
1058telnet localhost 89
1059
1060Or to run on the command line for testing
1061./vpopmaild
1062
1063First login. example:
1064login postmaster@example.com password
1065
1066Then for list of commands:
1067help
1068
1069
1070--------------------------------------------------------------------
1071--------------------------------------------------------------------
1072--------------------------------------------------------------------
1073--------------------------------------------------------------------
1074
10755 :     E r r o r    M e s s a g e    F o r m a t
1076
1077
1078Error messages are in the form  ERR- major.minor message
1079
1080Major is the error code that identifies what kind of error has been encountered,
1081and determines which message is displayed.  Minor is a number that identifies
1082which test within the source code triggered the error message.  The last two
1083digits should indicate the error number within a function, and the rest should
1084identify which function the failure happened in.  You can search the source
1085code with this value to find the point where an error happened.
1086
1087
1088The actual error messages are stored in the file vpopmaild.msg for easy translation.
1089Once there are other language files, I'll create a directory to store the various
1090language files, and use a symlink to select a language.  Error messages are set
1091at compile time.
1092
10930.X represents a message passed up from vpopmaild primitives, and does not otherwise
1094follow the standard error reporting structure.  (yet?)
1095

README.vqmaillocal

1** vqmaillocal has not been actively maintained and should not be used. **
2
3vqmaillocal is a developmental replacement for
4qmail-local. It will currently deliver email to
5vpopmail existing vpopmail users.
6
7Todo:
81) process .qmail-"user" files and .qmail-default file
9
10
11How to install:
12
131) mv /var/qmail/bin/qmail-local /var/qmail/bin/qmail-local.orig
14
152) cp vqmaillocal /var/qmail/bin/qmail-local
16
17done
18
19
20