Gentoo Wiki ArchivesGentoo Wiki

HOWTO_Email_Virus_Scanner_--_Mailscanner

This article is part of the HOWTO series.
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?

Software Versions Used

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

Warning: The most recent Mailscanner ebuild is on sunrise, don't use the bugzilla version. Use At Your Own Risk.

Please visit Bug 36060 for more information.

Method 1: Sunrise Layman Portage (half-maintained)

Warning: Nevertheless the overlay ebuilds are mainly from users, thus being unsupported and experimental.

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.

Note: If you add the source line prior to adding an overlay, emerge will fail.
# 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

Configuration for Postfix

There are two ways of configure postfix that is on the web.

  1. http://footon.jheslop.com/howto/anti-virus-spam-howto.html
  2. http://wiki.linuxquestions.org/wiki/Using_MailScanner/Postfix/SpamAssassin/ClamAV_in_Gentoo_Linux
Note: Don't chroot your postfix if you are using saslauthd for smtp auth, there are much to do for such configuration.

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

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Email_Virus_Scanner_--_Mailscanner"

Last modified: Mon, 02 Jun 2008 19:07:00 +1000 Hits: 29,045

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.