Subject Rewrite Help

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

jgao
Posts: 55
Joined: Tue Feb 14, 2006 11:54 pm

Subject Rewrite Help

Postby jgao » Fri May 19, 2006 3:33 pm

I need to make subject rewrite work with Sendmail, Spamassassin, spamass-milter and Scalix, in the way as adding *****SPAM***** to the beginning of Subject.

I used the local.cf generated by the configuration tool on Spassassin site, http://www.yrex.com/spam/spamconfig.php, and replaced the /etc/mail/spassassin/local.cf. After I restarted everything, the /var/log/maillog display the spam as :

Milteradd: header: X-Spam-Flag: YES
Milter add: header: X-Spam-Status: Yes

But the email subject still remains the same as original for the SAPM marked ones.

How to make this work in scalix environment here?

Everything commented out in the file /etc/syconfig/spamass-milter. It says the -f default option is to run spamass-milter in the background. What options to use if I want to change it? what to do to -f?

Thanks.

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Fri May 19, 2006 4:26 pm

Hi jgao,

Please post the following:

/etc/sysconfig/spamass-milter
/etc/sysconfig/spamassassin
/etc/mail/spamassassin/local.cf
/etc/init.d/spamassassin
/etc/init.d/spamass-milter

Thanks,
Rachel

jgao
Posts: 55
Joined: Tue Feb 14, 2006 11:54 pm

Postby jgao » Fri May 19, 2006 6:55 pm

1.
### Override for your different local config
#SOCKET=/var/run/spamass-milter/spamass-milter.sock

### Standard parameters for spamass-milter are:
### -P /var/run/spamass-milter.pid (PID file)
###
### Note that the -f parameter for running the milter in the background
### is not required because the milter runs in a wrapper script that
### backgrounds itself
###
### You may add another parameters here, see spamass-milter(1)
#EXTRA_FLAGS="-m -r 15"

2.
# Options to spamd
SPAMDOPTIONS="-d -c -m5 -H"

3.
# SpamAssassin config file for version 3.x
# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6
# See http://www.yrex.com/spam/spamconfig25.php for earlier versions
# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

# How many hits before a message is considered spam.
required_score 0.0

# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe 1

rewrite_header Subject [SPAM]

# Change the subject of suspected spam
rewrite_subject 1
subject_tag *****SPAM*****

# Enable the Bayes system
use_bayes 1

# Enable Bayes auto-learning
bayes_auto_learn 1

# Enable or disable network checks
skip_rbl_checks 0
use_razor2 0
use_dcc 0
use_pyzor 0

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages all

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales all

4.
#!/bin/sh
#
# spamassassin This script starts and stops the spamd daemon
#
# chkconfig: - 80 30
# processname: spamd
# description: spamd is a daemon process which uses SpamAssassin to check \
# email messages for SPAM. It is normally called by spamc \
# from a MDA.

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Set default spamd configuration.
SPAMDOPTIONS="-d -c -m5 -H"
SPAMD_PID=/var/run/spamassassin/spamd.pid

# Source spamd configuration.
if [ -f /etc/sysconfig/spamassassin ] ; then
. /etc/sysconfig/spamassassin
fi

[ -f /usr/bin/spamd -o -f /usr/local/bin/spamd ] || exit 0
PATH=$PATH:/usr/bin:/usr/local/bin

# By default it's all good
RETVAL=0

# See how we were called.
case "$1" in
start)
# Start daemon.
echo -n "Starting spamd: "
daemon $NICELEVEL spamd $SPAMDOPTIONS -r $SPAMD_PID
RETVAL=$?
echo
if [ $RETVAL = 0 ]; then
[ -n "$SPAMD_PID" ] && ln -s $SPAMD_PID /var/run/spamd.pid
touch /var/lock/subsys/spamassassin
fi
;;
stop)
# Stop daemons.
echo -n "Shutting down spamd: "
killproc spamd
RETVAL=$?
echo
if [ $RETVAL = 0 ]; then
rm -f /var/lock/subsys/spamassassin
rm -f /var/run/spamd.pid
fi
;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e /var/lock/subsys/spamassassin ] && $0 restart
;;
status)
status spamd
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|status|condrestart}"
RETVAL=1
;;
esac

exit $RETVAL

5.
#!/bin/bash
#
# Init file for Spamassassin sendmail milter.
#
# chkconfig: - 79 21
# description: spamass-milter is a daemon that hooks into sendmail and \
# routes email messages to spamassassin
#
# processname: spamass-milter
# config: /etc/sysconfig/spamass-milter
# pidfile: /var/run/spamass-milter.pid

source /etc/rc.d/init.d/functions
source /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/spamass-milter ] || exit 1

### Default variables
SOCKET="/var/run/spamass-milter/spamass-milter.sock"
EXTRA_FLAGS="-m -r 15"
SYSCONFIG="/etc/sysconfig/spamass-milter"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

RETVAL=0
prog="spamass-milter"
desc="SpamAssassin milter"
pidfile=/var/run/spamass-milter.pid

start() {
echo -n $"Starting $desc ($prog): "
touch $pidfile
chown sa-milt:sa-milt $pidfile
daemon --user sa-milt /usr/sbin/${prog}-wrapper -p $SOCKET -P $pidfile $EXTRA_FLAGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/spamass-milter
return $RETVAL
}

stop() {
echo -n $"Shutting down $desc ($prog): "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $pidfile
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/spamass-milter
return $RETVAL
}

restart() {
stop
sleep 2
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
condrestart)
[ -e /var/lock/subsys/spamass-milter ] && restart
RETVAL=$?
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Fri May 19, 2006 10:44 pm

Hi jgao,

If you look in your /etc/init.d/spamass-milter file, you have:

Code: Select all

EXTRA_FLAGS="-m -r 15"


If you look at the man pages for spamass-milter:

Code: Select all

     -m      Disables modification of the Subject: and Content-Type: head-
             ers and message body.  This is useful when SpamAssassin is con-
             figured with defang_mime 0 and report_header 1, or when SA is
             simply used to add headers for postprocessing later.  Updating
             the body through the milter interface can be slow for large mes-
             sages.


So, you'll need to remove the -m flag in order to rewrite the Subject: line.

Thanks,
Rachel

jgao
Posts: 55
Joined: Tue Feb 14, 2006 11:54 pm

Postby jgao » Fri May 19, 2006 11:26 pm

Thanks.


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 13 guests