Postfix Spam Filter using Ubuntu Dapper, MailScanner, SpamAssassin, Razor, Pyzor, DCC and ClamAV - Page 5

4 Mailscanner-MRTG Installation (Optional)

apt-get install mrtg apache2 snmp snmpd libsnmp4.2


Answer "Yes" to debconf MRTG screen.

rm /etc/cron.d/mrtg

We won't need that one

First let's backup our default SNMP config. Then create a new one with the correct settings.

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.dist vi /etc/snmp/snmpd.conf


Paste this text into the new snmpd.conf file.

# This line makes the snmp daemon listen only on the loopback interface
# If you want to run on an alternative port change the 161 part
# (Don't forget to update the mailscanner-mrtg.conf file with the new port
agentaddress localhost:161
# Use this version instead for ucd-snmp
#agentaddress 161@localhost

# This line sets up a single community string (with read-only access)
# With access only permitted from localhost
# If you have users logging into your machine and want to make sure they
# can't easily get info from snmp change 'public' to something else
# (Don't forget to update the community string in mailscanner-mrtg.conf)
rocommunity  public localhost

# System Information, change this if you want
syslocation YourSysLocation
syscontact Support 

/etc/init.d/snmpd restart


To install MailScanner-MRTG, we need to download then install it.

Go to http://sourceforge.net/projects/mailscannermrtg/ and download the latest tarball. At the time of this writing it was 0.10.0

tar xzvf mailscanner-mrtg-0.10.00.tar.gz
cd mailscanner-mrtg-0.10.00


Edit the install.pl

vi install.pl


Change a couple of options in this script. The following parameters should look like this:

"mrtgcfg" => "/etc/",
"www" => "/var/www/",
"wwwconf" => "/etc/apache2",

Run the install.pl

./install.pl


We have checked the configuration if install.pl so go ahead and install... When your editor with the mailscanner-mrtg config opens up in your editor, close it, we will edit it later:

Edit the /etc/MailScanner/mailscanner-mrtg.conf, change the following lines:

WWW Root = /var/www/
MTA = postfix
MTA Incoming Log = /var/log/mail.log
MTA Outgoing Log = /var/log/mail.log
MTA Reject Log = /var/log/mail.log
Incoming Queue Dir = /var/spool/postfix/hold/
Restart MailScanner = /usr/bin/check_mailscanner
MailScanner Log = /var/log/mail.log
Outgoing Queue Dir = /var/spool/postfix/deferred/:/var/spool/postfix/defer/
#MailScanner Work Directory = /var/spool/MailScanner/incoming #COMMENT THIS OUT UNLESS IT'S A MOUNTPOINT
Spool Directory = /var/spool #COMMENT THIS OUT UNLES IT'S A MOUNTPOINT
Use SNMP = yes
SNMP Community = public #OR WHATEVER YOU SET IT TO IN SNMPD.CONF

Lets try MailScanner-MRTG, run this two or three times. The first couple of times you should see some erros. If it keeps showing errors there's something wrong:

env LANG=C /usr/bin/mrtg /etc/mailscanner-mrtg.cfg

Add this line into cron to run mrtg every 5 minutes:

crontab -e


0-59/5 * * * * env LANG=C /usr/bin/mrtg /etc/mailscanner-mrtg.cfg 1> /dev/null 2> /dev/null

/etc/init.d/cron restart


Ok go to http://spf.example.com/mailscanner-mrtg and let's see if it comes up and the graphs are updating. You should edit out any graphs that don't work by editing the /var/www/mailscanner-mrtg/index.htm file and commenting those graphs out from /etc/mailscanner-mrtg.cfg.

Share this page:

18 Comment(s)

Add comment

Comments

From: Anonymous at: 2006-07-27 20:16:09

Just working my way through this great looking howto and have run into the following issues on page 1. 

1.) Your sources.list references breezy repeatedly despite this being a dapper howto.  I assumed I could just uncomment my dapper repos and install away.

 2.) When running the big apt-get install the following packages could not be found: unarj, unrar, and lha.  I just skipped them so hopefully it does not matter too much.

3.) There is no pcmcia under init.d in my install but there is a pcmciautils.  Should I be shutting down and removing that instead?

4.) There is no inetd in /etc/init.d on my system for me to restart.

