The username entry for the spamd daemon has no bearing on what userpref it loads. That is just so you can use a non-privileged account which is considered good security practice in case the daemon has a remote exploit.
Did you see the different SQL query using con cat? Regards, KAM Mark Chaney <m...@lists.macscr.com> wrote: >So here it is in non debug format and coming from my syslog. This is >with full email and not just a test from the command line: > >Jan 10 05:07:57 mx4 spamd[28599]: spamd: got connection over >/var/run/spamassassin/spamd.sock >Jan 10 05:07:57 mx4 spamd[28599]: spamd: processing message ><82b01a86-43c0-41a3-a8a7-8c83ef152...@example.com> for mchaney:1000 >Jan 10 05:07:58 mx4 spamd[28599]: spamd: clean message (4.6/5.0) for >mchaney:1000 in 1.0 seconds, 1138 bytes. >Jan 10 05:07:58 mx4 spamd[28599]: spamd: result: . 4 - >AWL,RP_MATCHES_RCVD,SO_FROM_HJPC,SO_HELO_LDOM,SO_LOCAL_FROM,SO_NOT_FROM_RP,SPF_FAIL > >scantime=1.0,size=1138,user=mchaney,uid=1000,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=/var/run/spamassassin/spamd.sock,mid=<82b01a86-43c0-41a3-a8a7-8c83ef152...@example.com>,autolearn=no,shortcircuit=no > >Options look like so: > >OPTIONS="--username spamd --max-children 2 --helper-home-dir ${SAHOME} >--socketpath=/var/run/spamassassin/spamd.sock --socketowner=spamd >--socketgroup=spamd --socketmode=0660 -q -x" > >So shouldnt the username be mcha...@example.com? Isnt this the only way > >its going to be able to get _DOMAIN_? > >On 2014-01-10 04:57, Axb wrote: >> This works for me.... >> as per http://wiki.apache.org/spamassassin/UsingSQL >> >> user_scores_sql_custom_query SELECT preference, value FROM >_TABLE_ >> WHERE username = _USERNAME_ OR username = '$GLOBAL' OR username = >> CONCAT('%',_DOMAIN_) ORDER BY username ASC >> >> >> >> spamd running with >> >> SPAMDOPTIONS="-d -m 50 --min-spare=5 --max-conn-per-child=100 -u >> spamd -x -q -l" >> >> >> >> On 01/10/2014 11:47 AM, Mark Chaney wrote: >>> On 2014-01-10 04:22, Axb wrote: >>>> Please show us the query you're using and the userpref content. >>>> >>>> On 01/10/2014 11:19 AM, Mark Chaney wrote: >>>>> The sql entry isnt the problem because if I change the query to >use >>>>> example.com versus _DOMAIN_, it works fine. I followed the guide >>>>> from >>>>> http://wiki.apache.org/spamassassin/UsingSQL. >>>>> >>>>> On 2014-01-10 03:52, Axb wrote: >>>>>> What does the SQL entry look like? >>>>>> >>> As I already mentioned, the query doesnt matter because _DOMAIN_ >isnt >>> be >>> filled. Doesnt matter what the query is if _DOMAIN_ isnt being >>> populated. >>> >>> user_scores_sql_custom_query SELECT 'required_hits' as >preference, >>> spam_score as value FROM domains WHERE domain = _DOMAIN_ ORDER BY >>> domain >>> ASC >>> >>> If i change it to: >>> >>> user_scores_sql_custom_query SELECT 'required_hits' as >preference, >>> spam_score as value FROM domains WHERE domain = 'example.com' ORDER >BY >>> domain ASC >>> >>> It works perfectly (obviously just for that domain). >>> >>> As mentioned, when I have _DOMAIN_ in it, the debug output shows: >>> >>> Jan 10 03:20:04.795 [28346] dbg: config: Conf::SQL: executing SQL: >>> SELECT 'required_hits' as preference, spam_score as value FROM >domains >>> WHERE domain = NULL ORDER BY domain ASC >>> >>> Thus obviously _DOMAIN_ isnt working for some reason. The wiki does >>> mention something about modifying SA subfunctions and some qmail >>> stuff, >>> but I havent done anything like that and dont really want to modify >>> any >>> core code. So maybe thats the issue? There isnt anything default in >SA >>> that provides the _DOMAIN_ value for the sql query? >>> >>> >>> >>>>>> I assume you used Dallas' setup under >>>>>> >>>>>> "Global, Per-Domain, and Per-User Preferences via SQL" >>>>>> >>>>>> On 01/10/2014 10:47 AM, Mark Chaney wrote: >>>>>>> So my I dont think I am getting this to work. I have _DOMAIN_ in > >>>>>>> my >>>>>>> query, but it doesnt appear to get assigned a value as the >>>>>>> spamassasin >>>>>>> debug is showing a value of NULL when it performs the query. Any >>>>>>> suggestions? I am not really finding much information on how >this >>>>>>> value >>>>>>> gets populated. If I do something like: >>>>>>> >>>>>>> echo -e "From: user\nTo:user\Subject: Test\n\n" | spamc -u >>>>>>> 'example.com' >>>>>>> >>>>>>> I get: >>>>>>> >>>>>>> Jan 10 03:20:04.791 [28346] info: spamd: handle_user unable to >>>>>>> find >>>>>>> user: 'example.com' >>>>>>> Jan 10 03:20:04.795 [28346] dbg: config: Conf::SQL: executing >SQL: >>>>>>> SELECT 'required_hits' as preference, spam_score as value FROM >>>>>>> domains >>>>>>> WHERE domain = NULL ORDER BY domain ASC >>>>>>> Jan 10 03:20:04.796 [28346] dbg: config: retrieving prefs for >>>>>>> example.com from SQL server >>>>>>> Jan 10 03:20:04.796 [28346] dbg: info: user has changed >>>>>>> >>>>>>> It says it getting the preferences for the example.com, but I am > >>>>>>> not >>>>>>> sure how thats correct when the query has it set as NULL. >>>>>>> Suggestions? >>>>>>> >>>>>>> >>>>>>> On 2014-01-06 08:48, Mark Chaney wrote: >>>>>>>> LOL, my bad. I had googled for spamassassin preferences per >>>>>>>> domain, >>>>>>>> but didnt use that exact text. I knew user preferences were >>>>>>>> available >>>>>>>> via mysql, but I didnt see that exact doc. Thanks! >>>>>>>> >>>>>>>> On 2014-01-06 08:35, Axb wrote: >>>>>>>>> On 01/06/2014 03:32 PM, Mark Chaney wrote: >>>>>>>>>> Is it possible to set spamassassin preferences per domain >>>>>>>>>> instead of >>>>>>>>>> per >>>>>>>>>> user? If so, how can I go about doing this? If this could be >>>>>>>>>> pulled >>>>>>>>>> from >>>>>>>>>> a mysql table, even better. >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Mark >>>>>>>>> >>>>>>>>> http://lmgtfy.com/?q=spamassassin+mysql+preferences