Using Qmail/vpopmail/courier-imap/qmail-scanner/igenus to build a mail system

Source: Internet
Author: User
Tags add filter sql mysql net version variable file permissions
Description: This guide will show you how to use Qmail/vpopmail/courier-imap/qmail-scanner/igenus to build a messaging system.

1. Foreword

This part of the text is translated from Gentoo forums. You can access the above address to view the latest version.

2. Set the USE environment variable

First set the use environment variable, modify/etc/make.conf, add the following use variable:

Code 2.1:/etc/make.conf

USE=apache2 maildir mysql

3. Install QMail

First you want to make sure that you have uninstalled other related mail processing software, such as: Ssmtp, SendMail or Postfix, and then execute:

Code 3.1: Installing QMail

# emerge -C ssmtp sendmail postfix
# emerge /usr/portage/mail-mta/qmail/qmail-1.03-r13.ebuild
# ebuild var/db/pkg/mail-mta/qmail-1.03-r13/qmail-1.03-r13.ebuild config
# ln -s /var/qmail/supervise/qmail-send /service/qmail-send
# ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd
# rc-update add svscan default
# /etc/init.d/svscan start

4. Install Vpopmail

Code 4.1: Installing Vpopmail

# emerge /usr/portage/net-mail/vpopmail/vpopmail-5.4.0.ebuild

Log in as root to your MySQL server for an operation:

Code 4.2: Operating the MySQL server

> create database vpopmail;
> use mysql;
> grant select, insert, update, delete, create, drop on vpopmail.* to vpopmail@localhost identified by 'your password';
> flush privileges;

If you find that Vpopmail cannot receive mail, make sure/etc/vpopmail.conf file permissions are 600 and are owned by Vpopmail:vpopmail.

Modify the/etc/vpopmail.conf below to modify the database password for the password set above. and carries out:

Code 4.3

# chmod 644 /etc/vpopmail.conf
# chown vpopmail:vpopmail /etc/vpopmail.conf

5. Install Courier-imap

Code 5.1: Installing Courier-imap

# emerge /usr/portage/net-mail/courier-imap/courier-imap-3.0.2-r1.ebuild
# nano -w /etc/courier-imap/authdaemonrc
加入 authmodulelist="authvchkpw"
#nano -w /etc/courier-imap/imapd
加入 IMAPDSTART=YES
AUTHMODULES="authvchkpw"
# nano -w /etc/courier-imap/pop3d
加入 POP3DSTART=YES
AUTHMODULES="authvchkpw"
# rc-update add courier-imapd default
#rc-update add courier-pop3d default
#/etc/init.d/courier-imapd start
#/etc/init.d/courier-pop3d start

6. Configure SMTPD to enable Smtp-auth to use Vpopmail

Code 6.1

# nano -w /var/qmail/control/conf-smtpd
加入 QMAIL_SMTP_POST="microweb.3322.org /var/vpopmail/bin/vchkpw /bin/true"
# svc -t /var/qmail/supervise/qmail-smtpd
# chmod u+s /var/vpopmail/bin/vchkpw

The following actions can greatly speed up the transmission of the message, if you find that the message transmission has a delay of 30-45 seconds, then I strongly recommend that you do the operation:

Code 6.2

# nano -w /var/qmail/control/conf-common
加入 TCPSERVER_OPTS="-H -R -l 0"

7. Install Spam Database client

Code 7.1

# emerge /usr/portage/dev-python/pyzor/pyzor-0.4.0-r1.ebuild
# emerge /usr/portage/mail-filter/razor/razor-2.40.ebuild
# emerge /usr/portage/mail-filter/dcc/dcc-1.2.28.ebuild

8. Installation of F-prot and Mail-spamassassin

Both of these software must work properly before installing Qmail-scanner.

Code 8.1

# emerge /usr/portage/app-antivirus/f-prot/f-prot-4.4.2.ebuild
# emerge /usr/portage/mail-filter/spamassassin/spamassassin-2.63.ebuild
# nano -w /etc/conf.d/spamd
加入 SPAMD_OPTS="-d -u vpopmail -v -x -C /etc/mail/spamassassin/local.cf"
# rc-update add spamd default
# /etc/init.d/spamd start

Now you can create a cron.hourly task to automatically update the F-prot definition:

Code 8.2

# nano -w /etc/cron.hourly/virus-update.cron
内容如下:
#!/bin/bash
/opt/f-prot/check-updates.pl -cron -quiet

Code 8.3

# chmod 755 /etc/cron.hourly/virus-update.cron
# crontab -e
min hour day month weekday command
0 * * * * /etc/cron.hourly/virus-update.cron

Now to set the spam process rules, add the following in the/ETC/MAIL/SPAMASSASSIN/LOCAL.CF:

Code 8.4:/ETC/MAIL/SPAMASSASSIN/LOCAL.CF

required_hits 5.0
rewrite_subject 1
subject_tag *****SPAM*****
report_safe 1
report_header 1
use_bayes 1
auto_learn 1
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
ok_languages all
ok_locales all

9. Install Qmail-scanner

You may need to force the installation of maildrop before installing Qmail-scanner.

Code 9.1: Installing Maildrop

# emerge /usr/portage/mail-filter/maildrop/maildrop-1.5.3-r1.ebuild
# emerge /usr/portage/net-mail/qmail-scanner/qmail-scanner-1.16-r2.ebuild

Log on and run as a "qmaild" User:

Code 9.2

# /var/qmail/bin/qmail-scanner-queue.pl -g

