LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-03-2007, 12:26 PM   #1
squintr
LQ Newbie
 
Registered: Jan 2007
Posts: 3

Rep: Reputation: 0
How to setup Mailscanner, ClamAV, Postfix, SpamAssassin (my notes)


Here's my personal notes from setting up a pretty effective spam filter (in my opinion). Hope this helps someone because I know I had very little help.

----------------------------

after fedora core setup

yum update

go to www.mailscanner.info, click on downloads. Copy url of most recent version for redhat/fedora

cd /usr/src
wget <<paste url>>

yum install rpm-build gcc
tar xvzf Mailscanner....tar.gz
./install.sh

Ensure selinux is disabled

run 'setup' and remove sendmail from system services startup after MailScanner install

yum install postfix

edit /etc/postfix/main.cf
relay_recipient_maps = hash:/etc/postfix/valid-users
show_user_unknown_table_name=no
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
relay_recipient_maps = hash:/etc/postfix/valid-users
smtpd_error_sleep_time = 5s
smtpd_soft_error_limit = 2
smtpd_hard_error_limit = 5
show_user_unknown_table_name=no

Create a file /etc/postfix/valid-users
And edit it to add a list of your valid users like this:
user@example.com X
user2@example.com X

Change the file from a “flat” file to a database by typing:
Postmap valid-users
This will create a file called valid-users.db

If you do not want to use DNS to resolve your domain names then do this:
edit /etc/postfix/transport
add your domains like this:
example.com smtp:[10.10.10.10]
mail.example.com smtp:[192.168.1.1]

edit /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport

postmap transport (this will create a file called transport.db)

If you want to use DNS to resolve your domains (or don’t care either way) then do this:
Edit /etc/postfix/relay_domains
Add your domains like this:
example.com, mail.example.com

Edit /etc/postfix/main.cf
relay_domains = /etc/postfix/relay_domains

Start Postfix with “postfix start”

Test Postfix before going to the next step. Note that computers on the same subnet as your spam filter are “trusted” so you won’t get any relay access denied errors unless you’re testing from an external source.

Stop Postfix with “postfix stop”

Install SpamAssassin if this hasn’t been done yet.

Install ClamAV
yum install clamav clamav-update clamav-server
freshclam

edit /etc/MailScanner/virus.scanners.conf so that the line regarding clamav reads:
clamav /usr/lib/MailScanner/clamav-wrapper /usr


Configure MailScanner with Postfix
(taken from http://www.mailscanner.info/postfix.html)

edit /etc/postfix/main.cf
header_checks = regexp:/etc/postfix/header_checks

In the file /etc/postfix/header_checks add this line:
/^Received:/ HOLD  tells mail to hold in queue for scanning

In your MailScanner.conf file (probably in /etc/MailScanner) there are 6 settings you need to change. They are all really near the top of the file. The settings are
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
You will need to ensure that the user "postfix" can write to /var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine:
chown postfix.postfix /var/spool/MailScanner/incoming
chown postfix.postfix /var/spool/MailScanner/quarantine
chown postfix.postfix /var/spool/MailScanner/spamassassin (not sure if this is required)
If you upgrade your copy of MailScanner, unfortunately these directories will be changed back to being owned by root, so you will have to do those 3 commands again.
run 'setup' and add MailScanner to system services startup

If you are switching from sendmail to postfix then you will need to change the ownership of /var/spool/MailScanner/incoming/ SpamAssassin.cache.db to postfixostfix


Highlight Phishing Fraud = no
Virus Scanners = clamav
Maximum Archive Depth = 0
Sign Clean Messages = no
Spam List = <pick your blacklist of choice>
Spam Lists To Reach High Score = <play around with these settings>
Use SpamAssassin = yes
Required SpamAssassin Score = <play around with these settings>
High SpamAssassin Score = <play around with these settings>
SpamAssassin Auto Whitelist = no
High Scoring Spam Actions = forward spam@example.com
Notify Senders = no

Edit /etc/MailScanner/rules/spam.whitelist.rules

# This is where you can build a Spam WhiteList
# Addresses matching in here, with the value
# "yes" will never be marked as spam.
#From: 152.78. yes
#From: 130.246. yes
FromOrTo: default no
From: *@hotmail.com yes

Reboot the machine and all should be good!

Check out the log in /var/log/maillog
 
Old 01-04-2007, 06:08 AM   #2
shawnbishop
Member
 
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Rep: Reputation: 30
Hi

Submit to howtoforge..should get it published on the site
 
Old 05-31-2012, 01:10 PM   #3
centos123
Member
 
Registered: Apr 2011
Posts: 397

Rep: Reputation: 16
can you provide some help on qmail and MAILWQATCH FOR MAILSCANNER........
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configure postfix with ClamAV MailScanner Dovecot Ilohamail shipon_97 Linux - Newbie 2 04-22-2010 01:51 PM
LXer: Book review: Setup and Run a Small Office Email Server Using Postfix, Courier, Procmail, Squirrelmail, Clamav and Spamassassin LXer Syndicated Linux News 0 08-24-2006 09:21 AM
Mailscanner With Spamassassin + Clamav On The Same Server treedstang Linux - Enterprise 3 02-09-2006 10:53 PM
Spamassassin setup with Postfix, Dovecot and Amavisd snurckle Linux - General 2 04-07-2005 12:16 PM
MailScanner and ClamAV Configuration problem AZIMBD03 Red Hat 1 01-29-2004 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration