Amavis doesn't get the right spam score values from policy table in MySQL

Tomaž tomaz at slovenka.net
Thu Mar 28 10:57:03 CET 2024


Hi everybody,
I kindly ask for assistance.
Amavis doesn't get the right spam score values from policy table in 
MySQL. When columns (spam_tag2_level, spam_tag3_level, spam_kill_level) 
are unmodified and are NULL, the default values are from Amavis config 
file. But when we modify the row, the returned values are 0.

Amavis config:
$sa_tag_level_deflt  = 2.0;  # add spam info headers if at, or above 
that level
$sa_tag2_level_deflt = 6.2;  # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.9;  # triggers spam evasive actions (e.g. 
blocks mail

When policy is unmodified - From postfix log:
tag=0, tag2=6.2, kill=6.9

When policy is modified - From postfix log:
tag=0, tag2=0, kill=0


When policy is modified - Debug from Amavis:
lookup_sql(user at domain.com) matches, result=(id=>"1", priority=>"0", 
policy_id=>"5", email=>"@.", fullname=>-, id=>"1", policy_name=>"@.", 
virus_lover=>"N", spam_lover=>"N", unchecked_lover=>-, 
banned_files_lover=>"N", bad_header_lover=>"Y", 
bypass_virus_checks=>"N", bypass_spam_checks=>"N", 
bypass_banned_checks=>"N", bypass_header_checks=>"N", 
virus_quarantine_to=>"virus-quarantine", 
spam_quarantine_to=>"spam-quarantine", 
banned_quarantine_to=>"banned-quarantine", unchecked_quarantine_to=>-, 
bad_header_quarantine_to=>"", clean_quarantine_to=>-, 
archive_quarantine_to=>-, spam_tag_level=>"0", spam_tag2_level=>"0", 
spam_tag3_level=>"0", spam_kill_level=>"0", spam_dsn_cutoff_level=>-, 
spam_quarantine_cutoff_level=>-, addr_extension_virus=>-, 
addr_extension_spam=>-, addr_extension_banned=>-, 
addr_extension_bad_header=>-, warnvirusrecip=>-, warnbannedrecip=>-, 
warnbadhrecip=>-, newvirus_admin=>-, virus_admin=>-, banned_admin=>-, 
bad_header_admin=>-, spam_admin=>-, spam_subject_tag=>-, 
spam_subject_tag2=>"[SPAM] ", spam_subject_tag3=>"[SPAM] ", 
message_size_limit=>-, banned_rulenames=>"", disclaimer_options=>-, 
forward_method=>-, sa_userconf=>-, sa_username=>-, id=>"1", local=>-)

Extract from above: spam_tag_level=>"0", spam_tag2_level=>"0", 
spam_tag3_level=>"0", spam_kill_level=>"0"
All are 0.


Modified row:
                           id: 5
                  policy_name: @.
                  virus_lover: N
                   spam_lover: N
              unchecked_lover: NULL
           banned_files_lover: N
             bad_header_lover: Y
          bypass_virus_checks: N
           bypass_spam_checks: N
         bypass_banned_checks: N
         bypass_header_checks: N
          virus_quarantine_to: virus-quarantine
           spam_quarantine_to: spam-quarantine
         banned_quarantine_to: banned-quarantine
      unchecked_quarantine_to: NULL
     bad_header_quarantine_to:
          clean_quarantine_to: NULL
        archive_quarantine_to: NULL
               spam_tag_level: -100
              spam_tag2_level: 4.8
              spam_tag3_level: 4.8
              spam_kill_level: 7
        spam_dsn_cutoff_level: NULL
spam_quarantine_cutoff_level: NULL
         addr_extension_virus: NULL
          addr_extension_spam: NULL
        addr_extension_banned: NULL
    addr_extension_bad_header: NULL
               warnvirusrecip: NULL
              warnbannedrecip: NULL
                warnbadhrecip: NULL
               newvirus_admin: NULL
                  virus_admin: NULL
                 banned_admin: NULL
             bad_header_admin: NULL
                   spam_admin: NULL
             spam_subject_tag: NULL
            spam_subject_tag2: [SPAM]
            spam_subject_tag3: [SPAM]
           message_size_limit: NULL
             banned_rulenames:
           disclaimer_options: NULL
               forward_method: NULL
                  sa_userconf: NULL
                  sa_username: NULL

Unmodified row:
                           id: 5
                  policy_name: @.
                  virus_lover: N
                   spam_lover: N
              unchecked_lover: NULL
           banned_files_lover: N
             bad_header_lover: Y
          bypass_virus_checks: N
           bypass_spam_checks: N
         bypass_banned_checks: N
         bypass_header_checks: N
          virus_quarantine_to: virus-quarantine
           spam_quarantine_to: spam-quarantine
         banned_quarantine_to: banned-quarantine
      unchecked_quarantine_to: NULL
     bad_header_quarantine_to:
          clean_quarantine_to: NULL
        archive_quarantine_to: NULL
               spam_tag_level: -100
              spam_tag2_level: NULL
              spam_tag3_level: NULL
              spam_kill_level: NULL
        spam_dsn_cutoff_level: NULL
