testing dovecot LMTP with postfix/spamassassin
:-) My postfix configuration is quite complex with a lot of special cases and rules. However I'd like to make an anti-spam configuration as simple and lightweight as possible (KISS).
/etc/postfix/master.cf
smtp inet n - n - - smtpd -o content_filter=spamassassin
spamassassin unix - n n - - pipe user=nobody argv=/usr/bin/vendor_perl/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
then the simplest sieve rule I can think of:
require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; }
I'd like to make this rule active for only local deliveries via dovecot LMTP with sieve plugin and setting postfix `mailbox_transport' to dovecot LMTP.
I believe it is so simple it should work (am I wrong?). But... It would be more convenient to do some tests before applying changes to a production environment config. The problem is: I have no separate testing environment with my strange configuration I'm able to test a spamassassin score for an e-mail manually. How about dovecot LMTP? Can I test local mail delivery by dovecot LMTP manually? I mean: to simulate "I'm the Postfix" and produce for some testing e-mail the same effect as postfix granting it via `local_transport' to dovecot?
Best regards, Marek
On 3/16/19 3:49 PM, Marek Kozlowski via dovecot wrote:
Can I test local mail delivery by dovecot LMTP manually? I mean: to simulate "I'm the Postfix" and produce for some testing e-mail the same effect as postfix granting it via `local_transport' to dovecot?
Best regards, Marek
You can use dovecot-lda like this :
cat <<EOF | /usr/lib/dovecot/dovecot-lda -d $USER From: sender
To:Recipient
Subject: Test
Hello, this is the body of the message
EOF
"I am The Postfix" really has potential as a t-shirt banner ^^'
Yassine.
:-)
On 3/17/19 10:22 AM, Yassine Chaouche via dovecot wrote:
On 3/16/19 3:49 PM, Marek Kozlowski via dovecot wrote:
Can I test local mail delivery by dovecot LMTP manually? I mean: to simulate "I'm the Postfix" and produce for some testing e-mail the same effect as postfix granting it via `local_transport' to dovecot?
You can use dovecot-lda like this :
cat <<EOF | /usr/lib/dovecot/dovecot-lda -d $USER
[...]
Thank you but... Please mind that I'm planning to use dovecot LMTP rather than LDA.
Best regards, Marek
On 3/17/19 11:59 AM, Yassine Chaouche via dovecot wrote:
On 3/17/19 11:10 AM, Marek Kozlowski via dovecot wrote:
Thank you but... Please mind that I'm planning to use dovecot LMTP rather than LDA.
Best regards, Marek
There's /usr/lib/dovecot/lmtp too
Yassine.
Here's a bad example :
root@messagerie[10.10.10.19] ~ # /usr/lib/dovecot/lmtp 220 messagerie.algerian-radio.dz Dovecot ready. Info: Connect from local EHLO 502 5.5.2 Unknown command HELO 502 5.5.2 Unknown command LHLO localhost 250-messagerie.algerian-radio.dz 250-8BITMIME 250-ENHANCEDSTATUSCODES 250 PIPELINING TO:a.chaouche 502 5.5.2 Unknown command MAIL FROM:ushead@us.gov 501 5.5.4 Invalid parameters MAIL FROM:<ushead@us.gov> 250 2.1.0 OK RCPT TO:a.chaouche@algerian-radio.dz 501 5.5.4 Invalid parameters RCPT TO:<a.chaouche@algerian-radio.dz> 250 2.1.5 OK DATA 354 OK Subject: Just a test
This is the body of the mail
. lmtp(11746, a.chaouche@algerian-radio.dz): Info: copy from <lmtp DATA>: box=INBOX, uid=12210, msgid=, from=, subject=Just a test lmtp(11746, a.chaouche@algerian-radio.dz): Info: dzRBHgkqjlziLQAArJM0yg: sieve: <>:Just a test stored mail into mailbox 'INBOX' 250 2.0.0 <a.chaouche@algerian-radio.dz> dzRBHgkqjlziLQAArJM0yg Saved
It's missing a lot of important fields I guess, but it made it to my inbox ^^'
On 16/03/2019 11:49, Marek Kozlowski via dovecot wrote:
Can I test local mail delivery by dovecot LMTP manually? I mean: to simulate "I'm the Postfix" and produce for some testing e-mail the same effect as postfix granting it via `local_transport' to dovecot?
You can probably use swaks for that, it has LMTP support.
-- You canna change the laws of physics, Captain; I've got to have thirty minutes!
Eduardo M KALINOWSKI eduardo@kalinowski.com.br
participants (4)
-
Aki Tuomi
-
Eduardo M KALINOWSKI
-
Marek Kozlowski
-
Yassine Chaouche