Everything seems to be working ok so far though so I am forging ahead with the install.

From: Anonymous at: 2006-08-14 22:06:43

Ok thanks. Any help is appreciated, when I have a chance I will update.

From: Anonymous at: 2006-08-18 15:06:35

When trying to install the long list of software packages in section 1.5, if there's a problem with one package, none will install.  I found that it was easier to install 4 or 5 packages at a time.

From: fdalmoro at: 2006-08-25 20:36:41

Good point. I need to do some more testing because I know some of the packages don't install with the repositories. That's why I made sure to put 'BETA' in the title :) ...

From: fdalmoro at: 2006-08-25 20:44:00

For those that are trying the install... I will be updating the documentation next week. I finally got all of the kinks worked out of my system and it's working fine. I have seen many posts regarding MailScanner+Postfix comments that say it is not recommended. I have not had any problems but like some posts say, updating either MailScanner or Postfix could be risky affair so fair warning. I'm willing to take the gamble because Postfix + MailScanner are the best in their respective fields I think (especially once MailScanner-MRTG is working). The graphs make it all worth it.

 

In any case if anyone runs into any snags just let me know through here or the forums and I will try to help out the best I can. Speaking of forums I'll have to hit those today just in case. Have not looked at them yet.

From: jtkooch at: 2006-09-07 15:04:55

Excellent guide for the most part but there are some things that have me confused. You mention this will use mailscanner instead of Amavis, but page 4 references the amavis user accounts.

Also, there doesn't seem to be anypoint where either of those programs actually get installed.

Am I missing it?

From: fdalmoro at: 2006-09-18 16:27:59

Been busy, have not finished this howto. I should have posted it when it was finished sorry.

From: till at: 2006-09-13 08:11:19

The title mentions that this howto installs ClamAV, in which step is it installed or is this part missing yet?

From: fdalmoro at: 2006-09-26 18:22:15

Page 4 has it.

From: at: 2006-11-06 11:33:30

I've set this up on dapper and now on eft. I've found on both that unrar, and lha are no longer on the reps for download. As alternatives, I have used unp & unrar-free which seem to work fine.

From: Anonymous at: 2011-06-21 14:20:25

I just tried to install on Ubuntu 11.04 and the installation fails on the line:

apt-get install libc6-dev dpkg-dev db4.3-util libdb4.3-dev vim lynx bzip2 unzip perl-doc libwww-perl ntp-simple

Result:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.3.6-0ubuntu20.6) but 2.13-0ubuntu13 is to be installed
E: Broken packages

From: Anonymous at: 2011-09-04 04:39:52

same here. : (

 e: unable to locate package link.

From: Anonymous at: 2006-08-18 15:02:38

If you're trying to use the "getadsmtp.pl" script to grab valid email addresses from exchange, as mentioned in section 2.2.11, you may have to do something extra.  It told me "permission denied" when I tried to execute the script.  The trick was to run "chmod +x getadsmtp.pl" before trying to execute the script.  More experienced users might scoff, but being new to Linux, it was a real head-scratcher for me.  Hope it helps someone!

From: at: 2008-03-30 10:39:46

the error traced back to problem in /etc/postfix/master.cf

line for local loopback was like this

"smtp      unix  -       -       n       -       -       smtp"

when cahnged to

"smtp      unix  -       -       y       -       -       smtp"

problem resolved.

 

From: Anonymous at: 2006-08-30 06:24:13

shouldn't

postfix start

read

/etc/init.d/postfix start ?

From: fdalmoro at: 2006-09-26 18:26:06

just 'postfix start' works fine too without having to put in the /etc/init.d/postfix in it.

From: at: 2008-03-16 13:15:58

when regisrering with razor you can recieve a

Error 202 while performing register, aborting.

Turns-out you need to run the razor-admin with a -discover first if you come across this error. In general it’s some sort of network error.

razor-admin -discover
razor-admin -create
razor-admin -register

thanks to
http://devnulled.com/content/2005/03/razor-error-202-while-performing-register-aborting/

for the solution

From: Damien at: 2009-11-24 11:22:45

Thanks for this very usefull HowTo.

I used it, technicaly, it works (the linux box relay the messages to the exchange server), but every message received by the exchange server is recognized as SPAM :(

Does anybody get this kind of troubles?

Thx,

Damien