1] Kill savemail (savemail's pid can be found using ps command)
2] edit root's crontab entry and comment lines for
i) savemailctl
ii) sendcopy
NOTE: crontab can be edited using following command
# crontab -e
3] Stop sendmail and sendmail-rx using following command
/etc/init.d/sendmail stop
/etc/init.d/sendmail-rx stop
4] copy mfilternew.tgz to /var/tmp/
5] untar mfilternew.tgz using following command
tar -C / -xzvpf /var/tmp/mfilternew.tgz
6] Edit /etc/mail/mfilter.cf.
add or modify BACKUP: parameter.
It should be comma separated list of email addresses to which
backup of mail should be sent.
Eg: BACKUP: backup@starcomsoftware.com,mailbac@starcomsoftware.com
7] Start mfilter using following command
/etc/init.d/mfilter restart
Note: This needs to be done because when sendmail starts it expects
Mfilter to be running. Later we are going to insserv the mfilter,
so that it starts before sendmail at startup.
8] Edit /etc/mail/merce-rx.mc file and add following entry:
INPUT_MAIL_FILTER(
`filter1',
`S=inet:1234@localhost, F=T, T=C:1m;S:30s;R:6m;E:1m'
)dnl
9] Edit /etc/mail/merce-rx.mc
i) Change value of `confCON_EXPENSIVE' from `True' to `False'.
ii) Delete following lines,
MODIFY_MAILER_FLAGS(`SMTP',`+e')dnl
MODIFY_MAILER_FLAGS(`UUCP',`+e')dnl
MODIFY_MAILER_FLAGS(`ESMTP',`+e')dnl
iii) Edit MODIFY_MAILER_FLAGS(`CYRUSV2',`+we')dnl to remove 'e' from
`+we' now line will look like
MODIFY_MAILER_FLAGS(`CYRUSV2',`+w')dnl
10] Generate sendmail.cf file from merce.mc using following command
m4 /usr/share/sendmail/m4/cf.m4 /etc/mail/merce-rx.mc >
/var/tmp/sendmail-rx.cf
11] Using vimdiff command verify that new sendmail.cf has changes related
to mfilter only. If there are any other changes like DS or Mail Size
those should be taken care of. If every thing is correct move
new sendmail.cf
to /etc using following command and proceed
mv /var/tmp/sendmail-rx.cf /etc/mail/sendmail-rx.cf
12] Start sendmail-rx using following command
/etc/init.d/sendmail-rx start
12] Edit /etc/init.d/sendmail file append ' mfilter'(note space before
mfilter) at the end of
"Requred-Start: " parameter. and restart sendmail
14] Give following command, so that after next restart mfilter start
before sendmail:
insserv /etc/init.d/mfilter
15] add the crontab entry for /usr/sbin/mailer-daemon.sh after
removing the 3 commented lines for "rm -rf". If you do not understand
this then call up
0-59/10 * * * * su -s /bin/bash vscan /usr/sbin/mailer-daemon.sh
16] restart mfilter
TESTING:
1] Using telnet verify that mfilter is accepting connection.
telnet localhost 1234
2] Send a test mail using telnet.
3] Check /var/adm/log/mail.log file. It should contain log with tag mfilter.
Also you should see mail to backup address you have specified in mfilter.conf
file.
SOME EXAMPLE RULE CONFIGURATIONS FOR MFILTER
rule for denying a user
x\@.* .*\@.* - - DENY
rule saying user x should not be able to send a mail of size > 10 kb
x\@.* .*\@.* - 10 ALLOW
x\@.* .*\@.* 10 - DENY
Always restart mfilter after making changes in the file /etc/mail/mfilter.rules