spam_quarantine_cutoff_level: NULL
         addr_extension_virus: NULL
          addr_extension_spam: NULL
        addr_extension_banned: NULL
    addr_extension_bad_header: NULL
               warnvirusrecip: NULL
              warnbannedrecip: NULL
                warnbadhrecip: NULL
               newvirus_admin: NULL
                  virus_admin: NULL
                 banned_admin: NULL
             bad_header_admin: NULL
                   spam_admin: NULL
             spam_subject_tag: NULL
            spam_subject_tag2: [SPAM]
            spam_subject_tag3: [SPAM]
           message_size_limit: NULL
             banned_rulenames:
           disclaimer_options: NULL
               forward_method: NULL
                  sa_userconf: NULL
                  sa_username: NULL

Only these are changed:
spam_tag2_level:
spam_tag3_level:
spam_kill_level:


Policy table structure:
+------------------------------+------------------+------+-----+---------+----------------+
| Field                        | Type             | Null | Key | Default 
| Extra          |
+------------------------------+------------------+------+-----+---------+----------------+
| id                           | int(10) unsigned | NO   | PRI | NULL    
| auto_increment |
| policy_name                  | varchar(255)     | NO   | UNI |         
|                |
| virus_lover                  | char(1)          | YES  |     | NULL    
|                |
| spam_lover                   | char(1)          | YES  |     | NULL    
|                |
| unchecked_lover              | char(1)          | YES  |     | NULL    
|                |
| banned_files_lover           | char(1)          | YES  |     | NULL    
|                |
| bad_header_lover             | char(1)          | YES  |     | NULL    
|                |
| bypass_virus_checks          | char(1)          | YES  |     | NULL    
|                |
| bypass_spam_checks           | char(1)          | YES  |     | NULL    
|                |
| bypass_banned_checks         | char(1)          | YES  |     | NULL    
|                |
| bypass_header_checks         | char(1)          | YES  |     | NULL    
|                |
| virus_quarantine_to          | varchar(64)      | YES  |     | NULL    
|                |
| spam_quarantine_to           | varchar(64)      | YES  |     | NULL    
|                |
| banned_quarantine_to         | varchar(64)      | YES  |     | NULL    
|                |
| unchecked_quarantine_to      | varchar(64)      | YES  |     | NULL    
|                |
| bad_header_quarantine_to     | varchar(64)      | YES  |     | NULL    
|                |
| clean_quarantine_to          | varchar(64)      | YES  |     | NULL    
|                |
| archive_quarantine_to        | varchar(64)      | YES  |     | NULL    
|                |
| spam_tag_level               | float            | YES  |     | NULL    
|                |
| spam_tag2_level              | float            | YES  |     | NULL    
|                |
| spam_tag3_level              | float            | YES  |     | NULL    
|                |
| spam_kill_level              | float            | YES  |     | NULL    
|                |
| spam_dsn_cutoff_level        | float            | YES  |     | NULL    
|                |
| spam_quarantine_cutoff_level | float            | YES  |     | NULL    
|                |
| addr_extension_virus         | varchar(64)      | YES  |     | NULL    
|                |
| addr_extension_spam          | varchar(64)      | YES  |     | NULL    
|                |
| addr_extension_banned        | varchar(64)      | YES  |     | NULL    
|                |
| addr_extension_bad_header    | varchar(64)      | YES  |     | NULL    
|                |
| warnvirusrecip               | char(1)          | YES  |     | NULL    
|                |
| warnbannedrecip              | char(1)          | YES  |     | NULL    
|                |
| warnbadhrecip                | char(1)          | YES  |     | NULL    
|                |
| newvirus_admin               | varchar(64)      | YES  |     | NULL    
|                |
| virus_admin                  | varchar(64)      | YES  |     | NULL    
|                |
| banned_admin                 | varchar(64)      | YES  |     | NULL    
|                |
| bad_header_admin             | varchar(64)      | YES  |     | NULL    
|                |
| spam_admin                   | varchar(64)      | YES  |     | NULL    
|                |
| spam_subject_tag             | varchar(64)      | YES  |     | NULL    
|                |
| spam_subject_tag2            | varchar(64)      | YES  |     | NULL    
|                |
| spam_subject_tag3            | varchar(64)      | YES  |     | NULL    
|                |
| message_size_limit           | int(11)          | YES  |     | NULL    
|                |
| banned_rulenames             | varchar(64)      | YES  |     | NULL    
|                |
| disclaimer_options           | varchar(64)      | YES  |     | NULL    
|                |
| forward_method               | varchar(64)      | YES  |     | NULL    
|                |
| sa_userconf                  | varchar(64)      | YES  |     | NULL    
|                |
| sa_username                  | varchar(64)      | YES  |     | NULL    
|                |
+------------------------------+------------------+------+-----+---------+----------------+


System:
AlmaLinux release 9.3

Amavis version:
amavis.noarch 2.13.0-4.el9 @epel
Also tried:
amavis.noarch 2.13.1-1.el9 @epel-testing

If any more information or config files are necessary, I will provide 
them.

Thank you for assistance in finding the solution for this problem.
Tomaž


More information about the amavis-users mailing list