IRedMail/FAQ/Integrate.MySQL.in.Amavisd
From iRedMail
(Difference between revisions)
| Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
| - | Note: This is achieved in iRedMail-0.7.0 and later versions. | + | Note: This is achieved and enabled in iRedMail-0.7.0 and later versions. |
= Summary = | = Summary = | ||
Revision as of 04:22, 24 August 2010
Contents |
Note: This is achieved and enabled in iRedMail-0.7.0 and later versions.
Summary
With MySQL integration, Amavisd can lookup per-user whitelist/blacklist and other policies from MySQL, and store incoming & outgoing email information in MySQL For example, mail size, sender/recipient, subject.
Steps
- Download SQL structure template file. This template file is extracted from Amavisd doc file: docs/README.sql-mysql.
| Terminal: |
$ cd /tmp/ $ wget http://iredmail.googlecode.com/hg/iRedMail/samples/amavisd.mysql |
- Create necessary database and import SQL structure template file:
| Terminal: |
$ mysql -uroot -p mysql> CREATE DATABASE amavisd DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON amavisd.* TO "amavisd"@localhost IDENTIFIED BY 'secret_passwd'; mysql> USE amavisd; mysql> SOURCE /tmp/amavisd.mysql; mysql> FLUSH PRIVILEGES; |
- Configure Amavisd in /etc/amavisd.conf (RHEL/CentOS) or /etc/amavis/conf.d/50-user (Debian/Ubuntu) or /usr/local/etc/amavisd.conf (FreeBSD):
| Terminal: |
@lookup_sql_dsn = (
['DBI:mysql:database=amavisd;host=localhost;port=3306', 'amavisd', 'secret_passwd'],
);
@storage_sql_dsn = @lookup_sql_dsn;
$sql_allow_8bit_address = 1;
|
- In Amavisd-new-2.6.4 and older versions, it can't store mail subject as "UTF-8" characters, you can fix it by edit /usr/sbin/amavisd (RHEL/CENTOS, line 19412) or /usr/sbin/amavisd-new (DEBIAN/UBUNTU) or /usr/local/sbin/amavisd (FreeBSD):
| File: /usr/sbin/amavisd |
$dbh->do("SET NAMES utf8"); # <-- Add this line.
section_time('sql-connect');
|
- Restart amavisd service.
