diff -r b5bb7b34e831 -r b17a9d7a59ae INSTALL --- a/INSTALL Wed Jun 27 20:15:06 2012 +0000 +++ b/INSTALL Wed Jun 27 20:20:00 2012 +0000 @@ -37,20 +37,20 @@ # reload configuration /etc/init.d/postgresql-8.4 force-reload -* Create a DB user if necessary: - DB Superuser: +* Create a database superuser if necessary: + # as root run: su - postgres + # if you have sudo privileges run: sudo su - postgres + # create your superuser, which will be able to create users and databases createuser -s -d -r -E -e -P $USERNAME - DB User: - createuser -d -E -e -P $USERNAME -* Create Database and db users for vmm, Postfix and Dovecot +* As superuser create the database and db users for vmm, Postfix and Dovecot connecting to PostgreSQL: psql template1 # create users, group and the database - CREATE USER vmm ENCRYPTED PASSWORD 'DB PASSWORD for vmm'; - CREATE USER dovecot ENCRYPTED password 'DB PASSWORD for Dovecot'; - CREATE USER postfix ENCRYPTED password 'DB PASSWORD for Postfix'; + CREATE ROLE vmm LOGIN ENCRYPTED PASSWORD 'DB PASSWORD for vmm'; + CREATE ROLE dovecot LOGIN ENCRYPTED password 'DB PASSWORD for Dovecot'; + CREATE ROLE postfix LOGIN ENCRYPTED password 'DB PASSWORD for Postfix'; CREATE ROLE mailsys WITH USER postfix, dovecot, vmm; CREATE DATABASE mailsys WITH OWNER vmm ENCODING 'UTF8'; \q @@ -58,18 +58,16 @@ # connect to the new database psql mailsys vmm -W -h 127.0.0.1 # either import the database structure for Dovecot v1.0.x/v1.1.x - \i /path/to/create_tables.pgsql - # or import the database structure for Dovecot v1.2.x - \i /path/to/create_tables-dovecot-1.2.x.pgsql - - # set permissions - GRANT SELECT ON dovecot_password, dovecot_user TO dovecot; - GRANT SELECT ON postfix_alias, postfix_gid, postfix_maildir, - postfix_relocated, postfix_transport, postfix_uid TO postfix; - + \i vmm-y.x.z/pgsql/create_tables.pgsql + # or import the database structure for Dovecot v1.2.x/v2.x + \i vmm-x.y.z/pgsql/create_tables-dovecot-1.2.x.pgsql # leave psql \q + # set permissions for your Dovecot and Postfix users + # see python set-permissions.py -h for details + python vmm-x.y.z/pgsql/set-permissions.py -a -H 127.0.0.1 -U vmm + Create directory for your mails mkdir /srv/mail cd /srv/mail/ @@ -77,7 +75,9 @@ chmod 771 /srv/mail chmod 751 /srv/mail/* -Configuring Dovecot + +For Dovecot >= 2.0 read the file Configure.Dovecot_2 +Configuring Dovecot v1.x * /etc/dovecot/dovecot.conf # all your other settings @@ -103,7 +103,7 @@ mode = 0600 } client { - path = /var/spool/postfix/private/auth + path = /var/spool/postfix/private/dovecot-auth mode = 0660 user = postfix group = postfix @@ -114,12 +114,15 @@ * /etc/dovecot/dovecot-sql.conf driver = pgsql connect = host=localhost dbname=mailsys user=dovecot password=$Dovecot_PASS - default_pass_scheme = PLAIN - password_query = SELECT "user", password FROM dovecot_password WHERE "user"='%Lu' AND %Ls - user_query = SELECT home, uid, gid, mail FROM dovecot_user WHERE userid = '%Lu' + default_pass_scheme = CRAM-MD5 + password_query = SELECT userid AS "user", password FROM dovecotpassword('%Ln', '%Ld') WHERE %Ls + user_query = SELECT home, uid, gid, mail FROM dovecotuser('%Ln', '%Ld') Provide a root SETUID copy of Dovecot's deliver agent for Postfix +/!\ Only required with Dovecot v.1.x. + With Dovecot >= v2.0 use Dovecot's lmtp! + mkdir -p /usr/local/lib/dovecot chmod 700 /usr/local/lib/dovecot chown nobody /usr/local/lib/dovecot @@ -133,7 +136,8 @@ Configuring Postfix's master.cf - + +/!\ Only required with Dovecot v.1.x. # Add Dovecot's deliver agent dovecot unix - n n - - pipe flags=DORhu user=nobody argv=/usr/local/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} @@ -144,23 +148,28 @@ # relocated users from the database #relocated_maps = pgsql:/etc/postfix/pgsql-relocated_maps.cf + # transport settings from our database + transport_maps = pgsql:/etc/postfix/pgsql-transport_maps.cf + # virtual domains virtual_mailbox_domains = pgsql:/etc/postfix/pgsql-virtual_mailbox_domains.cf virtual_alias_maps = pgsql:/etc/postfix/pgsql-virtual_alias_maps.cf - transport_maps = pgsql:/etc/postfix/pgsql-transport.cf virtual_minimum_uid = 70000 virtual_uid_maps = pgsql:/etc/postfix/pgsql-virtual_uid_maps.cf virtual_gid_maps = pgsql:/etc/postfix/pgsql-virtual_gid_maps.cf virtual_mailbox_base = / virtual_mailbox_maps = pgsql:/etc/postfix/pgsql-virtual_mailbox_maps.cf - # dovecot LDA - dovecot_destination_recipient_limit = 1 - virtual_transport = dovecot: + # dovecot LDA (only recommended with Dovecot v1.x) + #dovecot_destination_recipient_limit = 1 + #virtual_transport = dovecot: + + # dovecot lmtp + virtual_transport = lmtp:unix:private/dovecot-lmtp # dovecot SASL smtpd_sasl_type = dovecot - smtpd_sasl_path = private/auth + smtpd_sasl_path = private/dovecot-auth smtpd_sasl_auth_enable = yes # Keep smtpd_sasl_local_domain identical to Dovecot's auth_default_realm: # empty. Both are empty by default. Let it commented out. @@ -178,7 +187,7 @@ Installing the Virtual Mail Manager and configure the rest - Installing from Mercurial or vmm-x.y.z.tar.bz2 + Installing from Mercurial or vmm-x.y.z.tar.gz after cloning from the hg repo or extracting the archive change into the new directory and type: ./install.sh @@ -187,8 +196,14 @@ reload postfix # configure the Virtual Mail Manager + # vmm.cfg(5) - configuration file for vmm + # + # For Dovecot v1.x use 'dovecot:' as domain.transport + # When using Dovecot v2.x use 'lmtp:unix:private/dovecot-lmtp' as + # domain.transport vmm configure # for help type + # vmm(1) - command line tool to manage email domains/accounts/aliases vmm help