HOWTO_Email_Virus_Scanner_--_Mailscanner
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
Introduction
This guide will help you to install MailScanner.
Why MailScanner?
- Files Name/Type Rules Protection
- Phishing Attacks Protection
- Message Content Protection
- Multiple Virus Scanner (With clamav, etrust, mcafee, sophos, panda, f-secure, nod32 and etc)
- Simple Configuration Change on MTA (With Sendmail, Postfix)
- Spam Protection (With SpamAssassin)
Software Versions Used
- mail-mta/postfix-2.4.5 OR mail-mta/sendmail-8.13.1-r1
- mail-filter/MailScanner-4.66.5.3
- app-antivirus/clamav-0.92 (Required if need virus scan)
- mail-filter/spamassassin-3.0.2 or newer (Required if need Spam detection)
- And a few perl Modules
Preparation
You need a working MTA, just a simple MTA. You can find more information on HOWTO Email System for the Home Network to configure your MTA, though Postfix is highly recommended.
Please choose either one of the way below to get Mailscanner Ebuild, I select one as it is easy for Mailscanner ebuild update.
Getting Mailscanner
Please visit Bug 36060 for more information.
Method 1: Sunrise Layman Portage (half-maintained)
Please refer to Portage Overlay Listing for layman configuration. More info about sunrise.
In Summary Getting Layman, add sunrise overlay and add the source line to make.conf.
# emerge layman # layman --fetch # layman -a sunrise # echo "source /usr/portage/local/layman/make.conf" >> /etc/make.conf
Since MailScanner is currently unsupported (due to Bug 36060), you must add the "~x86" flag to /etc/portage/package.keywords:
# echo "mail-filter/MailScanner" >> /etc/portage/package.keywords
If you would like to automatically build spamassassin and/or clamav support, add these use flags to /etc/portage/package.use. Also note that you can specify which MTA to use, one of "sendmail", "postfix" or "exim":
# echo "mail-filter/MailScanner clamav spamassassin postfix" >> /etc/portage/package.use
The example above uses postfix. Replace with either exim or sendmail if thats what you prefer (both are only made compatible according to howto, needs testing). You can now continue to install Mailscanner, using portage:
# emerge MailScanner
From time to time when there is a Mailscanner update try.
# layman -s sunrise
Method 2: Bugzilla Ebuilds (don't do this)
Please refer to HOWTO Installing 3rd Party Ebuilds and configure your PORTDIR_OVERLAY in make.conf then download the ebuild from Bug 36060 as shown.
Extract only the /mail-filter directory from the eBuild into your PORTDIR_OVERLAY.
Installing The Software from eBuilds
# ebuild PORTDIR_OVERLAY/mail-filter/MailScanner-version.ebuild digest
then add the following line to your /etc/portage/package.keywords
# echo mail-filter/MailScanner ~x86 >> /etc/portage/package.keywords
This will make the ACCEPT_KEYWORDS="~x86" no more for this packages.
# emerge MailScanner --verbose --pretend
to see what will happen when emerging MailScanner.
When if you are using postfix as MTA
# USE="postfix -sendmail" emerge MailScanner --ask --verbose
or if you are using sendmail as MTA
# USE="-postfix sendmail" emerge MailScanner --ask --verbose
Then emerge will start to install Mailscanner and a few required Perl modules.
Installing of Additional Software
If you need Virus scanning you will need a something like Clamav or any CLI virus scanner on the market. Note that these steps are not necessary if you added clamav or spamassassin to your MailScanner USE flags, as they would have automatically been emerged as part of the dependancy tree.
P.s You can have as many as you want but the more you have the more resources will be taken.
# emerge clamav
If you need Spam detection you will need SpamAssassin
# emerge spamassassin
Configuration
Now it is time to configure your application. Mailscanner configuration files are located
- /etc/conf.d/MailScanner
- /etc/MailScanner
Configuration for Postfix
There are two ways of configure postfix that is on the web.
- http://footon.jheslop.com/howto/anti-virus-spam-howto.html
- http://wiki.linuxquestions.org/wiki/Using_MailScanner/Postfix/SpamAssassin/ClamAV_in_Gentoo_Linux
Add/Change your configuration on the following files.
| File: /etc/postfix/main.cf |
header_checks = regexp:/etc/postfix/header_checks |
| File: (if you have postfix 2.4) /etc/MailScanner/MailScanner.cf |
Incoming Queue Dir = /var/spool/postfix/hold Outgoing Queue Dir = /var/spool/postfix/incoming |
| File: /etc/postfix/header_checks |
/^Received:/ HOLD |
We are now done, Stop postfix now and start MailScanner
| Code: Stoping postfix and starting MailScanner |
/etc/init.d/postfix stop /etc/init.d/MailScanner start |
Configuration for Sendmail
Using Sendmail will be much easier.
| File: /etc/MailScanner/MailScanner.conf |
MTA = sendmail |
| File: /etc/init.d/MailScanner |
From need net MailScanner-mta To need net mta |
If you have postfix install you will need to disable the mta function.
| File: /etc/init.d/postfix |
From provide mta To # provide mta |
Remove sendmail from default rc and let MailScanner start sendmail.
| Code: Updating runlevel configuration |
rc-update del sendmail default rc-update add MailScanner default |
Configuration for Exim
| File: /etc/MailScanner/MailScanner.conf |
MTA = exim |
| File: /etc/init.d/MailScanner |
From need net MailScanner-mta To need net mta |
| File: /etc/init.d/exim |
In the "start()" function, from start-stop-daemon --start --quiet --exec /usr/sbin/exim --pidfile /var/run/exim.pid -- ${EXIM_OPTS:--bd -q15m}
To start-stop-daemon --start --quiet --exec /usr/sbin/exim --pidfile /var/run/exim.pid -- ${EXIM_OPTS:--bd}
In the "reload()" section, add the following after the existing "start-stop-daemon" line: start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/exim-out.pid --name exim-out |
And finally:
| File: /etc/conf.d/exim |
Edit to look as follows: EXIM_OUT_OPTS="-q15m -C /etc/exim/exim_outgoing.conf" EXIM_OPTS="-bd" |
You can now add MailScanner and exim to default startup (adding exim is not necessary, it will be started as a required dependancy of MailScanner):
| Code: Updating runlevel configuration |
rc-update del sendmail default # if sendmail is in default - will need to remove 'provides mta' too. rc-update del postfix default # if postfix is in default - will need to remove 'provides mta' too. rc-update add MailScanner default rc-update add exim default # not required, but added for safe measure. |
MailScanner Configuration with Clamav
| File: /etc/MailScanner/MailScanner.conf |
From Virus Scanning = no Virus Scanners = To Virus Scanning = yes Virus Scanners = clamav |
MailScanner Configuration with SpamAssassian
| File: /etc/MailScanner/MailScanner.conf |
From Use SpamAssassin = no To Use SpamAssassin = yes |
MailScanner Configuration
Please refer to http://www.sng.ecs.soton.ac.uk/mailscanner/man/MailScanner.conf.5.html for more information. I'll only show some basic example.
| File: /etc/MailScanner/MailScanner.conf |
%org-name% = FOO_BAR_ORG %org-long-name% = Foo Bar Example %web-site% = foo.bar.org MCP Checks = yes SpamAssassin Temporary Dir = /var/spool/MailScanner/incoming/SpamAssassin-Temp |
See Also
Browse categories > Applications > Antivirus
Browse categories > Applications > Mail server
Browse categories > Applications > Mail server > Postfix
Browse categories > Security
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.
