How to enable a 'userconf' target?

View: New views
4 Messages — Rating Filter:   Alert me  

How to enable a 'userconf' target?

by Ralf Fassel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SpamAssassin version 3.1.8
  running on Perl version 5.8.8
OpenSuse 10.2, latest patchlevel
 
How do I enable a target tagged 'userconf'?

I'd like to have all messages checked against the BODY_8BITS target
defined in /usr/share/spamassassin/25_textcat.cf:

    body BODY_8BITS eval:check_body_8bits()
    describe BODY_8BITS Body includes 8 consecutive 8-bit characters
    tflags BODY_8BITS userconf

The doc says that 'userconf' targets require explicit
configuration by the user, but how?

       tflags SYMBOLIC_TEST_NAME [ {net|nice|learn|userconf|noautolearn} ]
           Used to set flags on a test.  These flags are used in the
           score-determination back end system for details of the
           test's behaviour.  Please see "bayes_auto_learn" for more
           information about tflag interaction with those systems.
          The following flags can be set:
         
           userconf
               The test requires user configuration before it can be
               used (like language- specific tests).

Which magic do I have to put in my user_prefs file so that the
BODY_8BITS runs?

If I pipe the message through spamassassin -t -D, BODY_8BITS is not
listed amongst the tests though the message does not have anything else
than high-bit chars...

R'

--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

Re: How to enable a 'userconf' target?

by McDonald, Dan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-07-02 at 19:31 +0200, Ralf Fassel wrote:
> SpamAssassin version 3.1.8
>   running on Perl version 5.8.8
> OpenSuse 10.2, latest patchlevel
>  
> How do I enable a target tagged 'userconf'?
>

The flag just checks that there is something configured before it fires.

> I'd like to have all messages checked against the BODY_8BITS target
> defined in /usr/share/spamassassin/25_textcat.cf:
>
>     body BODY_8BITS eval:check_body_8bits()
>     describe BODY_8BITS Body includes 8 consecutive 8-bit characters
>     tflags BODY_8BITS userconf

> Which magic do I have to put in my user_prefs file so that the
> BODY_8BITS runs?

The code is pretty clear on this one:
my @languages = split(' ', $scan->{conf}->{ok_languages});
 for (@languages) {
    return 0 if $_ eq "all";
    return 0 if /^(?:am|ar|be|bg|cs|el|et|fa|fi|he|hi|hy|is|ja|ka|ko|mr|
pt|ru|ta|th|tr|uk|vi|yi|zh)$/;
}

So, as long as ok_languages is set and it does not include one of the
ones listed, then the rule should be evaluated.

--
Daniel J McDonald, CCIE #2495, CISSP #78281, CNX
Austin Energy
http://www.austinenergy.com



signature.asc (204 bytes) Download Attachment

Re: How to enable a 'userconf' target?

by Ralf Fassel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* McDonald, Dan
| > How do I enable a target tagged 'userconf'?
|
| The flag just checks that there is something configured before it
| fires.

'Something' meaning "something, and you'll have to lookup in the code
what exactly"?

| > Which magic do I have to put in my user_prefs file so that the
| > BODY_8BITS runs?
|
| The code is pretty clear on this one:
| my @languages = split(' ', $scan->{conf}->{ok_languages});
|  for (@languages) {
|     return 0 if $_ eq "all";
|     return 0 if /^(?:am|ar|be|bg|cs|el|et|fa|fi|he|hi|hy|is|ja|ka|ko|mr|
| pt|ru|ta|th|tr|uk|vi|yi|zh)$/;
| }
|
| So, as long as ok_languages is set and it does not include one of
| the ones listed, then the rule should be evaluated.

I had not put anything in my user_prefs, so probably it was set to
'all' (bypassing the test).

So I put in my user_prefs:

ok_languages en
ok_locales en

and run
  spamassassin -t -D < x
where x contains a message with only 8-bit chars (length > 256 so
textcat does not complain about "too short for language analysis")

spamassassin -t -D < x
--<snip-snip>--
[31114] dbg: generic: SpamAssassin version 3.1.8
--<snip-snip>--
[31114] dbg: config: read file /usr/share/spamassassin/25_textcat.cf
--<snip-snip>--
[31114] dbg: config: using "/homes/ralf/.spamassassin/user_prefs" for user prefs file
[31114] dbg: config: read file /homes/ralf/.spamassassin/user_prefs
--<snip-snip>--
[31114] dbg: plugin: loading Mail::SpamAssassin::Plugin::TextCat from @INC
[31114] dbg: textcat: loading languages file...
[31114] dbg: textcat: loaded 73 language models
[31114] dbg: plugin: registered Mail::SpamAssassin::Plugin::TextCat=HASH(0x8f77c6c)
--<snip-snip>--
[31114] dbg: message: decoding other encoding type (8bit), ignoring
[31114] dbg: textcat: classifying, skipping: yi sco lv is bs sl la ga sa eu et rm cy eo fy gd lt
[31114] dbg: textcat: language possibly: zh.gb2312,ko,ja.euc-jp,zh.big5,ja.shift-jis
[31114] dbg: textcat: X-Languages: "zh.gb2312 ko ja.euc-jp zh.big5 ja.shift-jis", X-Languages-Length: 509
--<snip-snip>--
[31114] dbg: rules: ran body rule __NONEMPTY_BODY ======> got hit: "s"
[31114] dbg: rules: ran body rule __HIGHBITS ======> got hit: "€ ¡¢£¤¥¦"
--<snip-snip>--
[31114] dbg: check: tests=ALL_TRUSTED
[31114] dbg: check: subtests=__CD,__CT,__CTE,__CT_TEXT_PLAIN,__HAS_RCVD,__HAS_SUBJECT,__HIGHBITS,__MIME_VERSION,__NONEMPTY_BODY,__RFC_IGNORANT_ENVFROM,__TOCC_EXISTS
--<snip-snip>--
Content preview:  € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ [...]

Content analysis details:   (-1.4 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
-1.4 ALL_TRUSTED            Passed through trusted hosts only via SMTP


No BODY_8BITS... :-/

R'

Parent Message unknown Re: How to enable a 'userconf' target?

by Ralf Fassel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* McDonald, Dan
| > How do I enable a target tagged 'userconf'?
|
| The flag just checks that there is something configured before it
| fires.

'Something' meaning "something, and you'll have to lookup in the code
what exactly"?

| > Which magic do I have to put in my user_prefs file so that the
| > BODY_8BITS runs?
|
| The code is pretty clear on this one:
| my @languages = split(' ', $scan->{conf}->{ok_languages});
|  for (@languages) {
|     return 0 if $_ eq "all";
|     return 0 if /^(?:am|ar|be|bg|cs|el|et|fa|fi|he|hi|hy|is|ja|ka|ko|mr|
| pt|ru|ta|th|tr|uk|vi|yi|zh)$/;
| }
|
| So, as long as ok_languages is set and it does not include one of
| the ones listed, then the rule should be evaluated.

I had not put anything in my user_prefs regarding ok_languages,
so probably it was set to 'all' (thus bypassing the test).

So I put in my user_prefs:

ok_languages en
ok_locales en

(the latter since it is mentioned in the ::Conf manpage)
and run
  spamassassin -t -D < x
where x contains a message with only 8-bit chars (length > 256 so
textcat does not complain about "too short for language analysis")

spamassassin -t -D < x
--<snip-snip>--
[31114] dbg: generic: SpamAssassin version 3.1.8
--<snip-snip>--
[31114] dbg: config: read file /usr/share/spamassassin/25_textcat.cf
--<snip-snip>--
[31114] dbg: config: using "/homes/ralf/.spamassassin/user_prefs" for user prefs file
[31114] dbg: config: read file /homes/ralf/.spamassassin/user_prefs
--<snip-snip>--
[31114] dbg: plugin: loading Mail::SpamAssassin::Plugin::TextCat from @INC
[31114] dbg: textcat: loading languages file...
[31114] dbg: textcat: loaded 73 language models
[31114] dbg: plugin: registered Mail::SpamAssassin::Plugin::TextCat=HASH(0x8f77c6c)
--<snip-snip>--
[31114] dbg: message: decoding other encoding type (8bit), ignoring
[31114] dbg: textcat: classifying, skipping: yi sco lv is bs sl la ga sa eu et rm cy eo fy gd lt
[31114] dbg: textcat: language possibly: zh.gb2312,ko,ja.euc-jp,zh.big5,ja.shift-jis
[31114] dbg: textcat: X-Languages: "zh.gb2312 ko ja.euc-jp zh.big5 ja.shift-jis", X-Languages-Length: 509
--<snip-snip>--
[31114] dbg: rules: ran body rule __NONEMPTY_BODY ======> got hit: "s"
[31114] dbg: rules: ran body rule __HIGHBITS ======> got hit: "€ ¡¢£¤¥¦"
--<snip-snip>--
[31114] dbg: check: tests=ALL_TRUSTED
[31114] dbg: check: subtests=__CD,__CT,__CTE,__CT_TEXT_PLAIN,__HAS_RCVD,__HAS_SUBJECT,__HIGHBITS,__MIME_VERSION,__NONEMPTY_BODY,__RFC_IGNORANT_ENVFROM,__TOCC_EXISTS
--<snip-snip>--
Content preview:  € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ € ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßà
   áâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ [...]

Content analysis details:   (-1.4 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
-1.4 ALL_TRUSTED            Passed through trusted hosts only via SMTP


No BODY_8BITS... :-/  Do these test have additional requirements
about what is in the Mime-Content-Type or some other header?

R'

--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
LightInTheBox - Buy quality products at wholesale price