Postfix + mailfix + ClamAV + spamassassin Integrated Installation

Source: Internet
Author: User
Tags spamassassin

1. Purpose of integrated installation:

When a mail is sent using Postfix, it is used to scan for virus mails and filter out spam mails.

2. Functions of each software:

1) Postfix: send and receive emails (Role: MTA)

2) ClamAV: Anti-Virus

3) spamassassin: Anti-Spam

4) mailfix: integrate Postfix/ClamAV/spamassassin

3. System Environment

OS: Debian 6x64

Source: Deb http://ftp.debian.org/debian/ squeeze main contrib non-free

NOTE: If it is in another system environment, modify the relevant commands and directories as appropriate according to the following situations:

4. Installation and integration

1) install and configure Postfix ClamAV

A) Installation

# Aptitude update

# Aptitude install Postfix ClamAV

B) Configure Postfix

# Nano/etc/Postfix/Main. cf

Because Postfix is a pure forwarding server, the actual recipient is not local. To avoid the unknown recipient problem, comment out the mydestination line.

At the same time, add some content. The content of Main. Cf after configuration is complete is as follows:

The configuration file is modified, and the file corresponding to the newly added content in the configuration file is also created.

For more information, see:


File description:

Transport ----- the MTA to which the email is forwarded. Details: example.com relay: [192.168.1.23]

Relay_recipients ----- recipient address on 192.168.1.23mta server, details: zhibei@example.com OK

Other corresponding databases are generated by the postmap command.

# Postmap/etc/Postfix/Transport

# Postmap/etc/Postfix/relay_recipients

Header_checks ------ this file is a necessary file for Postfix and maiscanner integration. Content:/^ stored ed:/hold (Note: The Tab key is in the middle)

After the configuration is complete, reload the Postfix configuration file. Command: Postfix reload

2) install spamassassin

# Aptitude install spamassassin

After installing spamassassin, the following prompt appears:

Modify the file:

# Nano/etc/default/spamassassin

SetEnabled = 0ChangeEnabled = 1

3) install mailbench

A. Download mailtoken

# Mkdir/Data

# Cd/Data

# Wget http://www.mailscanner.info/files/4/tar/MailScanner-install-4.84.5-3.tar.gz

Path and name of the downloaded file:/data/MailScanner-4.84.5-3.rpm.tar.gz

Note: This address may change over time and with the constant update of the mailbench version. If this address is invalid, please refer to the official mailbench website for details.

Mailbench official website address: http://www.mailscanner.info

B. decompress and install mailhandler

# Tar zxvf/data/MailScanner-install-4.84.5-3.tar.gz

#/Data/MailScanner-install-4.84.5/install. Sh

At the end of the installation, the following prompt is displayed:

Add a scheduled task as prompted (of course, the time can be modified according to the actual situation ):

# Crontab-e

37 5 ***/opt/mailscanner/bin/update_phishing_sites
07 ***/opt/mailscanner/bin/update_bad_phishing_sites
58 23 ***/opt/maildesk/ bin/clean. Quarantine
42 ****/opt/mail.pdf/bin/update_virus_scanners
3, 23, 43 ****/opt/mailhandler/bin/check_mailhandler

C. Modify the mailworker configuration file

# Nano/opt/maildesk/ ETC/CONF. d/mymaildesk. Conf

The content is as follows:

Run As User = postfix
   Run As Group = postfix
   Incoming Queue Dir = /var/spool/postfix/hold
   Outgoing Queue Dir = /var/spool/postfix/incoming
   MTA = postfix
   Always Include SpamAssassin Report = yes

   Send Notices = no
   Spam List = RFC-IGNORANT-DSN SORBS-SMTP spamhaus-ZEN spamcop.net CBL
   Spam Lists To Reach High Score = 2
   High SpamAssassin Score = 8
   Rebuild Bayes Every = 86400
   Wait During Bayes Rebuild = yes
   High Scoring Spam Actions = delete

D. Create a file and modify its permissions.

# Mkdir/var/spool/mail.pdf/spamassassin

# Chown-r Postfix: Postfix/var/spool/mail /*

E. What's the problem? Run the following command to view

#/Opt/mailbench/bin/mailbench -- lint

The result is as follows:

Next we will solve these problems one by one.

Question 1:

# Aptitude install unrar

Question 2:

# Nano/opt/mail1_/ ETC/mail1_. Conf

FindEnvelope_sender_header X-mailparts-fromAnd modify itEnvelope_sender_header X-yoursite-mailentries-from

Question 3:

# Nano/etc/spamassassin/mailmask. cf

Comment out the zero line of use_auto_whitelist

Question 4:

# Nano/opt/maildesk/ ETC/CONF. d/mymaildesk. Conf

Add the following content:

Virus scanners = ClamAV

Finally, run the command:/opt/mailhandler/bin/mailhandler -- lint to find that all the original problems have been fixed.

========================================================== ========================================================== ======================================

Let's see if there are any problems in the log file.

# Tail-FN 100/var/log/mail. Log

To avoid this problem, you can thoroughly modify the/var/spool/Postfix directory permissions.

# Chmod 777-r/var/spool/Postfix

Check the log again and find everything is normal.

 

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.