Tuesday, July 26, 2011

mailscanner

iksv


yum install wget ntp vixie-cron crontabs postfix patch rpm-build binutils gli unrar

yum install perl wget unzip gcc

myhostname = mail.abc.org
mydomain = abc.loc
myorigin = $mydomain
relay_domains = abc.org

mydestination = $myhostname, localhost.$mydomain $mydomain

vi /etc/postfix/main.cf
[root@mail postfix]# vi /etc/postfix/header_checks
[root@mail postfix]# vi /etc/postfix/transport



postmap /etc/postfix/transport

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

yum install spamassassin

sa-update


yum install clamav clamd


install.sh ---> mailscanner
service sendmail stop
chkconfig sendmail off
chkconfig MailScanner on
service MailScanner start



How to Set up MailScanner for Use with Postfix

In your MailScanner.conf file (probably in /etc/MailScanner or /opt/MailScanner/etc), there are 5 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


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

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 2 commands again.



You now have installed SpamAssassin. The next step is to configure it and MailScanner.

In /etc/MailScanner/MailScanner.conf, I would advise you set "Log Spam = yes" to start with.
You will of course need "Use SpamAssassin = yes".
If you don't have a very fast link, increase "SpamAssassin Timeout" to nearer 20.



spamassassin -D -p /etc/MailScanner/spam.assassin.prefs.conf --lint


yum install caching-nameserver


Local caching DNS

yum install caching-nameserver.x86_64

Update in /etc/resolv.conf:

nameserver 127.0.0.1

Run:

chkconfig named on
service named start

NTP

Keep your server time uptodate (always a good idea).

yum install ntp.x86_64
ntpdate ntp.connexeon.net
chkconfig ntpd on
service ntpd start



http://blog.connexeon.com/sysadmin/linux/mailscanner-with-postfix-mailwatch-installation-procedure-on-rhel/


mkdir /var/spool/MailScanner/spamassassin
chown postfix.postfix /var/spool/MailScanner/spamassassin


http://aaronwalrath.wordpress.com/2010/04/15/set-up-an-email-gateway-with-centos-linux-5-4/

Edit /etc/MailScanner/MailScanner.conf, otherwise you may receive an error when you attempt to start MailWatch:

Virus Scanners = clamav


**********************************************************************************************************
mailwatch
**********************************************************************************************************
yum install mysql-server php php-mysql php-gd httpd perl-DBD-MySQL
yum install php-gd mysql-server

/etc/init.d/mysqld start



[root@mail mailwatch-1.0.5]# /usr/bin/mysqladmin -u root password '596674'
[root@mail mailwatch-1.0.5]# /usr/bin/mysqladmin -u root -h mail.iksv.org password '596674'
[root@mail mailwatch-1.0.5]# mysql -p < create.sql
Enter password:
[root@mail mailwatch-1.0.5]# pwd
/usr/local/src/mailwatch-1.0.5


[root@mail mailwatch-1.0.5]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT ALL ON mailscanner.* TO mailwatch@localhost IDENTIFIED BY '596674';
GRANT FILE ON *.* TO mailwatch@localhost IDENTIFIED BY 'yourpassword';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)


vi MailWatch.pm
mysql -u root -p
ls /usr/lib/MailScanner/MailScanner/CustomFunctions/
mv MailWatch.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
[root@mail mailwatch-1.0.5]# vi SQLBlackWhiteList.pm
[root@mail mailwatch-1.0.5]# mv SQLBlackWhiteList.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/

[root@mail mailwatch-1.0.5]# mysql mailscanner -u mailwatch -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> INSERT INTO users VALUES ('dogan',md5('596674'),'Dogan Ar','A',0,0,0,0,'');
Query OK, 1 row affected (0.01 sec)



[root@mail mailwatch-1.0.5]# yum install httpd
[root@mail mailwatch-1.0.5]# mv mailscanner/ /var/www/html/

Edit /etc/MailScanner/spam.assassin.prefs.conf and set:

bayes_path /etc/MailScanner/bayes/bayes
bayes_file_mode 0660

Create the ‘new’ bayes directory, make the directory owned by the same group as the web server user and make the directory setgid:
mkdir /etc/MailScanner/bayes
chown root:apache /etc/MailScanner/bayes
chmod g+rws /etc/MailScanner/bayes
[root@mail mailwatch-1.0.5]# vi /etc/MailScanner/spam.assassin.prefs.conf
[root@mail mailwatch-1.0.5]#


# vi /etc/MailScanner/MailScanner.conf

Change some parameters so that they look like this:

Run As User = postfix

Run As Group = postfix

Incoming Queue Dir = /var/spool/postfix/hold

