Spam tagging for ARPL (autoresponder)

  • One of my clients asked whether it is possible to only send arpl-mails to senders that have sent mails which have not been classified as spam.
    So I had a closer look at postfix: it seems, that ne arpl-mail is created before spamassassin gets hands on it. As I think, in general, this is a good idea: do you guys have a suggestion how to provide that?


    I think in the end the problem is: when I implement the arpl-script as a second content filter, it will be called every time.


    Thanks in advance.

  • One of my clients asked whether it is possible to only send arpl-mails to senders that have sent mails which have not been classified as spam.

    Our ARPL script check for the presence of the X-Spam-Flag header already: https://github.com/i-MSCP/imsc…enger/imscp-arpl-msgr#L63


    So I had a closer look at postfix: it seems, that ne arpl-mail is created before spamassassin gets hands on it.

    How do you have installed SpamAssassin exactly? Our SpamAssassin plugin provides SpamAssassin through MILTER. Thus, it should acts before message queuing. Therefore, the mail, if it is a spam, should be already tagged as SPAM when passed-in to the ARPL transport.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @kurgans


    I've just tested the behavior with our SpamAssassin plugin.


    First of all: I've removed the -r -1 option in the /etc/default/spamass-milter file to not reject mails tagged as SPAM by SpamAssassin. Then, I've restarted the spamass-milter and postfix services.


    Then, I've done the following:

    • I've created a new (forward only) mail account spam@nuxwin.com forwarded to the l.declercq@nuxwin.com mail account.
    • I've enabled autoresponder (ARPL) for the spam@nuxwin.com forwarded mail account.
    • I've sent a mail (GTUBE test mail) to the spam@nuxwin.com forwarded mail account via the l.declercq@nuxwin.com mail account.

    Result

    • I've received the mail at l.declercq@nuxwin.com. The mail has been tagged as SPAM (expected result).
    • The ARPL transport has ignored the mail due to the presence of the X-Spam-Flag: YES header in the message (Expected result). This also clearly demonstrate that SpamAssassin (at least when used through MILTER), filters the mail before queuing, thus, before it is delivered via LDA or imscp-arpl service.

    All this is also confirmed in the/var/log/mail.log file:

    Code
    1. Jan 19 00:56:54 srv01 postfix/smtpd[7714]: connect from bsr-176-154-36-71.ft.ethernet.abo.bbox.fr[176.154.36.71]Jan 19 00:56:54 srv01 postfix/smtpd[7714]: 819D83E66A: client=bsr-176-154-36-71.ft.ethernet.abo.bbox.fr[176.154.36.71], sasl_method=CRAM-MD5, sasl_username=l.declercq@nuxwin.comJan 19 00:56:54 srv01 postfix/cleanup[7720]: 819D83E66A: message-id=<0e1b8445-99a9-3fc0-7eab-cf591ec5c950@nuxwin.com>Jan 19 00:56:54 srv01 spamd[6965]: spamd: connection from ip6-localhost [::1]:38437 to port 783, fd 6Jan 19 00:56:54 srv01 spamd[6965]: spamd: processing message <0e1b8445-99a9-3fc0-7eab-cf591ec5c950@nuxwin.com> for spam@nuxwin.com:114Jan 19 00:56:55 srv01 spamd[6965]: spamd: identified spam (999.0/5.0) for spam@nuxwin.com:114 in 0.5 seconds, 2072 bytes.Jan 19 00:56:55 srv01 spamd[6965]: spamd: result: Y 999 - ALL_TRUSTED,GTUBE,HTML_MESSAGE scantime=0.5,size=2072,user=spam@nuxwin.com,uid=114,required_score=5.0,rhost=ip6-localhost,raddr=::1,rport=38437,mid=<0e1b8445-99a9-3fc0-7eab-cf591ec5c950@nuxwin.com>,autolearn=no autolearn_force=noJan 19 00:56:55 srv01 postfix/qmgr[7713]: 819D83E66A: from=<l.declercq@nuxwin.com>, size=4394, nrcpt=2 (queue active)

    1. I've received the mail at l.declercq@nuxwin.com tagged as SPAM (expected result):

    Code
    1. Jan 19 00:56:55 srv01 dovecot: lda(l.declercq@nuxwin.com): msgid=<0e1b8445-99a9-3fc0-7eab-cf591ec5c950@nuxwin.com>: saved mail to INBOX.Jan 19 00:56:55 srv01 postfix/pipe[7723]: 819D83E66A: to=<l.declercq@nuxwin.com>, orig_to=<spam@nuxwin.com>, relay=dovecot, delay=0.67, delays=0.65/0/0/0.01, dsn=2.0.0, status=sent (delivered via dovecot service)
    Code
    1. Jan 19 00:56:55 srv01 spamd[6962]: prefork: child states: IIJan 19 00:56:55 srv01 postfix/smtpd[7714]: disconnect from bsr-176-154-36-71.ft.ethernet.abo.bbox.fr[176.154.36.71]

    2. The ARPL transport has ignored the mail due to the presence of the X-Spam-Flag: YES header in the message (Expected result):

    Code
    1. Jan 19 00:56:55 srv01 postfix/pipe[7724]: 819D83E66A: to=<spam@imscp-arpl.nuxwin.com>, orig_to=<spam@nuxwin.com>, relay=imscp-arpl, delay=0.87, delays=0.65/0/0/0.22, dsn=2.0.0, status=sent (delivered via imscp-arpl service)
    2. Jan 19 00:56:55 srv01 postfix/qmgr[7713]: 819D83E66A: removed

    In those last logs, you can see that the mail has been processed by the ARPL transport (imscp-arpl service). However, the imscp-arpl service has ignored the mail because it was tagged with the X-Spam-Flag: YES header. I've never received the auto-reply message (expected result).

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Thank you, for the answer.
    I have to admit I'm still running an older version of imscp (remember? I'm that Gentoo-gui :-) ) and didn't compare my configuration with that one is currently used by imscp/postfix. My configuration is based on amavisd, which is called by using content_filter. But as the transport-map is processed earlier, in my configuration spam-tagging cannot be recognized by arpl.


    Soon, I'll switch over to ubuntu cause it makes things easier for me in terms of imscp.


    So, finally: sorry for my question. Should have checked postfix' current config.