Confixx 3.2.1 und benutzerdefinierte Spamassassin-Regeln

taz

Registered User
Hi,
ich habe da mal wieder ein Problem.

Ich habe einen neuen Server mit
openSUSE 10.2 (X86-64)
Confixx 3.2.1
Perl 5.8.8
Postfix 2.3.2
Procmail 3.22
Spamassassin 3.1.6
MySQL 5.0.26

Leider scheint mein Anbieter nicht übermäßig viel Ahnung von Confixx zu haben und hat mir zwar Confixx installiert, jedoch viele Serverdienste nicht mit- oder unkonfiguriert installiert. Teilweise nicht mal die Zusammenarbeit mit Confixx konfiguriert.

Heute beschäftige ich mich mit dem Spamfilter. Leider bekomme ich es nicht auf die Reihe, das Spamassassin die richtigen Spamassassin-Einstellungen aus der Confixx-Datenbank (Tabelle: spampref) läd.

Spamassassin markiert Spammails immer nur mit den Standardeinstellungen aus der local.cf

Spamassassin - /etc/mail/spamassassin/local.cf
Code:
################### CONFIXX SPAMASSASSIN CONFIG FILE #####################
# created at Tue Apr 17 15:00:53 2007
#
#            !!! Do not make any changes in this file !!!
# All your changes will be lost after the file is auto updated next time.
#
#   If you want to add here any custom directive, you should include it
#   to '/root/confixx/safe/spamassassin.inc' file. Its content will be automatically
#   included during the file is autoupdated.
##########################################################################

# START CUSTOM INCLUSION (see /root/confixx/safe/spamassassin.inc)

# SpamAssassin config file for version 3.x

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

# Whether to change the subject of suspected spam
rewrite_header subject  ****SPAM****

# Encapsulate spam in an attachment
report_safe             1

# Add report into headers
add_header spam Report _REPORT_

# 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              1
use_dcc                 1
use_pyzor               1

# 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


# END OF CUSTOM INCLUSION

# START CONFIXX GENERATED SECTION

	
###

allow_user_rules 1

user_scores_dsn                 DBI:mysql:confixx:localhost;mysql_socket=/var/lib/mysql/mysql.sock
user_scores_sql_username        confixx
user_scores_sql_password        xxx

user_scores_sql_custom_query SELECT preference, value FROM spampref WHERE (username = _USERNAME_ OR username = '@GLOBAL') AND server_id='xxx' ORDER BY username ASC

# END OF CONFIXX GENERATED SECTION

Spamassassin ist über Procmail eingebunden.

Procmail - /etc/procmailrc:
Code:
# SpamAssassin sample procmailrc
# ==============================

# The following line is only used if you use a system-wide /etc/procmailrc.
# See procmailrc(5) for infos on what it exactly does, the short version:
#  * It ensures that the correct user is passed to spamd if spamc is used
#  * The folders the mail is filed to later on is owned by the user, not
#    root.
DROPPRIVS=yes

# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
|/usr/bin/spamc -f

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
almost-certainly-spam

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
# NOTE: This is probably NOT needed in recent versions of procmail
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "
  
  :0 fhw
  | sed -e '1s/^/F/'
}

Ich weiß mir leider keinen Rat. Zumal in den Logdateien keinerlei Fehler oder ähnliches auftreten. In den Logs ist auch keine Information enthalten, das Einstellungen aus der Datenbank geladen werden.

Kann mir jemand da helfen?

MfG taz
 
mach mal

Code:
ps aux | grep spam

Sollte so aussehen:

Code:
 /usr/sbin/spamd [B]--setuid-with-sql [/B]--nouser-config --daemonize --max-children=5 -d --pidfile=/var/run/spamd.pid

Meist fehlt der schwarz hervorgehobene Parameter, --nouser-config stört hier übrigens nicht.

Wenn mans nach Anleitung von SWSoft installiert, klappts übrigens nicht gescheit.

PS: Deine procmailrc von SWSoft sortiert Mails in Spam Ordner ein, das würde ich abschalten an Deiner Stelle.
 
Hi,
erstmal danke für deine Hilfe. Jedoch hat es leider das Problem noch nicht gelöst.

Auszug aus der /var/log/mail:
Code:
Apr 19 11:59:23 brb2 postfix/smtpd[3199]: connect from pXXX.XXX.XXX.XXX.tisdip.tiscali.de[XXX.XXX.XXX.XXX]
Apr 19 11:59:23 brb2 postfix/smtpd[3199]: E12E1168DF3: client=pXXX.XXX.XXX.XXX.tisdip.tiscali.de[XXX.XXX.XXX.XXX], sasl_method=LOGIN, sasl_username=web6p1
Apr 19 11:59:24 brb2 postfix/cleanup[3202]: E12E1168DF3: message-id=<765824359.20070418123355@HOST.TLD>
Apr 19 11:59:24 brb2 postfix/cleanup[3202]: E12E1168DF3: resent-message-id=<20070419095923.E12E1168DF3@HOST.TLD>
Apr 19 11:59:24 brb2 postfix/qmgr[29376]: E12E1168DF3: from=<info@HOST.TLD>, size=5247, nrcpt=1 (queue active)
Apr 19 11:59:24 brb2 amavis[539]: (00539-06) (!!)WARN: all primary virus scanners failed, considering backups
Apr 19 11:59:24 brb2 postfix/smtpd[3199]: disconnect from pXXX.XXX.XXX.XXX.tisdip.tiscali.de[XXX.XXX.XXX.XXX]
Apr 19 11:59:28 brb2 postfix/smtpd[3206]: connect from localhost[127.0.0.1]
Apr 19 11:59:28 brb2 postfix/smtpd[3206]: 66447168DFA: client=localhost[127.0.0.1]
Apr 19 11:59:28 brb2 postfix/cleanup[3202]: 66447168DFA: message-id=<765824359.20070418123355@HOST.TLD>
Apr 19 11:59:28 brb2 postfix/cleanup[3202]: 66447168DFA: resent-message-id=<20070419095923.E12E1168DF3@HOST.TLD>
Apr 19 11:59:28 brb2 postfix/qmgr[29376]: 66447168DFA: from=<info@HOST.TLD>, size=5710, nrcpt=1 (queue active)
Apr 19 11:59:28 brb2 postfix/smtpd[3206]: disconnect from localhost[127.0.0.1]
Apr 19 11:59:28 brb2 amavis[539]: (00539-06) Passed CLEAN, [XXX.XXX.XXX.XXX] <info@HOST.TLD> -> <web6p1@HOST.TLD>, Message-ID: <765824359.20070418123355@HOST.TLD>, Resent-Message-ID: <20070419095923.E12E1168DF3@HOST.TLD>, mail_id: iBAIC50JFIH3, Hits: -, queued_as: 66447168DFA, 4310 ms
Apr 19 11:59:28 brb2 spamd[3190]: spamd: connection from localhost [127.0.0.1] at port 11179
Apr 19 11:59:28 brb2 postfix/smtp[3203]: E12E1168DF3: to=<web6p1@HOST.TLD>, orig_to=<NAME@HOST.TLD>, relay=127.0.0.1[127.0.0.1]:10024, delay=4.7, delays=0.36/0.01/0/4.3, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=00539-06, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 66447168DFA)
Apr 19 11:59:28 brb2 postfix/qmgr[29376]: E12E1168DF3: removed
Apr 19 11:59:28 brb2 spamd[3190]: spamd: setuid to web6p1 succeeded
Apr 19 11:59:28 brb2 spamd[3190]: spamd: processing message <765824359.20070418123355@HOST.TLD> aka <20070419095923.E12E1168DF3@HOST.TLD> for web6p1:648
Apr 19 11:59:32 brb2 spamd[3190]: spamd: identified spam (19.2/5.0) for web6p1:648 in 4.3 seconds, 5691 bytes.
Apr 19 11:59:32 brb2 spamd[3190]: spamd: result: Y 19 - FROM_LOCAL_NOVOWEL,HTML_MESSAGE,MIME_HTML_ONLY,MSGID_FROM_MTA_ID,RCVD_IN_NJABL_DUL,RCVD_IN_SORBS_DUL,URIBL_JP_SURBL,URIBL_OB_SURBL,URIBL_SBL,URIBL_SC_SURBL,URIBL_WS_SURBL scantime=4.3,size=5691,user=web6p1,uid=648,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=11179,mid=<765824359.20070418123355@HOST.TLD>,rmid=<20070419095923.E12E1168DF3@HOST.TLD>,autolearn=spam
Apr 19 11:59:32 brb2 spamd[3188]: prefork: child states: II
Apr 19 11:59:32 brb2 postfix/local[3207]: 66447168DFA: to=<web6p1@HOST.TLD>, relay=local, delay=4.5, delays=0.1/0.01/0/4.4, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail)

Auszug aus ps aux | grep spam:
Code:
root      3188  0.0  4.2  94948 40748 pts/1    S    11:58   0:00 /usr/bin/perl -T -w /usr/sbin/spamd --setuid-with-sql -r /var/run/spamd.pid
root      3190  0.0  4.3  96524 42100 pts/1    S    11:58   0:00 spamd child
root      3191  0.0  4.0  94948 38652 pts/1    S    11:58   0:00 spamd child
root      3374  0.0  0.0   4100   712 pts/1    S+   12:15   0:00 grep spam

"--setuid-with-sql" hab ich dabei schon eingesetzt, das war vorher nicht drin.
Hat noch jemand eine Idee?

MfG taz
 
Im Log muss sowas stehen:

Code:
Apr 19 12:20:43 xxxxxx spamd[5246]: spamd: setuid to web1p1 succeeded, [B]reading scores from SQL[/B]

Ich hab ja schon geschrieben, wie die Start Options bei mir aussehen, hier aus meiner Config:

Code:
OPTIONS="--setuid-with-sql --nouser-config --daemonize --max-children=5"

Mehr fällt mir akut dazu nicht ein. stimmen die in der Spamassi Config angegebenen SQL Zugangsdaten?
 
Ich hab ja schon geschrieben, wie die Start Options bei mir aussehen

Ich habe ja unter SuSE ein Init-Skript, über das Spamassassin gestartet wird, kann es daran liegen?

Mehr fällt mir akut dazu nicht ein. stimmen die in der Spamassi Config angegebenen SQL Zugangsdaten?

Die Confixx-Daten sind korrekt. Habe sogar den Query ausprobiert. Datenbank ist da, Tabelle ist da und der SELECT funzt.

Ich weiß mir keinen Rat.

MfG taz
 
Ich hatte spowas wohl schon mal, da lags an den parametern von spamc / spamassassin. aber zu SuSE kann ich nix sagen, außer !löschen!
 
So, ich habe das Problem gelöst bekommen (ohne openSuSE zu löschen :D ).

Um spamd mit SQL-Unterstützung zu starten muss er mit dem Parameter -q gestartet werden.
Dieser Parameter stand auch eigentlich drin, jedoch läd das init.d-Skript, das Spamassassin unter SuSE startet, die Einstellungen standardmäßig nicht aus der /etc/sysconfig.

Einsprechender Teil aus der /etc/init.d/spamd muss entsprechend dekommentiert werden:
Code:
#SPAMD_CONFIG=/etc/sysconfig/spamd
#test -r $SPAMD_CONFIG || exit 6
#. $SPAMD_CONFIG

Nun funzt alles. Auf das sich niemand anderes mehr mit diesem Problem rumschlagen muss.

MfG taz
 
Ich hab zwar nix kapiert, aber mal wieder ein Grund mehr, froh zu sein, keine SuSE-Gülle auf dem Server zu haben...
 
Um spamd mit SQL-Unterstützung zu starten muss er mit dem Parameter -q gestartet werden.
Dieser Parameter stand auch eigentlich drin, jedoch läd das init.d-Skript, das Spamassassin unter SuSE startet, die Einstellungen standardmäßig nicht aus der /etc/sysconfig.