Consult the FAQ if you see the "Can ' t do setuid" or "Permission denied" error tips. (such as: "Setuidgid qmaild"/var/qmail/bin/qmail-scanner-queue.pl-g "or" su qmaild-c "/var/qmail/bin/qmail-scanner-queue.pl -G ")

The ' subject_tag ' variable in/ETC/MAIL/SENDMAIL/LOCAL.CF does not seem to modify the subject detected by spam, so we modify this:

Code 9.3

# nano -w /var/qmail/bin/qmail-scanner-queue.pl
加入 my $spamc_subject='*****SPAM*****';

Now to configure TCP.SMTP to activate Qmail-scanner:

Code 9.4

# nano -w /etc/tcp.smtp
加入
# Qmail-Scanner disabled for mail from localhost, relay allowed
127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-queue"
# Qmail-Scanner enabled (virus only) for mail from local network, relay allowed
192.168.1.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
# Qmail-Scanner enabled (virus and spam) for mail from external internet, relay denied
:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"

Code 9.5

# tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
# chmod 644 /etc/tcp.smtp*

10. Install Qmailadmin

Code 10.1

# emerge /usr/portage/net-mail/ezmlm-idx-mysql/ezmlm-idx-mysql-0.40-r2.ebuild
# emerge /usr/portage/net-mail/autorespond/autorespond-2.0.4.ebuild
# emerge /usr/portage/net-mail/qmailadmin/qmailadmin-1.2.0_rc2-r1.ebuild

You can login to the Http://www.youdomain.com/cgi-bin/qmailadmin address to enter the Qmailadmin admin interface. If the picture on the page is not displayed correctly, you must copy it to the correct location yourself, and you can view the/var/log/apache2/error_log to get its location. Note that this version of Qmailadmin does not use Valias to maintain forward/alias, and you can implement it from the source code installation version 1.2.1.

11. Install Igenus

Note: My domain name is microweb.3322.org, the following appears microweb.3322.org words you need to change according to your situation.

To www.igenus.org Download the latest Igenus compression package, I downloaded is igenus_2.0_20040703_release.tgz.

Extract the downloaded compressed package to/va/www/localhost/htdocs and set the owner to Vpopmail:

Code 11.1

# chown -R vpopmail:vpopmail /var/www/localhost/htdocs/igenus

12. Configure Igenus (First step)

Create a temporary directory for Igenus to run.

Code 12.1

# mkdir /tmp/igenus
# cd /tmp
# chmod -R 0755 igenus
# chown -R vpopmail:vpopmail igenus
# cd /var/www/localhost/htdocs/igenus

Modify the/var/www/localhost/htdocs/igenus/config/config_inc.php as follows:

Code 12.2:/var/www/localhost/htdocs/igenus/config/config_inc.php

$CFG_BASEPATH = "/var/wwww/localhost/htdocs/igenus";
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail';
$CFG_MYSQL_PASS = 'yourpasswd'; // 此处密码为vpopmail数据库密码
$CFG_MYSQL_DB = 'vpopmail';
$CFG_TEMP = "/tmp/igenus";

Modify the Vpopmail database for other features that use Igenus. Also, if you have previously established a login domain with Vadddomain, you need to delete the domain.

Code 12.3

# /var/vpopmail/bin/vdeldomain yourdomain
# mysql -u root -p
> use vpopmail;
> drop table vpopmail;
> quit

Then import the SQL file from the Igenus package and import a few of the tables that Igenus needs:

Code 12.4

# mysql -u root -p vpopmail < /var/www/localhost/htdocs/igenus/docs/iGENUS.sql

Note: Import work can also be done using phpMyAdmin.

After successful viewing the Vpopmail database should contain the following tables: Address,admin,dir_control,lastauth,limits,logs,message, Personal, stow,valias,vpopmail.

13. Modify PHP.ini

Modify/etc/php/apache2-php4/php.ini The following:

Code 13.1:/etc/php/apache2-php4/php.ini

max_execution_time=60
memory_limit=20M
post_max_size=10M
file_uploads=on
upload_max_filesize=10M
register_globals=On
session.bug_compat_42=0
session.bug_compat_warn=0
sendmail_path = /var/qmail/bin/qmail-inject

14. Modify Apache2.conf

Modify/etc/apache2/conf/commonapache2.conf:

Code 14.1:/etc/apache2/conf/commonapache2.conf

User vpopmail
Group vpopmail

Warning: This has a certain security risk, please decide for yourself.

Restart Apache2. If you find your other Web program having problems after restarting Apache2, you may need to change the corresponding file for Vpopmail:vpopmail.

15. Set up virtual login domain

Code 15.1

# /var/vpopmail/bin/vadddomain microweb.3322.org
Please enter password for postmaster: (输入 postmaster 密码)
enter password again:(再次输入密码)

Check/var/vpopmail/domains, the following should be able to see the established domain name. If you want to remove a domain, be sure to use the Vdeldomain command, and do not delete the corresponding directory directly.

16. Login Qmailadmin Establish user

Open the browser, type the address: http://microweb.3322.org/cgi-bin/qmailadmin/. Login to postmaster, domain is microweb.3322.org, password is the password set above. You can then add users based on the page prompts.

Note: You can also use the/var/vpopmail/bin/vadduser command to add users.

17. Configure Igenus (step two)

Because Vpopmail is using the. maildir format of the mailbox, and Igenus with the Maildir format of the mailbox, so now log in to Igenus there will be many errors. So we need to make some modifications:

Code 17.1

# cd /var/vpopmail/domains/${yourdomain}/${youruser}
# ln -s .maildir Maildir
# chown vpopmail:vpopmail Maildir

So Igenus can read the user's mailbox.

You can now open the Http://yourdomain/igenus and log in to your Igenus with a previously established user.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.