Maia MailGuard

Install Maia Mailguard Web Interface

Install Pre-Requisites Debian Package for Maia

# apt-get install apache2
# apt-get install mysql-client-5.0 mysql-server-5.0
# apt-get install spamassassin

Get Maia Source

# mkdir /opt/sources
# cd /opt/sources
# wget http://www.maiamailguard.com/files/maia-1.0.2a.tar.gz
# tar zxvf maia-1.0.2a.tar.gz

Create User & Group for Maia

# groupadd amavis
# useradd -g amavis -d /var/amavisd -s /bin/false -c "AMaViS system user" amavis

Setup Database for Maia

* Create Database

# mysql -u root -p mysql
# mysql> CREATE DATABASE maia;

* Build Initial Tables and Data

# mysql -u root -p maia < /opt/sources/maia-1.0.2/maia-mysql.sql

* Grant Access Right

# mysql -u root -p maia
# mysql> GRANT CREATE, DROP, ALTER, SELECT, INSERT, UPDATE, DELETE ON maia.* TO amavis@localhost IDENTIFIED BY 'passwd';

Install The Maintenance Scripts and Templates

* Buat folder yang diperlukan.

# mkdir -p /var/amavisd/maia/{scripts,templates}

* Copy source file ke direktori installasi.

# cp /opt/sources/maia-1.0.2/scripts/* /var/amavisd/maia/scripts
# cp /opt/sources/maia-1.0.2/templates/* /var/amavisd/maia/templates

* Fix files permissions.

# chmod 711 /var/amavisd
# chmod 711 /var/amavisd/maia
# chmod 644 /var/amavisd/maia/templates/*.tpl
# chmod 750 /var/amavisd/maia/scripts/*.pl

* Change ownerships.

# chown -R amavis:amavis /var/amavisd

* Copy file konfigurasi.

# cp /opt/sources/maia-1.0.2/maia.conf.dist /etc/maia.conf
# chown amavis:amavis /etc/maia.conf
# chmod 640 /etc/maia.conf

* Configure /etc/maia.conf

The most important settings in the /etc/maia.conf file are the ones that determine how the scripts should connect to your Maia database.

For MySQL:
 Berkas: /etc/maia.conf

# Configure your Maia database DSN here

$dsn = "DBI:mysql:maia:localhost:3306";

# Your Maia database user's login name

$username = "amavis";

# Your Maia database user's password

$password = "passwd";

Test Your amavisd-maia and SpamAssassin Configuration

# /var/amavisd/maia/scripts/configtest.pl

Periksa output dari perintah di atas. Lihat kolom status, pastikan semuanya statusnya OK. Contoh output:

# /var/amavisd/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.8.7 : OK
file(1)              :     4.16 : OK
Archive::Tar         :      N/A : NOT INSTALLED (required by Maia Mailguard)
Archive::Zip         :      N/A : NOT INSTALLED (required by Maia Mailguard)
BerkeleyDB           :      N/A : NOT INSTALLED (Maia Mailguard's optional caching feature requires this)
Compress::Zlib       :      N/A : NOT INSTALLED (required by Maia Mailguard)
Convert::TNEF        :      N/A : NOT INSTALLED (required by Maia Mailguard)
Convert::UUlib       :      N/A : NOT INSTALLED (required by Maia Mailguard)
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 DomainKeys plugin requires this)
Data::UUID           :      N/A : NOT INSTALLED (required by Maia Mailguard)
DB_File              :    1.811 : OK
DBD::mysql           :   3.0002 : OK
DBD::Pg              :      N/A : NOT INSTALLED (required if you use PostgreSQL as your Maia Mailguard database)
DBI                  :     1.50 : OK
Digest::MD5          :     2.33 : OK
Digest::SHA1         :     2.10 : OK
File::Spec           :     3.05 : OK
HTML::Parser         :     3.48 : OK
HTTP::Date           :      N/A : NOT INSTALLED (SpamAssassin's sa-update script requires this)
IO::Stringy          :      N/A : NOT INSTALLED (required by Maia Mailguard)
IO::Zlib             :      N/A : NOT INSTALLED (SpamAssassin's sa-update script requires this)
IP::Country          :      N/A : NOT INSTALLED (SpamAssassin's optional RelayCountry plugin requires this)
LWP::UserAgent       :      N/A : NOT INSTALLED (SpamAssassin's sa-update script requires this)
Mail::Address        :      N/A : NOT INSTALLED (SpamAssassin's optional DomainKeys plugin requires this)
Mail::DomainKeys     :      N/A : NOT INSTALLED (SpamAssassin's optional DomainKeys plugin requires this)
Mail::Internet       :      N/A : NOT INSTALLED (required by Maia Mailguard)
Mail::SpamAssassin   :    3.1.0 : OK
Mail::SPF::Query     :    1.997 : OK
MIME::Base64         :     3.05 : OK
MIME::Parser         :      N/A : NOT INSTALLED (required by Maia Mailguard)
MIME::QuotedPrint    :     3.03 : OK
Net::CIDR::Lite      :     0.15 : OK
Net::DNS             :     0.53 : OK
Net::Server          :      N/A : NOT INSTALLED (required by Maia Mailguard)
Net::SMTP            :     2.29 : OK
Pod::Usage           :      1.3 : OK
Template             :      N/A : NOT INSTALLED (required by Maia Mailguard)
Time::HiRes          :     1.66 : OK
Unix::Syslog         :      N/A : NOT INSTALLED (required by Maia Mailguard)
URI                  :     1.35 : OK 

Database DSN test    : PASSED

Beberapa paket yang perlu diinstall untuk melengkapi test diatas.

# apt-get install \
  libcompress-zlib-perl \
  libio-zlib-perl \
  libarchive-tar-perl \
  libarchive-zip-perl \
  libberkeleydb-perl \
  libconvert-binhex-perl \
  libio-stringy-perl \
  libnet-perl \
  libtimedate-perl \
  libmailtools-perl \
  libmime-perl \
  libconvert-tnef-perl \
  libconvert-uulib-perl \
  libio-multiplex-perl \
  libnet-server-perl \
  libunix-syslog-perl \
  libtemplate-perl \
  libcrypt-blowfish-perl \
  libcrypt-cbc-perl \
  libwww-perl \
  libossp-uuid-perl \
  libdbd-pg-perl \
  file

Jalankan kembali test script diatas. Catat bagian yang statusnya masih NOT INSTALLED atau UPGRADE RECOMMENDED.

# /var/amavisd/maia/scripts/configtest.pl

Jika masih ada bagian yang failed, kita perlu install modul perl secara manual dari CPAN. Untuk itu kita perlu install beberapa paket ubuntu agar installasi dari CPAN bisa berjalan dengan baik.

# apt-get install gcc g++ make autoconf ncftp lynx unzip libssl-dev

Setelah semuanya terinstall, install modul perl yang diperlukan. Lihat modul yang statusnya masih NOT INSTALLED atau UPGRADE RECOMMENDED.

# perl -MCPAN -e 'install Convert::UUlib'
# perl -MCPAN -e 'install Crypt::OpenSSL::RSA'
# perl -MCPAN -e 'install IP::Country'
# perl -MCPAN -e 'install Mail::DomainKeys'
# perl -MCPAN -e 'install MIME::Parser'
# perl -MCPAN -e 'install Net::Server'

* Load your SpamAssassin rules

# /var/amavisd/maia/scripts/load-sa-rules.pl

* Install the PHP scripts

# cp -Rp /opt/sources/maia-1.0.2/php /var/www/maia
# chown -R root:root /var/www/maia
# chown -R www-data:www-data /var/www/maia/themes

* Install the Smarty Template Engine

# apt-get install smarty

Maia mencari smarty di ${phplibdir}/Smarty. Sedangkan default installasi ubuntu menginstall smarty di /usr/share/php/smarty/libs. Solusi utk masalah ini adalah dengan membuat softlink.

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

* Configure Maia Mailguard: Database and Authentication

Lihat point no 8 di http://www.maiamailguard.com/maia/wiki/Install Test your PHP and database configuration

Browse ke http://localhost/maia/admin/configtest.php. Periksa apakah ada beberapa bagian yang masih FAILED.

Untuk melengkapi test diatas, kita perlu melakukan installasi modul PHP.

# apt-get install php5 php5-mysql php-pear php5-cli php5-gd php5-mcrypt php5-imap php5-ldap php5-pgsql

Setelah installasi selesai, restart apache.

# /etc/init.d/apache2 restart

* Juga beberapa modul dari PEAR.

# pear install Mail_Mime
# pear install DB
# pear install DB_Pager
# pear install Log
# pear install Net_SMTP
# pear install Net_IMAP
# pear install Net_POP3
# pear install Auth_SASL

Install Amavisd-Maia

Install Pre-Requisites Debian Package for amavisd-maia

# apt-get install nomarch gzip bzip2 lzop lha arj unrar zoo pax cpio cabextract

Copy Sources File

# cp amavisd-maia /usr/local/sbin/
# chown root /usr/local/sbin/amavisd-maia
# chmod 755 /usr/local/sbin/amavisd-maia

Generate your site's encryption key (optional)

# /var/amavisd/maia/scripts/generate-key.pl > /var/amavisd/blowfish.key

Configure amavisd-maia

# cp /opt/sources/maia-1.0.2/amavisd.conf.dist /etc/amavisd.conf

Kemudian edit, sesuai kebutuhan.

# vi /etc/amavisd.conf

(Re)start amavisd-maia

Buat startup (initscript) file, amavisd-maia. Simpan di /etc/init.d/amavisd-maia.

Jalankan amavisd-maia.

# /etc/init.d/amavisd-maia start

Periksa log files, berikan perhatian pada bagian yang error.

# tail -100 /var/log/mail.info

Jika sudah tidak ada masalah, pastikan script tersebut dijalankan pada saat booting.

# update-rc.d amavisd-maia defaults

Install & Configure ClamAV

* Install ClamAV

# apt-get install clamav clamav-daemon clamav-freshclam

* Edit konfigurasi ClamAV

Ada beberapa file yang perlu di edit, agar clamav bisa digunakan oleh Maia Mailguard.

* Ganti user clamav menjadi amavis.

# vi /etc/clamav/clamd.conf
# vi /etc/clamav/freshclam.conf
# vi /etc/logrotate.d/clamav-daemon
# vi /etc/logrotate.d/clamav-freshclam

* Fix Ownership

# chown -R amavis:amavis /var/run/clamav 
# chown -R amavis:amavis /var/lib/clamav 
# chown -R amavis:amavis /var/log/clamav

Referensi