spamass-milt-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

spamass-milter + MySQL users prefs + sendmail + cyrus


From: Glogger Steven
Subject: spamass-milter + MySQL users prefs + sendmail + cyrus
Date: Thu, 4 Aug 2005 15:59:55 +0200

hi all

i have a strange problem with the in the subject mentioned combination.

first: my goal
--------------
i have a cyrus based on mysql auth - this works great.
sendmail looks up the correct keys in the virtuser table and sends them
to cyrus.
i want to use the same username in the mysql database for storing the
sql prefs for spamassassin.
sendmail is correct installed (also with milter).


lets assume this:
-----------------

i want to send an email to address@hidden
in sendmail i have these entries:
address@hidden  --> steven

sendmail -bv "<address@hidden>"
address@hidden deliverable: mailer cyrusv2, user steven

ok, so far so good.
i want now, that he uses 'steven' as lookup key for the sql.
but he always takes 'root'.

the ports i'm using:
--------------------
- p5-Mail-SpamAssassin-3.0.4
- sendmail+tls+sasl2-8.13.4
- spamass-milter-0.3.0

ok, how did i installed the stuff:
----------------------------------
i'm using freebsd 5.4-STABLE (all ports are synced and up to date) as a
server.

i installed spamassassin on this way:
-su-2.05b# cd /usr/ports/mail/p5-Mail-SpamAssassin/
-su-2.05b# make install clean

??????????????????????????????????????????????????????????????????????
?              Options for p5-Mail-SpamAssassin 3.0.4                ?
? ?????????????????????????????????????????????????????????????????? ?
? ?     [X] AS_ROOT    Run spamd as root (recommended)             ? ?
? ?     [X] SSL        Build with SSL support for spamd/spamc      ? ?
? ?     [X] MYSQL      Add MySQL support                           ? ?
? ?     [ ] PGSQL      Add PostreSQL support                       ? ?
? ?     [X] RAZOR      Add Vipul's Razor support                   ? ?
? ?     [ ] SPF_QUERY  Add SPF query support                       ? ?
? ?     [X] TOOLS      Install SpamAssassin tools                  ? ?
??????????????????????????????????????????????????????????????????????
?                       [  OK  ]       Cancel                        ?
??????????????????????????????????????????????????????????????????????

after the installation, i go and edit the local.cf

user_scores_dsn                 DBI:mysql:spamassassin:localhost
user_scores_sql_username        mydbuser
user_scores_sql_password        mydbpassword
user_scores_sql_custom_query    SELECT preference, value FROM _TABLE_
WHERE username = _USERNAME_ OR username = '$GLOBAL' ORDER BY username
ASC


then i add following lines to /etc/rc.conf:
spamd_enable="YES"
spamd_pidfile="/var/run/spamd/spamd.pid"
spamd_flags="-d -q -x -r ${spamd_pidfile}"


and now starting the daemon:
-su-2.05b# /usr/local/etc/rc.d/sa-spamd.sh start

ok, the daemon is started and ready to run..


now the spamass-milter part...
-------------------------------
the installation is as simple as before:

-su-2.05b# cd /usr/ports/mail/spamass-milter/
-su-2.05b# make install clean

according to ../spamass-milter/activation.txt i did following changes to
the sendmail mc file:
 INPUT_MAIL_FILTER(`spamassassin',
`S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
 define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name},
{if_addr}')dnl

then i compiled and installed the new sendmail.cf file...

... and added in /etc/rc.conf this:
spamass_milter_enable="YES"
spamass_milter_socket="/var/run/spamass-milter.sock"
spamass_milter_flags="-x -f -p ${spamass_milter_socket}"
(for debugging reasons i added a "-d rcpt")

after starting the spamass-milter i found this in the log:
Aug  4 15:50:17 temp spamass-milter[46308]: Setting debug level to 0x101
Aug  4 15:50:17 temp spamass-milter[46309]: spamass-milter 0.3.0
starting
Aug  4 15:50:18 temp sm-mta[46281]: restarting /usr/sbin/sendmail due to
signal
Aug  4 15:50:18 temp sm-mta[46313]: starting daemon (8.13.4):
address@hidden:30:00

