Installing Maia Mailguard On Debian Lenny (Virtual Users/Domains With Postfix/MySQL) - Page 2

6 Maia Mailguard Configuration Test

Now run

cd /var/lib/amavis/maia/scripts/
./configtest.pl

This script checks if all Perl modules that are needed by amavisd-maia, SpamAssassin, and Maia Mailguard's maintenance scripts are installed. For me the output was as follows:

server1:/var/lib/amavis/maia/scripts# ./configtest.pl

MAIA MAILGUARD CONFIGURATION TEST

This script checks for the presence of applications and Perl modules
required by amavisd-maia, SpamAssassin, and Maia Mailguard's maintenance
scripts.  Version numbers are also checked, and if a newer version of
a component is recommended, you should consider upgrading to at least
the minimum recommended version.

If you have already configured your Maia Mailguard database, the script
will also test the connection to that database.

Remember also to run the configtest.php script on your web server to
perform similar tests of your web, PHP, and PEAR environment.

Application/Module      Version   Status
========================================================================
Perl                 :   5.10.0 : OK
file(1)              :     4.26 : OK
Archive::Tar         :     1.38 : OK
Archive::Zip         :     1.18 : OK
BerkeleyDB           :     0.34 : OK
Compress::Zlib       :    2.012 : OK
Convert::TNEF        :     0.17 : OK
Convert::UUlib       :     1.11 : OK
Crypt::Blowfish      :      N/A : NOT INSTALLED (Maia Mailguard's optional encryption feature requires this)
Crypt::CBC           :      N/A : NOT INSTALLED (Maia Mailguard's optional encryption feature requires this)
Crypt::OpenSSL::RSA  :      N/A : NOT INSTALLED (SpamAssassin's optional DKIM plugin requires this)
Data::UUID           :      N/A : NOT INSTALLED (required by Maia Mailguard)
DB_File              :  1.816_1 : OK
DBD::mysql           :    4.007 : OK
DBD::Pg              :      N/A : NOT INSTALLED (required if you use PostgreSQL as your Maia Mailguard database)
DBI                  :    1.605 : OK
Digest::MD5          :  2.36_01 : OK
Digest::SHA1         :     2.11 : OK
File::Spec           :   3.2501 : OK
HTML::Parser         :     3.56 : OK
HTTP::Date           :    5.810 : OK
IO::Stringy          :    2.110 : OK
IO::Zlib             :     1.07 : OK
IP::Country          :      N/A : NOT INSTALLED (SpamAssassin's optional RelayCountry plugin requires this)
LWP::UserAgent       :    5.813 : OK
Mail::Address        :     2.03 : OK
Mail::DKIM           :      N/A : NOT INSTALLED (SpamAssassin's optional DKIM plugin requires this)
Mail::Internet       :     2.03 : OK
Mail::SpamAssassin   :    3.2.5 : OK
Mail::SPF::Query     :      N/A : NOT INSTALLED (SpamAssassin's optional SPF plugin requires this)
MIME::Base64         :  3.07_01 : OK
MIME::Parser         :    5.427 : OK
MIME::QuotedPrint    :     3.07 : OK
Net::CIDR::Lite      :      N/A : NOT INSTALLED (SpamAssassin's optional SPF plugin requires this)
Net::Cmd             :     2.29 : OK
Net::DNS             :     0.63 : OK
Net::Server          :     0.97 : OK
Net::SMTP            :     2.31 : OK
Pod::Usage           :     1.35 : OK
Template             :      N/A : NOT INSTALLED (required by Maia Mailguard)
Time::HiRes          :   1.9711 : OK
Unix::Syslog         :      1.1 : OK
URI                  :     1.35 : OK
Text::CSV            :      N/A : NOT INSTALLED (required by maiadbtool.pl)

Database DSN test    : PASSED

    NOTE: When upgrading Perl to version 5.10 or planning to do so, please
    do not forget to add a missing /m flag to regular expressions in your existing
    AV entries, as suggested in the example file amavisd.conf.dist. Perl 5.8 does
    not mind missing /m flags, but with perl 5.10 the results from a virus scanner
    may no longer be properly recognized.
server1:/var/lib/amavis/maia/scripts#

As you see a few modules are missing. Most of them can be installed via aptitude:

aptitude install libcrypt-blowfish-perl libcrypt-cbc-perl libcrypt-openssl-rsa-perl libmail-dkim-perl libmail-spf-query-perl libnet-cidr-lite-perl libtemplate-perl libtext-csv-perl

IP::Country and Data::UUID are not available as Debian Lenny packages, so we must install them using the Perl shell:

perl -MCPAN -e shell

install IP::Country

install Data::UUID

Type

q

to leave the Perl shell afterwards.

Run

./configtest.pl

again - output should now be as follows:

server1:/var/lib/amavis/maia/scripts# ./configtest.pl

MAIA MAILGUARD CONFIGURATION TEST

This script checks for the presence of applications and Perl modules
required by amavisd-maia, SpamAssassin, and Maia Mailguard's maintenance
scripts.  Version numbers are also checked, and if a newer version of
a component is recommended, you should consider upgrading to at least
the minimum recommended version.

If you have already configured your Maia Mailguard database, the script
will also test the connection to that database.

Remember also to run the configtest.php script on your web server to
perform similar tests of your web, PHP, and PEAR environment.

Application/Module      Version   Status
========================================================================
Perl                 :   5.10.0 : OK
file(1)              :     4.26 : OK
Archive::Tar         :     1.38 : OK
Archive::Zip         :     1.18 : OK
BerkeleyDB           :     0.34 : OK
Compress::Zlib       :    2.012 : OK
Convert::TNEF        :     0.17 : OK
Convert::UUlib       :     1.11 : OK
Crypt::Blowfish      :     2.10 : OK
Crypt::CBC           :     2.29 : OK
Crypt::OpenSSL::RSA  :     0.25 : OK
Data::UUID           :    1.215 : OK
DB_File              :  1.816_1 : OK
DBD::mysql           :    4.007 : OK
DBD::Pg              :      N/A : NOT INSTALLED (required if you use PostgreSQL as your Maia Mailguard database)
DBI                  :    1.605 : OK
Digest::MD5          :  2.36_01 : OK
Digest::SHA1         :     2.11 : OK
File::Spec           :   3.2501 : OK
HTML::Parser         :     3.56 : OK
HTTP::Date           :    5.810 : OK
IO::Stringy          :    2.110 : OK
IO::Zlib             :     1.07 : OK
IP::Country          :     2.27 : OK
LWP::UserAgent       :    5.813 : OK
Mail::Address        :     2.03 : OK
Mail::DKIM           :     0.32 : OK
Mail::Internet       :     2.03 : OK
Mail::SpamAssassin   :    3.2.5 : OK
Mail::SPF::Query     :  1.999.1 : OK
MIME::Base64         :  3.07_01 : OK
MIME::Parser         :    5.427 : OK
MIME::QuotedPrint    :     3.07 : OK
Net::CIDR::Lite      :     0.20 : OK
Net::Cmd             :     2.29 : OK
Net::DNS             :     0.63 : OK
Net::Server          :     0.97 : OK
Net::SMTP            :     2.31 : OK
Pod::Usage           :     1.35 : OK
Template             :     2.19 : OK
Time::HiRes          :   1.9711 : OK
Unix::Syslog         :      1.1 : OK
URI                  :     1.35 : OK
Text::CSV            :     1.06 : OK

Database DSN test    : PASSED

    NOTE: When upgrading Perl to version 5.10 or planning to do so, please
    do not forget to add a missing /m flag to regular expressions in your existing
    AV entries, as suggested in the example file amavisd.conf.dist. Perl 5.8 does
    not mind missing /m flags, but with perl 5.10 the results from a virus scanner
    may no longer be properly recognized.
server1:/var/lib/amavis/maia/scripts#

Since we are using MySQL and not PostgreSQL, we don't need the DBD::Pg module.

 

7 Loading SpamAssassin Rules

Maia Mailguard needs to index all of the SpamAssassin rules you have installed on your system. This can be done as follows:

./load-sa-rules.pl --debug

This should be done again whenever your SpamAssassin rules are updated. If you've followed the Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Debian Lenny) tutorial, you have the following cron job on your system:

23 4 */2 * * /usr/bin/sa-update --no-gpg &> /dev/null

Run

crontab -e

to modify that cron job so that it looks as follows:

23 4 */2 * * /usr/bin/sa-update --no-gpg && /var/lib/amavis/maia/scripts/load-sa-rules.pl && /etc/init.d/amavis restart &> /dev/null

 

8 Installing The Maia Mailguard Web Interface

I want to install Maia's web interface in /var/www/maia so that it can be accessed via http://www.example.com/maia (please adjust the path if your document root is different from /var/www). Therefore I create that directory now and copy Maia's web interface to it:

mkdir /var/www/maia
cp -pfr /usr/src/maia/1.0/php/* /var/www/maia/

Certain subdirectories of the /var/www/maia/themes directory must be writable by the Apache user. This can be achieved as follows:

chgrp amavis /var/www/maia/themes/*/compiled
chmod 775 /var/www/maia/themes/*/compiled
gpasswd -a www-data amavis

Maia's web interface uses the Smarty template engine which can be installed as follows:

aptitude install smarty

ln -s /usr/share/php/smarty/libs /usr/share/php/Smarty

Next we rename /var/www/maia/config.php.dist to /var/www/maia/config.php...

mv /var/www/maia/config.php.dist /var/www/maia/config.php

... and change the following settings:

vi /var/www/maia/config.php

[...]
    $maia_sql_dsn = "mysql://amavis:passwd@tcp(localhost:3306)/maia";
[...]
    $address_rewriting_type = 4;
[...]
    // Select an authentication method from one of the following:
    //
    //    "pop3"     - use a POP3 server to authenticate
    //    "imap"     - use an IMAP server to authenticate
    //    "ldap"     - use an LDAP server to authenticate
    //    "exchange" - use an Exchange Server to authenticate
    //    "sql"      - use a SQL database server to authenticate
    //    "internal" - use Maia's internal SQL database to authenticate
    $auth_method = "pop3";
[...]

Run

chmod 0640 /var/www/maia/config.php
chown root:www-data /var/www/maia/config.php

afterwards.

 

9 Testing Your PHP Configuration

Open a browser and go to http://www.example.com/maia/admin/configtest.php. This page tells you if all needed PHP modules are installed:

If modules are missing, you must install them now. I had to do the following to install the missing modules:

aptitude install php-pear

pear channel-update pear.php.net

pear install Mail_Mime
pear install Mail_mimeDecode
pear install Pager
pear install Net_Socket
pear install Net_SMTP
pear install Auth_SASL
pear install Net_IMAP
pear install Net_POP3
pear install Log
pear install Image_Color
pear install Image_Canvas-0.3.1
pear install Image_Graph-0.7.2

cd /usr/share/php/Image/Graph/Plot/
cp Pie.php Pie.php.original
wget http://www.maiamailguard.org/maia/raw-attachment/ticket/326/Pie.php.patch
patch -p0<Pie.php.patch

pear install Numbers_Roman
pear install Numbers_Words-0.16.1

pear channel-discover htmlpurifier.org
pear install hp/HTMLPurifier

aptitude install php5-imap php5-ldap php5-mcrypt

/etc/init.d/apache2 restart

Now reload http://www.example.com/maia/admin/configtest.php - all required modules should now be installed:

Share this page:

6 Comment(s)

Add comment

Comments

From: VinS at: 2010-07-16 08:00:29

You can use
aptitude install  libdbd-pg-perl libdata-uuid-perl
to install  Data::UUID & DBD::Pg
;)

 Vins

From: David Morton at: 2010-07-10 13:22:11

As a developer for Maia Mailguard, I appreciate any the effort put into making a tutorial like this, however, I'm a little confused about the lack of communication with our community shown at the end of this tutorial.

We have an active community on the users mailing list, which you can join here:

https://www.maiamailguard.com/maia/wiki/MaiaMailingLists

It is unfortunate that the author happened to check out the 1.0 branch when he did, as it was one of the strangest states I've ever left that tree in.  I have since committed fixes for the items listed at the end of this tutorial.   A quick note on the mailing list could have had that fixed sooner and allowed the author to skip the work of documenting it!

 @Boudewijn Ector:  I develop Maia on Ubuntu, so it runs quite well on Debian-like systems.  If you have problems, please join the mailing list!   Having said that, we are in the process of packaging it up into an Ubuntu set of packages, so it will get easier when we finish that up. :)

 Lastly, I would like to point out that this tutorial uses screenshots from the "Ocean Blue" theme, which is the theme that has received less love.  The "Desert Sand" theme has a much more polished look to it, and is much preferred.

 

From: Anonymous at: 2010-07-12 12:42:28

If your developing maya for Ubuntu, which is nice, but wouldn't it not be nicer to port it to debian itself and let the ubuntu developers adapt it.

 

From: Boudewijn Ector at: 2010-07-09 23:13:37

Dear Author,


Well done! Maia is great, and debian is great!

Too bad there's no such thing as a debian package. Although I've been using FreeBSD together with Maia for years, I've been trying for some time to get Maia to work on Debian.

 

A minor comment (I might make more during the implementation of maia on my debian system): 

One might try :

svn checkout https://www.maiamailguard.com/svn/branches/1.0

 Instead of including a version number: this will automatically get the newest version in SVN. Minor note: watch out, this might be an unstable version!

From: Keith at: 2010-07-10 17:04:36

The developers of Maia have fixed the PHP errors described in this article so a checkout of the latest 1.x branch will not need to have these corrections applied.

From: Joshua at: 2010-08-11 19:35:01

I keep seeing the Maia Mailguard server (literally, it's in the room down the hall) and I mean to try it for my own personal use, but I haven't really got around to it. We use it at an ISP level and it works extremely well. This guide should hopefully help me get off my rear and install it on some more servers.