Eight-sendmail of Linux server Deployment series

Source: Internet
Author: User
Tags file copy sha1 dovecot openldap spamassassin

SendMail is one of the most widely used mail systems under Linux today, although it has some shortcomings, but there are still many companies using it. Learning about it also gives us a deeper understanding of how the messaging system works. Let's take a look at the deployment of the SendMail mail server. This article will explain the SendMail mail system from the following aspects: 1.Sendmail installation; 2.Sendmail basic configuration; 3.Openwebmail installation and configuration; 4. Configure MAILSCANNER+CLAMAV filter virus ; 5. Configure Spamassassin+mimedefang to filter spam messages. The system operating environment of this article: CentOS 5. First, installation Sendmail 1. Software requirements (the following software can be found on the installation CD-ROM)Cyrus-sasl-2.1.22-4.i386.rpmcyrus-sasl-lib-2.1.22-4.i386.rpmcyrus-sasl-plain-2.1.22-4.i386.rpmcyrus-sasl-devel-2.1.22-4.i 386. Rpmcyrus-sasl-md5-2.1.22-4.i386.rpmsendmail-8.13.8-2.el5.i386.rpmsendmail-cf-8.13.8-2.el5.i386.rpmsendmail-devel-8.13.8-2 . el5.i386.rpmsendmail-doc-8.13.8-2.el5.i386.rpmm4-1.4.5-3.el5.1.i386.rpmdovecot-1.0.7-2.el5.i386.rpm In addition, Dovecot requires two out of two packages Hold: perl-dbi-1.52-1.fc6.i386.rpmmysql-5.0.45-7.el5.i386.rpm 2. Software Installation1) CYRUS-SASL installation Check first, the system installed by default which packages, such as: Install cyrus-sasl-md5-2.1.22-4.i386.rpm, such as: 2) Install SendMail, dovecot and other related packages, such as: SendMail to work properly, is the need for DNS support, the general enterprise has a DNS server, if not, you can refer to my other article: Linux Server Deployment Series of three-dns (http://guoxuemin.blog.51cto.com/ 379574/169718), build a DNS server yourself. Second, the basic configuration 1. Modify Local-host-names file# Vi/etc/mail/local-host-names 2. Modify SendMail The main configuration file, modify the section as shown below in red box content:# VI/ETC/MAIL/SENDMAIL.MC Use the M4 command to generate SENDMAIL.CF files, such as: Modify the configuration file, limit the size of user mail, such as: # VI/ETC/MAIL/SENDMAIL.CF 3. add users, which can be added as commands, such as if you have installed the OpenLDAP can also be added via the graphical interface (for OpenLDAP the installation configuration, you can refer to my other article: Linux Server Deployment Series of seven-openldap article) 4. Modify Dovecot configuration fileOnce the Dovecot is installed, you can use POP3 and IMAP by default. Next, we'll configure the next dovecot to start support for Pop3s and Imaps. 1) generate the private key and certificate, such as: 2) Modify the configuration file, such as: # vi/etc/dovecot.conf 5. Test1) Start SendMail and Dovecot services: 2) Use Outlook to configure two user mailboxes, such as: 3) to send test messages, such as: can be sent and received normally. Ok,sendmail Server installation is complete. Third, Openwebmail 1. Software Requirements (tool software is available from download)Cgi.pm-3.05.tar.gzmime-base64-3.01.tar.gzdigest-1.08.tar.gzdigest-md5-2.33.tar.gztest-iconv-1.2.tar.gzlibnet-1.19.tar.gzp erl-suidperl-5.8.8-10.el5_0.2.i386.rpm In addition, Openwebmail need Apache support, about Apache configuration, can participate in my other article: Linux Server Deployment Series one- Apache article (http://guoxuemin.blog.51cto.com/379574/168534) 2. installation1) Installation of Support Tools: Install Cgi.pm,mime-base64,digest,digest-md5,libnet,text-iconv, install as follows: # tar ZXVF package. tar.gz# CD Package name # Perl MAKEF ile.pl# make# make install there is a special case where you must declare an environment variable before installing DIGETS-MD5, as follows: # export lc_all=c Also, you need to install the Perl-suidperl support tool, such as: 2) Install openwebmail# tar zxvf openwebmail-2.53.tar.gz after decompression do not need to compile, as long as the relevant files copy to the relevant directory, such as: # MV data/openwebmail/usr/local/ apache/htdocs# MV Cgi-bin/openwebmail/usr/local/apache/cgi-bin 3. Configuration1) Modify the main configuration file, such as: # vi/usr/local/apache/cgi-bin/openwebmail/etc/openwebmail.conf 2) to modify the data settings file, such as: # vi/usr/local/apache/ Cgi-bin/openwebmail/etc/defaults/dbm.conf 3) Modify the authentication settings file, such as: # vi/usr/local/apache/cgi-bin/openwebmail/etc/defaults/ Auth_unix.conf 4) Modify the Apache configuration file and add a line alias, such as: # vi/usr/local/apache/conf/httpd.conf 4. TestOpen the browser, enter: HTTP//server IP address/mail, you can access the webmail, such as: The first time, will be prompted to set up personal templates, such as: To set up personal templates, completed after the point of saving, such as: Ok,webmail interface came out, It is easy to send and receive mail and management, such as: We send a message to test, such as: Using Outlook to receive, normal. OK, at this point, the Openwebmail installation configuration is complete. iv. anti-virus 1. Software RequirementsMailscanner-4.55.10-3.rpm.tar.gzclamav-0.95.tar.gz 2. Install, configure Mailscanner1) Install # tar zxvf mailscanner-4.55.10-3.rpm.tar.gz# cd mailscanner-4.55.10-3#./install.sh2) configuration Mailscanner, modify content such as red box content. # vi/etc/mailscanner/mailscanner.conf 3. Install, configure Clamav1) Install first, set up your own execution account for ClamAV: # vi/usr/sbin/useradd-s/bin/false-d/var/run/clamav ClamAV Then, install clamav:# tar zxvf Clama v-0.95.tar.gz# CD clamav-0.95#./configure--prefix=/usr/local/clamav# make# make install2) to establish a CLAMAV socket file storage path, such as: 3) Modify the configuration file clamd.conf, modify the section below to see the red frame marked part of the content. # vi/usr/local/clamav/etc/clamd.conf 4) Modify the configuration file freshclam.conf, modify the section below to see the red frame marked part of the contents. # vi/usr/local/clamav/etc/freshclam.conf 5) Create a Freshclam.log file and set permissions. For example: NOTE: If you do not create the file, you will get an error at startup. 4. Configure Startup Items1) Start ClamAV, such as: Modify the system startup key to automatically start the ClamAV when the system starts, such as: # vi/etc/rc.d/rc.local 2) Update ClamAV virus database use command:/usr/local/clamav/bin/ Clamdscan-v View the ClamAV version of the current system, such as: Using the command:/usr/local/clamav/bin/freshclam update the virus database, such as: Use the command again:/usr/local/clamav/bin/ Clamdscan-v View the ClamAV version of the current system, such as: The virus database has been updated. 3) Configure Mailscanner Management mail system start We must deactivate SendMail, start Mailscanner, let Mailscanner to take over the mail server boot, so as to check the virus properly. such as: Oh, there is a mistake. Check under: The version of Mailtools is 2.04 and the version is too high. Let's try a lower version. # tar zxvf mailtools-1.77.tar.gz# cd mailtools-1.77# perl makefile.pl# make# make install let's check out the Mailtools version, for example: Let's try again. Try to start the Mailscanner,ok, everything is OK. SendMail virus Detection Module installation to this finish, however, ClamAV is just a tox program, not anti-virus, if it checks that the message contains viruses will directly discard it. e. Anti-spam 1. Software RequirementsMail-spamassassin-3.1.9.tar.gzmimedefang-2.67.tar.gzIn addition, Mimedefang installation requires support for the following packages:
digest-sha1-2.12.tar.gzio-string-1.08.tar.gzmailtools-1.77.tar.gzmime-base64-3.03.tar.gzmime-tools-5.420.tar.gznet-dns-0 .65.tar.gz 2. Install, configure1) SpamAssassin Installation # tar  zxvf  mail-spamassassin-3.1.9.tar.gz# cd  mail-spamassassin-3.1.9# perl  makefile.pl# make# make  install2) Add Chinese spam filtering rules: HTTP://WWW.CCERT.EDU.CN/SPAM/SA/CHINESE_RULES.CF store this rule in/etc/ The Mail/spamassassin directory. 3) Install Mimedefang Installation Support tool: Digest-sha1,io-string,mime-tools,net-dns, follow these steps to install: # tar  zxvf  package. tar.gz# CD Package Name # perl  makefile.pl# make# make  Install here there is no need to repeat the installation because the Mailtools and mime-base64 are already installed in front of it. Install mimedefang# tar  zxvf  mimedefang-2.67.tar.gz# cd  mimedefang-2.67#./configure# make# make install# CP examples/init-script /etc/init.d/        //will start the file copy to/etc/init.d #/etc/ init.d/init-script  start             // Startup Mimedefang mimedefang can start normally, but you also need to configure the sendmail.cf file to make it work correctly. 4) Configure SENDMAIL.CF file # vi /etc/mail/sendmail.cf Modify # Input mail filters line below, such as:  add a row below the # # mail FILTER definitions , such as:  junk e-mailThe filter gateway adds X-scanned-by:mimedefang 2.67 to each message header, checking the headers to see if the system configuration is successful, such as:      OK, Complete SendMail messaging system deployment completed. Confined to space, this article only describes the deployment of the SendMail server, and the application for SendMail will be explained in subsequent documentation.

This article is from the "Tonyguo de blog" Knowledge: "blog, be sure to keep this source http://tonyguo.blog.51cto.com/379574/186474

Eight-sendmail of Linux server Deployment series

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.