Koozali.org: home of the SME Server

check_badmailfromto plugin

iam

check_badmailfromto plugin
« on: February 12, 2007, 04:31:49 PM »
Hello!

Spend a whole day fighting with check_badmailfromto plugin but still without success... :(

It even shows in sqsmtpd log:

@4000000045d0845c30ef272c 5672 250-onnet.local Hi ug-out-1314.google.com [66.249.92.172]
@4000000045d0845c30ef5224 5672 250-PIPELINING
@4000000045d0845c30ef5224 5672 250-8BITMIME
@4000000045d0845c30ef560c 5672 250-SIZE 15000000
@4000000045d0845c30ef59f4 5672 250 AUTH PLAIN LOGIN
@4000000045d0845c3af6621c 5672 dispatching MAIL FROM:<kirill.sysoev@gmail.com>
@4000000045d0845c3af66604 5672 full from_parameter: FROM:<kirill.sysoev@gmail.com>
@4000000045d0845c3af669ec 5672 from email address : [<kirill.sysoev@gmail.com>]
@4000000045d0845c3b29e1b4 5672 running plugin (mail): require_resolvable_fromhost
@4000000045d0845c3b29e984 5672 trying to get config for invalid_resolvable_fromhost
@4000000045d0845c3b29ed6c 5672 trying to get config for require_resolvable_fromhost
@4000000045d0845c3b29f154 5672 Plugin require_resolvable_fromhost, hook mail returned DECLINED,
@4000000045d0845c3b29f53c 5672 running plugin (mail): check_badmailfrom
@4000000045d0845c3b29f924 5672 trying to get config for badmailfrom
@4000000045d0845c3b29fd0c 5672 Plugin check_badmailfrom, hook mail returned DECLINED,
@4000000045d0845c3b2a241c 5672 running plugin (mail): check_badmailfromto
@4000000045d0845c3b2a2804 5672 trying to get config for badmailfromto
@4000000045d0845c3b2a2bec 5672 Plugin check_badmailfromto, hook mail returned DECLINED,
@4000000045d0845c3b2a2fd4 5672 getting mail from <kirill.sysoev@gmail.com>
@4000000045d0845c3b2a33bc 5672 250 <kirill.sysoev@gmail.com>, sender OK - how exciting to get mail from you!
@4000000045d0845d03c48bd4 5672 dispatching RCPT TO:<iam@onnet.spb.ru>
@4000000045d0845d03c48fbc 5672 to email address : [<iam@onnet.spb.ru>]
@4000000045d0845d03c493a4 5672 running plugin (rcpt): check_badmailfrom
@4000000045d0845d03c4978c 5672 Plugin check_badmailfrom, hook rcpt returned DECLINED,
@4000000045d0845d03c49b74 5672 running plugin (rcpt): check_badmailfromto
@4000000045d0845d03c49f5c 5672 Plugin check_badmailfromto, hook rcpt returned DECLINED,
@4000000045d0845d03c4a344 5672 running plugin (rcpt): check_badrcptto_patterns
@4000000045d0845d03fc4d44 5672 trying to get config for badrcptto_patterns
@4000000045d0845d03fc5514 5672 Plugin check_badrcptto_patterns, hook rcpt returned DECLINED,
@4000000045d0845d03fc58fc 5672 running plugin (rcpt): check_badrcptto
@4000000045d0845d03fc5ce4 5672 trying to get config for badrcptto
@4000000045d0845d03fc60cc 5672 Plugin check_badrcptto, hook rcpt returned DECLINED,
@4000000045d0845d03fc64b4 5672 running plugin (rcpt): check_goodrcptto
@4000000045d0845d03fc64b4 5672 check_goodrcptto plugin: stripping '-' extensions
@4000000045d0845d03fc8bc4 5672 trying to get config for goodrcptto
@4000000045d0845d03fc8fac 5672 check_goodrcptto plugin: address includes extn '-', checking users: iam
@4000000045d0845d03fc9394 5672 Plugin check_goodrcptto, hook rcpt returned DECLINED,
@4000000045d0845d03fc977c 5672 running plugin (rcpt): rcpt_ok
@4000000045d0845d03fc9b64 5672 trying to get config for me
@4000000045d0845d03fc9f4c 5672 trying to get config for rcpthosts
@4000000045d0845d03fcaeec 5672 Plugin rcpt_ok, hook rcpt returned OK,
@4000000045d0845d03fcb2d4 5672 250 <iam@onnet.spb.ru>, recipient ok


It is also shows errors if badmailfromto file incorrectly configured:

@4000000045d07f2429c8c124 5237 running plugin (mail): check_badmailfromto
@4000000045d07f2429cb072c 5237 trying to get config for badmailfromto
@4000000045d07f2429d1779c 5237 check_badmailfromto plugin: Bad badmailfromto config: No @ sign in */*
@4000000045d07f2429d436bc 5237 Plugin check_badmailfromto, hook mail returned DECLINED,
@4000000045d07f2429f591cc 5237 running plugin (rcpt): check_badmailfromto
@4000000045d07f2429f8608c 5237 Plugin check_badmailfromto, hook rcpt returned DECLINED,
@4000000045d08025147075c4 5291 peers plugin: Compiling check_badmailfromto

But it doesnt stops any messages at all....


Does anybody over here have success with configuration of check_badmailfromto plugin

Thanks in advance
Kirill

iam

check_badmailfromto plugin
« Reply #1 on: February 12, 2007, 04:34:17 PM »
forget to attach my test badmailfromto file

[root@gate ~]# cat /var/qmail/control/badmailfromto
#spamer@spamdomain.com
#@spamdomain.com
#iam@onnet.spb.ru
iam@onnet.spb.ru/mx8@mail.ru
mx8@mail.ru/iam@onnet.spb.ru
@onnet.spb.ru/@ltt.ru
@ltt.ru/@onnet.spb.ru
@onnet.spb.ru/@mail.ru
@mail.ru/@onnet.spb.ru

iam

check_badmailfromto plugin
« Reply #2 on: February 12, 2007, 04:40:46 PM »
in first logs there was invalid recepient ( it wasn't written in badmailfromto file)
dut with right one result is the same:

@4000000045d08960282a574c 5794 250 onnet.local Hi pc-00234.onnet.local [192.168.1.234]; I am so happy to meet you.
@4000000045d089602859b834 5794 dispatching MAIL FROM: <iam@onnet.spb.ru>
@4000000045d08960285e388c 5794 full from_parameter: FROM: <iam@onnet.spb.ru>
@4000000045d089602860345c 5794 from email address : [<iam@onnet.spb.ru>]
@4000000045d0896028689cb4 5794 running plugin (mail): check_badmailfrom
@4000000045d08960286b407c 5794 trying to get config for badmailfrom
@4000000045d08960286fd45c 5794 Plugin check_badmailfrom, hook mail returned DECLINED,
@4000000045d089602871dfcc 5794 running plugin (mail): check_badmailfromto
@4000000045d0896028744514 5794 trying to get config for badmailfromto
@4000000045d08960287ce804 5794 Plugin check_badmailfromto, hook mail returned DECLINED,
@4000000045d08960287f60d4 5794 getting mail from <iam@onnet.spb.ru>
@4000000045d0896028818f6c 5794 250 <iam@onnet.spb.ru>, sender OK - how exciting to get mail from you!
@4000000045d08960289369bc 5794 dispatching RCPT TO: <mx8@mail.ru>
@4000000045d089602896b194 5794 to email address : [<mx8@mail.ru>]
@4000000045d089602899de14 5794 running plugin (rcpt): check_badmailfrom
@4000000045d08960289c89ac 5794 Plugin check_badmailfrom, hook rcpt returned DECLINED,
@4000000045d08960289e857c 5794 running plugin (rcpt): check_badmailfromto
@4000000045d0896028a15824 5794 Plugin check_badmailfromto, hook rcpt returned DECLINED,
@4000000045d0896028a353f4 5794 running plugin (rcpt): check_badrcptto_patterns
@4000000045d0896028a5f7bc 5794 Plugin check_badrcptto_patterns, hook rcpt returned DECLINED,
@4000000045d0896028a7f774 5794 running plugin (rcpt): check_badrcptto
@4000000045d0896028aad9bc 5794 Plugin check_badrcptto, hook rcpt returned DECLINED,
@4000000045d0896028acd1a4 5794 running plugin (rcpt): check_goodrcptto
@4000000045d0896028af88f4 5794 Plugin check_goodrcptto, hook rcpt returned DECLINED,
@4000000045d0896028b180dc 5794 running plugin (rcpt): rcpt_ok
@4000000045d0896028b3da6c 5794 trying to get config for me
@4000000045d0896028b62074 5794 trying to get config for rcpthosts
@4000000045d0896028bc8144 5794 trying to get config for morercpthosts
@4000000045d0896028bff02c 5794 Plugin rcpt_ok, hook rcpt returned OK,
@4000000045d0896028c2518c 5794 250 <mx8@mail.ru>, recipient ok
@4000000045d0896028cf0b5c 5794 dispatching DATA
@4000000045d0896028d27e2c 5794 354 go ahead

Offline raem

  • *
  • 3,972
  • +4/-0
check_badmailfromto plugin
« Reply #3 on: February 13, 2007, 09:45:22 AM »
iam

> [root@gate ~]# cat /var/qmail/control/badmailfromto

On my sme7.1 that file is named
/var/qmail/control/badmailfrom

If I manually add entries to that, they get rejected.
...

iam

check_badmailfromto plugin
« Reply #4 on: February 13, 2007, 10:41:04 AM »
Quote from: "RayMitchell"
iam

> [root@gate ~]# cat /var/qmail/control/badmailfromto

On my sme7.1 that file is named
/var/qmail/control/badmailfrom

If I manually add entries to that, they get rejected.


Yes, you are talking about check_badmailfrom plugin and it works properly.
But you can also find check_badmailfromto plugin that works with pairs FROM/RCPTTO

check_badmailfom is already built into the system and has its template structure? but check_badmailfromto not.

So there was a question how to implement it

Sincerely
Kirill

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
check_badmailfromto plugin
« Reply #5 on: February 13, 2007, 11:13:42 AM »
A How-To I wrote up for another plugin.

I see its already in the plugin directory.. even easier.

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0
mkdir -p /etc/e-smith/templates-custom/var/service/qpsmtpd/config/plugins


Code: [Select]
nano -w /etc/e-smith/templates-custom/var/service/qpsmtpd/config/plugins/31check_badmailfromto

Paste in

check_badmailfromto

with a carriage return and save.

Code: [Select]
ln -s /etc/e-smith/templates-custom/var/service/qpsmtpd/config/plugins/31check_badmailfromto /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0/31check_badmailfromto

Code: [Select]
signal-event email-update

Quote
Much like the similar check_badmailfrom, this plugin references both the
FROM: and TO: lines, and if they both are present in the badmailfromto
config file (a tab delimited list of FROM/TO pairs), then the message is
blocked as if the recipient (TO) didn't exist.  This is specifically designed
to not give the impression that the sender is blocked (good for cases of
harassment).

Based heavily on check_badmailfrom.
Regards,
William

IF I give advise.. It's only if it was me....

Offline raem

  • *
  • 3,972
  • +4/-0
check_badmailfromto plugin
« Reply #6 on: March 27, 2007, 03:10:59 AM »
iam

> ...check_badmailfromto plugin that works with pairs FROM/RCPTTO

Did you try william's suggestions ?
Did you get this working ?
...

Offline raem

  • *
  • 3,972
  • +4/-0
check_badmailfromto plugin
« Reply #7 on: March 27, 2007, 04:05:25 AM »
> Much like the similar check_badmailfrom, this plugin references both the
> FROM: and TO: lines, and if they both are present in the badmailfromto
> config file (a tab delimited list of FROM/TO pairs), then the message is
> blocked as if the recipient (TO) didn't exist.


To add to williams mini how to

pico -w /var/qmail/control/badmailfromto

type in the From To pairs that you want to stop email delivery for, with a tab between them and a carriage return at the end of the line, with additional pairs on a new line
ie
user@bad-domain.com tab user@yourdomain.com enter
user@bad-domain2 tab user2@yourdomain enter

eg
john@aol.com      mary@yourdomain
bill@yahoo.com      paul@yourdomain.com

then save using Ctrl x

Note also that wildcards or blank spaces do not appear to be supported.
...

Offline raem

  • *
  • 3,972
  • +4/-0
Re: check_badmailfromto plugin
« Reply #8 on: October 16, 2009, 09:20:18 AM »
william_syd

Added this to the FAQ, which uses a custom template, but needs more work/study to create the code to extract data from a db file.
http://wiki.contribs.org/Email#How_to_block_email_from_one_address_to_another_address_with_check_badmailfromto_plugin
...