|
PostFix Install for CentOS-4 (WBEL-4 / TaoLinux-4 / RHEL-4) Part 4 |
|
|
|
|
Written by Johnny Hughes
|
|
Saturday, 30 September 2006 |
This is a guide to install a PostFix mailserver (with MailScanner, ClamAV, SquirrelMail, and SpamAssassin) on CentOS-4.X. There are 4 parts, this is part 4. This install procedure also works with White Box Enterprise Linux 4 and TaoLinux-4 Part 1 | Part 3
Below is the full text for part 4 of the guide. If you have any questions concerning this guide, please ask at the Postfix Mail Server of HughesJR.com. Here comes the last part of the PostFix E-mail server install. That is to install Mailscanner utilizing Spamassassin and ClamAV. We will install ClamAV from Dag Wieers' RHEL 4 yum repository. I will show you how to only use Dag's repo for getting ClamAV and unrar (a program similar to unzip for checking compressed files). I want to be careful with Dag's repo, because it can over-write system files if we are not careful. You can add other programs from Dag's repo by adding the name of the program in the includepkgs= line in the [dag] repo section below. To use Dag's repo, you will need to create a new .repo file in your /etc/yum.repos.d directory to point to the mirror that is closest to you. A list of mirrors available can be found here. There is a mirror in the United States here (that is not listed at the above site): http://dag.linux.iastate.edu/dag/redhat/el$releasever/en/$basearch/dag That is the main mirror location I will use (we will add a couple backup mirrors as well). Create a file named /etc/yum.repos.d/dag.repo and have it contain the following lines: [dag] name=Dag-RHEL-Yum baseurl=http://dag.linux.iastate.edu/dag/redhat/el$releasever/en/$basearch/dag http://www.mirrorservice.org/sites/apt.sw.be/redhat/el$releasever/en/$basearch/dag http://mirrors.ircam.fr/pub/dag/redhat/el$releasever/en/$basearch/dag http://apt.sw.be/redhat/el$releasever/en/$basearch/dag enabled=1 gpgcheck=1 includepkgs=clamav clamav-devel clamav-db unrar With this repo file, the only packages that can install from Dag's repo are the ones we need for this install (clamav). Install Dag's rpm signing key. (Dag's instructions). This should do it: rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt Now to install the spamassassin and clamav like this (also includes other packages that will be required later for other parts of this install): yum install spamassassin clamav clamav-devel sendmail-devel bzip2-devel gmp-devel zlib-devel autoconf automake rpm-build rpm-devel gcc perl-CPAN curl-devel unrar (this is all one line) 2. Install the ClamAV Perl module via these instructions. I was able to accept all the defaults in the install all the way down to picking the closest CPAN servers (for step 1). I chose a couple from the first USA page. I did not upgrade CPAN ... I just installed the module via Steps 2 and 3. SKIP steps 1, 4, and 5 until we install MailScanner below....you are finished with this page and should now have the ClamAV perl module installed. 3.Download the latest MailScanner from here: http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/rpm/ At the time I wrote this guide, the lastest version is MailScanner-4.42.5-1.rpm.tar.gz ... you can download this version with: wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/rpm/MailScanner-4.42.5-1.rpm.tar.gz 4. Now we will unpack it with the command: tar -xvzf MailScanner-4.42.5-1.rpm.tar.gz 5.Now we will install MailScanner by going into the extracted directory and issuing these commands: cd MailScanner-4.42.5-1 export LANG=C; ./install.sh 6. Stop postfix with the command: /etc/init.d/postfix stop Ensure postfix doesn't restart, as Mailscanner will start it from now on, with the command: chkconfig postfix off 7. Make the following changes to the /etc/postfix/main.cf file... add the line: header_checks = regexp:/etc/postfix/header_checks 8. Edit the file /etc/postfix/header_checks, add this line to the file: /^Received:/ HOLD 9.Now we are ready to setup the file /etc/MailScanner/MailScanner.conf, which is the configuration file for MailScanner. In this file, edit it to show the following values: %org-name% = yoursite Run As User = postfix Run As Group = postfix Incoming Queue Dir = /var/spool/postfix/hold Outgoing Queue Dir = /var/spool/postfix/incoming MTA = postfix File Timeout = 120 Maximum Archive Depth = 20 Virus Scanners = clamavmodule Monitors for ClamAV Updates = /var/clamav/*.cvd Use SpamAssassin = yes SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin The MailScanner file is very well documented, and here is a guide to help you configure other parts of this file so you can get the most out of your Spamassassin and have more control over how mail is delivered to your users. Here are a couple other optional setting in MailScanner.conf: Spam List = ORDB-RBL SBL+XBL SORBS-DNSBL CBL RSL DSBL spamcop Allow IFrame Tags = yes Log IFrame Tags = yes Allow Script Tags = yes Allow Object Codebase Tags = yes Convert Dangerous HTML To Text = yes Minimum Stars If On Spam List = 3 Spam Lists To Reach High Score = 3 10. You will need to ensure that the user "postfix" can write to /var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine with the commands: chown postfix.postfix /var/spool/MailScanner/incoming chown postfix.postfix /var/spool/MailScanner/quarantine mkdir -m 700 /var/spool/MailScanner/spamassassin chown postfix.postfix /var/spool/MailScanner/spamassassin If you upgrade your copy of MailScanner, these directories may be changed back to being owned by root, so you may have to do the chown commands again. 11. ClamAV should try to update hourly, controlled by MailScanner (via the cron job /etc/cron.hourly/update_virus_scanners). To setup ClamAV for auto updates, edit the file /etc/MailScanner/virus.scanners.conf. Find the line: | CODE | | clamav /usr/lib/MailScanner/clamav-wrapper /usr/local | Change it to | CODE | | clamav /usr/lib/MailScanner/clamav-wrapper /usr | This will allow clamav to get hourly updates via /etc/cron.hourlyupdate_virus_scanners. There will be an error in the logs: ClamAV update warning: ERROR: Clamd was NOT notified: Can't find or parse configuration file /etc/clamd.conf because clamd is not needed when scanning via clamavmodule (which is faster and uses less resources). This error can be ignored .. or you can install clamd via Dag's repo by adding it to your includepkgs= line and running the command: yum install clamd 12.Now you can start MailScanner by issuing the command: /etc/init.d/MailScanner start You should now have a fully working email server that is POSTFIX + SASL + IMAP/POP3 + SMTP AUTH + SQUIRRELMAIL + MAILSCANNER + SPAMASSASSIN + CLAMAV 13. You can now remove all the rpms from the directories under /usr/src/redhat, and you can delete all the files you downloaded and the directory that was created when you extracted the MailScanner file. 14. After this install is completely finished, my server has 854MB used space....not to bad for a fully functional mail server. 15. Here are the final config files for my test server: PostFix /etc/postfix/main.cf MailScanner /etc/MailScanner.MailScanner.conf SquirrelMail /etc/squirrelmail/config.php Part 1 | Part 3 |
|
Last Updated ( Sunday, 05 August 2007 )
|