Outgoing Queue Dir = /var/spool/postfix/incoming

MTA = postfix

Incoming Work Group = clamav

Incoming Work Permissions = 0640

Virus Scanners = clamd

Clamd Socket = /tmp/clamd.socket

Clamd Lock File = /var/lock/subsys/clamd

SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

Quarantine User = root

Quarantine Group = apache

Quarantine Permissions = 0660

Quarantine Whole Message = yes

Quarantine Whole Message As Queue Files = no

Detailed Spam Report = yes

Include Scores In SpamAssassin Report = yes

Spam Actions = store

High Scoring Spam Actions = store

Always Looked Up Last = &MailWatchLogging Is Definitely Not Spam = &SQLWhitelist Is Definitely Spam = &SQLBlacklist Filename Rules = %etc-dir%/filename.rules.conf Filetype Rules = %etc-dir%/filetype.rules.conf Dangerous Content Scanning = %rules-dir%/content.scanning.rules.conf

cd /etc/MailScanner/
touch filename.rules filetype.rules filename.rules.allowall.conf filetype.rules.allowall.conf rules/content.scanning.rules
vi filename.rules
vi filetype.rules
vi filename.rules.allowall.conf
vi filetype.rules.allowall.conf
vi rules/content.scanning.rules
chown -R postfix:apache /var/spool/MailScanner/quarantine/
chmod g+rws /var/spool/MailScanner/quarantine




mailwatch kurulun dizininden tools dizininden
cp quarantine_maint.php db_clean.php /usr/local/bin/
chmod 755

[root@mail tools]# crontab -l
2 3 * * * /usr/bin/freshclam --quiet
2 3 * * * /usr/local/bin/quarantine_maint.php --clean
2 3 * * * /usr/local/bin/db_clean.php


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9.24 Fix to Allow Quarantine Release of Messages
Change the following in /var/www/mailscanner/conf.php:

define(QUARANTINE_FROM_ADDR, ‘postmaster@domain.tld’);

*You need to put the full email address or this will not work.

Also make sure the following string is set to true:
define(QUARANTINE_USE_FLAG, true);

If you’d like the message to be released in it’s original form and not as an attachment, set the following line to true:

define(QUARANTINE_USE_SENDMAIL, true);


9.24.3 Releasing Spam Messages
To allow MailWatch to release Spam messages without them being processed again, add 127.0.0.1 as a whitelist item in MailWatch/List interface. Make sure to restart MailScanner after configuring these options. Below is what my entry looks like.

127.0.0.1 default Del

http://www.webculture.co.uk/blog/?p=25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A patch for Mailwatch for Mailscanner which enables postfix mail queue monitoring support.

http://www.gbnetwork.co.uk/mailscanner/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

http://www.jonesol.com/index.php/MailWatch

http://adityo.blog.binusian.org/?tag=postfix-on-centos --------------> bunu kullanmışlar

MailScanner -D --lint





********************************************
Razor Setup
Next we create a Razor account on the remote servers. TCP 2703 must be allowed outbound or this command will fail.

# vi /etc/mail/spamassassin/mailscanner.cf
razor_config /etc/mail/spamassassin/.razor/razor-agent.conf
# razor-admin -create
# razor-admin -register
# vi /etc/mail/spamassassin/v310.pre
loadplugin Mail::SpamAssassin::Plugin::Razor2


baska yerden
7.3 Razor Configuration
Create the .razor configuration:

cd
rm /etc/razor/razor-agent.conf
mkdir /var/lib/MailScanner/.razor
razor-admin -home=/var/lib/MailScanner/.razor -create
razor-admin -home=/var/lib/MailScanner/.razor -discover
razor-admin -home=/var/lib/MailScanner/.razor -register
chown -R postfix:www-data /var/lib/MailScanner
chmod -R ug+rwx /var/lib/MailScanner

Make the following changes to /var/lib/MailScanner/.razor/razor-agent.conf:

vi /var/lib/MailScanner/.razor/razor-agent.conf

Change debuglevel = 3 to debuglevel = 0 (yes zero not "o"). This will prevent Razor from filling up your drive with debug information. Those two lines should look like this when done:

debuglevel = 0
razorhome = /var/lib/MailScanner/.razor/

***********************************************


EPEL repository rpm ini kur
yum install pyzor
pyzor --homedir /etc/mail/spamassassin/.pyzor discover


*******************************************************************
http://www.mailscanner.info/wiki/doku.php?id=custom_config:centos5**
*******************************************************************

Spam List = spamhaus-ZEN spamcop.net AHBL MULTI-SURBL MAPS-RBL
SORBS-DNSBL

No comments: