![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ....
|
Guardian Digital Inc. > InfoCenter > Mailing List Archives > Amavis Amavis Mailing List Archive
From: Daniel Luttermann (Daniel.Luttermann@t-online.de)
Hi Dale,
> Would someone be so kind as to provide instructions to enable mysql
This is my "documentation".... needs more descriptions....
Amavisd-new with MySQL
What you will need:
A recent version of amavisd-new (current:2.1.1)
Recommend: MySQL 4.1.x (current:4.1.8)
Perl DBI (current:1.46)
Perl DBD MySQL
Install steps
First you should compile and install MySQL if you don't have a working
USE mysql;
REPLACE INTO db (host, db, user, select_priv, insert_priv, update_priv,
This user (amavisd) is needed by amavisd-new to connect to the amavisd-new database.
SELECT,INSERT,UPDATE,DELETE
After you've created an user for connecting to the amavisd-new MySQL database
This can be done with this sql statement:
USE amavisd;
-- -- Database: `amavisd` -- -- -------------------------------------------------------- -- -- `mailaddr` -- CREATE TABLE `mailaddr` ( `id` int(10) unsigned NOT NULL auto_increment, `priority` int(11) NOT NULL default '7', `email` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `mailaddr_idx_email` (`email`), KEY `email` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ; -- -------------------------------------------------------- -- -- `policy` -- CREATE TABLE `policy` ( `id` int(10) unsigned NOT NULL auto_increment, `policy_name` varchar(32) default NULL, `virus_lover` char(1) default NULL, `spam_lover` char(1) default NULL, `banned_files_lover` char(1) default NULL, `bad_header_lover` char(1) default NULL, `bypass_virus_checks` char(1) default NULL, `bypass_spam_checks` char(1) default NULL, `bypass_banned_checks` char(1) default NULL, `bypass_header_checks` char(1) default NULL, `spam_modifies_subj` char(1) default NULL, `virus_quarantine_to` varchar(64) default NULL, `spam_quarantine_to` varchar(64) default NULL, `message_size_limit` float default NULL, `banned_quarantine_to` varchar(64) default NULL, `bad_header_quarantine_to` varchar(64) default NULL, `spam_tag_level` float default NULL, `spam_tag2_level` float default NULL, `spam_kill_level` float default NULL, `spam_dsn_cutoff_level` float default NULL, `addr_extension_virus` varchar(64) default NULL, `addr_extension_spam` varchar(64) default NULL, `addr_extension_banned` varchar(64) default NULL, `addr_extension_bad_header` varchar(64) default NULL, `warnvirusrecip` char(1) default 'N', `warnbannedrecip` char(1) default 'N', `warnbadhrecip` char(1) default 'N', `newvirus_admin` varchar(64) default NULL, `virus_admin` varchar(64) default NULL, `banned_admin` varchar(64) default NULL, `bad_header_admin` varchar(64) default NULL, `spam_admin` varchar(64) default NULL, `spam_subject_tag` varchar(64) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ; -- -------------------------------------------------------- -- -- `users` -- CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL auto_increment, `priority` int(11) NOT NULL default '7', `policy_id` int(10) unsigned NOT NULL default '1', `email` varchar(255) NOT NULL default '', `fullname` varchar(255) default NULL, `local` char(1) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_idx_email` (`email`), KEY `email` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ; -- -------------------------------------------------------- -- -- `wblist` -- CREATE TABLE `wblist` ( `rid` int(10) unsigned NOT NULL default '0', `sid` int(10) unsigned NOT NULL default '0', `wb` varchar(10) NOT NULL default '', PRIMARY KEY (`rid`,`sid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; All fields that are supported with amavisd-new 2.1.1 lookup are included. After that you should fill the fields with sample informations for your domain. You must fill in some data in the table "users" and "policys". If not, your sql queries will not be successful. If you like you can insert some data with this sql statement (from amavisd-new documentation readme.lookups): INSERT INTO users VALUES ( 1, 9, 5, 'user1+foo@y.example.com','Name1 Surname1', 'Y'); INSERT INTO users VALUES ( 2, 7, 5, 'user1@y.example.com', 'Name1 Surname1', 'Y'); INSERT INTO policy VALUES (1, 'Non-paying', 'N','N','N','N', 'Y','Y','Y','N', 'Y',NULL,NULL,NULL,NULL, 3.0, 7, 10, NULL, NULL,NULL,NULL,NULL); INSERT INTO policy VALUES (2, 'Uncensored', 'Y','Y','Y','Y', 'N','N','N','N', 'N',NULL,NULL,NULL,NULL, 3.0, 999, 999, NULL, NULL,NULL,NULL,NULL); INSERT INTO mailaddr VALUES ( 1, 5, '@example.com'); INSERT INTO mailaddr VALUES ( 2, 9, 'owner-postfix-users@postfix.org'); INSERT INTO wblist VALUES (14, 1, 'W'); INSERT INTO wblist VALUES (17, 2, 'W'); These are only examples so insert data that match your current environment. If you've finished your MySQL setup you should install all needed Perl modules from CPAN that are described in amavisd-new installation. These modules are (from amavisd-new installation documentation): Archive::Tar Archive::Zip Compress::Zlib Convert::TNEF Convert::UUlib MIME::Base64 MIME::Parser Mail::Internet Net::Server Net::SMTP Digest::MD5 IO::Stringy Time::HiRes Unix::Syslog BerkeleyDB Optional Perl modules: Mail::SpamAssassin Net::LDAP Authen::SASL Mail::ClamAV SAVI And for MySQL support you need the Perl modules described in "What you will need" at the top of this document. If the installation of these Perl modules were successful you can install amavisd-new as it is described in the installation document of amavisd-new. In amavisd.conf you must configure your settings for your MySQL database. Look at this line in amavisd.conf. @lookup_sql_dsn = ( ['DBI:mysql:database=database;host=localhost;mysql_socket=/var/lib/mysql/mysql.sock', 'username', 'password'] ); # ['DBI:mysql:database=mail;host=host2', 'username2', 'password2'] ); I prefer that you use the connect over MySQL sockets rather than port 3306. Then you can start the amavisd daemon with the option "debug". Look at the output if MySQL support has been loaded. If so you can send you the first message. With the debug switch you can see if sql lookups were successful or not. The mostly common error is that amavisd-new fails to connect to the database. --------------- -- Best Regards Daniel Luttermann mailto:daniel.luttermann@t-online.de ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/ |