Groupware Server With Group-Office, Postfix, Dovecot And SpamAssassin On Debian Lenny (5.0) - Page 3

Set up SpamAssasin

# groupadd -g 5001 spamd
# useradd -u 5001 -g spamd -s /sbin/nologin -d /var/lib/spamassassin spamd
# mkdir /var/lib/spamassassin
# chown spamd:spamd /var/lib/spamassassin

To start the server in /etc/default/spamassassin set:

ENABLED=1

You can tweak SpamAssassin yourself in /etc/spamassassin/local.cf.

 

Set up vacation

The vacation script is a Perl script that will handle automtic replies when a user is out of office.

Copy scripts/vacation.pl to /var/spool/vacation/vacation.pl and edit the database connection properties.

# mkdir /var/spool/vacation
# useradd -r -d /var/spool/vmail -s /sbin/nologin -c "Virtual vacation" vacation
# chown -R vacation:vacation /var/spool/vacation/
# chmod 700 /var/spool/vacation/
# chmod 750 /var/spool/vacation/vacation.pl
# touch /var/log/vacation.log /var/log/vacation-debug.log
# chown vacation:vacation /var/log/vacation*

Create /etc/postfix/transport. Make sure the domain matches the postfixadmin_autoreply_domain you configured in the Group-Office config.php file before.

autoreply.example.com vacation:

 

Set up Dovecot

Dovecot is a fast IMAP deamon and it can also check user quota and filter Spam to the spam folder. Change / add these values to /etc/dovecot.conf:

#Enable IMAP and IMAPS
protocols = imap imaps 
#Listen on all IP addresses
listen = *
#configure the location of our virtual mailboxes
mail_location = maildir:/vmail/%d/%u
# Group to enable temporarily for privileged operations. Currently this is
# used only for creating mbox dotlock files when creation fails for INBOX.
# Typically this is set to "mail" to give access to /var/mail.
#mail_privileged_group =
mail_privileged_group = mail
# Grant access to these supplementary groups for mail processes. Typically
# these are used to set up access to shared mailboxes. Note that it may be
# dangerous to set these if users can create symlinks (e.g. if "mail" group is
# set here, ln -s /var/mail ~/mail/var could allow a user to delete others'
# mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading it).
mail_access_groups = mail
# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
first_valid_uid = 150
last_valid_uid = 150

Inside the protocol imap { } section change:
mail_plugins = quota imap_quota
Inside the protocol lda { } section change:
postmaster_address = postmaster@intermesh.nl
mail_plugin_dir = /usr/lib/dovecot/modules/lda
mail_plugins = cmusieve quota
#the globalsieverc script will filter spam messages to the Spam folder 
global_script_path = /var/vmail/globalsieverc
Inside auth default { } section change:
auth default {
 mechanisms = plain
 passdb sql {
	 args = /etc/dovecot/dovecot-sql.conf
 }
 userdb sql {
	 args = /etc/dovecot/dovecot-sql.conf
 }
 user = nobody
 socket listen {
	 master {
	 path = /var/run/dovecot/auth-master
	 mode = 0660
	 user = vmail
	 group = mail
 }
 	client {
	 path = /var/spool/postfix/private/auth
	 mode = 0660
	 user = postfix
	 group = postfix
	}
}
plugin {
  quota = maildir:storage=512000
}

Also comment out the passdb pam section or you will get a very slow Dovecot connection!

/etc/postfix/dovecot-sql.conf:

driver = mysql
connect = host=localhost dbname=groupoffice user=vmail_user password=vmail_user_pass
default_pass_scheme = PLAIN-MD5
user_query = SELECT '/vmail/%d/%n' AS home, 'maildir:/vmail/%d/%n' AS mail, 150 AS uid, 8 AS gid, CONCAT('maildir:storage=', quota) AS quota FROM pa_mailboxes WHERE username = '%u' AND active = '1'
password_query = SELECT username AS user, password, '/vmail/%d/%n' AS userdb_home, 'maildir:/vmail/%d/%n' AS userdb_mail, 150 AS userdb_uid, 8 AS userdb_gid FROM pa_mailboxes WHERE username = '%u' AND active = '1'

Create globalsieverc script:

# mkdir /var/vmail/

Edit /var/vmail/globalsieverc:

require "fileinto";
if exists "X-Spam-Flag" {
  fileinto "Spam";
}

Set correct permissions:

# chown vmail:mail -R /var/vmail

Share this page:

4 Comment(s)

Add comment

Comments

From: at: 2009-02-24 19:12:15

Thank you!

From: Anonymous at: 2010-12-20 20:58:06

Create the transport db:

# cd /etc/postfix
# postmap transport

The above text should include the touch statement to create an empty transport file;

Create the transport db:

# cd /etc/postfix
# touch transport
# postmap transport

From: EagleClaw at: 2009-05-03 15:11:05

I agree and disagree with aboveamenity. I think there is all the information necessary to install and configure them properly. But there is some cleanup to do.

These are some of my observations:

 - At the second page, the main.cf portion of the tutorial should be changed from the current format (postconf -e) to the file itself (like what you have on the mysql files);

 - At the second page, the tutorial says to create the transport db; well, how can the transport db be created if we don't have the transport file yet? The transport file creation appears later on the article and at that point it doesn't say to run postmap on it. For newbies this is an issue;

 - Still at the postfix configuration, the tutorial says to to include the variable transport_map twice being one different than the other;

 - Adding the mail user: the second, third and fourth lines should be /var/vmail;

 - There's no mention for installing the postfix admin module at Group-Office before trying to create any accout.

 None of these items should be a problem to any experienced linux user, but for the sake of having a clean tutorial these items should be addressed.

Thanks Falko for all your good tutorials. I use your site since I started with Linux and continue to use as a reference resource.

Best regards.

From: aboveamenity at: 2009-04-20 04:33:49

Someone needs to expand on this tutorial. There isn't enough information. It tells you to do things and doesn't tell you how...