Einsprechender Teil aus der /etc/init.d/spamd muss entsprechend dekommentiert werden:
Code:
#SPAMD_CONFIG=/etc/sysconfig/spamd
#test -r $SPAMD_CONFIG || exit 6
#. $SPAMD_CONFIG

Bei mir ist dieser Teil nicht auskommentiert, aber trotzdem lässt sich kein eigener required_score einstellen. Es wird der globale required_score verwendet.
So sieht meine spamd aus:
Code:
# Description:    Start spamd to allow efficient filtering of mail
#	through spamassassin. Note: Read README.spamd about security implications
# Short-Description: Start the spamassassin daemon
### END INIT INFO
# 
# Note on Required-Start: It does specify the init script ordering,
# not real dependencies. Depencies have to be handled by admin
# resp. the configuration tools (s)he uses.

# Source SuSE config (if still necessary, most info has been moved)
test -r /etc/rc.config && . /etc/rc.config

# Check for missing binaries (stale symlinks should not happen)
SPAMD_BIN=/usr/sbin/spamd
PIDFILE=/var/run/spamd.pid
test -x $SPAMD_BIN || exit 5

# Check for existence of needed config file and read it
# 
# Later, we may want to make startup behaviour (user ID, firewalling, ...)
# configurable, as there are security implications (read README.spamd).
SPAMD_CONFIG=/etc/sysconfig/spamd
test -r $SPAMD_CONFIG || exit 6
. $SPAMD_CONFIG

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
#      rc_active	checks whether a service is activated by symlinks
. /etc/rc.status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
	echo -n "Starting spamd "
	## Start daemon with startproc(8). If this fails
	## the echo return value is set appropriate.

	# NOTE: startproc returns 0, even if service is 
	# already running to match LSB spec.
	startproc -p $PIDFILE $SPAMD_BIN $SPAMD_ARGS -r $PIDFILE

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down spamd "
	## Stop daemon with killproc(8) and if this fails
	## set echo the echo return value.

	killproc -p $PIDFILE -TERM $SPAMD_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
	## Stop the service and if this succeeds (i.e. the 
	## service was running before), start it again.
	## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
	$0 status >/dev/null &&  $0 restart

	# Remember status and be quiet
	rc_status
	;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	$0 start

	# Remember status and be quiet
	rc_status
	;;
    force-reload)
	## Signal the daemon to reload its config. Most daemons
	## do this on signal 1 (SIGHUP).
	## If it does not support it, restart.

	echo -n "Reload service spamd "
	## if it supports it:
	#killproc -HUP $SPAMD_BIN
	#touch /var/run/spamd.pid
	#rc_status -v

	## Otherwise:
	$0 stop  &&  $0 start
	rc_status
	;;
    reload)
	## Like force-reload, but if daemon does not support
	## signalling, do nothing (!)

	# If it supports signalling:
	#echo -n "Reload service spamd "
	#killproc -HUP $SPAMD_BIN
	#touch /var/run/spamd.pid
	#rc_status -v
	
	## Otherwise if it does not support reload:
	rc_failed 3
	rc_status -v
	;;
    status)
	echo -n "Checking for service spamd "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.

	# Return value is slightly different for the status command:
	# 0 - service running
	# 1 - service dead, but /var/run/  pid  file exists
	# 2 - service dead, but /var/lock/ lock file exists
	# 3 - service not running

	# NOTE: checkproc returns LSB compliant status values.
	checkproc -p $PIDFILE $SPAMD_BIN
	rc_status -v
	;;
    probe)
	## Optional: Probe for the necessity of a reload,
	## print out the argument which is required for a reload.

	test /etc/mail/spamassassin/local.cf -nt /var/run/spamd.pid && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit

Wäre dankbar wenn man das Problem auch für mich lösbar darstellen könnte.
Gleiche Serverkonfiguration wie taz, so wie sich das liest.