so far ... so good.. ;-)


ok, now the part which does not work properly:
----------------------------------------------

i will send now from outside a mail to address@hidden
sendmail will expand this as: 
sendmail -bv "<address@hidden>"
address@hidden deliverable: mailer cyrusv2, user steven

now, what do i find in the log file:

Aug  4 15:51:59 temp sm-mta[46322]: STARTTLS=server, relay=xxxxxx
[xx.xx.xx.xx], version=TLSv1/SSLv3, verify=FAIL,
cipher=DHE-RSA-AES256-SHA, bits=256/256
Aug  4 15:51:59 temp spamass-milter[46309]: calling /usr/sbin/sendmail
-bv "<address@hidden>" 2>&1
Aug  4 15:51:59 temp spamass-milter[46309]: sendmail output:
<address@hidden>>... deliverable: mailer cyrusv2, user steven
Aug  4 15:51:59 temp spamass-milter[46309]: user: steven
Aug  4 15:51:59 temp spamass-milter[46309]: Total of 1 actual recipients
Aug  4 15:51:59 temp spamass-milter[46309]: remembering steven for spamc
Aug  4 15:51:59 temp spamass-milter[46309]: remembering recipient
<address@hidden>>
Aug  4 15:51:59 temp sm-mta[46322]: j74DpwGb046322:
from=<address@hidden>, size=958, class=0, nrcpts=1,
msgid=<address@hidden>, proto=ESMTP, daemon=MTA,
relay=xxxxxx [xx.xx.xx.xx]
Aug  4 15:51:59 temp spamd[41691]: connection from localhost.mrmouse.ch
[127.0.0.1] at port 63803
Aug  4 15:51:59 temp spamd[41691]: processing message
<address@hidden> for root:0.
Aug  4 15:52:02 temp spamd[41691]: clean message (1.7/5.0) for root:0 in
3.0 seconds, 1009 bytes.
Aug  4 15:52:02 temp spamd[41691]: result: .  1 - MSGID_FROM_MTA_ID
scantime=3.0,size=1009,mid=<address@hidden>,auto
learn=no
Aug  4 15:52:02 temp sm-mta[46322]: j74DpwGb046322: Milter change:
header X-Spam-Status: from No, hits=-2.7 required=5.0 tests=AWL,BAYES_01
autolearn=ham \n\tversion=2.63 to No, score=1.7 required=5.0
tests=MSGID_FROM_MTA_ID \n\tautolearn=no version=3.0.4
Aug  4 15:52:02 temp sm-mta[46322]: j74DpwGb046322: Milter add: header:
X-Spam-Level: *
Aug  4 15:52:02 temp sm-mta[46322]: j74DpwGb046322: Milter change:
header X-Spam-Checker-Version: from SpamAssassin 2.63 (2004-01-11) on
xxxxxxxxxx to SpamAssassin 3.0.4 (2005-06-05) on xxxxxxxxxx
Aug  4 15:52:02 temp sm-mta[46328]: j74DpwGb046322: to=<address@hidden>,
delay=00:00:03, xdelay=00:00:00, mailer=cyrusv2, pri=30958,
relay=localhost, dsn=2.0.0, stat=Sent


ok, what i find interesting are following lines:
Aug  4 15:51:59 temp spamass-milter[46309]: sendmail output:
<address@hidden>>... deliverable: mailer cyrusv2, user steven
Aug  4 15:51:59 temp spamass-milter[46309]: user: steven
Aug  4 15:51:59 temp spamass-milter[46309]: remembering steven for spamc
...
Aug  4 15:51:59 temp spamd[41691]: processing message
<address@hidden> for root:0.


now, what i additionally see in the mysql-log is this query:

050804 15:43:48     138 Connect     address@hidden on spamassassin
                    138 Query       set autocommit=1
                    138 Query       SELECT preference, value FROM
userpref WHERE username = 'root' OR username = '$GLOBAL' ORDER BY
username ASC
                    138 Quit


and now the big question:
why does he takes 'root' instead of 'steven'?
did i missed anything?

-steven




reply via email to

[Prev in Thread] Current Thread [Next in Thread]