Setting up Postfix under Greenline (SMF) arrow postfix
postfix

            

Introduction to CRM114

CRM114 is a system to examine incoming e-mail, system log streams, data files or

other data streams, and to sort, filter, or alter the incoming files or data streams

according to the user's wildest desires. Criteria for categorization of data can be by

satisfaction of regexes, by sparse binary polynomial matching with a Bayesian Chain

Rule evaluator, or by other means. Accuracy of the SBPH/BCR classifier has been

seen in excess of 99 per cent, for 1/4 megabyte of learning text. In other words,

CRM114 learns, and it learns fast . 1

Lets start with obtaining CRM

You can pull off the latest version from http://crm114.sourceforge.net/. Since the

software is always in development and numerous bug fixes come out often check the

site at least monthly. Alternatively sign up for their mailing list at:

http://lists.sourceforge.net/lists/listinfo/crm114-general

Now let’s compile and install CRM

You can build CRM with gnu regex libraries or the TRE regex libraries. The TRE

libraries are recommended and come with the source.

Build your TRE:

#cd tre-<ver >

#./configure

#make

#make intall

You now should have libtre installed in /usr/local/lib:

/usr/local/lib/libtre.so.3

/usr/local/lib/libtre.so.3.0.1

/usr/local/lib/libtre.so

/usr/local/lib/libtre.la

/usr/local/lib/libtre.a

Now you are ready to compile CRM. By default the binaries will go to /usr/bin. If you

would like a different location edit the Makefile and edit INSTALL_DIR direcective

#gunzip crm114-<ver>.tar.gz

#tar xvf crm114-<ver>.tar

#cd crm114-<ver>

#make clean

#make

#make install

*Please note if compiling on Solaris use GNUmake otherwise compilation will fail.

                                          http://www.macroscape.com

*Also part of the Makefile is a strip command, which will not work on Soalris either unless you can obtain

the GNU version. You can just comment out all the refernces to “strip” in the Makefile and it will work just

fine.

“Make install” will install the following files into /usr/bin:

 crm                  -  the   CRM114 "compute engine".

 cssutil              -  the   .css file check/verify/edit program

 cssdiff              -  the   .css file diff program

 cssmerge             -  the   .css file merging program

Pick a directory where you will store all the .crm, .css and .mfp files and copy all of

them to the destination

#cp *.css /path/to/crm

#cp *.mfp /path/to/crm

#cp *.crm /path/to/crm

Obtaining or recreating .css files

While the .css files that you can download from

http://crm114.sourceforge.net/crm114-2003-09-20-Beta.css.tar.gz are pretty

substantial in size and have been trained well, They will not work on Sparc

architecture, furthermore it is best to train your spam according to what spam you

get.

The first thing to do is create the new spam and nonspam css files:

cssutil -b -r /path/to/spam.css

cssutil -b -r /path/to/nonspam.css

Editing mailfilterconfig.crm file

First thing to do is you need to change your password:

# ------------define the secret password ---------- YOU NEED TO CHANGE THIS!

#

isolate (:spw:)

alter (:spw:) /your_password_here/

The rest of the options are very well documented within the file itself so we will not

spend much more time on this.

One option for mime encoding needs to be changed from the default:

alter (:mime_decoder:) /mimencode -u/

                                    http://www.macroscape.com

You will need to download mimencode for Solaris and install the package.

Configuring postfix and procmail

We are assuming you already have postfix running and procmail installed, if not refer

to their respected documentation. There is not much to do within postfix to enable

procmail.

Method A – Global procmailrc file

(not recommended since that will only use one mailfilter.crm file for all users)

1.Pick a directory where you will store all the .crm, .css and .mfp files ((for ex.

/etc/opt/crm) and copy all of them to the destination

#cp *.css /path/to/crm

#cp *.mfp /path/to/crm

#cp *.crm /path/to/crm

2.Create a global procmailrc file in /etc/

Change permissions on the file to:

#chmod 644 /etc/procmailrc

3.Edit your main.cf

mailbox_command = /usr/bin/procmail -pm /etc/procmailrc

CRM use to come with a procmail recipe to use in its distribution, however we

changed it a bit to reflect our environment:

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

SHELL=/usr/bin/sh                #Use the Bourne shell (check your path!)

MAILDIR=$HOME                #

LOGFILE=$MAILDIR/procmail.log

DEFAULT=$HOME/Mailbox

LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "

:0fw: .msgid.lock

| /usr/bin/crm –u /etc/opt/crm mailfilter.crm

:0:

* ^X-CRM-Rejected:.*

mail/crm-spam

# Accept all the rest to your default mailbox

:0:

${DEFAULT}

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

                                   http://www.macroscape.com

The logging can be disabled, however it’s a good idea to have it on at first to perform

any troubleshooting. Your procmail.log will give you pretty good indication on where

the issue is regarding CRM configuration

4.Reload postfix

#postfix reload

After reloading you will see similar messages in your mail log file:

Sep 28 03:13:32 host.example.com postfix/local[19273]: [ID 197553 mail.info]

92B4A26E57: to=< This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

>, relay=local, delay=1, status=sent ("|/usr/bin/procmail -pm /etc/procmailrc")

Method B – Per User Spam filtering

For this method no changes to Postifx configuration is needed. Postfix supports

.forward files out of the box.

1.Once the binaries are installed, each user will have to have all the above .css, .crm

and .mfp files which you can preload for them in their home directories:

For ex. /export/home/user/crm

Remember to chown –R:

#chown –R user:group /export/home/user/crm

#chmod –R 700 /export/home/user/crm

2. I would suggest generating new .css files for each user and instructing them on

how to train CRM (see the HOWTO from

http://crm114.sourceforge.net/CRM114_Mailfilter_HOWTO.txt)

3. Each user will need a .forward and .procmailrc files

the .forward file will need to contain the following:

"|exec /usr/bin/procmail -pm /export/home/user/.procmailrc"

the .procmailrc file can be used from above with a minor change of invoking crm:

| /usr/bin/crm -u /export/home/user/crm/ mailfilter.crm

                                 http://www.macroscape.com

References

1.Bill Yerazunis, Mailfilter HOWTO,

http://crm114.sourceforge.net/CRM114_Mailfilter_HOWTO.txt

 

 

domain zengin   loan   ihracat