[imp] Spam-config with Rspamd in IMP

Christoph Haas christoph+horde at haas-online.org
Sun Nov 1 22:33:41 UTC 2020


Hello,

I'm trying to setup a working spam-config for IMP. - The E-mail part  
is working and sends "innocent" and "spam" mail messages...

But far more interesting than getting emails, would be reporting to my  
external Rspamd via its REST-API.

The command "/usr/bin/curl --data-binary @-  
https://my.rspamd-server.com/rspamd/learnspam?password=mysecretpassword"  
expects the contents of an email as input.
E.g.:
"/usr/bin/curl --data-binary @-  
https://my.rspamd-server.com/rspamd/learnspam?password=mysecretpassword <  
email-from-/dev/stdin"

I've checked that the PHP-user (Apache: www-data) can execute the  
curl-command.


So I configured in /var/www/html/horde/imp/config/backends.local.php  
(only relevant parts)
'spam' => array(
            'innocent' => array(
                'display' => true,
                'program' => '/usr/bin/curl --data-binary @-  
https://my.rspamd-server.com/rspamd/learnham?password=mysecretpassword',
            ),
),
            'spam' => array(
                'display' => false,
                'program' => '/usr/bin/curl --data-binary @-  
https://my.rspamd-server.com/rspamd/learnspam?password=mysecretpassword',
        ),
)


But I get only errors like this in syslog:
Nov  1 16:00:10 myhordeserver HORDE: [imp] Error reporting spam:   %  
Total    % Received % Xferd  Average Speed   Time    Time     Time   
Current
Nov  1 16:00:10 myhordeserver HORDE:                                   
Dload  Upload   Total   Spent    Left  Speed
Nov  1 16:00:10 myhordeserver HORDE: \x0d  0     0    0     0    0      
0      0      0 --:--:-- --:--:-- --:--:--     0\x0d100 11869    0      
0  100 11869      0   9626  0:00:01  0:00:01 --:--:--  9626\x0d100  
11869    0     0  100 11869      0   5312  0
:00:02  0:00:02 --:--:--  5312\x0d100 11869    0     0  100 11869       
0   3668  0:00:03  0:00:03 --:--:--  3668\x0d100 11885  100    16  100  
11869      4   3286  0:00:04  0:00:03  0:00:01  3291
Nov  1 16:00:10 myhordeserver HORDE:  [pid 24371 on line 74 of  
"/var/www/html/horde/imp/lib/Spam/Program.php"]

Nov  1 17:13:45 groupware HORDE: [imp] Error reporting spam:   % Total  
    % Received % Xferd  Average Speed   Time    Time     Time  Current
Nov  1 17:13:45 groupware HORDE:                                   
Dload  Upload   Total   Spent    Left  Speed
Nov  1 17:13:45 groupware HORDE: \x0d  0     0    0     0    0     0    
    0      0 --:--:-- --:--:-- --:--:--     0\x0d100  8877    0     0   
100  8877      0  48508 --:--:-- --:--:-- --:--:-- 48508
Nov  1 17:13:45 groupware HORDE:  [pid 26040 on line 74 of  
"/var/www/html/horde/imp/lib/Spam/Program.php"]



Then I've tried:
          'program' => '/bin/echo "$(</dev/stdin)" >>  
/var/www/html/horde/ham.log'
but with no result. The ham.log or spam.log files are created, but  
with no content.

The Docu says "Messages will be reported to the program via standard input."

How can I capture the input to 'program'?

Or even best: Can anybody tell me the correct way to use the  
Rspamd-REST-API for training a remote Rspamd-server?


Many thanks in advance!
Christoph.


-- 
christoph+horde at haas-online.org



More information about the imp mailing list