mfg 0etzi
 
Last edited by a moderator:
Confixx schreibt user_prefs nicht

Hi@all,

ich schlage mich mit den selben Problemen rum, Confixx schreibt zwar die Richtigen Werte der individuellen Spamassassin Einstellungen in die Tabelle spampref in die Confixx DB aber es aktualisiert nicht das File user_prefs das in jedem .spamassassin Verzeichnis in den Maildir's liegt. Beim scannen werden lediglich die defaults verwendet. Erst wenn ich manuell die user_prefs ändere wird mit den Richtigen Werten gescannt, aber das kann doch nicht der Weisheit letzter Schluss sein,oder??

Die Startparameter in /etc/sysconfig/spamd sehen so aus SPAMD_ARGS="-d -x -q -Q -L" nach man spamd soweit alles Richtig.

Wie kann ich das blöde Confixx bewegen die user_prefs richtig zu schreiben? In die DB schreibt es doch auch die richtigen Werte rein....

System: RootDS Apache 2.2.0 PHP 5.2.4 Confixx3.3.1 SuSE10.1 procmail Postfix Courier

Kennt jemand die Lösung?

//EDIT: hat sich erledigt, Spamassassin wurde in der procmail.rc direkt aufgerufen, richtig ist aber der Aufruf über spamc. Weil es direkt aufgerufen wurde zeigte ein ps aux | grep spam zwar schön brav das es wohl läuft aber es wird nicht mit der richtigen config aufgerufen..

cu
Sundriver
 
Last edited by a moderator:
Bei mir sieht es in der procmailrc so aus:
Code:
# Diese Option muss wenn IMAP benutzt wird. Wenn IMAP nicht benutzt 
# wird, muss man den Eintrag auskommentieren.
# DEFAULT=/home/mail/$LOGNAME/Maildir/
DEFAULT=$HOME/Maildir/

LOGFILE=/var/log/procmail-spamd.log
DROPPRIVS=YES
SHELL=/bin/sh

# Der Pfad zu spamd muss richtig gesetzt sein.
:0 fw
* < 256000
| /usr/bin/spamc -f
#| /usr/bin/spamd -f

# Mails with a score of 15 or higher are almost certainly spam (with 
# 0.05% false positives according to rules/STATISTICS.txt). Let's put them in 
# a different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
#/var/spool/mail/almost-certainly-spam
/home/mail/$LOGNAME/Maildir/.almost-certainly-spam/

# All mail tagged as spam (eg. with a score higher than the set 
# threshold)
## is moved to "Spam".
:0:
* ^X-Spam-Status: Yes
#/var/spool/mail/Spam
/home/mail/$LOGNAME/Maildir/.Spam/

# Work around procmail bug: any output on stderr will cause the "F" in 
#"From"
# to be dropped.  This will re-add it.
:0 H
* ! ^From[ ]
* ^rom[ ]
{
        LOG="*** Dropped F off From_ header! Fixing up. "

        :0 fhw
        | sed -e 's/^rom /From /'
}

Wie ruft man das dann über spamc auf? Die spamc entählt nur Hieroglyphen.
Code:
ELF
in der spamd könnte ich was konfigurieren.

Hier noch die Ausgabe von ps aux | grep spam
Code:
# ps aux | grep spam
root     24882  0.0  4.4  99500 45104 ?        Ss   Nov29   0:00 /usr/sbin/spamd -d -c -L -r /var/run/spamd.pid
root     24883  0.0  5.2 107896 53464 ?        S    Nov29   0:21 spamd child
root     24884  0.0  4.5 100720 46144 ?        S    Nov29   0:00 spamd child
root     29662  0.0  0.0   4096   704 pts/0    R+   12:07   0:00 grep spam

mfg 0etzi
 
Last edited by a moderator:
Problem gelöst

Wiedermal meine Blindheit:
in etc/sysconfig/spamd hat -x -q bei SPAMD_ARGS gefehlt.

Jetzt klappt es endlich.

mfg 0etzi
 
Back
Top