<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1368947721;
        mso-list-type:hybrid;
        mso-list-template-ids:-959393542 -751507296 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:48;
        mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1
        {mso-list-id:1915896927;
        mso-list-type:hybrid;
        mso-list-template-ids:-1731196138 1292031482 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-start-at:48;
        mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have had some experience using these new config parameters. Let me try to answer these as best I can:<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:13.5pt'><br><br></span><o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>Hi,<br><br>I'd like to use the new sa_userconf_maps feature in Amavis 2.7.0 (Ubuntu<br>x64), but unfortunately I'm not able to figure out the correct<br>configuration from what I can find online.<br><br>My setting is as follows:<br><br>I have a MYSQL database called 'spamassassin_db' on my server with a<br>single table 'userpref' in it, containing white- and blacklist entries.<br>These are filled by some other application, so I don't want to change<br>anything here (e.g., to amavis SQL rules which seem to be even less well<br>documented) if possible.<br><br>I have configured the SQL database in my /etc/spamassassin/local.cf as<br>follows:<br><br>user_scores_dsn                 DBI:mysql:spamassassin_db:localhost<br>user_scores_sql_username        (...)<br>user_scores_sql_password        (...)<br>user_scores_sql_custom_query    SELECT preference, value FROM userpref<br>WHERE username = _USERNAME_ OR username = '$GLOBAL' OR username =<br>CONCAT('%',_DOMAIN_) ORDER BY username ASC<br><br><br><br>What I would like amavisd to do is to have spamassassin respect the<br>whitelist_auth/blacklist_from rules in this database table globally,<br>i.e. regardless of the recipient's email address.<br>However, I don't seem to know the appropriate commands, and where to put<br>them.<br><br>If I just put<br><br>@sa_userconf_maps = (<br>      {<br>         '.*' => 'sql:',<br>      }<br>    );<br><br><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in;text-indent:0in;mso-list:l1 level1 lfo2'><![if !supportLists]><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'><span style='mso-list:Ignore'>Ø<span style='font:7.0pt "Times New Roman"'>    </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>This is how it is configured on my end as well.<o:p></o:p></span></p><p class=MsoNormal style='margin-right:.5in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><br>...how does amavis know which SQL database is referred to? Or that it<br>should use "local.cf"? <span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:1.0in;margin-bottom:5.0pt;margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'><span style='mso-list:Ignore'>Ø<span style='font:7.0pt "Times New Roman"'>  </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>SpamAssassin knows which SQL database to use based on what is configured in your site’s /etc/spamassassin/local.cf file  (user_scores_dsn, user_awl_dsn, bayes_sql_dsn) as long as those are configured – they will be referenced in the Amavis lookup routine. As for which table – as long as you imported the “standard” SpamAssassin SQL schema, the lookups will work properly.<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal>I have also tried something like<br><br>@sa_userconf_maps = (<br>"/etc/spamassassin/local.cf"<br>    );<br><br><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in;text-indent:0in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'><span style='mso-list:Ignore'>Ø<span style='font:7.0pt "Times New Roman"'>    </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Not valid – please use the parameter you specified above which is known good on my machine as well.<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><br>It's not surprising to me that I haven't got it to work so far, given<br>that I simply can't find any clear instructions anywhere on the Web.<br><br><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:1.0in;margin-bottom:5.0pt;margin-left:0in;text-indent:0in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'><span style='mso-list:Ignore'>Ø<span style='font:7.0pt "Times New Roman"'>    </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I hear ya, thanks to people on this list I was able to figure it out – but it did take some time due to the lack of published examples. <o:p></o:p></span></p><p class=MsoNormal><br>Any help would be very much appreciated! :)<br><br><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in;text-indent:0in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'><span style='mso-list:Ignore'>Ø<span style='font:7.0pt "Times New Roman"'>    </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>One more configuration option you may need, is the @sa_username_maps parameter. When SpamAssassin stores config options, Bayesian tokens, and white/black list records – it does so with the ‘username’ field. If you do not specify a username – SpamAssassin will store all config options under the _<i>same</i>_ user that invokes amavisd. So if you want each user to be able to store individual preferences, awl/blacklist, and bayes – you will need to define the @sa_username_maps. Using the following regular expression – you will effectively map the RECIPIENT address (of the incoming email to be scanned/parsed) as the SA ‘username’. Any awl/autolearn/Bayesian/config options that are either retrieved from the database, or written to it – will do so by the recipient address of the email.<o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>(originally provided by Renato Botelho on 09/2/2011 in amavis-users)<o:p></o:p></span></p><p class=MsoListParagraph style='mso-margin-top-alt:5.0pt;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:5.0pt;margin-right:1.5in;margin-bottom:5.0pt;margin-left:.5in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>@sa_username_maps = new_RE (<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:5.0pt;margin-right:1.5in;margin-bottom:5.0pt;margin-left:.5in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>  [ qr'^([^@]+@.*)'i => '${1}' ]<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:5.0pt;margin-right:1.0in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>);<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:.5in;margin-bottom:5.0pt;margin-left:0in'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Again, only use the above regular expression if you want the SA username field in the database to be the ‘user@domain.com’ in the RCPT of the email message (which should be your mail user, anyways). This would be useful in a mail server that houses more than one domain.<o:p></o:p></span></p><p class=MsoNormal><br>Thanks,<br>S.<o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I hope that helps.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Matt Goodman<o:p></o:p></span></p></div></blockquote></div></body></html>