There is a new version of this tutorial available for Debian 7 (Wheezy).
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAssassin, ClamAV) - Page 3
This tutorial exists for these OS versions
- Debian 7 (Wheezy)
- Debian 6 (Squeeze)
- Debian 5 (Lenny)
- Debian 4 (Etch)
- Debian 3.1 (Sarge)
On this page
7 Install Amavisd-new, SpamAssassin And ClamAV
To install amavisd-new, spamassassin and clamav, run the following command:
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip unarj bzip2
You will be asked a few questions:
Virus database update method: <-- daemon
Local database mirror site: <-- db.de.clamav.net (Germany; select the mirror that is closest to you)
HTTP proxy information (leave blank for none): <-- (blank)
Should clamd be notified after updates? <-- Yes
Now we have to edit /etc/amavis/amavisd.conf. This is a very long file with lots of comments. I have stripped out the unnecessary parts, this is with what I ended up (make sure you adjust line 112 (@lookup_sql_dsn = ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'mail_admin', 'mail_admin_password'] ); to your own database settings):
use strict; |
amavisd-new is the program that glues together Postfix and SpamAssassin/ClamAV. Postfix gives the mails to amavisd-new which then invokes SpamAssassin and ClamAV to scan the emails. Please have a look at the Spamassassin and ClamAV settings in /etc/amavis/amavisd.conf. Of course, you can customize that file a lot more. Feel free to do so, and have a look at the explanations in the original /etc/amavis/amavisd.conf file!
adduser clamav amavis
/etc/init.d/amavis restart
/etc/init.d/clamav-daemon restart
Now we have to configure Postfix to pipe incoming email through amavisd-new:
postconf -e 'content_filter = amavis:[127.0.0.1]:10024'
postconf -e 'receive_override_options = no_address_mappings'
Afterwards append the following lines to /etc/postfix/master.cf:
amavis unix - - - - 2 smtp |
and restart Postfix:
/etc/init.d/postfix restart
postfix check
Sub pages
Suggested articles
8 Comment(s)
Comments
this paper finally worked. But I had to add for grant ... to [email protected]'%' identified by that is, mysql was not accepting from localhost.. now my mail has arrived. thanks. [email protected]
Can you or someone else please explain in more detail how to solve this problem!
Thanks
Michael
Please post the problem in the forum: http://www.howtoforge.com/forums
Hi, I followed this Howto (its great thanks), however after I recently upgraded postfix with apt it threw the following error at me in mail.log ;
Aug 19 09:25:41 localhost postfix/virtual[14165]: fatal: mysql:/etc/postfix/mysql-virtual_mailboxes.cf: proxy map is not allowed for security sensitive data
I dont know if it is related to the postfix update or not with debian, however to fix this problem I edited /etc/postfix/main.cf and removed proxy: from all the mysql lines, for example;
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
Instead of
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
Thought I would post this as it might help some one out :D
Regards
Keith
I found these instructions lacking a little. If you create a new user, you have to take an extra step. You need to create a maildir for the user before you setup the user in the database.
You need to create a folder for your users (example for [email protected]):
mkdir /home/vmail/YOURVIRTUALDOMAIN.com
mkdir /home/vmail/YOURVIRTUALDOMAIN.com/bofh
cd /home/vmail/YOURVIRTUALDOMAIN.com/bofh
maildirmake Maildir
chown -R vmail:vmail /home/vmail/YOURVIRTUALDOMAIN.com/*
Now you're ready to insert the user into the SQL database. This avoids having mail accepted without a place to put it. After you insert the user into the database, you should be able to login via IMAP and see an empty directory. You should also now be able to send mail!
I would add a step between
apt-get install amavisd-new
and
edit /etc/amavis/amavisd.conf
edit /etc/apt/sources.list
add to the bottom:
deb http://some_clamav_mirror sarge/volatile main
where some_clamav_mirror is from this list: http://www.debian.org/devel/debian-volatile/volatile-mirrors
then
apt-get update && apt-get upgrade
Vertical
Hi,
I finally found what's the problem with amavisd. It writes an error like: Table 'mail.policy' not found...
To solve the problem , insert into the new amavisd.conf file the following two lines with correct values:
@lookup_sql_dsn =
( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'mail_admin', 'mail_admin_password'] );
$sql_select_policy = 'SELECT "Y" as local FROM domains WHERE CONCAT("@",domain) IN (%k)';
Great howto!!!
If you get this message, look in /etc/amavis/conf.d/50-user. It seems that they switched to a multiple-file configuration setup.
English |
Deutsch